Index: tolsh/tolsh.vfs/lib/app-tolsh/tolsh.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/app-tolsh/tolsh.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/lib/app-tolsh/tolsh.tcl	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -30,13 +30,10 @@
   # By default load initLibrary
   #
-  set options(lang)    ""
+  set options(lang)    0
   set options(initlib) 1
-  set options(iniproject) 1
-  set options(defaultpackages) 1
   set options(compile) ""
   set options(vmode)   ""
   set options(out,enabled) no
   set options(runmode) ""
-  set options(tolversion) ""
 }
 
@@ -48,5 +45,4 @@
 #
 #    -i       --> do not include initLibrary
-#    -np      --> do not load _iniproject.tol
 #    -c"..."  --> compile a tol expression
 #    -c "..." --> compile a tol expression
@@ -64,6 +60,5 @@
 #    -e?n?    --> use english language
 #    -s?p?    --> use spanish language
-#    -tolversion ver --> specify an strict tol version to start with
-#    -server [port]  --> start tol as a server tolsvc.<pid>.log will be the log
+#    -server [port] --> start tol as a server tolsvc.<pid>.log will be the log
 #             [port] is the port number where the serve will be listening.
 #
@@ -75,6 +70,4 @@
 proc ::tolsh::getoptions { cmdline } {
   variable options
-
-  logtmp "entering ::tolsh::getoptions $cmdline"
 
   # cmdline could be a bad list so the next sentence could fail.
@@ -84,20 +77,15 @@
   set i 0
   while {$i < $num} {
-    logtmp "set item [lindex $cmdline $i]"
     set item [lindex $cmdline $i]
     if {[string index $item 0] eq "-"} {
       set opt [string range $item 1 end]
       if {$opt eq "e" || $opt eq "en"} {
-        set options(lang) "en"
+        set $options(lang) 0
       } elseif {$opt eq "s" || $opt eq "sp"} {
-        set options(lang) "es"
+        set $options(lang) 1
       } elseif {$opt eq "i"} {
         # initLibrary should not be loaded
         # 
         set options(initlib) 0
-      } elseif {$opt eq "ndp"} {
-        set options(defaultpackages) 0
-      }  elseif {$opt eq "np"} {
-        set options(iniproject) 0
       } elseif {[string index $opt 0] eq "c"} {
         if {[string length $opt]>1} {
@@ -143,7 +131,4 @@
         }
         set options(runmode) "interactive"
-      } elseif {$opt eq "tolversion"} {
-        incr i 
-        set options(tolversion) [lindex $cmdline $i]
       } elseif {$opt eq "server"} {
         # check if next argument is the port number
@@ -165,24 +150,4 @@
           exit
         }
-      } elseif {$opt eq "slave"} {
-        # the next argument is the port number
-        set options(server,port) [lindex $cmdline [expr {$i+1}]]
-        incr i
-        if {$options(runmode) ne "" && $options(runmode) ne "slave"} {
-          puts "Replacing previous run mode '$options(runmode)' with 'slave'"
-        }
-        set options(runmode) "slave"
-      } elseif {$opt eq "shared"} {
-        # the next argument is the port number
-        set options(shared,port) [lindex $cmdline [expr {$i+1}]]
-        incr i
-        if {$options(runmode) ne "" && $options(runmode) ne "shared"} {
-          puts "Replacing previous run mode '$options(runmode)' with 'shared'"
-        }
-        set options(runmode) "shared"
-      }  elseif {$opt eq "shport"} {
-        # the next argument is the port number
-        set options(shared,port) [lindex $cmdline [expr {$i+1}]]
-        incr i
       } else {
         append delayed_msg "\nignoring unknown option: '$item'"
@@ -234,5 +199,5 @@
   puts {
     -i file  --> include a file but not initLibrary
-    -np      --> do not load _iniproject.tol
+    -c"..."  --> compile a tol expression
     -c "..." --> compile a tol expression
     -v?A?    --> enable all output
@@ -249,7 +214,6 @@
     -e?n?    --> use english language
     -s?p?    --> use spanish language
-    -tolversion --> specify an strict tol version to start with
-    -server [port] --> start tol as a server tolsvc.<pid>.log will be the log
-            [port] is the port number where the serve will be listening.
+   -server [port] --> start tol as a server tolsvc.<pid>.log will be the log
+           [port] is the port number where the serve will be listening.
  
   Multiple verbose mode is accepted in one option, for instance,
@@ -284,13 +248,5 @@
 }
 
-#puts "starkit = [namespace exist ::starkit]"
-#puts "topdir = [file dir $starkit::topdir]"
-#puts "info script = [info script]"
-#puts "starkit::startup = [starkit::startup]"
-#puts "[ info commands starkit::* ]"
-#puts "argv0 = $argv0"
-
 proc ::tolsh::setup_pkg { pkg } {
-  #puts ":tolsh::setup_pkg $pkg [namespace exist ::starkit] "
   if {[lsearch [package names] $pkg]==-1} {
     if {[namespace exist ::starkit]} {
@@ -300,13 +256,4 @@
       if {[llength $pkg_dirs]} {
         lappend ::auto_path [file normalize $libdir]
-      } elseif { $::tcl_platform(platform) eq "unix" } {
-          set activeTcl "/opt/ActiveTcl-8.4/lib"
-          if { [ file exists $activeTcl ] &&
-	       [ lsearch $::auto_path $activeTcl ] == -1 } {
-            lappend ::auto_path $activeTcl
-          }
-          if { [ lsearch $::auto_path "/usr/lib" ] == -1 } {
-            lappend ::auto_path "/usr/lib"
-          }
       } else {
         set tclsh [auto_execok tclsh]
@@ -320,5 +267,5 @@
           }
         }
-      }
+      } 
       tclPkgUnknown ${pkg}+1 ""
     } else {
@@ -342,31 +289,7 @@
 ###############################################################################
 proc ::tolsh::setup_autopath { } {
-  logtmp "entering ::tolsh::setup_autopath"
-
   setup_pkg toltcl
   setup_pkg tolcomm
   setup_pkg tlogger
-  setup_pkg tequila
-  setup_pkg tequilas
-
-  logtmp "auto_path = $::auto_path"
-  logtmp "leaving ::tolsh::setup_autopath"  
-}
-
-proc GetHomeDir { } {
-  global env 
-  # Check if we're using windows 
-  if { $::tcl_platform(platform) eq "windows" } {
-    package require registry 1.0
-    set key1 {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders}
-    set key2 {Personal}
-    set env_home [ registry get $key1 $key2 ]
-    if {[string match %USERPROFILE%* $env_home]} {
-      set env_home [string replace $env_home 0 12 $env(USERPROFILE)]
-    } 
-  } else {
-    set env_home $env(HOME)
-  }
-  return $env_home
 }
 
@@ -379,82 +302,63 @@
   variable options
 
-  #logtmp "user : [ exec whoami ]"
-  logtmp "entering run with cmdline = $cmdline"
   # Process command line options
   #
   getoptions $cmdline
-  logtmp "options(compile): $options(compile)"
-  logtmp "options(runmode): $options(runmode)"
   if {![something_to_compile] && ($options(runmode) eq "")} {
     show_usage
     return
   }
+
+  # Ensure Toltcl is found
+  #
+  setup_autopath
+
+  # Load Toltcl (+tol)
+  #
+  package require Toltcl
+  tol::initkernel $options(lang) $options(vmode)
+
+  # Load initLibrary if required
+  #
+  if {$options(initlib)} {
+    tol::initlibrary
+  }
+
+  set appdata [string trim \
+               [lindex [::tol::info var Text TolAppDataPath] 0] \"]
+
+  set tolcomm_dir [file join $appdata tolcomm] 
+  file mkdir $tolcomm_dir
+
+  # load rmtps_client
+  #
+  if {[catch {package require rmtps_client} msg]} {
+    std "could not load rmtps_client: $msg"
+  } else {
+    ::rmtps_client::init [file join $tolcomm_dir "rmtps_client.log"]
+    if {[catch rmtps_client::define_TOLAPI msg]} {
+      std "could not load tol code for rmtps_client: $msg"
+    }
+  }
   
-  logtmp "pase getoptions"
-
-  # Ensure Toltcl is found
-  #
-  setup_autopath
-
-  # Load Toltcl (+tol) and initLibrary if required
-  #
-  if {$options(runmode) != "server" && $options(runmode) != "shared"} {
-    package require -exact Toltcl 3.3
-    #puts "tol::initkernel $options(lang) $options(vmode)"
-    tol::initkernel $options(lang) $options(vmode)
-
-    if {$options(initlib)} {
-      tol::initlibrary -initproject $options(iniproject) \
-          -defaultpackages $options(defaultpackages)
+  # load tolclient
+  #
+  if {[catch {package require tolclient} msg]} {
+    std "could not load tolclient: $msg"
+  } else {
+    ::tolclient::init [file join $tolcomm_dir "tolclient.log"]
+    if {[catch ::tolclient::define_TOLAPI msg]} {
+      std "could not load tol code for rmtps_client: $msg"
     }
-    # why should I do that?
-    if { $options(lang) ne "" } {
-      ::tol::language $options(lang)
+  }
+
+  # Compile expression and tol file provided in the command line
+  #
+  foreach item $options(compile) {
+    if {[lindex $item 0] eq "expr"} {
+      tol::console eval [lindex $item 1]
+    } elseif {[lindex $item 0] eq "file"} {
+      tol::include [lindex $item 1]
     }
-    set appdata [string trim \
-               [lindex [::tol::info var [list Text TolAppDataPath]] 2] \"]
-    logtmp "appdata = $appdata"
-  }
-
-  set tolcomm_dir [file join [GetHomeDir] ".tol" "tolcomm"] 
-  file mkdir $tolcomm_dir
-
-  # load rmtps_client and tolclient if required
-  #
-  if {$options(runmode) != "server" && $options(runmode) != "shared"} {
-  
-    if {[catch {package require rmtps_client} msg]} {
-      std "could not load rmtps_client: $msg"
-    } else {
-      ::rmtps_client::init [file join $tolcomm_dir "rmtps_client.log"]
-      if {[catch rmtps_client::define_TOLAPI msg]} {
-        std "could not load tol code for rmtps_client: $msg"
-      }
-    }
-  
-    if {[catch {package require tolclient} msg]} {
-      std "could not load tolclient: $msg"
-    } else {
-      ::tolclient::init [file join $tolcomm_dir "tolclient.log"]
-      if {[catch ::tolclient::define_TOLAPI msg]} {
-        std "could not load tol code for rmtps_client: $msg"
-      }
-    }
-    
-  }
-
-  # Compile expression and tol file provided in the command line if required
-  #
-  if {$options(runmode) != "server" && $options(runmode) != "shared" \
-                                    && $options(runmode) != "slave" } {
-
-    foreach item $options(compile) {
-      if {[lindex $item 0] eq "expr"} {
-        tol::console eval [lindex $item 1]
-      } elseif {[lindex $item 0] eq "file"} {
-        tol::include [lindex $item 1]
-      }
-    }
-
   }
   
@@ -467,81 +371,11 @@
     # enter the tcl event loop
     vwait __forever__
-    
   } elseif {$options(runmode) eq "server"} {
-    #puts "runmode=server"
-    run_as_server $tolcomm_dir
-    
-  } elseif {$options(runmode) eq "shared"} {
-    #puts "runmode=shared"
-    run_as_shared $tolcomm_dir
-  
-  } elseif {$options(runmode) eq "slave"} {
-    #puts "runmode=slave"
-    run_as_slave $tolcomm_dir   
-  }
-}
-
-proc ::tolsh::run_as_server {tolcomm_dir} {
-  variable options
-  package require tolserver
-
-  set shared_port [ clone ]
-  tolserver::start -port $options(server,port) \
-    -shport $shared_port \
-    -logfile [file join $tolcomm_dir "tolserver.log"] \
-    -compile $options(compile)
-  vwait __forever__
-}   
-
-proc ::tolsh::find_shared_port { port } {
-  puts "::tolsh::find_shared_port $port"
-  set i 0
-  while { $i < 100 } {
-    if { [ catch { socket localhost $port } fd ] } {
-      puts "find_shared_port OK = $port"
-      return $port
-    }
-    incr port
-    incr i
-  }
-  puts "find_shared_port FAIL!"
-  return 0
-}
-
-proc ::tolsh::clone {} {
-  variable options
-
-  puts "::tolsh::clone"
-  set tolsh [list [info nameofexecutable] ]
-  if { $starkit::tolsh_mode ne "starpack" } {
-    lappend tolsh $::argv0
-  }
-  set shared_port [ find_shared_port 20458 ]
-  if { !$shared_port } {
-    puts "::tolsh::clone: could not find a valid port for shared data"
-    exit
-  }
-  eval exec $tolsh -shared $shared_port &
-  after 5000            ;# wait for data sharing are created by 'shared'
-  puts "exec slave"
-  eval exec $tolsh -slave $options(server,port) -shport $shared_port &
-  return $shared_port
-}
-
-proc ::tolsh::run_as_shared { tolcomm_dir } {
-  package require tolshared
-  variable options
-
-  tolshared::start $options(shared,port) $tolcomm_dir
-}   
-
-proc ::tolsh::run_as_slave { tolcomm_dir } {
-  variable options
-  package require tolslave
-
-  tolslave::start -port $options(server,port) -shport $options(shared,port) \
-    -logfile [file join $tolcomm_dir "tolslave.log"]
-  vwait __forever__
-}   
+    package require tolserver
+    tolserver::start -port $options(server,port) \
+        -logfile [file join $tolcomm_dir "tolserver.log"]
+    vwait __forever__
+  }
+}
 
 proc ::tolsh::console_cmd { cmd } {
@@ -582,12 +416,3 @@
 }
 
-proc logtmp { msg } {
-  return
-  set user $::tcl_platform(user)
-  set fd [ open "/tmp/tolsh.${user}.log" a ]
-  puts $fd $msg
-  flush $fd
-  close $fd
-}
-
 ::tolsh::run $argv
Index: tolsh/tolsh.vfs/lib/base64/base64.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/base64/base64.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,326 +1,0 @@
-# base64.tcl --
-#
-# Encode/Decode base64 for a string
-# Stephen Uhler / Brent Welch (c) 1997 Sun Microsystems
-# The decoder was done for exmh by Chris Garrigues
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: base64.tcl,v 1.27 2005/12/09 18:27:15 andreas_kupries Exp $
-
-# Version 1.0   implemented Base64_Encode, Base64_Decode
-# Version 2.0   uses the base64 namespace
-# Version 2.1   fixes various decode bugs and adds options to encode
-# Version 2.2   is much faster, Tcl8.0 compatible
-# Version 2.2.1 bugfixes
-# Version 2.2.2 bugfixes
-# Version 2.3   bugfixes and extended to support Trf
-
-# @mdgen EXCLUDE: base64c.tcl
-
-package require Tcl 8.2
-namespace eval ::base64 {
-    namespace export encode decode
-}
-
-if {![catch {package require Trf 2.0}]} {
-    # Trf is available, so implement the functionality provided here
-    # in terms of calls to Trf for speed.
-
-    # ::base64::encode --
-    #
-    #	Base64 encode a given string.
-    #
-    # Arguments:
-    #	args	?-maxlen maxlen? ?-wrapchar wrapchar? string
-    #	
-    #		If maxlen is 0, the output is not wrapped.
-    #
-    # Results:
-    #	A Base64 encoded version of $string, wrapped at $maxlen characters
-    #	by $wrapchar.
-    
-    proc ::base64::encode {args} {
-	# Set the default wrapchar and maximum line length to match the output
-	# of GNU uuencode 4.2.  Various RFCs allow for different wrapping 
-	# characters and wraplengths, so these may be overridden by command line
-	# options.
-	set wrapchar "\n"
-	set maxlen 60
-
-	if { [llength $args] == 0 } {
-	    error "wrong # args: should be \"[lindex [info level 0] 0]\
-		    ?-maxlen maxlen? ?-wrapchar wrapchar? string\""
-	}
-
-	set optionStrings [list "-maxlen" "-wrapchar"]
-	for {set i 0} {$i < [llength $args] - 1} {incr i} {
-	    set arg [lindex $args $i]
-	    set index [lsearch -glob $optionStrings "${arg}*"]
-	    if { $index == -1 } {
-		error "unknown option \"$arg\": must be -maxlen or -wrapchar"
-	    }
-	    incr i
-	    if { $i >= [llength $args] - 1 } {
-		error "value for \"$arg\" missing"
-	    }
-	    set val [lindex $args $i]
-
-	    # The name of the variable to assign the value to is extracted
-	    # from the list of known options, all of which have an
-	    # associated variable of the same name as the option without
-	    # a leading "-". The [string range] command is used to strip
-	    # of the leading "-" from the name of the option.
-	    #
-	    # FRINK: nocheck
-	    set [string range [lindex $optionStrings $index] 1 end] $val
-	}
-    
-	# [string is] requires Tcl8.2; this works with 8.0 too
-	if {[catch {expr {$maxlen % 2}}]} {
-	    error "expected integer but got \"$maxlen\""
-	}
-
-	set string [lindex $args end]
-	set result [::base64 -mode encode -- $string]
-	set result [string map [list \n ""] $result]
-
-	if {$maxlen > 0} {
-	    set res ""
-	    set edge [expr {$maxlen - 1}]
-	    while {[string length $result] > $maxlen} {
-		append res [string range $result 0 $edge]$wrapchar
-		set result [string range $result $maxlen end]
-	    }
-	    if {[string length $result] > 0} {
-		append res $result
-	    }
-	    set result $res
-	}
-
-	return $result
-    }
-
-    # ::base64::decode --
-    #
-    #	Base64 decode a given string.
-    #
-    # Arguments:
-    #	string	The string to decode.  Characters not in the base64
-    #		alphabet are ignored (e.g., newlines)
-    #
-    # Results:
-    #	The decoded value.
-
-    proc ::base64::decode {string} {
-	regsub -all {\s} $string {} string
-	::base64 -mode decode -- $string
-    }
-
-} else {
-    # Without Trf use a pure tcl implementation
-
-    namespace eval base64 {
-	variable base64 {}
-	variable base64_en {}
-
-	# We create the auxiliary array base64_tmp, it will be unset later.
-
-	set i 0
-	foreach char {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
-		a b c d e f g h i j k l m n o p q r s t u v w x y z \
-		0 1 2 3 4 5 6 7 8 9 + /} {
-	    set base64_tmp($char) $i
-	    lappend base64_en $char
-	    incr i
-	}
-
-	#
-	# Create base64 as list: to code for instance C<->3, specify
-	# that [lindex $base64 67] be 3 (C is 67 in ascii); non-coded
-	# ascii chars get a {}. we later use the fact that lindex on a
-	# non-existing index returns {}, and that [expr {} < 0] is true
-	#
-
-	# the last ascii char is 'z'
-	scan z %c len
-	for {set i 0} {$i <= $len} {incr i} {
-	    set char [format %c $i]
-	    set val {}
-	    if {[info exists base64_tmp($char)]} {
-		set val $base64_tmp($char)
-	    } else {
-		set val {}
-	    }
-	    lappend base64 $val
-	}
-
-	# code the character "=" as -1; used to signal end of message
-	scan = %c i
-	set base64 [lreplace $base64 $i $i -1]
-
-	# remove unneeded variables
-	unset base64_tmp i char len val
-
-	namespace export encode decode
-    }
-
-    # ::base64::encode --
-    #
-    #	Base64 encode a given string.
-    #
-    # Arguments:
-    #	args	?-maxlen maxlen? ?-wrapchar wrapchar? string
-    #	
-    #		If maxlen is 0, the output is not wrapped.
-    #
-    # Results:
-    #	A Base64 encoded version of $string, wrapped at $maxlen characters
-    #	by $wrapchar.
-    
-    proc ::base64::encode {args} {
-	set base64_en $::base64::base64_en
-	
-	# Set the default wrapchar and maximum line length to match the output
-	# of GNU uuencode 4.2.  Various RFCs allow for different wrapping 
-	# characters and wraplengths, so these may be overridden by command line
-	# options.
-	set wrapchar "\n"
-	set maxlen 60
-
-	if { [llength $args] == 0 } {
-	    error "wrong # args: should be \"[lindex [info level 0] 0]\
-		    ?-maxlen maxlen? ?-wrapchar wrapchar? string\""
-	}
-
-	set optionStrings [list "-maxlen" "-wrapchar"]
-	for {set i 0} {$i < [llength $args] - 1} {incr i} {
-	    set arg [lindex $args $i]
-	    set index [lsearch -glob $optionStrings "${arg}*"]
-	    if { $index == -1 } {
-		error "unknown option \"$arg\": must be -maxlen or -wrapchar"
-	    }
-	    incr i
-	    if { $i >= [llength $args] - 1 } {
-		error "value for \"$arg\" missing"
-	    }
-	    set val [lindex $args $i]
-
-	    # The name of the variable to assign the value to is extracted
-	    # from the list of known options, all of which have an
-	    # associated variable of the same name as the option without
-	    # a leading "-". The [string range] command is used to strip
-	    # of the leading "-" from the name of the option.
-	    #
-	    # FRINK: nocheck
-	    set [string range [lindex $optionStrings $index] 1 end] $val
-	}
-    
-	# [string is] requires Tcl8.2; this works with 8.0 too
-	if {[catch {expr {$maxlen % 2}}]} {
-	    error "expected integer but got \"$maxlen\""
-	}
-
-	set string [lindex $args end]
-
-	set result {}
-	set state 0
-	set length 0
-
-
-	# Process the input bytes 3-by-3
-
-	binary scan $string c* X
-	foreach {x y z} $X {
-	    # Do the line length check before appending so that we don't get an
-	    # extra newline if the output is a multiple of $maxlen chars long.
-	    if {$maxlen && $length >= $maxlen} {
-		append result $wrapchar
-		set length 0
-	    }
-	
-	    append result [lindex $base64_en [expr {($x >>2) & 0x3F}]] 
-	    if {$y != {}} {
-		append result [lindex $base64_en [expr {(($x << 4) & 0x30) | (($y >> 4) & 0xF)}]] 
-		if {$z != {}} {
-		    append result \
-			    [lindex $base64_en [expr {(($y << 2) & 0x3C) | (($z >> 6) & 0x3)}]]
-		    append result [lindex $base64_en [expr {($z & 0x3F)}]]
-		} else {
-		    set state 2
-		    break
-		}
-	    } else {
-		set state 1
-		break
-	    }
-	    incr length 4
-	}
-	if {$state == 1} {
-	    append result [lindex $base64_en [expr {(($x << 4) & 0x30)}]]== 
-	} elseif {$state == 2} {
-	    append result [lindex $base64_en [expr {(($y << 2) & 0x3C)}]]=  
-	}
-	return $result
-    }
-
-    # ::base64::decode --
-    #
-    #	Base64 decode a given string.
-    #
-    # Arguments:
-    #	string	The string to decode.  Characters not in the base64
-    #		alphabet are ignored (e.g., newlines)
-    #
-    # Results:
-    #	The decoded value.
-
-    proc ::base64::decode {string} {
-	if {[string length $string] == 0} {return ""}
-
-	set base64 $::base64::base64
-	set output "" ; # Fix for [Bug 821126]
-
-	binary scan $string c* X
-	foreach x $X {
-	    set bits [lindex $base64 $x]
-	    if {$bits >= 0} {
-		if {[llength [lappend nums $bits]] == 4} {
-		    foreach {v w z y} $nums break
-		    set a [expr {($v << 2) | ($w >> 4)}]
-		    set b [expr {(($w & 0xF) << 4) | ($z >> 2)}]
-		    set c [expr {(($z & 0x3) << 6) | $y}]
-		    append output [binary format ccc $a $b $c]
-		    set nums {}
-		}		
-	    } elseif {$bits == -1} {
-		# = indicates end of data.  Output whatever chars are left.
-		# The encoding algorithm dictates that we can only have 1 or 2
-		# padding characters.  If x=={}, we have 12 bits of input 
-		# (enough for 1 8-bit output).  If x!={}, we have 18 bits of
-		# input (enough for 2 8-bit outputs).
-		
-		foreach {v w z} $nums break
-		set a [expr {($v << 2) | (($w & 0x30) >> 4)}]
-		if {$z == {}} {
-		    append output [binary format c $a ]
-		} else {
-		    set b [expr {(($w & 0xF) << 4) | (($z & 0x3C) >> 2)}]
-		    append output [binary format cc $a $b]
-		}		
-		break
-	    } else {
-		# RFC 2045 says that line breaks and other characters not part
-		# of the Base64 alphabet must be ignored, and that the decoder
-		# can optionally emit a warning or reject the message.  We opt
-		# not to do so, but to just ignore the character. 
-		continue
-	    }
-	}
-	return $output
-    }
-}
-
-package provide base64 2.3.2
Index: tolsh/tolsh.vfs/lib/base64/base64c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/base64/base64c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,18 +1,0 @@
-# base64c - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This package is a place-holder for the critcl enhanced code present in
-# the tcllib base64 module.
-#
-# Normally this code will become part of the tcllibc library.
-#
-
-package require critcl
-package provide base64c 0.1.0
-
-namespace eval ::base64c {
-    variable base64c_rcsid {$Id: base64c.tcl,v 1.4 2006/11/04 15:20:36 patthoyts Exp $}
-
-    critcl::ccode {
-        /* no code required in this file */
-    }
-}
Index: tolsh/tolsh.vfs/lib/base64/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/base64/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded base64   2.3.2 [list source [file join $dir base64.tcl]]
-package ifneeded uuencode 1.1.4 [list source [file join $dir uuencode.tcl]]
-package ifneeded yencode  1.1.1 [list source [file join $dir yencode.tcl]]
Index: tolsh/tolsh.vfs/lib/base64/uuencode.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/base64/uuencode.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,346 +1,0 @@
-# uuencode - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provide a Tcl only implementation of uuencode and uudecode.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# @(#)$Id: uuencode.tcl,v 1.21 2006/10/14 06:30:55 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-# Try and get some compiled helper package.
-if {[catch {package require tcllibc}]} {
-    catch {package require Trf}
-}
-
-namespace eval ::uuencode {
-    variable version 1.1.4
-
-    namespace export encode decode uuencode uudecode
-}
-
-proc ::uuencode::Enc {c} {
-    return [format %c [expr {($c != 0) ? (($c & 0x3f) + 0x20) : 0x60}]]
-}
-
-proc ::uuencode::Encode {s} {
-    set r {}
-    binary scan $s c* d
-    foreach {c1 c2 c3} $d {
-        if {$c1 == {}} {set c1 0}
-        if {$c2 == {}} {set c2 0}
-        if {$c3 == {}} {set c3 0}
-        append r [Enc [expr {$c1 >> 2}]]
-        append r [Enc [expr {(($c1 << 4) & 060) | (($c2 >> 4) & 017)}]]
-        append r [Enc [expr {(($c2 << 2) & 074) | (($c3 >> 6) & 003)}]]
-        append r [Enc [expr {($c3 & 077)}]]
-    }
-    return $r
-}
-
-
-proc ::uuencode::Decode {s} {
-    if {[string length $s] == 0} {return ""}
-    set r {}
-    binary scan [pad $s] c* d
-        
-    foreach {c0 c1 c2 c3} $d {
-        append r [format %c [expr {((($c0-0x20)&0x3F) << 2) & 0xFF
-                                   | ((($c1-0x20)&0x3F) >> 4) & 0xFF}]]
-        append r [format %c [expr {((($c1-0x20)&0x3F) << 4) & 0xFF
-                                   | ((($c2-0x20)&0x3F) >> 2) & 0xFF}]]
-        append r [format %c [expr {((($c2-0x20)&0x3F) << 6) & 0xFF
-                                   | (($c3-0x20)&0x3F) & 0xFF}]]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# C coded version of the Encode/Decode functions for base64c package.
-# -------------------------------------------------------------------------
-if {[package provide critcl] != {}} {
-    namespace eval ::uuencode {
-        critcl::ccode {
-            #include <string.h>
-            static unsigned char Enc(unsigned char c) {
-                return (c != 0) ? ((c & 0x3f) + 0x20) : 0x60;
-            }
-        }
-        critcl::ccommand CEncode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-            if ((xtra = (3 - (len % 3))) != 3) {
-                if (Tcl_IsShared(inputPtr))
-                    inputPtr = Tcl_DuplicateObj(inputPtr);
-                input = Tcl_SetByteArrayLength(inputPtr, len + xtra);
-                memset(input + len, 0, xtra);
-                len += xtra;
-            }
-
-            rlen = (len / 3) * 4;
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            memset(r, 0, rlen);
-            
-            for (p = input; p < input + len; p += 3) {
-                char a, b, c;
-                a = *p; b = *(p+1), c = *(p+2);
-                *r++ = Enc(a >> 2);
-                *r++ = Enc(((a << 4) & 060) | ((b >> 4) & 017));
-                *r++ = Enc(((b << 2) & 074) | ((c >> 6) & 003));
-                *r++ = Enc(c & 077);
-            }
-            
-            return TCL_OK;
-        }
-
-        critcl::ccommand CDecode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* if input is not mod 4, extend it with nuls */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-            if ((xtra = (4 - (len % 4))) != 4) {
-                if (Tcl_IsShared(inputPtr))
-                    inputPtr = Tcl_DuplicateObj(inputPtr);
-                input = Tcl_SetByteArrayLength(inputPtr, len + xtra);
-                memset(input + len, 0, xtra);
-                len += xtra;
-            }
-
-            /* output will be 1/3 smaller than input and a multiple of 3 */
-            rlen = (len / 4) * 3;
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            memset(r, 0, rlen);
-            
-            for (p = input; p < input + len; p += 4) {
-                char a, b, c, d;
-                a = *p; b = *(p+1), c = *(p+2), d = *(p+3);
-                *r++ = (((a - 0x20) & 0x3f) << 2) | (((b - 0x20) & 0x3f) >> 4);
-                *r++ = (((b - 0x20) & 0x3f) << 4) | (((c - 0x20) & 0x3f) >> 2);
-                *r++ = (((c - 0x20) & 0x3f) << 6) | (((d - 0x20) & 0x3f) );
-            }
-            
-            return TCL_OK;
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Permit more tolerant decoding of invalid input strings by padding to
-#  a multiple of 4 bytes with nulls.
-# Result:
-#  Returns the input string - possibly padded with uuencoded null chars.
-#
-proc ::uuencode::pad {s} {
-    if {[set mod [expr {[string length $s] % 4}]] != 0} {
-        append s [string repeat "`" [expr {4 - $mod}]]
-    }
-    return $s
-}
-
-# -------------------------------------------------------------------------
-
-# If the Trf package is available then we shall use this by default but the
-# Tcllib implementations are always visible if needed (ie: for testing)
-if {[info command ::uuencode::CDecode] != {}} {    
-    # tcllib critcl package
-    interp alias {} ::uuencode::encode {} ::uuencode::CEncode
-    interp alias {} ::uuencode::decode {} ::uuencode::CDecode
-} elseif {[package provide Trf] != {}} {
-    proc ::uuencode::encode {s} {
-        return [::uuencode -mode encode -- $s]
-    }
-    proc ::uuencode::decode {s} {
-        return [::uuencode -mode decode -- [pad $s]]
-    }
-} else {
-    # pure-tcl then
-    interp alias {} ::uuencode::encode {} ::uuencode::Encode
-    interp alias {} ::uuencode::decode {} ::uuencode::Decode
-}
-
-# -------------------------------------------------------------------------
-
-proc ::uuencode::uuencode {args} {
-    array set opts {mode 0644 filename {} name {}}
-    set wrongargs "wrong \# args: should be\
-            \"uuencode ?-name string? ?-mode octal?\
-            (-file filename | ?--? string)\""
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(filename) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -m* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(mode) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -n* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(name) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -- {
-                set args [lreplace $args 0 0]
-                break
-            }
-            default {
-                return -code error "bad option [lindex $args 0]:\
-                      must be -file, -mode, or -name"
-            }
-        }
-        set args [lreplace $args 0 0]
-    }
-
-    if {$opts(name) == {}} {
-        set opts(name) $opts(filename)
-    }
-    if {$opts(name) == {}} {
-        set opts(name) "data.dat"
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        fconfigure $f -translation binary
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error $wrongargs
-        }
-        set data [lindex $args 0]
-    }
-
-    set r {}
-    append r [format "begin %o %s" $opts(mode) $opts(name)] "\n"
-    for {set n 0} {$n < [string length $data]} {incr n 45} {
-        set s [string range $data $n [expr {$n + 44}]]
-        append r [Enc [string length $s]]
-        append r [encode $s] "\n"
-    }
-    append r "`\nend"
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Perform uudecoding of a file or data. A file may contain more than one
-#  encoded data section so the result is a list where each element is a 
-#  three element list of the provided filename, the suggested mode and the 
-#  data itself.
-#
-proc ::uuencode::uudecode {args} {
-    array set opts {mode 0644 filename {}}
-    set wrongargs "wrong \# args: should be \"uudecode (-file filename | ?--? string)\""
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(filename) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -- {
-                set args [lreplace $args 0 0]
-                break
-            }
-            default {
-                return -code error "bad option [lindex $args 0]:\
-                      must be -file"
-            }
-        }
-        set args [lreplace $args 0 0]
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error $wrongargs
-        }
-        set data [lindex $args 0]
-    }
-
-    set state false
-    set result {}
-
-    foreach {line} [split $data "\n"] {
-        switch -exact -- $state {
-            false {
-                if {[regexp {^begin ([0-7]+) ([^\s]*)} $line \
-                         -> opts(mode) opts(name)]} {
-                    set state true
-                    set r {}
-                }
-            }
-
-            true {
-                if {[string match "end" $line]} {
-                    set state false
-                    lappend result [list $opts(name) $opts(mode) $r]
-                } else {
-                    scan $line %c c
-                    set n [expr {($c - 0x21)}]
-                    append r [string range \
-                                  [decode [string range $line 1 end]] 0 $n]
-                }
-            }
-        }
-    }
-
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-package provide uuencode $::uuencode::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
Index: tolsh/tolsh.vfs/lib/base64/yencode.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/base64/yencode.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,315 +1,0 @@
-# yencode.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provide a Tcl only implementation of yEnc encoding algorithm
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# @(#)$Id: yencode.tcl,v 1.11 2005/09/28 04:51:19 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-catch {package require crc32};          # tcllib 1.1
-catch {package require tcllibc};        # critcl enhancements for tcllib
-
-namespace eval ::yencode {
-    variable version 1.1.1
-    namespace export encode decode yencode ydecode
-}
-
-# -------------------------------------------------------------------------
-
-proc ::yencode::Encode {s} {
-    set r {}
-    binary scan $s c* d
-    foreach {c} $d {
-        set v [expr {($c + 42) % 256}]
-        if {$v == 0x00 || $v == 0x09 || $v == 0x0A 
-            || $v == 0x0D || $v == 0x3D} {
-            append r "="
-            set v [expr {($v + 42) % 256}]
-        }
-        append r [format %c $v]
-    }
-    return $r
-}
-
-proc ::yencode::Decode {s} {
-    if {[string length $s] == 0} {return ""}
-    set r {}
-    set esc 0
-    binary scan $s c* d
-    foreach c $d {
-        if {$c == 61 && $esc == 0} {
-            set esc 1
-            continue
-        }
-        set v [expr {($c - 42) % 256}]
-        if {$esc} {
-            set v [expr {($v - 42) % 256}]
-            set esc 0
-        }
-        append r [format %c $v]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# C coded versions for critcl built base64c package
-# -------------------------------------------------------------------------
-
-if {[package provide critcl] != {}} {
-    namespace eval ::yencode {
-        critcl::ccode {
-            #include <string.h>
-        }
-        critcl::ccommand CEncode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r, v;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* fetch the input data */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-
-            /* calculate the length of the encoded result */
-            rlen = len;
-            for (p = input; p < input + len; p++) {
-                v = (*p + 42) % 256;
-                if (v == 0 || v == 9 || v == 0x0A || v == 0x0D || v == 0x3D)
-                   rlen++;
-            }
-            
-            /* allocate the output buffer */
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            
-            /* encode the input */
-            for (p = input; p < input + len; p++) {
-                v = (*p + 42) % 256;
-                if (v == 0 || v == 9 || v == 0x0A || v == 0x0D || v == 0x3D) {
-                    *r++ = '=';
-                    v = (v + 42) % 256;
-                }
-                *r++ = v;
-            }
-
-            return TCL_OK;
-        }
-
-        critcl::ccommand CDecode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, esc;
-            unsigned char *input, *p, *r, v;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* fetch the input data */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-
-            /* allocate the output buffer */
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, len);
-            
-            /* encode the input */
-            for (p = input, esc = 0, rlen = 0; p < input + len; p++) {
-                if (*p == 61 && esc == 0) {
-                    esc = 1;
-                    continue;
-                }
-                v = (*p - 42) % 256;
-                if (esc) {
-                    v = (v - 42) % 256;
-                    esc = 0;
-                }
-                *r++ = v;
-                rlen++;
-            }
-            Tcl_SetByteArrayLength(resultPtr, rlen);
-
-            return TCL_OK;
-        }
-    }
-}
-
-if {[info command ::yencode::CEncode] != {}} {
-    interp alias {} ::yencode::encode {} ::yencode::CEncode
-    interp alias {} ::yencode::decode {} ::yencode::CDecode
-} else {
-    interp alias {} ::yencode::encode {} ::yencode::Encode
-    interp alias {} ::yencode::decode {} ::yencode::Decode
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::yencode::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::yencode::yencode {args} {
-    array set opts {mode 0644 filename {} name {} line 128 crc32 1}
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* { set opts(filename) [Pop args 1] }
-            -m* { set opts(mode) [Pop args 1] }
-            -n* { set opts(name) [Pop args 1] }
-            -l* { set opts(line) [Pop args 1] }
-            -c* { set opts(crc32) [Pop args 1] }
-            --  { Pop args ; break }
-            default {
-                set options [join [lsort [array names opts]] ", -"]
-                return -code error "bad option [lindex $args 0]:\
-                      must be -$options"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(name) == {}} {
-        set opts(name) $opts(filename)
-    }
-    if {$opts(name) == {}} {
-        set opts(name) "data.dat"
-    }
-    if {! [string is boolean $opts(crc32)]} {
-        return -code error "bad option -crc32: argument must be true or false"
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        fconfigure $f -translation binary
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args: should be\
-                  \"yencode ?options? -file name | data\""
-        }
-        set data [lindex $args 0]
-    }
-    
-    set opts(size) [string length $data]
-    
-    set r {}
-    append r [format "=ybegin line=%d size=%d name=%s" \
-                  $opts(line) $opts(size) $opts(name)] "\n"
-
-    set ndx 0
-    while {$ndx < $opts(size)} {
-        set pln [string range $data $ndx [expr {$ndx + $opts(line) - 1}]]
-        set enc [encode $pln]
-        incr ndx [string length $pln]
-        append r $enc "\r\n"
-    }
-
-    append r [format "=yend size=%d" $ndx]
-    if {$opts(crc32)} {
-        append r " crc32=" [crc::crc32 -format %x $data]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Perform ydecoding of a file or data. A file may contain more than one
-#  encoded data section so the result is a list where each element is a 
-#  three element list of the provided filename, the file size and the 
-#  data itself.
-#
-proc ::yencode::ydecode {args} {
-    array set opts {mode 0644 filename {} name default.bin}
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* { set opts(filename) [Pop args 1] }
-            -- { Pop args ; break; }
-            default {
-                set options [join [lsort [array names opts]] ", -"]
-                return -code error "bad option [lindex $args 0]:\
-                      must be -$opts"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args: should be\
-                  \"ydecode ?options? -file name | data\""
-        }
-        set data [lindex $args 0]
-    }
-
-    set state false
-    set result {}
-
-    foreach {line} [split $data "\n"] {
-        set line [string trimright $line "\r\n"]
-        switch -exact -- $state {
-            false {
-                if {[string match "=ybegin*" $line]} {
-                    regexp {line=(\d+)} $line -> opts(line)
-                    regexp {size=(\d+)} $line -> opts(size)
-                    regexp {name=(\d+)} $line -> opts(name)
-
-                    if {$opts(name) == {}} {
-                        set opts(name) default.bin
-                    }
-
-                    set state true
-                    set r {}
-                }
-            }
-
-            true {
-                if {[string match "=yend*" $line]} {
-                    set state false
-                    lappend result [list $opts(name) $opts(size) $r]
-                } else {
-                    append r [decode $line]
-                }
-            }
-        }
-    }
-
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-package provide yencode $::yencode::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/aes/aes.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/aes/aes.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,595 +1,0 @@
-# aes.tcl - 
-#
-# Copyright (c) 2005 Thorsten Schloermann
-# Copyright (c) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# A Tcl implementation of the Advanced Encryption Standard (US FIPS PUB 197)
-#
-# AES is a block cipher with a block size of 128 bits and a variable
-# key size of 128, 192 or 256 bits.
-# The algorithm works on each block as a 4x4 state array. There are 4 steps
-# in each round:
-#   SubBytes    a non-linear substitution step using a predefined S-box
-#   ShiftRows   cyclic transposition of rows in the state matrix
-#   MixColumns  transformation upon columns in the state matrix
-#   AddRoundKey application of round specific sub-key
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.2
-
-namespace eval ::aes {
-    variable version 1.0.0
-    variable rcsid {$Id: aes.tcl,v 1.5 2005/09/04 17:15:56 patthoyts Exp $}
-    variable uid ; if {![info exists uid]} { set uid 0 }
-
-    namespace export {aes}
-
-    # constants
-
-    # S-box
-    variable sbox {
-        0x63 0x7c 0x77 0x7b 0xf2 0x6b 0x6f 0xc5 0x30 0x01 0x67 0x2b 0xfe 0xd7 0xab 0x76
-        0xca 0x82 0xc9 0x7d 0xfa 0x59 0x47 0xf0 0xad 0xd4 0xa2 0xaf 0x9c 0xa4 0x72 0xc0
-        0xb7 0xfd 0x93 0x26 0x36 0x3f 0xf7 0xcc 0x34 0xa5 0xe5 0xf1 0x71 0xd8 0x31 0x15
-        0x04 0xc7 0x23 0xc3 0x18 0x96 0x05 0x9a 0x07 0x12 0x80 0xe2 0xeb 0x27 0xb2 0x75
-        0x09 0x83 0x2c 0x1a 0x1b 0x6e 0x5a 0xa0 0x52 0x3b 0xd6 0xb3 0x29 0xe3 0x2f 0x84
-        0x53 0xd1 0x00 0xed 0x20 0xfc 0xb1 0x5b 0x6a 0xcb 0xbe 0x39 0x4a 0x4c 0x58 0xcf
-        0xd0 0xef 0xaa 0xfb 0x43 0x4d 0x33 0x85 0x45 0xf9 0x02 0x7f 0x50 0x3c 0x9f 0xa8
-        0x51 0xa3 0x40 0x8f 0x92 0x9d 0x38 0xf5 0xbc 0xb6 0xda 0x21 0x10 0xff 0xf3 0xd2
-        0xcd 0x0c 0x13 0xec 0x5f 0x97 0x44 0x17 0xc4 0xa7 0x7e 0x3d 0x64 0x5d 0x19 0x73
-        0x60 0x81 0x4f 0xdc 0x22 0x2a 0x90 0x88 0x46 0xee 0xb8 0x14 0xde 0x5e 0x0b 0xdb
-        0xe0 0x32 0x3a 0x0a 0x49 0x06 0x24 0x5c 0xc2 0xd3 0xac 0x62 0x91 0x95 0xe4 0x79
-        0xe7 0xc8 0x37 0x6d 0x8d 0xd5 0x4e 0xa9 0x6c 0x56 0xf4 0xea 0x65 0x7a 0xae 0x08
-        0xba 0x78 0x25 0x2e 0x1c 0xa6 0xb4 0xc6 0xe8 0xdd 0x74 0x1f 0x4b 0xbd 0x8b 0x8a
-        0x70 0x3e 0xb5 0x66 0x48 0x03 0xf6 0x0e 0x61 0x35 0x57 0xb9 0x86 0xc1 0x1d 0x9e
-        0xe1 0xf8 0x98 0x11 0x69 0xd9 0x8e 0x94 0x9b 0x1e 0x87 0xe9 0xce 0x55 0x28 0xdf
-        0x8c 0xa1 0x89 0x0d 0xbf 0xe6 0x42 0x68 0x41 0x99 0x2d 0x0f 0xb0 0x54 0xbb 0x16
-    }
-    # inverse S-box
-    variable xobs {
-        0x52 0x09 0x6a 0xd5 0x30 0x36 0xa5 0x38 0xbf 0x40 0xa3 0x9e 0x81 0xf3 0xd7 0xfb
-        0x7c 0xe3 0x39 0x82 0x9b 0x2f 0xff 0x87 0x34 0x8e 0x43 0x44 0xc4 0xde 0xe9 0xcb
-        0x54 0x7b 0x94 0x32 0xa6 0xc2 0x23 0x3d 0xee 0x4c 0x95 0x0b 0x42 0xfa 0xc3 0x4e
-        0x08 0x2e 0xa1 0x66 0x28 0xd9 0x24 0xb2 0x76 0x5b 0xa2 0x49 0x6d 0x8b 0xd1 0x25
-        0x72 0xf8 0xf6 0x64 0x86 0x68 0x98 0x16 0xd4 0xa4 0x5c 0xcc 0x5d 0x65 0xb6 0x92
-        0x6c 0x70 0x48 0x50 0xfd 0xed 0xb9 0xda 0x5e 0x15 0x46 0x57 0xa7 0x8d 0x9d 0x84
-        0x90 0xd8 0xab 0x00 0x8c 0xbc 0xd3 0x0a 0xf7 0xe4 0x58 0x05 0xb8 0xb3 0x45 0x06
-        0xd0 0x2c 0x1e 0x8f 0xca 0x3f 0x0f 0x02 0xc1 0xaf 0xbd 0x03 0x01 0x13 0x8a 0x6b
-        0x3a 0x91 0x11 0x41 0x4f 0x67 0xdc 0xea 0x97 0xf2 0xcf 0xce 0xf0 0xb4 0xe6 0x73
-        0x96 0xac 0x74 0x22 0xe7 0xad 0x35 0x85 0xe2 0xf9 0x37 0xe8 0x1c 0x75 0xdf 0x6e
-        0x47 0xf1 0x1a 0x71 0x1d 0x29 0xc5 0x89 0x6f 0xb7 0x62 0x0e 0xaa 0x18 0xbe 0x1b
-        0xfc 0x56 0x3e 0x4b 0xc6 0xd2 0x79 0x20 0x9a 0xdb 0xc0 0xfe 0x78 0xcd 0x5a 0xf4
-        0x1f 0xdd 0xa8 0x33 0x88 0x07 0xc7 0x31 0xb1 0x12 0x10 0x59 0x27 0x80 0xec 0x5f
-        0x60 0x51 0x7f 0xa9 0x19 0xb5 0x4a 0x0d 0x2d 0xe5 0x7a 0x9f 0x93 0xc9 0x9c 0xef
-        0xa0 0xe0 0x3b 0x4d 0xae 0x2a 0xf5 0xb0 0xc8 0xeb 0xbb 0x3c 0x83 0x53 0x99 0x61
-        0x17 0x2b 0x04 0x7e 0xba 0x77 0xd6 0x26 0xe1 0x69 0x14 0x63 0x55 0x21 0x0c 0x7d
-    }
-}
-
-# aes::Init --
-#
-#	Initialise our AES state and calculate the key schedule. An initialization
-#	vector is maintained in the state for modes that require one. The key must
-#	be binary data of the correct size and the IV must be 16 bytes.
-#
-#	Nk: columns of the key-array
-#	Nr: number of rounds (depends on key-length)
-#	Nb: columns of the text-block, is always 4 in AES
-#
-proc ::aes::Init {mode key iv} {
-    switch -exact -- $mode {
-        ecb - cbc { }
-        cfb - ofb {
-            return -code error "$mode mode not implemented"
-        }
-        default {
-            return -code error "invalid mode \"$mode\":\
-                must be one of ecb or cbc."
-        }
-    }
-
-    set size [expr {[string length $key] << 3}]
-    switch -exact -- $size {
-        128 {set Nk 4; set Nr 10; set Nb 4}
-        192 {set Nk 6; set Nr 12; set Nb 4}
-        256 {set Nk 8; set Nr 14; set Nb 4}
-        default {
-            return -code error "invalid key size \"$size\":\
-                must be one of 128, 192 or 256."
-        }
-    }
-
-    variable uid
-    set Key [namespace current]::[incr uid]
-    upvar #0 $Key state
-    array set state [list M $mode K $key I $iv Nk $Nk Nr $Nr Nb $Nb W {}]
-    ExpandKey $Key
-    return $Key
-}
-
-# aes::Reset --
-#
-#	Reset the initialization vector for the specified key. This permits the
-#	key to be reused for encryption or decryption without the expense of
-#	re-calculating the key schedule.
-#
-proc ::aes::Reset {Key iv} {
-    upvar #0 $Key state
-    set state(I) $iv
-    return
-}
-    
-# aes::Final --
-#
-#	Clean up the key state
-#
-proc ::aes::Final {Key} {
-    # FRINK: nocheck
-    unset $Key
-}
-
-# -------------------------------------------------------------------------
-
-# 5.1 Cipher:  Encipher a single block of 128 bits.
-proc ::aes::EncryptBlock {Key block} {
-    upvar #0 $Key state
-    if {[binary scan $block I4 data] != 1} {
-        return -code error "invalid block size: blocks must be 16 bytes"
-    }
-
-    if {[string equal $state(M) cbc]} {
-        if {[binary scan $state(I) I4 iv] != 1} {
-            return -code error "invalid initialization vector: must be 16 bytes"
-        }
-        for {set n 0} {$n < 4} {incr n} {
-            lappend data2 [expr {[lindex $data $n] ^ [lindex $iv $n]}]
-        }
-        set data $data2
-    }
-
-    set data [AddRoundKey $Key 0 $data]
-    for {set n 1} {$n < $state(Nr)} {incr n} {
-        set data [AddRoundKey $Key $n [MixColumns [ShiftRows [SubBytes $data]]]]
-    }
-    set data [AddRoundKey $Key $n [ShiftRows [SubBytes $data]]]
-    return [set state(I) [binary format I4 $data]]
-}
-
-# 5.3: Inverse Cipher: Decipher a single 128 bit block.
-proc ::aes::DecryptBlock {Key block} {
-    upvar #0 $Key state
-    if {[binary scan $block I4 data] != 1} {
-        return -code error "invalid block size: block must be 16 bytes"
-    }
-
-    set n $state(Nr)
-    set data [AddRoundKey $Key $state(Nr) $data]
-    for {incr n -1} {$n > 0} {incr n -1} {
-        set data [InvMixColumns [AddRoundKey $Key $n [InvSubBytes [InvShiftRows $data]]]]
-    }
-    set data [AddRoundKey $Key $n [InvSubBytes [InvShiftRows $data]]]
-    
-    if {[string equal $state(M) cbc]} {
-        if {[binary scan $state(I) I4 iv] != 1} {
-            return -code error "invalid initialization vector: must be 16 bytes"
-        }
-        for {set n 0} {$n < 4} {incr n} {
-            lappend data2 [expr {[lindex $data $n] ^ [lindex $iv $n]}]
-        }
-        set data $data2
-    }
-    
-    set state(I) $block
-    return [binary format I4 $data]
-}
-
-# 5.2: KeyExpansion
-proc ::aes::ExpandKey {Key} {
-    upvar #0 $Key state
-    set Rcon [list 0x00000000 0x01000000 0x02000000 0x04000000 0x08000000 \
-                  0x10000000 0x20000000 0x40000000 0x80000000 0x1b000000 \
-                  0x36000000 0x6c000000 0xd8000000 0xab000000 0x4d000000]
-    # Split the key into Nk big-endian words
-    binary scan $state(K) I* W
-    set max [expr {$state(Nb) * ($state(Nr) + 1)}]
-    set i $state(Nk)
-    set h $state(Nk) ; incr h -1
-    set j 0
-    for {} {$i < $max} {incr i; incr h; incr j} {
-        set temp [lindex $W $h]
-        if {($i % $state(Nk)) == 0} {
-            set sub [SubWord [RotWord $temp]]
-            set rc [lindex $Rcon [expr {$i/$state(Nk)}]]
-            set temp [expr {$sub ^ $rc}]
-        } elseif {$state(Nk) > 6 && ($i % $state(Nk)) == 4} { 
-            set temp [SubWord $temp]
-        }
-        lappend W [expr {[lindex $W $j] ^ $temp}]
-    }
-    set state(W) $W
-    return
-}
-
-# 5.2: Key Expansion: Apply S-box to each byte in the 32 bit word
-proc ::aes::SubWord {w} {
-    variable sbox
-    set s3 [lindex $sbox [expr {(($w >> 24) & 255)}]]
-    set s2 [lindex $sbox [expr {(($w >> 16) & 255)}]]
-    set s1 [lindex $sbox [expr {(($w >> 8 ) & 255)}]]
-    set s0 [lindex $sbox [expr {( $w        & 255)}]]
-    return [expr {($s3 << 24) | ($s2 << 16) | ($s1 << 8) | $s0}]
-}
-
-proc ::aes::InvSubWord {w} {
-    variable xobs
-    set s3 [lindex $xobs [expr {(($w >> 24) & 255)}]]
-    set s2 [lindex $xobs [expr {(($w >> 16) & 255)}]]
-    set s1 [lindex $xobs [expr {(($w >> 8 ) & 255)}]]
-    set s0 [lindex $xobs [expr {( $w        & 255)}]]
-    return [expr {($s3 << 24) | ($s2 << 16) | ($s1 << 8) | $s0}]
-}
-
-# 5.2: Key Expansion: Rotate a 32bit word by 8 bits
-proc ::aes::RotWord {w} {
-    return [expr {(($w << 8) | (($w >> 24) & 0xff)) & 0xffffffff}]
-}
-
-# 5.1.1: SubBytes() Transformation
-proc ::aes::SubBytes {words} {
-    set r {}
-    foreach w $words {
-        lappend r [SubWord $w]
-    }
-    return $r
-}
-
-# 5.3.2: InvSubBytes() Transformation
-proc ::aes::InvSubBytes {words} {
-    set r {}
-    foreach w $words {
-        lappend r [InvSubWord $w]
-    }
-    return $r
-}
-
-# 5.1.2: ShiftRows() Transformation
-proc ::aes::ShiftRows {words} {
-    for {set n0 0} {$n0 < 4} {incr n0} {
-        set n1 [expr {($n0 + 1) % 4}]
-        set n2 [expr {($n0 + 2) % 4}]
-        set n3 [expr {($n0 + 3) % 4}]
-        lappend r [expr {(  [lindex $words $n0] & 0xff000000)
-                         | ([lindex $words $n1] & 0x00ff0000)
-                         | ([lindex $words $n2] & 0x0000ff00)
-                         | ([lindex $words $n3] & 0x000000ff)
-                     }]
-    }
-    return $r
-}
-
-
-# 5.3.1: InvShiftRows() Transformation
-proc ::aes::InvShiftRows {words} {
-    for {set n0 0} {$n0 < 4} {incr n0} {
-        set n1 [expr {($n0 + 1) % 4}]
-        set n2 [expr {($n0 + 2) % 4}]
-        set n3 [expr {($n0 + 3) % 4}]
-        lappend r [expr {(  [lindex $words $n0] & 0xff000000)
-                         | ([lindex $words $n3] & 0x00ff0000)
-                         | ([lindex $words $n2] & 0x0000ff00)
-                         | ([lindex $words $n1] & 0x000000ff)
-                     }]
-    }
-    return $r
-}
-
-# 5.1.3: MixColumns() Transformation
-proc ::aes::MixColumns {words} {
-    set r {}
-    foreach w $words {
-        set r0 [expr {(($w >> 24) & 255)}]
-        set r1 [expr {(($w >> 16) & 255)}]
-        set r2 [expr {(($w >> 8 ) & 255)}]
-        set r3 [expr {( $w        & 255)}]
-
-        set s0 [expr {[GFMult2 $r0] ^ [GFMult3 $r1] ^ $r2 ^ $r3}]
-        set s1 [expr {$r0 ^ [GFMult2 $r1] ^ [GFMult3 $r2] ^ $r3}]
-        set s2 [expr {$r0 ^ $r1 ^ [GFMult2 $r2] ^ [GFMult3 $r3]}]
-        set s3 [expr {[GFMult3 $r0] ^ $r1 ^ $r2 ^ [GFMult2 $r3]}]
-
-        lappend r [expr {($s0 << 24) | ($s1 << 16) | ($s2 << 8) | $s3}]
-    }
-    return $r
-}
-
-# 5.3.3: InvMixColumns() Transformation
-proc ::aes::InvMixColumns {words} {
-    set r {}
-    foreach w $words {
-        set r0 [expr {(($w >> 24) & 255)}]
-        set r1 [expr {(($w >> 16) & 255)}]
-        set r2 [expr {(($w >> 8 ) & 255)}]
-        set r3 [expr {( $w        & 255)}]
-
-        set s0 [expr {[GFMult0e $r0] ^ [GFMult0b $r1] ^ [GFMult0d $r2] ^ [GFMult09 $r3]}]
-        set s1 [expr {[GFMult09 $r0] ^ [GFMult0e $r1] ^ [GFMult0b $r2] ^ [GFMult0d $r3]}]
-        set s2 [expr {[GFMult0d $r0] ^ [GFMult09 $r1] ^ [GFMult0e $r2] ^ [GFMult0b $r3]}]
-        set s3 [expr {[GFMult0b $r0] ^ [GFMult0d $r1] ^ [GFMult09 $r2] ^ [GFMult0e $r3]}]
-
-        lappend r [expr {($s0 << 24) | ($s1 << 16) | ($s2 << 8) | $s3}]
-    }
-    return $r
-}
-
-# 5.1.4: AddRoundKey() Transformation
-proc ::aes::AddRoundKey {Key round words} {
-    upvar #0 $Key state
-    set r {}
-    set n [expr {$round * $state(Nb)}]
-    foreach w $words {
-        lappend r [expr {$w ^ [lindex $state(W) $n]}]
-        incr n
-    }
-    return $r
-}
-    
-# -------------------------------------------------------------------------
-# ::aes::GFMult*
-#
-#	some needed functions for multiplication in a Galois-field
-#
-proc ::aes::GFMult2 {number} {
-    # this is a tabular representation of xtime (multiplication by 2)
-    # it is used instead of calculation to prevent timing attacks
-    set xtime {
-        0x00 0x02 0x04 0x06 0x08 0x0a 0x0c 0x0e 0x10 0x12 0x14 0x16 0x18 0x1a 0x1c 0x1e
-        0x20 0x22 0x24 0x26 0x28 0x2a 0x2c 0x2e 0x30 0x32 0x34 0x36 0x38 0x3a 0x3c 0x3e 
-        0x40 0x42 0x44 0x46 0x48 0x4a 0x4c 0x4e 0x50 0x52 0x54 0x56 0x58 0x5a 0x5c 0x5e
-        0x60 0x62 0x64 0x66 0x68 0x6a 0x6c 0x6e 0x70 0x72 0x74 0x76 0x78 0x7a 0x7c 0x7e 
-        0x80 0x82 0x84 0x86 0x88 0x8a 0x8c 0x8e 0x90 0x92 0x94 0x96 0x98 0x9a 0x9c 0x9e 
-        0xa0 0xa2 0xa4 0xa6 0xa8 0xaa 0xac 0xae 0xb0 0xb2 0xb4 0xb6 0xb8 0xba 0xbc 0xbe 
-        0xc0 0xc2 0xc4 0xc6 0xc8 0xca 0xcc 0xce 0xd0 0xd2 0xd4 0xd6 0xd8 0xda 0xdc 0xde 
-        0xe0 0xe2 0xe4 0xe6 0xe8 0xea 0xec 0xee 0xf0 0xf2 0xf4 0xf6 0xf8 0xfa 0xfc 0xfe 
-        0x1b 0x19 0x1f 0x1d 0x13 0x11 0x17 0x15 0x0b 0x09 0x0f 0x0d 0x03 0x01 0x07 0x05 
-        0x3b 0x39 0x3f 0x3d 0x33 0x31 0x37 0x35 0x2b 0x29 0x2f 0x2d 0x23 0x21 0x27 0x25 
-        0x5b 0x59 0x5f 0x5d 0x53 0x51 0x57 0x55 0x4b 0x49 0x4f 0x4d 0x43 0x41 0x47 0x45 
-        0x7b 0x79 0x7f 0x7d 0x73 0x71 0x77 0x75 0x6b 0x69 0x6f 0x6d 0x63 0x61 0x67 0x65 
-        0x9b 0x99 0x9f 0x9d 0x93 0x91 0x97 0x95 0x8b 0x89 0x8f 0x8d 0x83 0x81 0x87 0x85 
-        0xbb 0xb9 0xbf 0xbd 0xb3 0xb1 0xb7 0xb5 0xab 0xa9 0xaf 0xad 0xa3 0xa1 0xa7 0xa5 
-        0xdb 0xd9 0xdf 0xdd 0xd3 0xd1 0xd7 0xd5 0xcb 0xc9 0xcf 0xcd 0xc3 0xc1 0xc7 0xc5 
-        0xfb 0xf9 0xff 0xfd 0xf3 0xf1 0xf7 0xf5 0xeb 0xe9 0xef 0xed 0xe3 0xe1 0xe7 0xe5
-    }
-    return [lindex $xtime $number]
-}
-
-proc ::aes::GFMult3 {number} {
-    # multliply by 2 (via GFMult2) and add the number again on the result (via XOR)
-    return [expr {$number ^ [GFMult2 $number]}]
-}
-
-proc ::aes::GFMult09 {number} {
-    # 09 is: (02*02*02) + 01
-    return [expr {[GFMult2 [GFMult2 [GFMult2 $number]]] ^ $number}]
-}
-
-proc ::aes::GFMult0b {number} {
-    # 0b is: (02*02*02) + 02 + 01
-    #return [expr [GFMult2 [GFMult2 [GFMult2 $number]]] ^ [GFMult2 $number] ^ $number]
-    #set g0 [GFMult2 $number]
-    return [expr {[GFMult09 $number] ^ [GFMult2 $number]}]
-}
-
-proc ::aes::GFMult0d {number} {
-    # 0d is: (02*02*02) + (02*02) + 01
-    set temp [GFMult2 [GFMult2 $number]]
-    return [expr {[GFMult2 $temp] ^ ($temp ^ $number)}]
-}
-
-proc ::aes::GFMult0e {number} {
-    # 0e is: (02*02*02) + (02*02) + 02
-    set temp [GFMult2 [GFMult2 $number]]
-    return [expr {[GFMult2 $temp] ^ ($temp ^ [GFMult2 $number])}]
-}
-
-# -------------------------------------------------------------------------
-
-# aes::Encrypt --
-#
-#	Encrypt a blocks of plain text and returns blocks of cipher text.
-#	The input data must be a multiple of the block size (16).
-#
-proc ::aes::Encrypt {Key data} {
-    set len [string length $data]
-    if {($len % 16) != 0} {
-        return -code error "invalid block size: AES requires 16 byte blocks"
-    }
-
-    set result {}
-    for {set i 0} {$i < $len} {incr i 1} {
-        set block [string range $data $i [incr i 15]]
-        append result [EncryptBlock $Key $block]
-    }
-    return $result
-}
-
-# aes::DecryptBlock --
-#
-#	Decrypt a blocks of cipher text and returns blocks of plain text.
-#	The input data must be a multiple of the block size (16).
-#
-proc ::aes::Decrypt {Key data} {
-    set len [string length $data]
-    if {($len % 16) != 0} {
-        return -code error "invalid block size: AES requires 16 byte blocks"
-    }
-
-    set result {}
-    for {set i 0} {$i < $len} {incr i 1} {
-        set block [string range $data $i [incr i 15]]
-        append result [DecryptBlock $Key $block]
-    }
-    return $result
-}
-
-# -------------------------------------------------------------------------
-# Fileevent handler for chunked file reading.
-#
-proc ::aes::Chunk {Key in {out {}} {chunksize 4096}} {
-    upvar #0 $Key state
-    
-    if {[eof $in]} {
-        fileevent $in readable {}
-        set state(reading) 0
-    }
-
-    set data [read $in $chunksize]
-    # FIX ME: we should ony pad after eof
-    set data [Pad $data 16]
-    
-    if {$out == {}} {
-        append state(output) [$state(cmd) $Key $data]
-    } else {
-        puts -nonewline $out [$state(cmd) $Key $data]
-    }
-}
-
-proc ::aes::SetOneOf {lst item} {
-    set ndx [lsearch -glob $lst "${item}*"]
-    if {$ndx == -1} {
-        set err [join $lst ", "]
-        return -code error "invalid mode \"$item\": must be one of $err"
-    }
-    return [lindex $lst $ndx]
-}
-
-proc ::aes::CheckSize {what size thing} {
-    if {[string length $thing] != $size} {
-        return -code error "invalid value for $what: must be $size bytes long"
-    }
-    return $thing
-}
-
-proc ::aes::Pad {data blocksize {fill \0}} {
-    set len [string length $data]
-    if {$len == 0} {
-        set data [string repeat $fill $blocksize]
-    } elseif {($len % $blocksize) != 0} {
-        set pad [expr {$blocksize - ($len % $blocksize)}]
-        append data [string repeat $fill $pad]
-    }
-    return $data
-}
-
-proc ::aes::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-proc ::aes::Hex {data} {
-    binary scan $data H* r
-    return $r 
-}
-
-proc ::aes::aes {args} {
-    array set opts {-dir encrypt -mode cbc -key {} -in {} -out {} -chunksize 4096 -hex 0}
-    set opts(-iv) [string repeat \0 16]
-    set modes {ecb cbc}
-    set dirs {encrypt decrypt}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -mode      { set opts(-mode) [SetOneOf $modes [Pop args 1]] }
-            -dir       { set opts(-dir) [SetOneOf $dirs [Pop args 1]] }
-            -iv        { set opts(-iv) [CheckSize -iv 16 [Pop args 1]] }
-            -key       { set opts(-key) [Pop args 1] }
-            -in        { set opts(-in) [Pop args 1] }
-            -out       { set opts(-out) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            --         { Pop args ; break }
-            default {
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option \"$option\":\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-key) == {}} {
-        return -code error "no key provided: the -key option is required"
-    }
-
-    set r {}
-    if {$opts(-in) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args:\
-                should be \"aes ?options...? -key keydata plaintext\""
-        }
-
-        set data [Pad [lindex $args 0] 16]
-        set Key [Init $opts(-mode) $opts(-key) $opts(-iv)]
-        if {[string equal $opts(-dir) "encrypt"]} {
-            set r [Encrypt $Key $data]
-        } else {
-            set r [Decrypt $Key $data]
-        }
-
-        if {$opts(-out) != {}} {
-            puts -nonewline $opts(-out) $r
-            set r {}
-        }
-        Final $Key
-
-    } else {
-
-        if {[llength $args] != 0} {
-            return -code error "wrong \# args:\
-                should be \"aes ?options...? -key keydata -in channel\""
-        }
-
-        set Key [Init $opts(-mode) $opts(-key) $opts(-iv)]
-        upvar $Key state
-        set state(reading) 1
-        if {[string equal $opts(-dir) "encrypt"]} {
-            set state(cmd) Encrypt
-        } else {
-            set state(cmd) Decrypt
-        }
-        set state(output) ""
-        fileevent $opts(-in) readable \
-            [list [namespace origin Chunk] \
-                 $Key $opts(-in) $opts(-out) $opts(-chunksize)]
-        if {[info commands ::tkwait] != {}} {
-            tkwait variable [subst $Key](reading)
-        } else {
-            vwait [subst $Key](reading)
-        }
-        if {$opts(-out) == {}} {
-            set r $state(output)
-        }
-        Final $Key
-
-    }
-
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-package provide aes $::aes::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-# mode: tcl
-# indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/aes/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/aes/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded aes 1.0.0 [list source [file join $dir aes.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/asn/asn.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/asn/asn.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1498 +1,0 @@
-#-----------------------------------------------------------------------------
-#   Copyright (C) 1999-2004 Jochen C. Loewer (loewerj@web.de)
-#   Copyright (C) 2004-2007 Michael Schlenker (mic42@users.sourceforge.net)
-#-----------------------------------------------------------------------------
-#   
-#   A partial ASN decoder/encoder implementation in plain Tcl. 
-#
-#   See ASN.1 (X.680) and BER (X.690).
-#   See 'asn_ber_intro.txt' in this directory.
-#
-#   This software is copyrighted by Jochen C. Loewer (loewerj@web.de). The 
-#   following terms apply to all files associated with the software unless 
-#   explicitly disclaimed in individual files.
-#
-#   The authors hereby grant permission to use, copy, modify, distribute,
-#   and license this software and its documentation for any purpose, provided
-#   that existing copyright notices are retained in all copies and that this
-#   notice is included verbatim in any distributions. No written agreement,
-#   license, or royalty fee is required for any of the authorized uses.
-#   Modifications to this software may be copyrighted by their authors
-#   and need not follow the licensing terms described here, provided that
-#   the new terms are clearly indicated on the first page of each file where
-#   they apply.
-#  
-#   IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-#   FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-#   ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-#   DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-#   POSSIBILITY OF SUCH DAMAGE.
-#
-#   THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-#   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-#   FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-#   IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-#   NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-#   MODIFICATIONS.
-#
-#   written by Jochen Loewer
-#   3 June, 1999
-#
-#   $Id: asn.tcl,v 1.17 2007/04/21 12:35:14 mic42 Exp $
-#
-#-----------------------------------------------------------------------------
-
-# needed for using wide()
-package require Tcl 8.4
-
-namespace eval asn {
-    # Encoder commands
-    namespace export \
-        asnSequence \
-	asnSequenceFromList \
-        asnSet \
-	asnSetFromList \
-        asnApplicationConstr \
-        asnApplication \
-	asnContext\
-	asnContextConstr\
-        asnChoice \
-        asnChoiceConstr \
-        asnInteger \
-        asnEnumeration \
-        asnBoolean \
-        asnOctetString \
-        asnNull	   \
-	asnUTCTime \
-	asnNumericString \
-        asnPrintableString \
-        asnIA5String\
-	asnBMPString\
-	asnUTF8String\
-        asnBitString \
-        asnObjectIdentifer 
-        
-    # Decoder commands
-    namespace export \
-        asnGetResponse \
-        asnGetInteger \
-        asnGetEnumeration \
-        asnGetOctetString \
-        asnGetSequence \
-        asnGetSet \
-        asnGetApplication \
-	asnGetNumericString \
-        asnGetPrintableString \
-        asnGetIA5String \
-	asnGetBMPString \
-	asnGetUTF8String \
-        asnGetObjectIdentifier \
-        asnGetBoolean \
-        asnGetUTCTime \
-        asnGetBitString \
-        asnGetContext 
-    
-    # general BER utility commands    
-    namespace export \
-        asnPeekByte  \
-        asnGetLength \
-        asnRetag     \
-	asnPeekTag   \
-	asnTag	     
-        
-}
-
-#-----------------------------------------------------------------------------
-# Implementation notes:
-#
-# See the 'asn_ber_intro.txt' in this directory for an introduction
-# into BER/DER encoding of ASN.1 information. Bibliography information
-#
-#   A Layman's Guide to a Subset of ASN.1, BER, and DER
-#
-#   An RSA Laboratories Technical Note
-#   Burton S. Kaliski Jr.
-#   Revised November 1, 1993
-#
-#   Supersedes June 3, 1991 version, which was also published as
-#   NIST/OSI Implementors' Workshop document SEC-SIG-91-17.
-#   PKCS documents are available by electronic mail to
-#   <pkcs@rsa.com>.
-#
-#   Copyright (C) 1991-1993 RSA Laboratories, a division of RSA
-#   Data Security, Inc. License to copy this document is granted
-#   provided that it is identified as "RSA Data Security, Inc.
-#   Public-Key Cryptography Standards (PKCS)" in all material
-#   mentioning or referencing this document.
-#   003-903015-110-000-000
-#
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# asnLength : Encode some length data. Helper command.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnLength {len} {
-    
-    if {$len < 0} {
-        return -code error "Negative length octet requested"
-    }
-    if {$len < 128} {
-        # short form: ISO X.690 8.1.3.4 
-        return [binary format c $len]
-    }
-    # long form: ISO X.690 8.1.3.5
-    # try to use a minimal encoding, 
-    # even if not required by BER, but it is required by DER
-    # take care for signed vs. unsigned issues
-    if {$len < 256  } {
-        return [binary format H2c 81 [expr {$len - 256}]]
-    }
-    if {$len < 32769} {
-        # two octet signed value
-        return [binary format H2S 82 $len]
-    }
-    if {$len < 65536} {
-        return [binary format H2S 82 [expr {$len - 65536}]]
-    }
-    if {$len < 8388608} {
-        # three octet signed value    
-        return [binary format H2cS 83 [expr {$len >> 16}] [expr {($len & 0xFFFF) - 65536}]] 
-    }    
-    if {$len < 16777216} {
-        # three octet signed value    
-        return [binary format H2cS 83 [expr {($len >> 16) -256}] [expr {($len & 0xFFFF) -65536}]] 
-    }
-    if {$len < 2147483649} { 
-        # four octet signed value
-        return [binary format H2I 84 $len]
-    }
-    if {$len < 4294967296} {
-        # four octet unsigned value
-        return [binary format H2I 84 [expr {$len - 4294967296}]]
-    }
-    if {$len < 1099511627776} {
-        # five octet unsigned value
-        return [binary format H2 85][string range [binary format W $len] 3 end]  
-    }
-    if {$len < 281474976710656} {
-        # six octet unsigned value
-        return [binary format H2 86][string range [binary format W $len] 2 end]
-    }
-    if {$len < 72057594037927936} {
-        # seven octet value
-        return [binary format H2 87][string range [binary format W $len] 1 end]
-    }
-    
-    # must be a 64-bit wide signed value
-    return [binary format H2W 88 $len] 
-}
-
-#-----------------------------------------------------------------------------
-# asnSequence : Assumes that the arguments are already ASN encoded.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnSequence {args} {
-    asnSequenceFromList $args
-}
-
-proc ::asn::asnSequenceFromList {lst} {
-    # The sequence tag is 0x30. The length is arbitrary and thus full
-    # length coding is required. The arguments have to be BER encoded
-    # already. Constructed value, definite-length encoding.
-
-    set out ""
-    foreach part $lst {
-        append out $part
-    }
-    set len [string length $out]
-    return [binary format H2a*a$len 30 [asnLength $len] $out]
-}
-
-
-#-----------------------------------------------------------------------------
-# asnSet : Assumes that the arguments are already ASN encoded.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnSet {args} {
-    asnSetFromList $args
-}
-
-proc ::asn::asnSetFromList {lst} {
-    # The set tag is 0x31. The length is arbitrary and thus full
-    # length coding is required. The arguments have to be BER encoded
-    # already.
-
-    set out ""
-    foreach part $lst {
-        append out $part
-    }
-    set len [string length $out]
-    return [binary format H2a*a$len 31 [asnLength $len] $out]
-}
-
-
-#-----------------------------------------------------------------------------
-# asnApplicationConstr
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnApplicationConstr {appNumber args} {
-    # Packs the arguments into a constructed value with application tag.
-
-    set out ""
-    foreach part $args {
-        append out $part
-    }
-    set code [expr {0x060 + $appNumber}]
-    set len  [string length $out]
-    return [binary format ca*a$len $code [asnLength $len] $out]
-}
-
-#-----------------------------------------------------------------------------
-# asnApplication
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnApplication {appNumber data} {
-    # Packs the arguments into a constructed value with application tag.
-
-    set code [expr {0x040 + $appNumber}]
-    set len  [string length $data]
-    return [binary format ca*a$len $code [asnLength $len] $data]
-}
-
-#-----------------------------------------------------------------------------
-# asnContextConstr
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnContextConstr {contextNumber args} {
-    # Packs the arguments into a constructed value with application tag.
-
-    set out ""
-    foreach part $args {
-        append out $part
-    }
-    set code [expr {0x0A0 + $contextNumber}]
-    set len  [string length $out]
-    return [binary format ca*a$len $code [asnLength $len] $out]
-}
-
-#-----------------------------------------------------------------------------
-# asnContext
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnContext {contextNumber data} {
-    # Packs the arguments into a constructed value with application tag.
-    set code [expr {0x080 + $contextNumber}]
-    set len  [string length $data]
-    return [binary format ca*a$len $code [asnLength $len] $data]
-}
-#-----------------------------------------------------------------------------
-# asnChoice
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnChoice {appNumber args} {
-    # Packs the arguments into a choice construction.
-
-    set out ""
-    foreach part $args {
-        append out $part
-    }
-    set code [expr {0x080 + $appNumber}]
-    set len  [string length $out]
-    return [binary format ca*a$len $code [asnLength $len] $out]
-}
-
-#-----------------------------------------------------------------------------
-# asnChoiceConstr
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnChoiceConstr {appNumber args} {
-    # Packs the arguments into a choice construction.
-
-    set out ""
-    foreach part $args {
-        append out $part
-    }
-    set code [expr {0x0A0 + $appNumber}]
-    set len  [string length $out]
-    return [binary format ca*a$len $code [asnLength $len] $out]
-}
-
-#-----------------------------------------------------------------------------
-# asnInteger : Encode integer value.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnInteger {number} {
-    asnIntegerOrEnum 02 $number
-}
-
-#-----------------------------------------------------------------------------
-# asnEnumeration : Encode enumeration value.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnEnumeration {number} {
-    asnIntegerOrEnum 0a $number
-}
-
-#-----------------------------------------------------------------------------
-# asnIntegerOrEnum : Common code for Integers and Enumerations
-#                    No Bignum version, as we do not expect large Enums.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnIntegerOrEnum {tag number} {
-    # The integer tag is 0x02 , the Enum Tag 0x0a otherwise identical. 
-    # The length is 1, 2, 3, or 4, coded in a
-    # single byte. This can be done directly, no need to go through
-    # asnLength. The value itself is written in big-endian.
-
-    # Known bug/issue: The command cannot handle very wide integers, i.e.
-    # anything above 8 bytes length. Use asnBignumInteger for those.
-    
-    # check if we really have an int
-    set num $number
-    incr num
-    
-    if {($number >= -128) && ($number < 128)} {
-        return [binary format H2H2c $tag 01 $number]
-    }
-    if {($number >= -32768) && ($number < 32768)} {
-        return [binary format H2H2S $tag 02 $number]
-    }
-    if {($number >= -8388608) && ($number < 8388608)} {
-        set numberb [expr {$number & 0xFFFF}]
-        set numbera [expr {($number >> 16) & 0xFF}]
-        return [binary format H2H2cS $tag 03 $numbera $numberb]
-    }
-    if {($number >= -2147483648) && ($number < 2147483648)} {
-        return [binary format H2H2I $tag 04 $number]
-    }
-    if {($number >= -549755813888) && ($number < 549755813888)} {
-        set numberb [expr {$number & 0xFFFFFFFF}]
-        set numbera [expr {($number >> 32) & 0xFF}]
-        return [binary format H2H2cI $tag 05 $numbera $numberb]
-    }
-    if {($number >= -140737488355328) && ($number < 140737488355328)} {
-        set numberb [expr {$number & 0xFFFFFFFF}]
-        set numbera [expr {($number >> 32) & 0xFFFF}]
-        return [binary format H2H2SI $tag 06 $numbera $numberb]        
-    }
-    if {($number >= -36028797018963968) && ($number < 36028797018963968)} {
-        set numberc [expr {$number & 0xFFFFFFFF}]
-        set numberb [expr {($number >> 32) & 0xFFFF}]
-        set numbera [expr {($number >> 48) & 0xFF}]
-        return [binary format H2H2cSI $tag 07 $numbera $numberb $numberc]        
-    }    
-    if {($number >= -9223372036854775808) && ($number <= 9223372036854775807)} {
-        return [binary format H2H2W $tag 08 $number]
-    }
-    return -code error "Integer value to large to encode, use asnBigInteger" 
-}
-
-#-----------------------------------------------------------------------------
-# asnBigInteger : Encode a long integer value using math::bignum
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnBigInteger {bignum} {
-    # require math::bignum only if it is used
-    package require math::bignum
-    
-    # this is a hack to check for bignum...
-    if {[llength $bignum] < 2 || ([lindex $bignum 0] ne "bignum")} {
-        return -code error "expected math::bignum value got \"$bignum\""
-    }
-    if {[math::bignum::sign $bignum]} {
-        # generate two's complement form
-        set bits [math::bignum::bits $bignum]
-        set padding [expr {$bits % 8}]
-        set len [expr {int(ceil($bits / 8.0))}]
-        if {$padding == 0} {
-            # we need a complete extra byte for the sign
-            # unless this is a base 2 multiple
-            set test [math::bignum::fromstr 0]
-            math::bignum::setbit test [expr {$bits-1}]
-            if {[math::bignum::ne [math::bignum::abs $bignum] $test]} {
-                incr len
-            }
-        }
-        set exp [math::bignum::pow \
-		    [math::bignum::fromstr 256] \
-		    [math::bignum::fromstr $len]]
-        set bignum [math::bignum::add $bignum $exp]
-        set hex [math::bignum::tostr $bignum 16]
-    } else {
-        set bits [math::bignum::bits $bignum]
-        if {($bits % 8) == 0 && $bits > 0} {
-            set pad "00"
-        } else {
-            set pad ""
-        }
-        set hex $pad[math::bignum::tostr $bignum 16]
-    }
-    if {[string length $hex]%2} {
-        set hex "0$hex"
-    }
-    set octets [expr {(([string length $hex]+1)/2)}]
-    return [binary format H2a*H* 02 [asnLength $octets] $hex]   
-}
-
-
-#-----------------------------------------------------------------------------
-# asnBoolean : Encode a boolean value.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnBoolean {bool} {
-    # The boolean tag is 0x01. The length is always 1, coded in
-    # a single byte. This can be done directly, no need to go through
-    # asnLength. The value itself is written in big-endian.
-
-    return [binary format H2H2c 01 01 [expr {$bool ? 0x0FF : 0x0}]]
-}
-
-#-----------------------------------------------------------------------------
-# asnOctetString : Encode a string of arbitrary bytes
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnOctetString {string} {
-    # The octet tag is 0x04. The length is arbitrary, so we need
-    # 'asnLength' for full coding of the length.
-
-    set len [string length $string]
-    return [binary format H2a*a$len 04 [asnLength $len] $string]
-}
-
-#-----------------------------------------------------------------------------
-# asnNull : Encode a null value
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnNull {} {
-    # Null has only one valid encoding
-    return \x05\x00
-}
-
-#-----------------------------------------------------------------------------
-# asnBitstring : Encode a Bit String value
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnBitString {bitstring} {
-    # The bit string tag is 0x03.
-    # Bit strings can be either simple or constructed
-    # we always use simple encoding
-    
-    set bitlen [string length $bitstring]
-    set padding [expr {(8 - ($bitlen % 8)) % 8}]
-    set len [expr {($bitlen / 8) + 1}]
-    if {$padding != 0} {incr len}
-    
-    return [binary format H2a*B* 03 [asnLength $len] $bitstring]    
-}
-
-#-----------------------------------------------------------------------------
-# asnUTCTime : Encode an UTC time string
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnUTCTime {UTCtimestring} {
-    # the utc time tag is 0x17.
-    # 
-    # BUG: we do not check the string for well formedness
-    
-    set ascii [encoding convertto ascii $UTCtimestring]
-    set len [string length $ascii]
-    return [binary format H2a*a* 17 [asnLength $len] $ascii]
-}
-
-#-----------------------------------------------------------------------------
-# asnPrintableString : Encode a printable string
-#-----------------------------------------------------------------------------
-namespace eval asn {
-    variable nonPrintableChars {[^ A-Za-z0-9'()+,.:/?=-]}
-}	
-proc ::asn::asnPrintableString {string} {
-    # the printable string tag is 0x13
-    variable nonPrintableChars
-    # it is basically a restricted ascii string
-    if {[regexp $nonPrintableChars $string ]} {
-        return -code error "Illegal character in PrintableString."
-    }
-    
-    # check characters
-    set ascii [encoding convertto ascii $string]
-    return [asnEncodeString 13 $ascii]
-}
-
-#-----------------------------------------------------------------------------
-# asnIA5String : Encode an Ascii String
-#-----------------------------------------------------------------------------
-proc ::asn::asnIA5String {string} {
-    # the IA5 string tag is 0x16
-    # check for extended charachers
-    if {[string length $string]!=[string bytelength $string]} {
-	return -code error "Illegal character in IA5String"
-    }
-    set ascii [encoding convertto ascii $string]
-    return [asnEncodeString 16 $ascii]
-}
-
-#-----------------------------------------------------------------------------
-# asnNumericString : Encode a Numeric String type
-#-----------------------------------------------------------------------------
-namespace eval asn {
-    variable nonNumericChars {[^0-9 ]}
-}
-proc ::asn::asnNumericString {string} {
-    # the Numeric String type has tag 0x12
-    variable nonNumericChars
-    if {[regexp $nonNumericChars $string]} {
-        return -code error "Illegal character in Numeric String."
-    }
-    
-    return [asnEncodeString 12 $string]
-}
-#----------------------------------------------------------------------
-# asnBMPString: Encode a Tcl string as Basic Multinligval (UCS2) string
-#-----------------------------------------------------------------------
-proc asn::asnBMPString  {string} {
-    if {$::tcl_platform(byteOrder) eq "littleEndian"} {
-	set bytes ""
-	foreach {lo hi} [split [encoding convertto unicode $string] ""] {
-	    append bytes $hi $lo
-	}	
-    } else {
-	set bytes [encoding convertto unicode $string]
-    }
-    return [asnEncodeString 1e $bytes]
-}	
-#---------------------------------------------------------------------------
-# asnUTF8String: encode tcl string as UTF8 String
-#----------------------------------------------------------------------------
-proc asn::asnUTF8String {string} {
-    return [asnEncodeString 0c [encoding convertto utf-8 $string]]
-}
-#-----------------------------------------------------------------------------
-# asnEncodeString : Encode an RestrictedCharacter String
-#-----------------------------------------------------------------------------
-proc ::asn::asnEncodeString {tag string} {
-    set len [string length $string]
-    return [binary format H2a*a$len $tag [asnLength $len] $string]    
-}
-
-#-----------------------------------------------------------------------------
-# asnObjectIdentifier : Encode an Object Identifier value
-#-----------------------------------------------------------------------------
-proc ::asn::asnObjectIdentifier {oid} {
-    # the object identifier tag is 0x06
-    
-    if {[llength $oid] < 2} {
-        return -code error "OID must have at least two subidentifiers."
-    }
-    
-    # basic check that it is valid
-    foreach identifier $oid {
-        if {$identifier < 0} {
-            return -code error \
-		"Malformed OID. Identifiers must be positive Integers."
-        }
-    }
-    
-    if {[lindex $oid 0] > 2} {
-            return -code error "First subidentifier must be 0,1 or 2"
-    }
-    if {[lindex $oid 1] > 39} {
-            return -code error \
-		"Second subidentifier must be between 0 and 39"
-    }
-    
-    # handle the special cases directly
-    switch [llength $oid] {
-        2  {  return [binary format H2H2c 06 01 \
-		[expr {[lindex $oid 0]*40+[lindex $oid 1]}]] }
-        default {
-              # This can probably be written much shorter. 
-              # Just a first try that works...
-              #
-              set octets [binary format c \
-		[expr {[lindex $oid 0]*40+[lindex $oid 1]}]]
-              foreach identifier [lrange $oid 2 end] {
-                  set d 128
-                  if {$identifier < 128} {
-                    set subidentifier [list $identifier]
-                  } else {  
-                    set subidentifier [list]
-                    # find the largest divisor
-                    
-                    while {($identifier / $d) >= 128} { 
-			set d [expr {$d * 128}] 
-		    }
-                    # and construct the subidentifiers
-                    set remainder $identifier
-                    while {$d >= 128} {
-                        set coefficient [expr {($remainder / $d) | 0x80}]
-                        set remainder [expr {$remainder % $d}]
-                        set d [expr {$d / 128}]
-                        lappend subidentifier $coefficient
-                    }
-                    lappend subidentifier $remainder
-                  }
-                  append octets [binary format c* $subidentifier]
-              }
-              return [binary format H2a*a* 06 \
-		      [asnLength [string length $octets]] $octets]
-        }
-    }
-
-}
-
-#-----------------------------------------------------------------------------
-# asnGetResponse : Read a ASN response from a channel.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetResponse {sock data_var} {
-    upvar 1 $data_var data
-
-    # We expect a sequence here (tag 0x30). The code below is an
-    # inlined replica of 'asnGetSequence', modified for reading from a
-    # channel instead of a string.
-
-    set tag [read $sock 1]
-
-    if {$tag == "\x30"} {
-    # The following code is a replica of 'asnGetLength', modified
-    # for reading the bytes from the channel instead of a string.
-
-        set len1 [read $sock 1]
-        binary scan $len1 c num
-        set length [expr {($num + 0x100) % 0x100}]
-
-        if {$length  >= 0x080} {
-        # The byte the read is not the length, but a prefix, and
-        # the lower nibble tells us how many bytes follow.
-
-            set len_length  [expr {$length & 0x7f}]
-
-        # BUG: We should not perform the value extraction for an
-        # BUG: improper length. It wastes cycles, and here it can
-        # BUG: cause us trouble, reading more data than there is
-        # BUG: on the channel. Depending on the channel
-        # BUG: configuration an attacker can induce us to block,
-        # BUG: causing a denial of service.
-            set lengthBytes [read $sock $len_length]
-
-            switch $len_length {
-                1 {
-            binary scan $lengthBytes     c length 
-            set length [expr {($length + 0x100) % 0x100}]
-                }
-                2 { binary scan $lengthBytes     S length }
-                3 { binary scan \x00$lengthBytes I length }
-                4 { binary scan $lengthBytes     I length }
-                default {
-                    return -code error \
-			"length information too long ($len_length)"
-                }
-            }
-        }
-
-    # Now that the length is known we get the remainder,
-    # i.e. payload, and construct proper in-memory BER encoded
-    # sequence.
-
-        set rest [read $sock $length]
-        set data [binary format aa*a$length $tag [asnLength $length] $rest]
-    }  else {
-    # Generate an error message if the data is not a sequence as
-    # we expected.
-
-        set tag_hex ""
-        binary scan $tag H2 tag_hex
-        return -code error "unknown start tag [string length $tag] $tag_hex"
-    }
-}
-
-#-----------------------------------------------------------------------------
-# asnGetByte : Retrieve a single byte from the data (unsigned)
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetByte {data_var byte_var} {
-    upvar $data_var data $byte_var byte
-    
-    binary scan [string index $data 0] c byte
-    set byte [expr {($byte + 0x100) % 0x100}]  
-    set data [string range $data 1 end]
-
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnPeekByte : Retrieve a single byte from the data (unsigned) 
-#               without removing it.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnPeekByte {data_var byte_var {offset 0}} {
-    upvar 1 $data_var data $byte_var byte
-    
-    binary scan [string index $data $offset] c byte
-    set byte [expr {($byte + 0x100) % 0x100}]  
-
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnRetag: Remove an explicit tag with the real newTag
-#
-#-----------------------------------------------------------------------------
-proc ::asn::asnRetag {data_var newTag} {
-    upvar 1 $data_var data 
-    set tag ""
-    set type ""
-    set len [asnPeekTag data tag type dummy]	
-    asnGetBytes data $len tagbytes
-    set data [binary format c* $newTag]$data
-}
-
-#-----------------------------------------------------------------------------
-# asnGetBytes : Retrieve a block of 'length' bytes from the data.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetBytes {data_var length bytes_var} {
-    upvar 1 $data_var data  $bytes_var bytes
-
-    incr length -1
-    set bytes [string range $data 0 $length]
-    incr length
-    set data [string range $data $length end]
-
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnPeekTag : Decode the tag value
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnPeekTag {data_var tag_var tagtype_var constr_var} {
-    upvar 1 $data_var data $tag_var tag $tagtype_var tagtype $constr_var constr
-    
-    set type 0	
-    set offset 0
-    asnPeekByte data type $offset
-    # check if we have a simple tag, < 31, which fits in one byte
-     
-    set tval [expr {$type & 0x1f}]
-    if {$tval == 0x1f} {
-	# long tag, max 64-bit with Tcl 8.4, unlimited with 8.5 bignum
-	asnPeekByte data tagbyte [incr offset]
-	set tval [expr {wide($tagbyte & 0x7f)}]
-	while {($tagbyte & 0x80)} {
-	    asnPeekByte data tagbyte [incr offset] 
-	    set tval [expr {($tval << 7) + ($tagbyte & 0x7f)}]
-	}
-    } 
-
-    set tagtype [lindex {UNIVERSAL APPLICATION CONTEXT PRIVATE} \
-	[expr {($type & 0xc0) >>6}]]
-    set tag $tval
-    set constr [expr {($type & 0x20) > 0}]
-
-    return [incr offset]	
-}
-
-#-----------------------------------------------------------------------------
-# asnTag : Build a tag value
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnTag {tagnumber {class UNIVERSAL} {tagstyle P}} {
-    set first 0
-    if {$tagnumber < 31} {
-	# encode everything in one byte
-	set first $tagnumber	
-	set bytes [list]
-    } else {
-	# multi-byte tag
-	set first 31
-	set bytes [list [expr {$tagnumber & 0x7f}]]
-	set tagnumber [expr {$tagnumber >> 7}]
-	while {$tagnumber > 0} {
-	    lappend bytes [expr {($tagnumber & 0x7f)+0x80}]
-	    set tagnumber [expr {$tagnumber >>7}]	
-	}
-
-    }
-    
-    if {$tagstyle eq "C" || $tagstyle == 1 } {incr first 32}
-    switch -glob -- $class {
-	U* {		    ;# UNIVERSAL } 
-	A* { incr first 64  ;# APPLICATION }
-	C* { incr first 128 ;# CONTEXT }
-	P* { incr first 192 ;# PRIVATE }
-	default {
-	    return -code error "Unknown tag class \"$class\""
-	}	
-    }
-    if {[llength $bytes] > 0} {
-	# long tag
-	set rbytes [list]
-	for {set i [expr {[llength $bytes]-1}]} {$i >= 0} {incr i -1} {
-	    lappend rbytes [lindex $bytes $i]
-	}
-	return [binary format cc* $first $rbytes ]
-    } 
-    return [binary format c $first]
-}
-
-#-----------------------------------------------------------------------------
-# asnGetLength : Decode an ASN length value (See notes)
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetLength {data_var length_var} {
-    upvar 1 $data_var data  $length_var length
-
-    asnGetByte data length
-    if {$length == 0x080} {
-        return -code error "Indefinite length BER encoding not yet supported"
-    }
-    if {$length > 0x080} {
-    # The retrieved byte is a prefix value, and the integer in the
-    # lower nibble tells us how many bytes were used to encode the
-    # length data following immediately after this prefix.
-
-        set len_length [expr {$length & 0x7f}]
-        
-        if {[string length $data] < $len_length} {
-            return -code error \
-		"length information invalid, not enough octets left" 
-        }
-        
-        asnGetBytes data $len_length lengthBytes
-
-        switch $len_length {
-            1 {
-        # Efficiently coded data will not go through this
-        # path, as small length values can be coded directly,
-        # without a prefix.
-
-            binary scan $lengthBytes     c length 
-            set length [expr {($length + 0x100) % 0x100}]
-            }
-            2 { binary scan $lengthBytes     S length 
-            set length [expr {($length + 0x10000) % 0x10000}]
-            }
-            3 { binary scan \x00$lengthBytes I length 
-            set length [expr {($length + 0x1000000) % 0x1000000}]
-            }
-            4 { binary scan $lengthBytes     I length 
-            set length [expr {(wide($length) + 0x100000000) % 0x100000000}]
-            }
-            default {                
-                binary scan $lengthBytes H* hexstr
-                # skip leading zeros which are allowed by BER
-                set hexlen [string trimleft $hexstr 0] 
-                # check if it fits into a 64-bit signed integer
-                if {[string length $hexlen] > 16} {
-                    return -code error -errorcode {ARITH IOVERFLOW 
-                            {Length value too large for normal use, try asnGetBigLength}} \
-			    "Length value to large"
-                } elseif {  [string length $hexlen] == 16 \
-			&& ([string index $hexlen 0] & 0x8)} { 
-                    # check most significant bit, if set we need bignum
-                    return -code error -errorcode {ARITH IOVERFLOW 
-                            {Length value too large for normal use, try asnGetBigLength}} \
-			    "Length value to large"
-                } else {
-                    scan $hexstr "%lx" length
-                }
-            }
-        }
-    }
-    return
-}
-
-
-#-----------------------------------------------------------------------------
-# asnGetBigLength : Retrieve a length that can not be represented in 63-bit
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetBigLength {data_var biglength_var} {
-
-    # Does any real world code really need this? 
-    # If we encounter this, we are doomed to fail anyway, 
-    # (there would be an Exabyte inside the data_var, )
-    #
-    # So i implement it just for completness.
-    # 
-    package require math::bignum
-    
-    upvar 1 $data_var data  $biglength_var length
-
-    asnGetByte data length
-    if {$length == 0x080} {
-        return -code error "Indefinite length BER encoding not yet supported"
-    }
-    if {$length > 0x080} {
-    # The retrieved byte is a prefix value, and the integer in the
-    # lower nibble tells us how many bytes were used to encode the
-    # length data following immediately after this prefix.
-
-        set len_length [expr {$length & 0x7f}]
-        
-        if {[string length $data] < $len_length} {
-            return -code error \
-		"length information invalid, not enough octets left" 
-        }
-        
-        asnGetBytes data $len_length lengthBytes
-        binary scan $lengthBytes H* hexlen
-        set length [math::bignum::fromstr $hexlen 16]
-    }
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetInteger : Retrieve integer.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetInteger {data_var int_var} {
-    # Tag is 0x02. 
-
-    upvar 1 $data_var data $int_var int
-
-    asnGetByte   data tag
-
-    if {$tag != 0x02} {
-        return -code error \
-            [format "Expected Integer (0x02), but got %02x" $tag]
-    }
-
-    asnGetLength data len
-    asnGetBytes  data $len integerBytes
-
-    set int ?
-
-    switch $len {
-        1 { binary scan $integerBytes     c int }
-        2 { binary scan $integerBytes     S int }
-        3 { 
-            # check for negative int and pad 
-            scan [string index $integerBytes 0] %c byte
-            if {$byte & 128} {
-                binary scan \xff$integerBytes I int
-            } else {
-                binary scan \x00$integerBytes I int 
-            }
-          }
-        4 { binary scan $integerBytes     I int }
-        5 -
-        6 -
-        7 -
-        8 {
-            # check for negative int and pad
-            scan [string index $integerBytes 0] %c byte
-            if {$byte & 128} {
-                set pad [string repeat \xff [expr {8-$len}]]
-            } else {
-                set pad [string repeat \x00 [expr {8-$len}]]
-            }
-            binary scan $pad$integerBytes W int 
-        }
-        default {
-        # Too long, or prefix coding was used.
-            return -code error "length information too long"
-        }
-    }
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetBigInteger : Retrieve a big integer.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetBigInteger {data_var bignum_var} {
-    # require math::bignum only if it is used
-    package require math::bignum
-
-    # Tag is 0x02. We expect that the length of the integer is coded with
-    # maximal efficiency, i.e. without a prefix 0x81 prefix. If a prefix
-    # is used this decoder will fail.
-
-    upvar 1 $data_var data $bignum_var bignum
-
-    asnGetByte   data tag
-
-    if {$tag != 0x02} {
-        return -code error \
-            [format "Expected Integer (0x02), but got %02x" $tag]
-    }
-
-    asnGetLength data len
-    asnGetBytes  data $len integerBytes
-    
-    binary scan $integerBytes H* hex
-    set bignum [math::bignum::fromstr $hex 16]
-    set bits [math::bignum::bits $bignum]
-    set exp [math::bignum::pow \
-		[math::bignum::fromstr 2] \
-		[math::bignum::fromstr $bits]]
-    set big [math::bignum::sub $bignum $exp]
-    set bignum $big
-    
-    return    
-}
-
-
-
-#-----------------------------------------------------------------------------
-# asnGetEnumeration : Retrieve an enumeration id
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetEnumeration {data_var enum_var} {
-    # This is like 'asnGetInteger', except for a different tag.
-
-    upvar 1 $data_var data $enum_var enum
-
-    asnGetByte   data tag
-
-    if {$tag != 0x0a} {
-        return -code error \
-            [format "Expected Enumeration (0x0a), but got %02x" $tag]
-    }
-
-    asnGetLength data len
-    asnGetBytes  data $len integerBytes
-    set enum ?
-
-    switch $len {
-        1 { binary scan $integerBytes     c enum }
-        2 { binary scan $integerBytes     S enum }
-        3 { binary scan \x00$integerBytes I enum }
-        4 { binary scan $integerBytes     I enum }
-        default {
-            return -code error "length information too long"
-        }
-    }
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetOctetString : Retrieve arbitrary string.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetOctetString {data_var string_var} {
-    # Here we need the full decoder for length data.
-
-    upvar 1 $data_var data $string_var string
-    
-    asnGetByte data tag
-    if {$tag != 0x04} { 
-        return -code error \
-            [format "Expected Octet String (0x04), but got %02x" $tag]
-    }
-    asnGetLength data length
-    asnGetBytes  data $length temp
-    set string $temp
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetSequence : Retrieve Sequence data for further decoding.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetSequence {data_var sequence_var} {
-    # Here we need the full decoder for length data.
-
-    upvar 1 $data_var data $sequence_var sequence
-
-    asnGetByte data tag
-    if {$tag != 0x030} { 
-        return -code error \
-            [format "Expected Sequence (0x30), but got %02x" $tag]
-    }    
-    asnGetLength data length
-    asnGetBytes  data $length temp
-    set sequence $temp
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetSet : Retrieve Set data for further decoding.
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetSet {data_var set_var} {
-    # Here we need the full decoder for length data.
-
-    upvar 1 $data_var data $set_var set
-
-    asnGetByte data tag
-    if {$tag != 0x031} { 
-        return -code error \
-            [format "Expected Set (0x31), but got %02x" $tag]
-    }    
-    asnGetLength data length
-    asnGetBytes  data $length temp
-    set set $temp
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetApplication
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetApplication {data_var appNumber_var {content_var {}} {encodingType_var {}} } {
-    upvar 1 $data_var data $appNumber_var appNumber
-
-    asnGetByte   data tag
-    asnGetLength data length
-
-    if {($tag & 0xC0) != 0x40} {
-        return -code error \
-            [format "Expected Application, but got %02x" $tag]
-    }    
-    if {$encodingType_var != {}} {
-	upvar 1 $encodingType_var encodingType
-	set encodingType [expr {($tag & 0x20) > 0}]
-    }
-    set appNumber [expr {$tag & 0x1F}]
-	if {[string length $content_var]} {
-		upvar 1 $content_var content
-		asnGetBytes data $length content
-	}	
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetBoolean: decode a boolean value
-#-----------------------------------------------------------------------------
-
-proc asn::asnGetBoolean {data_var bool_var} {
-    upvar 1 $data_var data $bool_var bool
-
-    asnGetByte data tag
-    if {$tag != 0x01} {
-        return -code error \
-            [format "Expected Boolean (0x01), but got %02x" $tag]
-    }
-
-    asnGetLength data length
-    asnGetByte data byte
-    set bool [expr {$byte == 0 ? 0 : 1}]    
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetUTCTime: Extract an UTC Time string from the data. Returns a string
-#                representing an UTC Time.
-#
-#-----------------------------------------------------------------------------
-
-proc asn::asnGetUTCTime {data_var utc_var} {
-    upvar 1 $data_var data $utc_var utc
-
-    asnGetByte data tag
-    if {$tag != 0x17} {
-        return -code error \
-            [format "Expected UTCTime (0x17), but got %02x" $tag]
-    }
-
-    asnGetLength data length
-    asnGetBytes data $length bytes
-    
-    # this should be ascii, make it explicit
-    set bytes [encoding convertfrom ascii $bytes]
-    binary scan $bytes a* utc
-    
-    return
-}
-
-
-#-----------------------------------------------------------------------------
-# asnGetBitString: Extract a Bit String value (a string of 0/1s) from the
-#                  ASN.1 data.
-#
-#-----------------------------------------------------------------------------
-
-proc asn::asnGetBitString {data_var bitstring_var} {
-    upvar 1 $data_var data $bitstring_var bitstring
-
-    asnGetByte data tag
-    if {$tag != 0x03} {
-        return -code error \
-            [format "Expected Bit String (0x03), but got %02x" $tag]
-    }
-    
-    asnGetLength data length
-    # get the number of padding bits used at the end
-    asnGetByte data padding
-    incr length -1
-    asnGetBytes data $length bytes
-    binary scan $bytes B* bits
-    
-    # cut off the padding bits
-    set bits [string range $bits 0 end-$padding]
-    set bitstring $bits
-}
-
-#-----------------------------------------------------------------------------
-# asnGetObjectIdentifier: Decode an ASN.1 Object Identifier (OID) into
-#                         a Tcl list of integers.
-#-----------------------------------------------------------------------------
-
-proc asn::asnGetObjectIdentifier {data_var oid_var} {
-      upvar 1 $data_var data $oid_var oid
-
-      asnGetByte data tag
-      if {$tag != 0x06} {
-        return -code error \
-            [format "Expected Object Identifier (0x06), but got %02x" $tag]  
-      }
-      asnGetLength data length
-      
-      # the first byte encodes the OID parts in position 0 and 1
-      asnGetByte data val
-      set oid [expr {$val / 40}]
-      lappend oid [expr {$val % 40}]
-      incr length -1
-      
-      # the next bytes encode the remaining parts of the OID
-      set bytes [list]
-      set incomplete 0
-      while {$length} {
-        asnGetByte data octet
-        incr length -1
-        if {$octet < 128} {
-            set oidval $octet
-            set mult 128
-            foreach byte $bytes {
-                if {$byte != {}} {
-                incr oidval [expr {$mult*$byte}]    
-                set mult [expr {$mult*128}]
-                }
-            }
-            lappend oid $oidval
-            set bytes [list]
-            set incomplete 0
-        } else {
-            set byte [expr {$octet-128}]
-            set bytes [concat [list $byte] $bytes]
-            set incomplete 1
-        }                      
-      }
-      if {$incomplete} {
-        return -code error "OID Data is incomplete, not enough octets."
-      }
-      return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetContext: Decode an explicit context tag 
-#
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetContext {data_var contextNumber_var {content_var {}} {encodingType_var {}}} {
-    upvar 1 $data_var data $contextNumber_var contextNumber 
-    
-    asnGetByte   data tag
-    asnGetLength data length
-
-    if {($tag & 0xC0) != 0x80} {
-        return -code error \
-            [format "Expected Context, but got %02x" $tag]
-    }    
-    if {$encodingType_var != {}} { 
-	upvar 1 $encodingType_var encodingType 
-	set encodingType [expr {($tag & 0x20) > 0}]
-    }
-    set contextNumber [expr {$tag & 0x1F}]
-	if {[string length $content_var]} {
-		upvar 1 $content_var content
-		asnGetBytes data $length content
-	}	
-    return
-}
-
-
-#-----------------------------------------------------------------------------
-# asnGetNumericString: Decode a Numeric String from the data
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetNumericString {data_var print_var} {
-    upvar 1 $data_var data $print_var print
-
-    asnGetByte data tag
-    if {$tag != 0x12} {
-        return -code error \
-            [format "Expected Numeric String (0x12), but got %02x" $tag]  
-    }
-    asnGetLength data length 
-    asnGetBytes data $length string
-    set print [encoding convertfrom ascii $string]
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetPrintableString: Decode a Printable String from the data
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetPrintableString {data_var print_var} {
-    upvar 1 $data_var data $print_var print
-
-    asnGetByte data tag
-    if {$tag != 0x13} {
-        return -code error \
-            [format "Expected Printable String (0x13), but got %02x" $tag]  
-    }
-    asnGetLength data length 
-    asnGetBytes data $length string
-    set print [encoding convertfrom ascii $string]
-    return
-}
-
-#-----------------------------------------------------------------------------
-# asnGetIA5String: Decode a IA5(ASCII) String from the data
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetIA5String {data_var print_var} {
-    upvar 1 $data_var data $print_var print
-
-    asnGetByte data tag
-    if {$tag != 0x16} {
-        return -code error \
-            [format "Expected IA5 String (0x16), but got %02x" $tag]  
-    }
-    asnGetLength data length 
-    asnGetBytes data $length string
-    set print [encoding convertfrom ascii $string]
-    return
-}
-#------------------------------------------------------------------------
-# asnGetBMPString: Decode Basic Multiningval (UCS2 string) from data
-#------------------------------------------------------------------------
-proc asn::asnGetBMPString {data_var print_var} {
-    upvar 1 $data_var data $print_var print
-    asnGetByte data tag
-    if {$tag != 0x1e} {
-        return -code error \
-            [format "Expected BMP String (0x1e), but got %02x" $tag]  
-    }
-    asnGetLength data length 
-	asnGetBytes data $length string
-	if {$::tcl_platform(byteOrder) eq "littleEndian"} {
-		set str2 ""
-		foreach {hi lo} [split $string ""] {
-			append str2 $lo $hi
-		}
-	} else {
-		set str2 $string
-	}
-	set print [encoding convertfrom unicode $str2]
-	return
-}	
-#------------------------------------------------------------------------
-# asnGetUTF8String: Decode UTF8 string from data
-#------------------------------------------------------------------------
-proc asn::asnGetUTF8String {data_var print_var} {
-    upvar 1 $data_var data $print_var print
-    asnGetByte data tag
-    if {$tag != 0x0c} {
-        return -code error \
-            [format "Expected UTF8 String (0x0c), but got %02x" $tag]  
-    }
-    asnGetLength data length 
-	asnGetBytes data $length string
-	#there should be some error checking to see if input is
-	#properly-formatted utf8
-	set print [encoding convertfrom utf-8 $string]
-	
-	return
-}	
-#-----------------------------------------------------------------------------
-# asnGetNull: decode a NULL value
-#-----------------------------------------------------------------------------
-
-proc ::asn::asnGetNull {data_var} {
-    upvar 1 $data_var data 
-
-    asnGetByte data tag
-    if {$tag != 0x05} {
-        return -code error \
-            [format "Expected NULL (0x05), but got %02x" $tag]
-    }
-
-    asnGetLength data length
-    asnGetBytes data $length bytes
-    
-    # we do not check the null data, all bytes must be 0x00
-    
-    return
-}
-
-#----------------------------------------------------------------------------
-# MultiType string routines
-#----------------------------------------------------------------------------
-
-namespace eval asn {
-	variable stringTypes
-	array set stringTypes {
-		12 NumericString 
-		13 PrintableString 
-		16 IA5String 
-		1e BMPString 
-		0c UTF8String 
-		14 T61String
-		15 VideotexString
-		1a VisibleString
-		1b GeneralString
-		1c UniversalString
-	}	
-	variable defaultStringType UTF8
-}	
-#---------------------------------------------------------------------------
-# asnGetString - get readable string automatically detecting its type
-#---------------------------------------------------------------------------
-proc ::asn::asnGetString {data_var print_var {type_var {}}} {
-	variable stringTypes
-	upvar 1 $data_var data $print_var print
-	asnPeekByte data tag
-	set tag [format %02x $tag]
-	if {![info exists stringTypes($tag)]} {
-		return -code error "Expected one of string types, but got $tag"
-	}
-	asnGet$stringTypes($tag) data print
-	if {[string length $type_var]} {
-		upvar $type_var type
-		set type $stringTypes($tag)
-	}	
-}
-#---------------------------------------------------------------------
-# defaultStringType - set or query default type for unrestricted strings
-#---------------------------------------------------------------------
-proc ::asn::defaultStringType {{type {}}} {
-	variable defaultStringType
-	if {![string length $type]} {
-		return $defaultStringType
-	}
-	if {$type ne "BMP" && $type ne "UTF8"} {
-		return -code error "Invalid default string type. Should be one of BMP, UTF8"
-	}
-	set defaultStringType $type
-	return
-}	
-
-#---------------------------------------------------------------------------
-# asnString - encode readable string into most restricted type possible
-#---------------------------------------------------------------------------
-
-proc ::asn::asnString {string} {
-	variable nonPrintableChars
-	variable nonNumericChars
-	if {[string length $string]!=[string bytelength $string]} {
-	# There are non-ascii character
-		variable defaultStringType
-		return [asn${defaultStringType}String $string]
-	} elseif {![regexp $nonNumericChars $string]} {
-		return [asnNumericString $string]
-	} elseif {![regexp $nonPrintableChars $string]} {
-		return [asnPrintableString $string]
-	} else {
-		return [asnIA5String $string]
-	}	
-}
-
-#-----------------------------------------------------------------------------
-package provide asn 0.8.1
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/asn/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/asn/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded asn 0.8.1 [list source [file join $dir asn.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,182 +1,0 @@
-# -*- tcl -*-
-# This code is hereby put into the public domain.
-# ### ### ### ######### ######### #########
-## Overview
-# Base32 encoding and decoding of small strings.
-#
-# Management code for switching between Tcl and C accelerated
-# implementations.
-#
-# RCS: @(#) $Id: base32.tcl,v 1.2 2006/10/13 05:39:49 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: base32_c.tcl
-
-package require Tcl 8.4
-
-namespace eval ::base32 {}
-
-# ### ### ### ######### ######### #########
-## Management of base32 std implementations.
-
-# ::base32::LoadAccelerator --
-#
-#	Loads a named implementation, if possible.
-#
-# Arguments:
-#	key	Name of the implementation to load.
-#
-# Results:
-#	A boolean flag. True if the implementation
-#	was successfully loaded; and False otherwise.
-
-proc ::base32::LoadAccelerator {key} {
-    variable accel
-    set isok 0
-    switch -exact -- $key {
-	critcl {
-	    # Critcl implementation of base32 requires Tcl 8.4.
-	    if {![package vsatisfies [package provide Tcl] 8.4]} {return 0}
-	    if {[catch {package require tcllibc}]} {return 0}
-	    set isok [llength [info commands ::base32::critcl_encode]]
-	}
-	tcl {
-	    variable selfdir
-	    if {[catch {source [file join $selfdir base32_tcl.tcl]}]} {return 0}
-	    set isok [llength [info commands ::base32::tcl_encode]]
-	}
-        default {
-            return -code error "invalid accelerator $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($key) $isok
-    return $isok
-}
-
-# ::base32::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::base32::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-	foreach c {encode decode} {
-	    rename ::base32::$c ::base32::${loaded}_$c
-	}
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-	foreach c {encode decode} {
-	    rename ::base32::${key}_$c ::base32::$c
-	}
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# ::base32::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::base32::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::base32::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::base32::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-proc ::base32::Names {} {
-    return {
-	critcl {tcllibc based}
-	tcl    {pure Tcl}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Data structures.
-
-namespace eval ::base32 {
-    variable  selfdir [file dirname [info script]]
-    variable  loaded  {}
-
-    variable  accel
-    array set accel   {tcl 0 critcl 0}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Choose an implementation,
-## most prefered first. Loads only one of the
-## possible implementations. And activates it.
-
-namespace eval ::base32 {
-    variable e
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-
-    namespace export encode decode
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide base32 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32_c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32_c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,253 +1,0 @@
-# base32c.tcl --
-#
-#       Implementation of a base32 (std) de/encoder for Tcl.
-#
-# Public domain
-#
-# RCS: @(#) $Id: base32_c.tcl,v 1.2 2006/05/28 04:29:09 andreas_kupries Exp $
-
-package require critcl
-package require Tcl 8.4
-
-namespace eval ::base32 {
-    # Supporting code for the main command.
-    catch {
-	critcl::cheaders -g
-	critcl::debug memory symbols
-    }
-
-    # Main commands, encoder & decoder
-
-    critcl::ccommand critcl_encode {dummy interp objc objv} {
-      /* Syntax -*- c -*-
-       * critcl_encode string
-       */
-
-      unsigned char* buf;
-      int           nbuf;
-
-      unsigned char* out;
-      unsigned char* at;
-      int           nout;
-
-      /*
-       * The array used for encoding
-       */                     /* 123456789 123456789 123456789 12 */
-      static const char map[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
-
-#define USAGEE "bitstring"
-
-      if (objc != 2) {
-        Tcl_WrongNumArgs (interp, 1, objv, USAGEE);
-        return TCL_ERROR;
-      }
-
-      buf  = Tcl_GetByteArrayFromObj (objv[1], &nbuf);
-      nout = ((nbuf+4)/5)*8;
-      out  = (unsigned char*) Tcl_Alloc (nout*sizeof(char));
-
-      for (at = out; nbuf >= 5; nbuf -= 5, buf += 5) {
-	*(at++) = map [         (buf[0]>>3)                ];
-	*(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	*(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	*(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	*(at++) = map [ 0x1f & ((buf[2]<<1) | (buf[3]>>7)) ];
-	*(at++) = map [ 0x1f &  (buf[3]>>2)                ];
-	*(at++) = map [ 0x1f & ((buf[3]<<3) | (buf[4]>>5)) ];
-	*(at++) = map [ 0x1f &  (buf[4])                   ];
-      }
-      if (nbuf > 0) {
-	/* Process partials at end. */
-	switch (nbuf) {
-	case 1:
-	  /* |01234567|		 2, padding 6
-	   *  xxxxx
-	   *       xxx 00
-	   */
-
-	  *(at++) = map [        (buf[0]>>3) ];
-	  *(at++) = map [ 0x1f & (buf[0]<<2) ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 2: /* x3/=4 */
-	  /* |01234567|01234567|	 4, padding 4
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x 0000
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f &  (buf[1]<<4)                ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 3:
-	  /* |01234567|01234567|01234567|	 5, padding 3
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x xxxx
-	   *                        xxxx 0
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	  *(at++) = map [ 0x1f &  (buf[2]<<1)                ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 4:
-	  /* |01234567|01234567|01234567|012334567|	 7, padding 1
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x xxxx
-	   *                        xxxx
-	   *                             xxxxx
-	   *                                  xxxx 0
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	  *(at++) = map [ 0x1f & ((buf[2]<<1) | (buf[3]>>7)) ];
-	  *(at++) = map [ 0x1f &  (buf[3]>>2)                ];
-	  *(at++) = map [ 0x1f &  (buf[3]<<3)                ];
-	  *(at++) = '=';
-	  break;
-	}
-      }
-
-      Tcl_SetObjResult (interp, Tcl_NewStringObj (out, nout));
-      Tcl_Free ((char*) out);
-      return TCL_OK;
-    }
-
-
-    critcl::ccommand critcl_decode {dummy interp objc objv} {
-      /* Syntax -*- c -*-
-       * critcl_decode estring
-       */
-
-      unsigned char* buf;
-      int           nbuf;
-
-      unsigned char* out;
-      unsigned char* at;
-      unsigned char  x [8];
-      int           nout;
-
-      int i, j, a, pad, nx;
-
-      /*
-       * An array for translating single base-32 characters into a value.
-       * Disallowed input characters have a value of 64.  Upper and lower
-       * case is the same. Only 128 chars, as everything above char(127)
-       * is 64.
-       */
-      static const char map [] = {
-	/* \00 */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* DLE */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* SPC */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* '0' */ 64, 64, 26, 27, 28, 29, 30, 31,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* '@' */ 64,  0,  1,  2,  3,  4,  5,  6,   7,  8,  9, 10, 11, 12, 13, 14,
-	/* 'P' */ 15, 16, 17, 18, 19, 20, 21, 22,  23, 24, 25, 64, 64, 64, 64, 64,
-	/* '`' */ 64,  0,  1,  2,  3,  4,  5,  6,   7,  8,  9, 10, 11, 12, 13, 14,
-	/* 'p' */ 15, 16, 17, 18, 19, 20, 21, 22,  23, 24, 25, 64, 64, 64, 64, 64
-      };
-
-#define USAGED "estring"
-
-      if (objc != 2) {
-        Tcl_WrongNumArgs (interp, 1, objv, USAGED);
-        return TCL_ERROR;
-      }
-
-      buf = Tcl_GetStringFromObj (objv[1], &nbuf);
-
-      if (nbuf % 8) {
-	Tcl_SetObjResult (interp, Tcl_NewStringObj ("Length is not a multiple of 8", -1));
-        return TCL_ERROR;
-      }
-
-      nout = (nbuf/8)*5 *TCL_UTF_MAX;
-      out  = (unsigned char*) Tcl_Alloc (nout*sizeof(char));
-
-#define HIGH(x) (((x) & 0x80) != 0)
-#define BADC(x) ((x) == 64)
-#define BADCHAR(a,j) (HIGH ((a)) || BADC (x [(j)] = map [(a)]))
-
-      for (pad = 0, i=0, at = out; i < nbuf; i += 8, buf += 8){
-	for (j=0; j < 8; j++){
-	  a = buf [j];
-
-	  if (a == '=') {
-	    x[j] = 0;
-	    pad++;
-	    continue;
-	  } else if (pad) {
-	    char     msg [120];
-	    sprintf (msg,
-		     "Invalid character at index %d: \"=\" (padding found in the middle of the input)",
-		     j-1);
-	    Tcl_Free ((char*) out);
-	    Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	    return TCL_ERROR;
-	  }
-
-	  if (BADCHAR (a,j)) {
-	    char     msg [100];
-	    sprintf (msg,"Invalid character at index %d: \"%c\"",j,a);
-	    Tcl_Free ((char*) out);
-	    Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	    return TCL_ERROR;
-	  }
-	}
-
-	*(at++) = (x[0]<<3) | (x[1]>>2)            ;
-	*(at++) = (x[1]<<6) | (x[2]<<1) | (x[3]>>4);
-	*(at++) = (x[3]<<4) | (x[4]>>1)            ;
-	*(at++) = (x[4]<<7) | (x[5]<<2) | (x[6]>>3);
-	*(at++) = (x[6]<<5) | x[7]                 ;
-      }
-
-      if (pad) {
-	if (pad == 1) {
-	  at -= 1;
-	} else if (pad == 3) {
-	  at -= 2;
-	} else if (pad == 4) {
-	  at -= 3;
-	} else if (pad == 6) {
-	  at -= 4;
-	} else {
-	  char     msg [100];
-	  sprintf (msg,"Invalid padding of length %d",pad);
-	  Tcl_Free ((char*) out);
-	  Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	  return TCL_ERROR;
-	}
-      }
-
-      Tcl_SetObjResult (interp, Tcl_NewByteArrayObj (out, at-out));
-      Tcl_Free ((char*) out);
-      return TCL_OK;
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,73 +1,0 @@
-# -*- tcl -*-
-# This code is hereby put into the public domain.
-# ### ### ### ######### ######### #########
-## Overview
-# Base32 encoding and decoding of small strings.
-
-# ### ### ### ######### ######### #########
-## Notes
-
-# A binary string is split into groups of 5 bits (2^5 == 32), and each
-# group is converted into a printable character as is specified in RFC
-# 3548.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require  base32::core
-namespace eval ::base32 {}
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-proc ::base32::tcl_encode {bitstring} {
-    variable forward
-
-    binary scan $bitstring B* bits
-    set len [string length $bits]
-    set rem [expr {$len % 5}]
-    if {$rem} {append bits =/$rem}
-    #puts "($bitstring) => <$bits>"
-
-    return [string map $forward $bits]
-}
-
-proc ::base32::tcl_decode {estring} {
-    variable backward
-    variable invalid
-
-    if {![core::valid $estring $invalid msg]} {
-	return -code error $msg
-    }
-    #puts "I<$estring>"
-    #puts "M<[string map $backward $estring]>"
-
-    return [binary format B* [string map $backward [string toupper $estring]]]
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::base32 {
-    # Initialize the maps
-    variable forward
-    variable backward
-    variable invalid
-
-    core::define {
-	0 A    9 J   18 S   27 3
-	1 B   10 K   19 T   28 4
-	2 C   11 L   20 U   29 5
-	3 D   12 M   21 V   30 6
-	4 E   13 N   22 W   31 7
-	5 F   14 O   23 X
-	6 G   15 P   24 Y
-	7 H   16 Q   25 Z
-	8 I   17 R   26 2
-    } forward backward invalid ; # {}
-    # puts ///$forward///
-    # puts ///$backward///
-}
-
-# ### ### ### ######### ######### #########
-## Ok
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32core.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32core.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,134 +1,0 @@
-# -*- tcl -*-
-# This code is hereby put into the public domain.
-# ### ### ### ######### ######### #########
-#= Overview
-
-# Fundamental handling of base32 conversion tables. Expansion of a
-# basic mapping into a full mapping and its inverse mapping.
-
-# ### ### ### ######### ######### #########
-#= Requisites
-
-namespace eval ::base32::core {}
-
-# ### ### ### ######### ######### #########
-#= API & Implementation
-
-proc ::base32::core::define {map fv bv iv} {
-    variable bits
-    upvar 1 $fv forward $bv backward $iv invalid
-
-    # bytes - bits - padding  - tail       | bits - padding  - tail
-    # 0     -  0   - ""       - "xxxxxxxx" | 0    - ""       - ""
-    # 1     -  8   - "======" - "xx======" | 3    - "======" - "x======"
-    # 2     - 16   - "===="   - "xxxx====" | 1    - "===="   - "x===="
-    # 3     - 24   - "==="    - "xxxxx===" | 4    - "==="    - "x==="
-    # 4     - 32   - "="      - "xxxxxxx=" | 2    - "="      - "x="
-
-    array set _ $bits
-
-    set invalid  "\[^="
-    set forward  {}
-    set btmp     {}
-
-    foreach {code char} $map {
-	set b $_($code)
-
-	append invalid [string tolower $char][string toupper $char]
-
-	# 5 bit remainder
-	lappend forward    $b $char
-	lappend btmp [list $char $b]
-
-	# 4 bit remainder
-	if {$code%2} continue
-	set b [string range $b 0 end-1]
-	lappend forward    ${b}=/4    ${char}===
-	lappend btmp [list ${char}=== $b]
-
-	# 3 bit remainder
-	if {$code%4} continue
-	set b [string range $b 0 end-1]
-	lappend forward    ${b}=/3       ${char}======
-	lappend btmp [list ${char}====== $b]
-
-	# 2 bit remainder
-	if {$code%8} continue
-	set b [string range $b 0 end-1]
-	lappend forward    ${b}=/2  ${char}=
-	lappend btmp [list ${char}= $b]
-
-	# 1 bit remainder
-	if {$code%16} continue
-	set b [string range $b 0 end-1]
-	lappend forward    ${b}=/1     ${char}====
-	lappend btmp [list ${char}==== $b]
-    }
-
-    set backward {}
-    foreach item [lsort -index 0 -decreasing $btmp] {
-	foreach {c b} $item break
-	lappend backward $c $b
-    }
-
-    append invalid "\]"
-    return
-}
-
-proc ::base32::core::valid {estring pattern mv} {
-    upvar 1 $mv message
-
-    if {[string length $estring] % 8} {
-	set message "Length is not a multiple of 8"
-	return 0
-    } elseif {[regexp -indices $pattern $estring where]} {
-	foreach {s e} $where break
-	set message "Invalid character at index $s: \"[string index $estring $s]\""
-	return 0
-    } elseif {[regexp {(=+)$} $estring -> pad]} {
-	set padlen [string length $pad]
-	if {
-	    ($padlen != 6) &&
-	    ($padlen != 4) &&
-	    ($padlen != 3) &&
-	    ($padlen != 1)
-	} {
-	    set message "Invalid padding of length $padlen"
-	    return 0
-	}
-    }
-
-    # Remove the brackets and ^= from the pattern, to construct the
-    # class of valid characters which must not follow the padding.
-
-    set badp "=\[[string range $pattern 3 end-1]\]"
-    if {[regexp -indices $badp $estring where]} {
-	foreach {s e} $where break
-	set message "Invalid character at index $s: \"[string index $estring $s]\" (padding found in the middle of the input)"
-	return 0
-    }
-    return 1
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::base32::core {
-    namespace export define valid
-
-    variable bits {
-	 0 00000	 1 00001	 2 00010	 3 00011
-	 4 00100	 5 00101	 6 00110	 7 00111
-	 8 01000	 9 01001	10 01010	11 01011
-	12 01100	13 01101	14 01110	15 01111
-	16 10000	17 10001	18 10010	19 10011
-	20 10100	21 10101	22 10110	23 10111
-	24 11000	25 11001	26 11010	27 11011
-	28 11100	29 11101	30 11110	31 11111
-    }
-}
-
-# ### ### ### ######### ######### #########
-#= Registration
-
-package provide base32::core 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,175 +1,0 @@
-# -*- tcl -*-
-# This code is hereby put into the public domain.
-# ### ### ### ######### ######### #########
-## Overview
-# Base32 encoding and decoding of small strings.
-#
-# Management code for switching between Tcl and C accelerated
-# implementations.
-#
-# RCS: @(#) $Id: base32hex.tcl,v 1.2 2007/03/23 17:31:17 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: base32hex_c.tcl
-
-package require Tcl 8.4
-
-namespace eval ::base32::hex {}
-
-# ### ### ### ######### ######### #########
-## Management of base32 std implementations.
-
-# ::base32::hex::LoadAccelerator --
-#
-#	Loads a named implementation, if possible.
-#
-# Arguments:
-#	key	Name of the implementation to load.
-#
-# Results:
-#	A boolean flag. True if the implementation
-#	was successfully loaded; and False otherwise.
-
-proc ::base32::hex::LoadAccelerator {key} {
-    variable accel
-    set isok 0
-    switch -exact -- $key {
-	critcl {
-	    # Critcl implementation of base32 requires Tcl 8.4.
-	    if {![package vsatisfies [package provide Tcl] 8.4]} {return 0}
-	    if {[catch {package require tcllibc}]} {return 0}
-	    set isok [llength [info commands ::base32::hex::critcl_encode]]
-	}
-	tcl {
-	    variable selfdir
-	    if {[catch {source [file join $selfdir base32hex_tcl.tcl]}]} {return 0}
-	    set isok [llength [info commands ::base32::hex::tcl_encode]]
-	}
-        default {
-            return -code error "invalid accelerator $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($key) $isok
-    return $isok
-}
-
-# ::base32::hex::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::base32::hex::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-	foreach c {encode decode} {
-	    rename ::base32::hex::$c ::base32::hex::${loaded}_$c
-	}
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-	foreach c {encode decode} {
-	    rename ::base32::hex::${key}_$c ::base32::hex::$c
-	}
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# ::base32::hex::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::base32::hex::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::base32::hex::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::base32::hex::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Data structures.
-
-namespace eval ::base32::hex {
-    variable  selfdir [file dirname [info script]]
-    variable  loaded  {}
-
-    variable  accel
-    array set accel   {tcl 0 critcl 0}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Choose an implementation,
-## most prefered first. Loads only one of the
-## possible implementations. And activates it.
-
-namespace eval ::base32::hex {
-    variable e
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-
-    namespace export encode decode
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide base32::hex 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex_c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex_c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,253 +1,0 @@
-# base32hexc.tcl --
-#
-#       Implementation of a base32 (extended hex) de/encoder for Tcl.
-#
-# Public domain
-#
-# RCS: @(#) $Id: base32hex_c.tcl,v 1.2 2006/05/28 04:29:09 andreas_kupries Exp $
-
-package require critcl
-package require Tcl 8.4
-
-namespace eval ::base32::hex {
-    # Supporting code for the main command.
-    catch {
-	critcl::cheaders -g
-	critcl::debug memory symbols
-    }
-
-    # Main commands, encoder & decoder
-
-    critcl::ccommand critcl_encode {dummy interp objc objv} {
-      /* Syntax -*- c -*-
-       * critcl_encode string
-       */
-
-      unsigned char* buf;
-      int           nbuf;
-
-      unsigned char* out;
-      unsigned char* at;
-      int           nout;
-
-      /*
-       * The array used for encoding
-       */                     /* 123456789 123456789 123456789 12 */
-      static const char map[] = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
-
-#define USAGEE "bitstring"
-
-      if (objc != 2) {
-        Tcl_WrongNumArgs (interp, 1, objv, USAGEE);
-        return TCL_ERROR;
-      }
-
-      buf  = Tcl_GetByteArrayFromObj (objv[1], &nbuf);
-      nout = ((nbuf+4)/5)*8;
-      out  = (unsigned char*) Tcl_Alloc (nout*sizeof(char));
-
-      for (at = out; nbuf >= 5; nbuf -= 5, buf += 5) {
-	*(at++) = map [         (buf[0]>>3)                ];
-	*(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	*(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	*(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	*(at++) = map [ 0x1f & ((buf[2]<<1) | (buf[3]>>7)) ];
-	*(at++) = map [ 0x1f &  (buf[3]>>2)                ];
-	*(at++) = map [ 0x1f & ((buf[3]<<3) | (buf[4]>>5)) ];
-	*(at++) = map [ 0x1f &  (buf[4])                   ];
-      }
-      if (nbuf > 0) {
-	/* Process partials at end. */
-	switch (nbuf) {
-	case 1:
-	  /* |01234567|		 2, padding 6
-	   *  xxxxx
-	   *       xxx 00
-	   */
-
-	  *(at++) = map [        (buf[0]>>3) ];
-	  *(at++) = map [ 0x1f & (buf[0]<<2) ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 2: /* x3/=4 */
-	  /* |01234567|01234567|	 4, padding 4
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x 0000
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f &  (buf[1]<<4)                ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 3:
-	  /* |01234567|01234567|01234567|	 5, padding 3
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x xxxx
-	   *                        xxxx 0
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	  *(at++) = map [ 0x1f &  (buf[2]<<1)                ];
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  *(at++) = '=';
-	  break;
-	case 4:
-	  /* |01234567|01234567|01234567|012334567|	 7, padding 1
-	   *  xxxxx
-	   *       xxx xx
-	   *             xxxxx
-	   *                  x xxxx
-	   *                        xxxx
-	   *                             xxxxx
-	   *                                  xxxx 0
-	   */
-
-	  *(at++) = map [         (buf[0]>>3)                ];
-	  *(at++) = map [ 0x1f & ((buf[0]<<2) | (buf[1]>>6)) ];
-	  *(at++) = map [ 0x1f &  (buf[1]>>1)                ];
-	  *(at++) = map [ 0x1f & ((buf[1]<<4) | (buf[2]>>4)) ];
-	  *(at++) = map [ 0x1f & ((buf[2]<<1) | (buf[3]>>7)) ];
-	  *(at++) = map [ 0x1f &  (buf[3]>>2)                ];
-	  *(at++) = map [ 0x1f &  (buf[3]<<3)                ];
-	  *(at++) = '=';
-	  break;
-	}
-      }
-
-      Tcl_SetObjResult (interp, Tcl_NewStringObj (out, nout));
-      Tcl_Free ((char*) out);
-      return TCL_OK;
-    }
-
-
-    critcl::ccommand critcl_decode {dummy interp objc objv} {
-      /* Syntax -*- c -*-
-       * critcl_decode estring
-       */
-
-      unsigned char* buf;
-      int           nbuf;
-
-      unsigned char* out;
-      unsigned char* at;
-      unsigned char  x [8];
-      int           nout;
-
-      int i, j, a, pad, nx;
-
-      /*
-       * An array for translating single base-32 characters into a value.
-       * Disallowed input characters have a value of 64.  Upper and lower
-       * case is the same. Only 128 chars, as everything above char(127)
-       * is 64.
-       */
-      static const char map [] = {
-	/* \00 */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* DLE */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* SPC */ 64, 64, 64, 64, 64, 64, 64, 64,  64, 64, 64, 64, 64, 64, 64, 64, 
-	/* '0' */  0,  1,  2,  3,  4,  5,  6,  7,   8,  9, 64, 64, 64, 64, 64, 64, 
-	/* '@' */ 64, 10, 11, 12, 13, 14, 15, 16,  17, 18, 19, 20, 21, 22, 23, 24,
-	/* 'P' */ 25, 26, 27, 28, 29, 30, 31, 64,  64, 64, 64, 64, 64, 64, 64, 64,
-	/* '`' */ 64, 10, 11, 12, 13, 14, 15, 16,  17, 18, 19, 20, 21, 22, 23, 24,
-	/* 'p' */ 25, 26, 27, 28, 29, 30, 31, 64,  64, 64, 64, 64, 64, 64, 64, 64
-      };
-
-#define USAGED "estring"
-
-      if (objc != 2) {
-        Tcl_WrongNumArgs (interp, 1, objv, USAGED);
-        return TCL_ERROR;
-      }
-
-      buf = Tcl_GetStringFromObj (objv[1], &nbuf);
-
-      if (nbuf % 8) {
-	Tcl_SetObjResult (interp, Tcl_NewStringObj ("Length is not a multiple of 8", -1));
-        return TCL_ERROR;
-      }
-
-      nout = (nbuf/8)*5 *TCL_UTF_MAX;
-      out  = (unsigned char*) Tcl_Alloc (nout*sizeof(char));
-
-#define HIGH(x) (((x) & 0x80) != 0)
-#define BADC(x) ((x) == 64)
-#define BADCHAR(a,j) (HIGH ((a)) || BADC (x [(j)] = map [(a)]))
-
-      for (pad = 0, i=0, at = out; i < nbuf; i += 8, buf += 8){
-	for (j=0; j < 8; j++){
-	  a = buf [j];
-
-	  if (a == '=') {
-	    x[j] = 0;
-	    pad++;
-	    continue;
-	  } else if (pad) {
-	    char     msg [120];
-	    sprintf (msg,
-		     "Invalid character at index %d: \"=\" (padding found in the middle of the input)",
-		     j-1);
-	    Tcl_Free ((char*) out);
-	    Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	    return TCL_ERROR;
-	  }
-
-	  if (BADCHAR (a,j)) {
-	    char     msg [100];
-	    sprintf (msg,"Invalid character at index %d: \"%c\"",j,a);
-	    Tcl_Free ((char*) out);
-	    Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	    return TCL_ERROR;
-	  }
-	}
-
-	*(at++) = (x[0]<<3) | (x[1]>>2)            ;
-	*(at++) = (x[1]<<6) | (x[2]<<1) | (x[3]>>4);
-	*(at++) = (x[3]<<4) | (x[4]>>1)            ;
-	*(at++) = (x[4]<<7) | (x[5]<<2) | (x[6]>>3);
-	*(at++) = (x[6]<<5) | x[7]                 ;
-      }
-
-      if (pad) {
-	if (pad == 1) {
-	  at -= 1;
-	} else if (pad == 3) {
-	  at -= 2;
-	} else if (pad == 4) {
-	  at -= 3;
-	} else if (pad == 6) {
-	  at -= 4;
-	} else {
-	  char     msg [100];
-	  sprintf (msg,"Invalid padding of length %d",pad);
-	  Tcl_Free ((char*) out);
-	  Tcl_SetObjResult (interp, Tcl_NewStringObj (msg, -1));
-	  return TCL_ERROR;
-	}
-      }
-
-      Tcl_SetObjResult (interp, Tcl_NewByteArrayObj (out, at-out));
-      Tcl_Free ((char*) out);
-      return TCL_OK;
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/base32hex_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,79 +1,0 @@
-# -*- tcl -*-
-# This code is hereby put into the public domain.
-# ### ### ### ######### ######### #########
-## Overview
-# Base32 encoding and decoding of small strings.
-
-# ### ### ### ######### ######### #########
-## Notes
-
-# A binary string is split into groups of 5 bits (2^5 == 32), and each
-# group is converted into a printable character as is specified in RFC
-# 3548 for the extended hex encoding.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require  base32::core
-namespace eval ::base32::hex {}
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-proc ::base32::hex::tcl_encode {bitstring} {
-    variable forward
-
-    binary scan $bitstring B* bits
-    set len [string length $bits]
-    set rem [expr {$len % 5}]
-    if {$rem} {append bits =/$rem}
-    #puts "($bitstring) => <$bits>"
-
-    return [string map $forward $bits]
-}
-
-proc ::base32::hex::tcl_decode {estring} {
-    variable backward
-    variable invalid
-
-    if {![core::valid $estring $invalid msg]} {
-	return -code error $msg
-    }
-    #puts "I<$estring>"
-    #puts "M<[string map $backward $estring]>"
-
-    return [binary format B* [string map $backward [string toupper $estring]]]
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::base32::hex {
-    namespace eval core {
-	namespace import ::base32::core::define
-	namespace import ::base32::core::valid
-    }
-
-    namespace export encode decode
-    # Initialize the maps
-    variable forward
-    variable backward
-    variable invalid
-
-    core::define {
-	0 0    9 9        18 I   27 R
-	1 1   10 A        19 J   28 S
-	2 2   11 B        20 K   29 T
-	3 3   12 C        21 L   30 U
-	4 4   13 D        22 M   31 V
-	5 5   14 E        23 N
-	6 6   15 F        24 O
-	7 7        16 G   25 P
-	8 8        17 H   26 Q
-    } forward backward invalid ; # {}
-    # puts ///$forward///
-    # puts ///$backward///
-}
-
-# ### ### ### ######### ######### #########
-## Ok
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base32/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base32/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} return
-package ifneeded base32       0.1 [list source [file join $dir base32.tcl]]
-package ifneeded base32::hex  0.1 [list source [file join $dir base32hex.tcl]]
-package ifneeded base32::core 0.1 [list source [file join $dir base32core.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base64/base64.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base64/base64.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,326 +1,0 @@
-# base64.tcl --
-#
-# Encode/Decode base64 for a string
-# Stephen Uhler / Brent Welch (c) 1997 Sun Microsystems
-# The decoder was done for exmh by Chris Garrigues
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: base64.tcl,v 1.27 2005/12/09 18:27:15 andreas_kupries Exp $
-
-# Version 1.0   implemented Base64_Encode, Base64_Decode
-# Version 2.0   uses the base64 namespace
-# Version 2.1   fixes various decode bugs and adds options to encode
-# Version 2.2   is much faster, Tcl8.0 compatible
-# Version 2.2.1 bugfixes
-# Version 2.2.2 bugfixes
-# Version 2.3   bugfixes and extended to support Trf
-
-# @mdgen EXCLUDE: base64c.tcl
-
-package require Tcl 8.2
-namespace eval ::base64 {
-    namespace export encode decode
-}
-
-if {![catch {package require Trf 2.0}]} {
-    # Trf is available, so implement the functionality provided here
-    # in terms of calls to Trf for speed.
-
-    # ::base64::encode --
-    #
-    #	Base64 encode a given string.
-    #
-    # Arguments:
-    #	args	?-maxlen maxlen? ?-wrapchar wrapchar? string
-    #	
-    #		If maxlen is 0, the output is not wrapped.
-    #
-    # Results:
-    #	A Base64 encoded version of $string, wrapped at $maxlen characters
-    #	by $wrapchar.
-    
-    proc ::base64::encode {args} {
-	# Set the default wrapchar and maximum line length to match the output
-	# of GNU uuencode 4.2.  Various RFCs allow for different wrapping 
-	# characters and wraplengths, so these may be overridden by command line
-	# options.
-	set wrapchar "\n"
-	set maxlen 60
-
-	if { [llength $args] == 0 } {
-	    error "wrong # args: should be \"[lindex [info level 0] 0]\
-		    ?-maxlen maxlen? ?-wrapchar wrapchar? string\""
-	}
-
-	set optionStrings [list "-maxlen" "-wrapchar"]
-	for {set i 0} {$i < [llength $args] - 1} {incr i} {
-	    set arg [lindex $args $i]
-	    set index [lsearch -glob $optionStrings "${arg}*"]
-	    if { $index == -1 } {
-		error "unknown option \"$arg\": must be -maxlen or -wrapchar"
-	    }
-	    incr i
-	    if { $i >= [llength $args] - 1 } {
-		error "value for \"$arg\" missing"
-	    }
-	    set val [lindex $args $i]
-
-	    # The name of the variable to assign the value to is extracted
-	    # from the list of known options, all of which have an
-	    # associated variable of the same name as the option without
-	    # a leading "-". The [string range] command is used to strip
-	    # of the leading "-" from the name of the option.
-	    #
-	    # FRINK: nocheck
-	    set [string range [lindex $optionStrings $index] 1 end] $val
-	}
-    
-	# [string is] requires Tcl8.2; this works with 8.0 too
-	if {[catch {expr {$maxlen % 2}}]} {
-	    error "expected integer but got \"$maxlen\""
-	}
-
-	set string [lindex $args end]
-	set result [::base64 -mode encode -- $string]
-	set result [string map [list \n ""] $result]
-
-	if {$maxlen > 0} {
-	    set res ""
-	    set edge [expr {$maxlen - 1}]
-	    while {[string length $result] > $maxlen} {
-		append res [string range $result 0 $edge]$wrapchar
-		set result [string range $result $maxlen end]
-	    }
-	    if {[string length $result] > 0} {
-		append res $result
-	    }
-	    set result $res
-	}
-
-	return $result
-    }
-
-    # ::base64::decode --
-    #
-    #	Base64 decode a given string.
-    #
-    # Arguments:
-    #	string	The string to decode.  Characters not in the base64
-    #		alphabet are ignored (e.g., newlines)
-    #
-    # Results:
-    #	The decoded value.
-
-    proc ::base64::decode {string} {
-	regsub -all {\s} $string {} string
-	::base64 -mode decode -- $string
-    }
-
-} else {
-    # Without Trf use a pure tcl implementation
-
-    namespace eval base64 {
-	variable base64 {}
-	variable base64_en {}
-
-	# We create the auxiliary array base64_tmp, it will be unset later.
-
-	set i 0
-	foreach char {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
-		a b c d e f g h i j k l m n o p q r s t u v w x y z \
-		0 1 2 3 4 5 6 7 8 9 + /} {
-	    set base64_tmp($char) $i
-	    lappend base64_en $char
-	    incr i
-	}
-
-	#
-	# Create base64 as list: to code for instance C<->3, specify
-	# that [lindex $base64 67] be 3 (C is 67 in ascii); non-coded
-	# ascii chars get a {}. we later use the fact that lindex on a
-	# non-existing index returns {}, and that [expr {} < 0] is true
-	#
-
-	# the last ascii char is 'z'
-	scan z %c len
-	for {set i 0} {$i <= $len} {incr i} {
-	    set char [format %c $i]
-	    set val {}
-	    if {[info exists base64_tmp($char)]} {
-		set val $base64_tmp($char)
-	    } else {
-		set val {}
-	    }
-	    lappend base64 $val
-	}
-
-	# code the character "=" as -1; used to signal end of message
-	scan = %c i
-	set base64 [lreplace $base64 $i $i -1]
-
-	# remove unneeded variables
-	unset base64_tmp i char len val
-
-	namespace export encode decode
-    }
-
-    # ::base64::encode --
-    #
-    #	Base64 encode a given string.
-    #
-    # Arguments:
-    #	args	?-maxlen maxlen? ?-wrapchar wrapchar? string
-    #	
-    #		If maxlen is 0, the output is not wrapped.
-    #
-    # Results:
-    #	A Base64 encoded version of $string, wrapped at $maxlen characters
-    #	by $wrapchar.
-    
-    proc ::base64::encode {args} {
-	set base64_en $::base64::base64_en
-	
-	# Set the default wrapchar and maximum line length to match the output
-	# of GNU uuencode 4.2.  Various RFCs allow for different wrapping 
-	# characters and wraplengths, so these may be overridden by command line
-	# options.
-	set wrapchar "\n"
-	set maxlen 60
-
-	if { [llength $args] == 0 } {
-	    error "wrong # args: should be \"[lindex [info level 0] 0]\
-		    ?-maxlen maxlen? ?-wrapchar wrapchar? string\""
-	}
-
-	set optionStrings [list "-maxlen" "-wrapchar"]
-	for {set i 0} {$i < [llength $args] - 1} {incr i} {
-	    set arg [lindex $args $i]
-	    set index [lsearch -glob $optionStrings "${arg}*"]
-	    if { $index == -1 } {
-		error "unknown option \"$arg\": must be -maxlen or -wrapchar"
-	    }
-	    incr i
-	    if { $i >= [llength $args] - 1 } {
-		error "value for \"$arg\" missing"
-	    }
-	    set val [lindex $args $i]
-
-	    # The name of the variable to assign the value to is extracted
-	    # from the list of known options, all of which have an
-	    # associated variable of the same name as the option without
-	    # a leading "-". The [string range] command is used to strip
-	    # of the leading "-" from the name of the option.
-	    #
-	    # FRINK: nocheck
-	    set [string range [lindex $optionStrings $index] 1 end] $val
-	}
-    
-	# [string is] requires Tcl8.2; this works with 8.0 too
-	if {[catch {expr {$maxlen % 2}}]} {
-	    error "expected integer but got \"$maxlen\""
-	}
-
-	set string [lindex $args end]
-
-	set result {}
-	set state 0
-	set length 0
-
-
-	# Process the input bytes 3-by-3
-
-	binary scan $string c* X
-	foreach {x y z} $X {
-	    # Do the line length check before appending so that we don't get an
-	    # extra newline if the output is a multiple of $maxlen chars long.
-	    if {$maxlen && $length >= $maxlen} {
-		append result $wrapchar
-		set length 0
-	    }
-	
-	    append result [lindex $base64_en [expr {($x >>2) & 0x3F}]] 
-	    if {$y != {}} {
-		append result [lindex $base64_en [expr {(($x << 4) & 0x30) | (($y >> 4) & 0xF)}]] 
-		if {$z != {}} {
-		    append result \
-			    [lindex $base64_en [expr {(($y << 2) & 0x3C) | (($z >> 6) & 0x3)}]]
-		    append result [lindex $base64_en [expr {($z & 0x3F)}]]
-		} else {
-		    set state 2
-		    break
-		}
-	    } else {
-		set state 1
-		break
-	    }
-	    incr length 4
-	}
-	if {$state == 1} {
-	    append result [lindex $base64_en [expr {(($x << 4) & 0x30)}]]== 
-	} elseif {$state == 2} {
-	    append result [lindex $base64_en [expr {(($y << 2) & 0x3C)}]]=  
-	}
-	return $result
-    }
-
-    # ::base64::decode --
-    #
-    #	Base64 decode a given string.
-    #
-    # Arguments:
-    #	string	The string to decode.  Characters not in the base64
-    #		alphabet are ignored (e.g., newlines)
-    #
-    # Results:
-    #	The decoded value.
-
-    proc ::base64::decode {string} {
-	if {[string length $string] == 0} {return ""}
-
-	set base64 $::base64::base64
-	set output "" ; # Fix for [Bug 821126]
-
-	binary scan $string c* X
-	foreach x $X {
-	    set bits [lindex $base64 $x]
-	    if {$bits >= 0} {
-		if {[llength [lappend nums $bits]] == 4} {
-		    foreach {v w z y} $nums break
-		    set a [expr {($v << 2) | ($w >> 4)}]
-		    set b [expr {(($w & 0xF) << 4) | ($z >> 2)}]
-		    set c [expr {(($z & 0x3) << 6) | $y}]
-		    append output [binary format ccc $a $b $c]
-		    set nums {}
-		}		
-	    } elseif {$bits == -1} {
-		# = indicates end of data.  Output whatever chars are left.
-		# The encoding algorithm dictates that we can only have 1 or 2
-		# padding characters.  If x=={}, we have 12 bits of input 
-		# (enough for 1 8-bit output).  If x!={}, we have 18 bits of
-		# input (enough for 2 8-bit outputs).
-		
-		foreach {v w z} $nums break
-		set a [expr {($v << 2) | (($w & 0x30) >> 4)}]
-		if {$z == {}} {
-		    append output [binary format c $a ]
-		} else {
-		    set b [expr {(($w & 0xF) << 4) | (($z & 0x3C) >> 2)}]
-		    append output [binary format cc $a $b]
-		}		
-		break
-	    } else {
-		# RFC 2045 says that line breaks and other characters not part
-		# of the Base64 alphabet must be ignored, and that the decoder
-		# can optionally emit a warning or reject the message.  We opt
-		# not to do so, but to just ignore the character. 
-		continue
-	    }
-	}
-	return $output
-    }
-}
-
-package provide base64 2.3.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base64/base64c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base64/base64c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,18 +1,0 @@
-# base64c - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This package is a place-holder for the critcl enhanced code present in
-# the tcllib base64 module.
-#
-# Normally this code will become part of the tcllibc library.
-#
-
-package require critcl
-package provide base64c 0.1.0
-
-namespace eval ::base64c {
-    variable base64c_rcsid {$Id: base64c.tcl,v 1.4 2006/11/04 15:20:36 patthoyts Exp $}
-
-    critcl::ccode {
-        /* no code required in this file */
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base64/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base64/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded base64   2.3.2 [list source [file join $dir base64.tcl]]
-package ifneeded uuencode 1.1.4 [list source [file join $dir uuencode.tcl]]
-package ifneeded yencode  1.1.1 [list source [file join $dir yencode.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base64/uuencode.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base64/uuencode.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,346 +1,0 @@
-# uuencode - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provide a Tcl only implementation of uuencode and uudecode.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# @(#)$Id: uuencode.tcl,v 1.21 2006/10/14 06:30:55 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-# Try and get some compiled helper package.
-if {[catch {package require tcllibc}]} {
-    catch {package require Trf}
-}
-
-namespace eval ::uuencode {
-    variable version 1.1.4
-
-    namespace export encode decode uuencode uudecode
-}
-
-proc ::uuencode::Enc {c} {
-    return [format %c [expr {($c != 0) ? (($c & 0x3f) + 0x20) : 0x60}]]
-}
-
-proc ::uuencode::Encode {s} {
-    set r {}
-    binary scan $s c* d
-    foreach {c1 c2 c3} $d {
-        if {$c1 == {}} {set c1 0}
-        if {$c2 == {}} {set c2 0}
-        if {$c3 == {}} {set c3 0}
-        append r [Enc [expr {$c1 >> 2}]]
-        append r [Enc [expr {(($c1 << 4) & 060) | (($c2 >> 4) & 017)}]]
-        append r [Enc [expr {(($c2 << 2) & 074) | (($c3 >> 6) & 003)}]]
-        append r [Enc [expr {($c3 & 077)}]]
-    }
-    return $r
-}
-
-
-proc ::uuencode::Decode {s} {
-    if {[string length $s] == 0} {return ""}
-    set r {}
-    binary scan [pad $s] c* d
-        
-    foreach {c0 c1 c2 c3} $d {
-        append r [format %c [expr {((($c0-0x20)&0x3F) << 2) & 0xFF
-                                   | ((($c1-0x20)&0x3F) >> 4) & 0xFF}]]
-        append r [format %c [expr {((($c1-0x20)&0x3F) << 4) & 0xFF
-                                   | ((($c2-0x20)&0x3F) >> 2) & 0xFF}]]
-        append r [format %c [expr {((($c2-0x20)&0x3F) << 6) & 0xFF
-                                   | (($c3-0x20)&0x3F) & 0xFF}]]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# C coded version of the Encode/Decode functions for base64c package.
-# -------------------------------------------------------------------------
-if {[package provide critcl] != {}} {
-    namespace eval ::uuencode {
-        critcl::ccode {
-            #include <string.h>
-            static unsigned char Enc(unsigned char c) {
-                return (c != 0) ? ((c & 0x3f) + 0x20) : 0x60;
-            }
-        }
-        critcl::ccommand CEncode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-            if ((xtra = (3 - (len % 3))) != 3) {
-                if (Tcl_IsShared(inputPtr))
-                    inputPtr = Tcl_DuplicateObj(inputPtr);
-                input = Tcl_SetByteArrayLength(inputPtr, len + xtra);
-                memset(input + len, 0, xtra);
-                len += xtra;
-            }
-
-            rlen = (len / 3) * 4;
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            memset(r, 0, rlen);
-            
-            for (p = input; p < input + len; p += 3) {
-                char a, b, c;
-                a = *p; b = *(p+1), c = *(p+2);
-                *r++ = Enc(a >> 2);
-                *r++ = Enc(((a << 4) & 060) | ((b >> 4) & 017));
-                *r++ = Enc(((b << 2) & 074) | ((c >> 6) & 003));
-                *r++ = Enc(c & 077);
-            }
-            
-            return TCL_OK;
-        }
-
-        critcl::ccommand CDecode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* if input is not mod 4, extend it with nuls */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-            if ((xtra = (4 - (len % 4))) != 4) {
-                if (Tcl_IsShared(inputPtr))
-                    inputPtr = Tcl_DuplicateObj(inputPtr);
-                input = Tcl_SetByteArrayLength(inputPtr, len + xtra);
-                memset(input + len, 0, xtra);
-                len += xtra;
-            }
-
-            /* output will be 1/3 smaller than input and a multiple of 3 */
-            rlen = (len / 4) * 3;
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            memset(r, 0, rlen);
-            
-            for (p = input; p < input + len; p += 4) {
-                char a, b, c, d;
-                a = *p; b = *(p+1), c = *(p+2), d = *(p+3);
-                *r++ = (((a - 0x20) & 0x3f) << 2) | (((b - 0x20) & 0x3f) >> 4);
-                *r++ = (((b - 0x20) & 0x3f) << 4) | (((c - 0x20) & 0x3f) >> 2);
-                *r++ = (((c - 0x20) & 0x3f) << 6) | (((d - 0x20) & 0x3f) );
-            }
-            
-            return TCL_OK;
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Permit more tolerant decoding of invalid input strings by padding to
-#  a multiple of 4 bytes with nulls.
-# Result:
-#  Returns the input string - possibly padded with uuencoded null chars.
-#
-proc ::uuencode::pad {s} {
-    if {[set mod [expr {[string length $s] % 4}]] != 0} {
-        append s [string repeat "`" [expr {4 - $mod}]]
-    }
-    return $s
-}
-
-# -------------------------------------------------------------------------
-
-# If the Trf package is available then we shall use this by default but the
-# Tcllib implementations are always visible if needed (ie: for testing)
-if {[info command ::uuencode::CDecode] != {}} {    
-    # tcllib critcl package
-    interp alias {} ::uuencode::encode {} ::uuencode::CEncode
-    interp alias {} ::uuencode::decode {} ::uuencode::CDecode
-} elseif {[package provide Trf] != {}} {
-    proc ::uuencode::encode {s} {
-        return [::uuencode -mode encode -- $s]
-    }
-    proc ::uuencode::decode {s} {
-        return [::uuencode -mode decode -- [pad $s]]
-    }
-} else {
-    # pure-tcl then
-    interp alias {} ::uuencode::encode {} ::uuencode::Encode
-    interp alias {} ::uuencode::decode {} ::uuencode::Decode
-}
-
-# -------------------------------------------------------------------------
-
-proc ::uuencode::uuencode {args} {
-    array set opts {mode 0644 filename {} name {}}
-    set wrongargs "wrong \# args: should be\
-            \"uuencode ?-name string? ?-mode octal?\
-            (-file filename | ?--? string)\""
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(filename) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -m* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(mode) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -n* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(name) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -- {
-                set args [lreplace $args 0 0]
-                break
-            }
-            default {
-                return -code error "bad option [lindex $args 0]:\
-                      must be -file, -mode, or -name"
-            }
-        }
-        set args [lreplace $args 0 0]
-    }
-
-    if {$opts(name) == {}} {
-        set opts(name) $opts(filename)
-    }
-    if {$opts(name) == {}} {
-        set opts(name) "data.dat"
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        fconfigure $f -translation binary
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error $wrongargs
-        }
-        set data [lindex $args 0]
-    }
-
-    set r {}
-    append r [format "begin %o %s" $opts(mode) $opts(name)] "\n"
-    for {set n 0} {$n < [string length $data]} {incr n 45} {
-        set s [string range $data $n [expr {$n + 44}]]
-        append r [Enc [string length $s]]
-        append r [encode $s] "\n"
-    }
-    append r "`\nend"
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Perform uudecoding of a file or data. A file may contain more than one
-#  encoded data section so the result is a list where each element is a 
-#  three element list of the provided filename, the suggested mode and the 
-#  data itself.
-#
-proc ::uuencode::uudecode {args} {
-    array set opts {mode 0644 filename {}}
-    set wrongargs "wrong \# args: should be \"uudecode (-file filename | ?--? string)\""
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* {
-                if {[llength $args] < 2} {
-                    return -code error $wrongargs
-                }
-                set opts(filename) [lindex $args 1]
-                set args [lreplace $args 0 0]
-            }
-            -- {
-                set args [lreplace $args 0 0]
-                break
-            }
-            default {
-                return -code error "bad option [lindex $args 0]:\
-                      must be -file"
-            }
-        }
-        set args [lreplace $args 0 0]
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error $wrongargs
-        }
-        set data [lindex $args 0]
-    }
-
-    set state false
-    set result {}
-
-    foreach {line} [split $data "\n"] {
-        switch -exact -- $state {
-            false {
-                if {[regexp {^begin ([0-7]+) ([^\s]*)} $line \
-                         -> opts(mode) opts(name)]} {
-                    set state true
-                    set r {}
-                }
-            }
-
-            true {
-                if {[string match "end" $line]} {
-                    set state false
-                    lappend result [list $opts(name) $opts(mode) $r]
-                } else {
-                    scan $line %c c
-                    set n [expr {($c - 0x21)}]
-                    append r [string range \
-                                  [decode [string range $line 1 end]] 0 $n]
-                }
-            }
-        }
-    }
-
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-package provide uuencode $::uuencode::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/base64/yencode.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/base64/yencode.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,315 +1,0 @@
-# yencode.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provide a Tcl only implementation of yEnc encoding algorithm
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# @(#)$Id: yencode.tcl,v 1.11 2005/09/28 04:51:19 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-catch {package require crc32};          # tcllib 1.1
-catch {package require tcllibc};        # critcl enhancements for tcllib
-
-namespace eval ::yencode {
-    variable version 1.1.1
-    namespace export encode decode yencode ydecode
-}
-
-# -------------------------------------------------------------------------
-
-proc ::yencode::Encode {s} {
-    set r {}
-    binary scan $s c* d
-    foreach {c} $d {
-        set v [expr {($c + 42) % 256}]
-        if {$v == 0x00 || $v == 0x09 || $v == 0x0A 
-            || $v == 0x0D || $v == 0x3D} {
-            append r "="
-            set v [expr {($v + 42) % 256}]
-        }
-        append r [format %c $v]
-    }
-    return $r
-}
-
-proc ::yencode::Decode {s} {
-    if {[string length $s] == 0} {return ""}
-    set r {}
-    set esc 0
-    binary scan $s c* d
-    foreach c $d {
-        if {$c == 61 && $esc == 0} {
-            set esc 1
-            continue
-        }
-        set v [expr {($c - 42) % 256}]
-        if {$esc} {
-            set v [expr {($v - 42) % 256}]
-            set esc 0
-        }
-        append r [format %c $v]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# C coded versions for critcl built base64c package
-# -------------------------------------------------------------------------
-
-if {[package provide critcl] != {}} {
-    namespace eval ::yencode {
-        critcl::ccode {
-            #include <string.h>
-        }
-        critcl::ccommand CEncode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, xtra;
-            unsigned char *input, *p, *r, v;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* fetch the input data */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-
-            /* calculate the length of the encoded result */
-            rlen = len;
-            for (p = input; p < input + len; p++) {
-                v = (*p + 42) % 256;
-                if (v == 0 || v == 9 || v == 0x0A || v == 0x0D || v == 0x3D)
-                   rlen++;
-            }
-            
-            /* allocate the output buffer */
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, rlen);
-            
-            /* encode the input */
-            for (p = input; p < input + len; p++) {
-                v = (*p + 42) % 256;
-                if (v == 0 || v == 9 || v == 0x0A || v == 0x0D || v == 0x3D) {
-                    *r++ = '=';
-                    v = (v + 42) % 256;
-                }
-                *r++ = v;
-            }
-
-            return TCL_OK;
-        }
-
-        critcl::ccommand CDecode {dummy interp objc objv} {
-            Tcl_Obj *inputPtr, *resultPtr;
-            int len, rlen, esc;
-            unsigned char *input, *p, *r, v;
-            
-            if (objc !=  2) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data");
-                return TCL_ERROR;
-            }
-            
-            /* fetch the input data */
-            inputPtr = objv[1];
-            input = Tcl_GetByteArrayFromObj(inputPtr, &len);
-
-            /* allocate the output buffer */
-            resultPtr = Tcl_GetObjResult(interp);
-            if (Tcl_IsShared(resultPtr)) {
-                resultPtr = Tcl_DuplicateObj(resultPtr);
-                Tcl_SetObjResult(interp, resultPtr);
-            }
-            r = Tcl_SetByteArrayLength(resultPtr, len);
-            
-            /* encode the input */
-            for (p = input, esc = 0, rlen = 0; p < input + len; p++) {
-                if (*p == 61 && esc == 0) {
-                    esc = 1;
-                    continue;
-                }
-                v = (*p - 42) % 256;
-                if (esc) {
-                    v = (v - 42) % 256;
-                    esc = 0;
-                }
-                *r++ = v;
-                rlen++;
-            }
-            Tcl_SetByteArrayLength(resultPtr, rlen);
-
-            return TCL_OK;
-        }
-    }
-}
-
-if {[info command ::yencode::CEncode] != {}} {
-    interp alias {} ::yencode::encode {} ::yencode::CEncode
-    interp alias {} ::yencode::decode {} ::yencode::CDecode
-} else {
-    interp alias {} ::yencode::encode {} ::yencode::Encode
-    interp alias {} ::yencode::decode {} ::yencode::Decode
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::yencode::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::yencode::yencode {args} {
-    array set opts {mode 0644 filename {} name {} line 128 crc32 1}
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* { set opts(filename) [Pop args 1] }
-            -m* { set opts(mode) [Pop args 1] }
-            -n* { set opts(name) [Pop args 1] }
-            -l* { set opts(line) [Pop args 1] }
-            -c* { set opts(crc32) [Pop args 1] }
-            --  { Pop args ; break }
-            default {
-                set options [join [lsort [array names opts]] ", -"]
-                return -code error "bad option [lindex $args 0]:\
-                      must be -$options"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(name) == {}} {
-        set opts(name) $opts(filename)
-    }
-    if {$opts(name) == {}} {
-        set opts(name) "data.dat"
-    }
-    if {! [string is boolean $opts(crc32)]} {
-        return -code error "bad option -crc32: argument must be true or false"
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        fconfigure $f -translation binary
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args: should be\
-                  \"yencode ?options? -file name | data\""
-        }
-        set data [lindex $args 0]
-    }
-    
-    set opts(size) [string length $data]
-    
-    set r {}
-    append r [format "=ybegin line=%d size=%d name=%s" \
-                  $opts(line) $opts(size) $opts(name)] "\n"
-
-    set ndx 0
-    while {$ndx < $opts(size)} {
-        set pln [string range $data $ndx [expr {$ndx + $opts(line) - 1}]]
-        set enc [encode $pln]
-        incr ndx [string length $pln]
-        append r $enc "\r\n"
-    }
-
-    append r [format "=yend size=%d" $ndx]
-    if {$opts(crc32)} {
-        append r " crc32=" [crc::crc32 -format %x $data]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Perform ydecoding of a file or data. A file may contain more than one
-#  encoded data section so the result is a list where each element is a 
-#  three element list of the provided filename, the file size and the 
-#  data itself.
-#
-proc ::yencode::ydecode {args} {
-    array set opts {mode 0644 filename {} name default.bin}
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -f* { set opts(filename) [Pop args 1] }
-            -- { Pop args ; break; }
-            default {
-                set options [join [lsort [array names opts]] ", -"]
-                return -code error "bad option [lindex $args 0]:\
-                      must be -$opts"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(filename) != {}} {
-        set f [open $opts(filename) r]
-        set data [read $f]
-        close $f
-    } else {
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args: should be\
-                  \"ydecode ?options? -file name | data\""
-        }
-        set data [lindex $args 0]
-    }
-
-    set state false
-    set result {}
-
-    foreach {line} [split $data "\n"] {
-        set line [string trimright $line "\r\n"]
-        switch -exact -- $state {
-            false {
-                if {[string match "=ybegin*" $line]} {
-                    regexp {line=(\d+)} $line -> opts(line)
-                    regexp {size=(\d+)} $line -> opts(size)
-                    regexp {name=(\d+)} $line -> opts(name)
-
-                    if {$opts(name) == {}} {
-                        set opts(name) default.bin
-                    }
-
-                    set state true
-                    set r {}
-                }
-            }
-
-            true {
-                if {[string match "=yend*" $line]} {
-                    set state false
-                    lappend result [list $opts(name) $opts(size) $r]
-                } else {
-                    append r [decode $line]
-                }
-            }
-        }
-    }
-
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-package provide yencode $::yencode::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bee/bee.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bee/bee.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,990 +1,0 @@
-# bee.tcl --
-#
-#	BitTorrent Bee de- and encoder.
-#
-# Copyright (c) 2004 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# See the file license.terms.
-
-package require Tcl 8.4
-
-namespace eval ::bee {
-    # Encoder commands
-    namespace export \
-	    encodeString encodeNumber \
-	    encodeListArgs encodeList \
-	    encodeDictArgs encodeDict
-
-    # Decoder commands.
-    namespace export \
-	    decode \
-	    decodeChannel \
-	    decodeCancel \
-	    decodePush
-
-    # Channel decoders, reference to state information, keyed by
-    # channel handle.
-
-    variable  bee
-    array set bee {}
-
-    # Counter for generation of names for the state variables.
-
-    variable count 0
-
-    # State information for the channel decoders.
-
-    # stateN, with N an integer number counting from 0 on up.
-    # ...(chan)   Handle of channel the decoder is for.
-    # ...(cmd)    Command prefix, completion callback
-    # ...(exact)  Boolean flag, set for exact processing.
-    # ...(read)   Buffer for new characters to process.
-    # ...(type)   Type of current value (integer, string, list, dict)
-    # ...(value)  Buffer for assembling the current value.
-    # ...(pend)   Stack of pending 'value' buffers, for nested
-    #             containers.
-    # ...(state)  Current state of the decoding state machine.
-
-    # States of the finite automaton ...
-    # intro  - One char, type of value, or 'e' as stop of container.
-    # signum - sign or digit, for integer.
-    # idigit - digit, for integer, or 'e' as stop
-    # ldigit - digit, for length of string, or :
-    # data   - string data, 'get' characters.
-    # Containers via 'pend'.
-
-    #Debugging help, nesting level
-    #variable X 0
-}
-
-
-# ::bee::encodeString --
-#
-#	Encode a string to bee-format.
-#
-# Arguments:
-#	string	The string to encode.
-#
-# Results:
-#	The bee-encoded form of the string.
-
-proc ::bee::encodeString {string} {
-    return "[string length $string]:$string"
-}
-
-
-# ::bee::encodeNumber --
-#
-#	Encode an integer number to bee-format.
-#
-# Arguments:
-#	num	The integer number to encode.
-#
-# Results:
-#	The bee-encoded form of the integer number.
-
-proc ::bee::encodeNumber {num} {
-    if {![string is integer -strict $num]} {
-	return -code error "Expected integer number, got \"$num\""
-    }
-
-    # The reformatting deals with hex, octal and other tcl
-    # representation of the value. In other words we normalize the
-    # string representation of the input value.
-
-    set num [format %d $num]
-    return "i${num}e"
-}
-
-
-# ::bee::encodeList --
-#
-#	Encode a list of bee-coded values to bee-format.
-#
-# Arguments:
-#	list	The list to encode.
-#
-# Results:
-#	The bee-encoded form of the list.
-
-proc ::bee::encodeList {list} {
-    return "l[join $list ""]e"
-}
-
-
-# ::bee::encodeListArgs --
-#
-#	Encode a variable list of bee-coded values to bee-format.
-#
-# Arguments:
-#	args	The values to encode.
-#
-# Results:
-#	The bee-encoded form of the list of values.
-
-proc ::bee::encodeListArgs {args} {
-    return [encodeList $args]
-}
-
-
-# ::bee::encodeDict --
-#
-#	Encode a dictionary of keys and bee-coded values to bee-format.
-#
-# Arguments:
-#	dict	The dictionary to encode.
-#
-# Results:
-#	The bee-encoded form of the dictionary.
-
-proc ::bee::encodeDict {dict} {
-    if {([llength $dict] % 2) == 1} {
-	return -code error "Expected even number of elements, got \"[llength $dict]\""
-    }
-    set temp [list]
-    foreach {k v} $dict {
-	lappend temp [list $k $v]
-    }
-    set res "d"
-    foreach item [lsort -index 0 $temp] {
-	foreach {k v} $item break
-	append res [encodeString $k]$v
-    }
-    append res "e"
-    return $res
-}
-
-
-# ::bee::encodeDictArgs --
-#
-#	Encode a variable dictionary of keys and bee-coded values to bee-format.
-#
-# Arguments:
-#	args	The keys and values to encode.
-#
-# Results:
-#	The bee-encoded form of the dictionary.
-
-proc ::bee::encodeDictArgs {args} {
-    return [encodeDict $args]
-}
-
-
-# ::bee::decode --
-#
-#	Decode a bee-encoded value and returns the embedded tcl
-#	value. For containers this recurses into the contained value.
-#
-# Arguments:
-#	value	The string containing the bee-encoded value to decode.
-#	evar	Optional. If set the name of the variable to store the
-#		index of the first character after the decoded value to.
-#	start	Optional. If set the index of the first character of the
-#		value to decode. Defaults to 0, i.e. the beginning of the
-#		string.
-#
-# Results:
-#	The tcl value embedded in the encoded string.
-
-proc ::bee::decode {value {evar {}} {start 0}} {
-    #variable X
-    #puts -nonewline "[string repeat "    " $X]decode @$start" ; flush stdout
-
-    if {$evar ne ""} {upvar 1 $evar end} else {set end _}
-
-    if {[string length $value] < ($start+2)} {
-	# This checked that the 'start' index is still in the string,
-	# and the end of the value most likely as well. Note that each
-	# encoded value consists of at least two characters (the
-	# bracketing characters for integer, list, and dict, and for
-	# string at least one digit length and the colon).
-
-	#puts \t[string length $value]\ <\ ($start+2)
-	return -code error "String not large enough for value"
-    }
-
-    set type [string index $value $start]
-
-    #puts -nonewline " $type=" ; flush stdout
-
-    if {$type eq "i"} {
-	# Extract integer
-	#puts -nonewline integer ; flush stdout
-
-	incr start ; # Skip over intro 'i'.
-	set end [string first e $value $start]
-	if {$end < 0} {
-	    return -code error "End of integer number not found"
-	}
-	incr end -1 ; # Get last character before closing 'e'.
-	set num [string range $value $start $end]
-	if {
-	    [regexp {^-0+$} $num] ||
-	    ![string is integer -strict $num] ||
-	    (([string length $num] > 1) && [string match 0* $num])
-	} {
-	    return -code error "Expected integer number, got \"$num\""
-	}
-	incr end 2 ; # Step after closing 'e' to the beginning of
-	# ........ ; # the next bee-value behind the current one.
-
-	#puts " ($num) @$end"
-	return $num
-
-    } elseif {($type eq "l") || ($type eq "d")} {
-	#puts -nonewline $type\n ; flush stdout
-
-	# Extract list or dictionary, recursively each contained
-	# element. From the perspective of the decoder this is the
-	# same, the tcl representation of both is a list, and for a
-	# dictionary keys and values are also already in the correct
-	# order.
-
-	set result [list]
-	incr start ; # Step over intro 'e' to beginning of the first
-	# ........ ; # contained value, or behind the container (if
-	# ........ ; # empty).
-
-	set end $start
-	#incr X
-	while {[string index $value $start] ne "e"} {
-	    lappend result [decode $value end $start]
-	    set start $end
-	}
-	#incr X -1
-	incr end
-
-	#puts "[string repeat "    " $X]($result) @$end"
-
-	if {$type eq "d" && ([llength $result] % 2 == 1)} {
-	    return -code error "Dictionary has to be of even length"
-	}
-	return $result
-
-    } elseif {[string match {[0-9]} $type]} {
-	#puts -nonewline string ; flush stdout
-
-	# Extract string. First the length, bounded by a colon, then
-	# the appropriate number of characters.
-
-	set end [string first : $value $start]
-	if {$end < 0} {
-	    return -code error "End of string length not found"
-	}
-	incr end -1
-	set length [string range $value $start $end]
-	incr end 2 ;# Skip to beginning of the string after the colon
-
-	if {![string is integer -strict $length]} {
-	    return -code error "Expected integer number for string length, got \"$length\""
-	} elseif {$length < 0} {
-	    # This cannot happen. To happen "-" has to be first character,
-	    # and this is caught as unknown bee-type.
-	    return -code error "Illegal negative string length"
-	} elseif {($end + $length) > [string length $value]} {
-	    return -code error "String not large enough for value"
-	}
-
-	#puts -nonewline \[$length\] ; flush stdout
-	if {$length > 0} {
-	    set  start $end
-	    incr end $length
-	    incr end -1
-	    set result [string range $value $start $end]
-	    incr end
-	} else {
-	    set result ""
-	}
-
-	#puts " ($result) @$end"
-	return $result
-
-    } else {
-	return -code error "Unknown bee-type \"$type\""
-    }
-}
-
-# ::bee::decodeIndices --
-#
-#	Similar to 'decode', but does not return the decoded tcl values,
-#	but a structure containing the start- and end-indices for all
-#	values in the structure.
-#
-# Arguments:
-#	value	The string containing the bee-encoded value to decode.
-#	evar	Optional. If set the name of the variable to store the
-#		index of the first character after the decoded value to.
-#	start	Optional. If set the index of the first character of the
-#		value to decode. Defaults to 0, i.e. the beginning of the
-#		string.
-#
-# Results:
-#	The structure of the value, with indices and types for all
-#	contained elements.
-
-proc ::bee::decodeIndices {value {evar {}} {start 0}} {
-    #variable X
-    #puts -nonewline "[string repeat "    " $X]decode @$start" ; flush stdout
-
-    if {$evar ne ""} {upvar 1 $evar end} else {set end _}
-
-    if {[string length $value] < ($start+2)} {
-	# This checked that the 'start' index is still in the string,
-	# and the end of the value most likely as well. Note that each
-	# encoded value consists of at least two characters (the
-	# bracketing characters for integer, list, and dict, and for
-	# string at least one digit length and the colon).
-
-	#puts \t[string length $value]\ <\ ($start+2)
-	return -code error "String not large enough for value"
-    }
-
-    set type [string index $value $start]
-
-    #puts -nonewline " $type=" ; flush stdout
-
-    if {$type eq "i"} {
-	# Extract integer
-	#puts -nonewline integer ; flush stdout
-
-	set begin $start
-
-	incr start ; # Skip over intro 'i'.
-	set end [string first e $value $start]
-	if {$end < 0} {
-	    return -code error "End of integer number not found"
-	}
-	incr end -1 ; # Get last character before closing 'e'.
-	set num [string range $value $start $end]
-	if {
-	    [regexp {^-0+$} $num] ||
-	    ![string is integer -strict $num] ||
-	    (([string length $num] > 1) && [string match 0* $num])
-	} {
-	    return -code error "Expected integer number, got \"$num\""
-	}
-	incr end
-	set stop $end
-	incr end 1 ; # Step after closing 'e' to the beginning of
-	# ........ ; # the next bee-value behind the current one.
-
-	#puts " ($num) @$end"
-	return [list integer $begin $stop]
-
-    } elseif {$type eq "l"} {
-	#puts -nonewline $type\n ; flush stdout
-
-	# Extract list, recursively each contained element.
-
-	set result [list]
-
-	lappend result list $start @
-
-	incr start ; # Step over intro 'e' to beginning of the first
-	# ........ ; # contained value, or behind the container (if
-	# ........ ; # empty).
-
-	set end $start
-	#incr X
-
-	set contained [list]
-	while {[string index $value $start] ne "e"} {
-	    lappend contained [decodeIndices $value end $start]
-	    set start $end
-	}
-	lappend result $contained
-	#incr X -1
-	set stop $end
-	incr end
-
-	#puts "[string repeat "    " $X]($result) @$end"
-
-	return [lreplace $result 2 2 $stop]
-
-    } elseif {($type eq "l") || ($type eq "d")} {
-	#puts -nonewline $type\n ; flush stdout
-
-	# Extract dictionary, recursively each contained element.
-
-	set result [list]
-
-	lappend result dict $start @
-
-	incr start ; # Step over intro 'e' to beginning of the first
-	# ........ ; # contained value, or behind the container (if
-	# ........ ; # empty).
-
-	set end $start
-	set atkey 1
-	#incr X
-
-	set contained [list]
-	set val       [list]
-	while {[string index $value $start] ne "e"} {
-	    if {$atkey} {
-		lappend contained [decode $value {} $start]
-		lappend val       [decodeIndices $value end $start]
-		set atkey 0
-	    } else {
-		lappend val       [decodeIndices $value end $start]
-		lappend contained $val
-		set val [list]
-		set atkey 1
-	    }
-	    set start $end
-	}
-	lappend result $contained
-	#incr X -1
-	set stop $end
-	incr end
-
-	#puts "[string repeat "    " $X]($result) @$end"
-
-	if {[llength $result] % 2 == 1} {
-	    return -code error "Dictionary has to be of even length"
-	}
-	return [lreplace $result 2 2 $stop]
-
-    } elseif {[string match {[0-9]} $type]} {
-	#puts -nonewline string ; flush stdout
-
-	# Extract string. First the length, bounded by a colon, then
-	# the appropriate number of characters.
-
-	set end [string first : $value $start]
-	if {$end < 0} {
-	    return -code error "End of string length not found"
-	}
-	incr end -1
-	set length [string range $value $start $end]
-	incr end 2 ;# Skip to beginning of the string after the colon
-
-	if {![string is integer -strict $length]} {
-	    return -code error "Expected integer number for string length, got \"$length\""
-	} elseif {$length < 0} {
-	    # This cannot happen. To happen "-" has to be first character,
-	    # and this is caught as unknown bee-type.
-	    return -code error "Illegal negative string length"
-	} elseif {($end + $length) > [string length $value]} {
-	    return -code error "String not large enough for value"
-	}
-
-	#puts -nonewline \[$length\] ; flush stdout
-	incr end -1
-	if {$length > 0} {
-	    incr end $length
-	    set stop $end
-	} else {
-	    set stop $end
-	}
-	incr end
-
-	#puts " ($result) @$end"
-	return [list string $start $stop]
-
-    } else {
-	return -code error "Unknown bee-type \"$type\""
-    }
-}
-
-
-# ::bee::decodeChannel --
-#
-#	Attach decoder for a bee-value to a channel. See the
-#	documentation for details.
-#
-# Arguments:
-#	chan			Channel to attach to.
-#	-command cmdprefix	Completion callback. Required.
-#	-exact			Keep running after completion.
-#	-prefix data		Seed for decode buffer.
-#
-# Results:
-#	A token to use when referring to the decoder.
-#	For example when canceling it.
-
-proc ::bee::decodeChannel {chan args} {
-    variable bee
-    if {[info exists bee($chan)]} {
-	return -code error "bee-Decoder already active for channel"
-    }
-
-    # Create state and token.
-
-    variable  count
-    variable  [set st state$count]
-    array set $st {}
-    set       bee($chan) $st
-    upvar 0  $st state
-    incr count
-
-    # Initialize the decoder state, process the options. When
-    # encountering errors here destroy the half-baked state before
-    # throwing the message.
-
-    set       state(chan) $chan
-    array set state {
-	exact  0
-	type   ?
-	read   {}
-	value  {}
-	pend   {}
-	state  intro
-	get    1
-    }
-
-    while {[llength $args]} {
-	set option [lindex $args 0]
-	set args [lrange $args 1 end]
-	if {$option eq "-command"} {
-	    if {![llength $args]} {
-		unset bee($chan)
-		unset state
-		return -code error "Missing value for option -command."
-	    }
-	    set state(cmd) [lindex $args 0]
-	    set args       [lrange $args 1 end]
-
-	} elseif {$option eq "-prefix"} {
-	    if {![llength $args]} {
-		unset bee($chan)
-		unset state
-		return -code error "Missing value for option -prefix."
-	    }
-	    set state(read) [lindex $args 0]
-	    set args        [lrange $args 1 end]
-
-	} elseif {$option eq "-exact"} {
-	    set state(exact) 1
-	} else {
-	    unset bee($chan)
-	    unset state
-	    return -code error "Illegal option \"$option\",\
-		    expected \"-command\", \"-prefix\", or \"-keep\""
-	}
-    }
-
-    if {![info exists state(cmd)]} {
-	unset bee($chan)
-	unset state
-	return -code error "Missing required completion callback."
-    }
-
-    # Set up the processing of incoming data.
-
-    fileevent $chan readable [list ::bee::Process $chan $bee($chan)]
-
-    # Return the name of the state array as token.
-    return $bee($chan)
-}
-
-# ::bee::Parse --
-#
-#	Internal helper. Fileevent handler for a decoder.
-#	Parses input and handles both error and eof conditions.
-#
-# Arguments:
-#	token	The decoder to run on its input.
-#
-# Results:
-#	None.
-
-proc ::bee::Process {chan token} {
-    if {[catch {Parse $token} msg]} {
-	# Something failed. Destroy and report.
-	Command $token error $msg
-	return
-    }
-
-    if {[eof $chan]} {
-	# Having data waiting, either in the input queue, or in the
-	# output stack (of nested containers) is a failure. Report
-	# this instead of the eof.
-
-	variable $token
-	upvar 0  $token state
-
-	if {
-	    [string length $state(read)] ||
-	    [llength       $state(pend)] ||
-	    [string length $state(value)] ||
-	    ($state(state) ne "intro")
-	} {
-	    Command $token error "Incomplete value at end of channel"
-	} else {
-	    Command $token eof
-	}
-    }
-    return
-}
-
-# ::bee::Parse --
-#
-#	Internal helper. Reading from the channel and parsing the input.
-#	Uses a hardwired state machine.
-#
-# Arguments:
-#	token	The decoder to run on its input.
-#
-# Results:
-#	None.
-
-proc ::bee::Parse {token} {
-    variable $token
-    upvar 0  $token state
-    upvar 0  state(state) current
-    upvar 0  state(read)  input
-    upvar 0  state(type)  type
-    upvar 0  state(value) value
-    upvar 0  state(pend)  pend
-    upvar 0  state(exact) exact
-    upvar 0  state(get)   get
-    set chan $state(chan)
-
-    #puts Parse/$current
-
-    if {!$exact} {
-	# Add all waiting characters to the buffer so that we can process as
-	# much as is possible in one go.
-	append input [read $chan]
-    } else {
-	# Exact reading. Usually one character, but when in the data
-	# section for a string value we know for how many characters
-	# we are looking for.
-
-	append input [read $chan $get]
-    }
-
-    # We got nothing, do nothing.
-    if {![string length $input]} return
-
-
-    if {$current eq "data"} {
-	# String data, this can be done faster, as we read longer
-	# sequences of characters for this.
-	set l [string length $input]
-	if {$l < $get} {
-	    # Not enough, wait for more.
-	    append value $input
-	    incr get -$l
-	    return
-	} elseif {$l == $get} {
-	    # Got all, exactly. Prepare state machine for next value.
-
-	    if {[Complete $token $value$input]} return
-
-	    set current intro
-	    set get 1
-	    set value ""
-	    set input ""
-
-	    return
-	} else {
-	    # Got more than required (only for !exact).
-
-	    incr get -1
-	    if {[Complete $token $value[string range $input 0 $get]]} {return}
-
-	    incr get
-	    set input [string range $input $get end]
-	    set get 1
-	    set value ""
-	    set current intro
-	    # This now falls into the loop below.
-	}
-    }
-
-    set where 0
-    set n [string length $input]
-
-    #puts Parse/$n
-
-    while {$where < $n} {
-	# Hardwired state machine. Get current character.
-	set ch [string index $input $where]
-
-	#puts Parse/@$where/$current/$ch/
-	if {$current eq "intro"} {
-	    # First character of a value.
-
-	    if {$ch eq "i"} {
-		# Begin reading integer.
-		set type    integer
-		set current signum
-	    } elseif {$ch eq "l"} {
-		# Begin a list.
-		set type list
-		lappend pend list {}
-		#set current intro
-
-	    } elseif {$ch eq "d"} {
-		# Begin a dictionary.
-		set type dict
-		lappend pend dict {}
-		#set current intro
-
-	    } elseif {$ch eq "e"} {
-		# Close a container. Throw an error if there is no
-		# container to close.
-
-		if {![llength $pend]} {
-		    return -code error "End of container outside of container."
-		}
-
-		set v    [lindex $pend end]
-		set t    [lindex $pend end-1]
-		set pend [lrange $pend 0 end-2]
-
-		if {$t eq "dict" && ([llength $v] % 2 == 1)} {
-		    return -code error "Dictionary has to be of even length"
-		}
-
-		if {[Complete $token $v]} {return}
-		set current intro
-
-	    } elseif {[string match {[0-9]} $ch]} {
-		# Begin reading a string, length section first.
-		set type    string
-		set current ldigit
-		set value   $ch
-
-	    } else {
-		# Unknown type. Throw error.
-		return -code error "Unknown bee-type \"$ch\""
-	    }
-
-	    # To next character.
-	    incr where
-	} elseif {$current eq "signum"} {
-	    # Integer number, a minus sign, or a digit.
-	    if {[string match {[-0-9]} $ch]} {
-		append value $ch
-		set current idigit
-	    } else {
-		return -code error "Syntax error in integer,\
-			expected sign or digit, got \"$ch\""
-	    }
-	    incr where
-
-	} elseif {$current eq "idigit"} {
-	    # Integer number, digit or closing 'e'.
-
-	    if {[string match {[-0-9]} $ch]} {
-		append value $ch
-	    } elseif {$ch eq "e"} {
-		# Integer closes. Validate and report.
-		#puts validate
-		if {
-		    [regexp {^-0+$} $value] ||
-		    ![string is integer -strict $value] ||
-		    (([string length $value] > 1) && [string match 0* $value])
-		} {
-		    return -code error "Expected integer number, got \"$value\""
-		}
-
-		if {[Complete $token $value]} {return}
-		set value ""
-		set current intro
-	    } else {
-		return -code error "Syntax error in integer,\
-			expected digit, or 'e', got \"$ch\""
-	    }
-	    incr where
-
-	} elseif {$current eq "ldigit"} {
-	    # String, length section, digit, or :
-
-	    if {[string match {[-0-9]} $ch]} {
-		append value $ch
-
-	    } elseif {$ch eq ":"} {
-		# Length section closes, validate,
-		# then perform data processing.
-
-		set num $value
-		if {
-		    [regexp {^-0+$} $num] ||
-		    ![string is integer -strict $num] ||
-		    (([string length $num] > 1) && [string match 0* $num])
-		} {
-		    return -code error "Expected integer number as string length, got \"$num\""
-		}
-
-		set value ""
-
-		# We may have already part of the data in
-		# memory. Process that piece before looking for more.
-
-		incr where
-		set have [expr {$n - $where}]
-		if {$num < $have} {
-		    # More than enough in the buffer.
-
-		    set  end $where
-		    incr end $num
-		    incr end -1
-
-		    if {[Complete $token [string range $input $where $end]]} {return}
-
-		    set where   $end ;# Further processing behind the string.
-		    set current intro
-
-		} elseif {$num == $have} {
-		    # Just enough. 
-
-		    if {[Complete $token [string range $input $where end]]} {return}
-
-		    set where   $n
-		    set current intro
-		} else {
-		    # Not enough. Initialize value with the data we
-		    # have (after the colon) and stop processing for
-		    # now.
-
-		    set value   [string range $input $where end]
-		    set current data
-		    set get     $num
-		    set input   ""
-		    return
-		}
-	    } else {
-		return -code error "Syntax error in string length,\
-			expected digit, or ':', got \"$ch\""
-	    }
-	    incr where
-	} else {
-	    # unknown state = internal error
-	    return -code error "Unknown decoder state \"$current\", internal error"
-	}
-    }
-
-    set input ""
-    return
-}
-
-# ::bee::Command --
-#
-#	Internal helper. Runs the decoder command callback.
-#
-# Arguments:
-#	token	The decoder invoking its callback
-#	how	Which method to invoke (value, error, eof)
-#	args	Arguments for the method.
-#
-# Results:
-#	A boolean flag. Set if further processing has to stop.
-
-proc ::bee::Command {token how args} {
-    variable $token
-    upvar 0  $token state
-
-    #puts Report/$token/$how/$args/
-
-    set cmd  $state(cmd)
-    set chan $state(chan)
-
-    # We catch the fileevents because they will fail when this is
-    # called from the 'Close'. The channel will already be gone in
-    # that case.
-
-    set stop 0
-    if {($how eq "error") || ($how eq "eof")} {
-	variable bee
-
-	set stop 1
-	fileevent $chan readable {}
-	unset bee($chan)
-	unset state
-
-	if {$how eq "eof"} {
-	    #puts \tclosing/$chan
-	    close $chan
-	}
-    }
-
-    lappend cmd $how $token
-    foreach a $args {lappend cmd $a}
-    uplevel #0 $cmd
-
-    if {![info exists state]} {
-	# The decoder token was killed by the callback, stop
-	# processing.
-	set stop 1
-    }
-
-    #puts /$stop/[file channels]
-    return $stop
-}
-
-# ::bee::Complete --
-#
-#	Internal helper. Reports a completed value.
-#
-# Arguments:
-#	token	The decoder reporting the value.
-#	value	The value to report.
-#
-# Results:
-#	A boolean flag. Set if further processing has to stop.
-
-proc ::bee::Complete {token value} {
-    variable $token
-    upvar 0  $token state
-    upvar 0   state(pend) pend
-
-    if {[llength $pend]} {
-	# The value is part of a container. Add the value to its end
-	# and keep processing.
-
-	set pend [lreplace $pend end end \
-		[linsert [lindex $pend end] end \
-		$value]]
-
-	# Don't stop.
-	return 0
-    }
-
-    # The value is at the top, report it. The callback determines if
-    # we keep processing.
-
-    return [Command $token value $value]
-}
-
-# ::bee::decodeCancel --
-#
-#	Destroys the decoder referenced by the token.
-#
-# Arguments:
-#	token	The decoder to destroy.
-#
-# Results:
-#	None.
-
-proc ::bee::decodeCancel {token} {
-    variable bee
-    variable $token
-    upvar 0  $token state
-    unset bee($state(chan))
-    unset state
-    return
-}
-
-# ::bee::decodePush --
-#
-#	Push data into the decoder input buffer.
-#
-# Arguments:
-#	token	The decoder to extend.
-#	string	The characters to add.
-#
-# Results:
-#	None.
-
-proc ::bee::decodePush {token string} {
-    variable $token
-    upvar 0  $token state
-    append state(read) $string
-    return
-}
-
-
-package provide bee 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bee/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bee/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded bee 0.1 [list source [file join $dir bee.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,524 +1,0 @@
-# bench.tcl --
-#
-#	Management of benchmarks.
-#
-# Copyright (c) 2005-2007 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# library derived from runbench.tcl application (C) Jeff Hobbs.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: bench.tcl,v 1.12 2007/08/23 17:35:10 andreas_kupries Exp $
-
-# ### ### ### ######### ######### ######### ###########################
-## Requisites - Packages and namespace for the commands and data.
-
-package require Tcl 8.2
-package require logger
-package require csv
-package require struct::matrix
-package require report
-
-namespace eval ::bench      {}
-namespace eval ::bench::out {}
-
-# @mdgen OWNER: libbench.tcl
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Benchmark execution
-
-# ::bench::run --
-#
-#	Run a series of benchmarks.
-#
-# Arguments:
-#	...
-#
-# Results:
-#	Dictionary.
-
-proc ::bench::run {args} {
-    log::debug [linsert $args 0 ::bench::run]
-
-    # -errors  0|1         default 1, propagate errors in benchmarks
-    # -threads <num>       default 0, no threads, #threads to use
-    # -match  <pattern>    only run tests matching this pattern
-    # -rmatch <pattern>    only run tests matching this pattern
-    # -iters  <num>        default 1000, max#iterations for any benchmark
-    # -pkgdir <dir>        Defaults to nothing, regular bench invokation.
-
-    # interps - dict (path -> version)
-    # files   - list (of files)
-
-    # Process arguments ......................................
-    # Defaults first, then overides by the user
-
-    set errors  1    ; # Propagate errors
-    set threads 0    ; # Do not use threads
-    set match   {}   ; # Do not exclude benchmarks based on glob pattern
-    set rmatch  {}   ; # Do not exclude benchmarks based on regex pattern
-    set iters   1000 ; # Limit #iterations for any benchmark
-    set pkgdirs {}   ; # List of dirs to put in front of auto_path in the
-                       # bench interpreters. Default: nothing.
-
-    while {[string match "-*" [set opt [lindex $args 0]]]} {
-	set val [lindex $args 1]
-	switch -exact -- $opt {
-	    -errors {
-		if {![string is boolean -strict $val]} {
-		    return -code error "Expected boolean, got \"$val\""
-		}
-		set errors $val
-	    }
-	    -threads {
-		if {![string is int -strict $val] || ($val < 0)} {
-		    return -code error "Expected int >= 0, got \"$val\""
-		}
-		set threads [lindex $args 1]
-	    }
-	    -match {
-		set match [lindex $args 1]
-	    }
-	    -rmatch {
-		set rmatch [lindex $args 1]
-	    }
-	    -iters {
-		if {![string is int -strict $val] || ($val <= 0)} {
-		    return -code error "Expected int > 0, got \"$val\""
-		}
-		set iters   [lindex $args 1]
-	    }
-	    -pkgdir {
-		CheckPkgDirArg  $val
-		lappend pkgdirs $val
-	    }
-	    default {
-		return -code error "Unknown option \"$opt\", should -errors, -threads, -match, -rmatch, or -iters"
-	    }
-	}
-	set args [lrange $args 2 end]
-    }
-    if {[llength $args] != 2} {
-	return -code error "wrong\#args, should be: ?options? interp files"
-    }
-    foreach {interps files} $args break
-
-    # Run the benchmarks .....................................
-
-    array set DATA {}
-
-    if {![llength $pkgdirs]} {
-	# No user specified package directories => Simple run.
-	foreach {ip ver} $interps {
-	    Invoke $ip $ver {} ;# DATA etc passed via upvar.
-	}
-    } else {
-	# User specified package directories.
-	foreach {ip ver} $interps {
-	    foreach pkgdir $pkgdirs {
-		Invoke $ip $ver $pkgdir ;# DATA etc passed via upvar.
-	    }
-	}
-    }
-
-    # Benchmark data ... Structure, dict (key -> value)
-    #
-    # Key          || Value
-    # ============ ++ =========================================
-    # interp IP    -> Version. Shell IP was used to run benchmarks. IP is
-    #                 the path to the shell.
-    #
-    # desc DESC    -> "". DESC is description of an executed benchmark.
-    #
-    # usec DESC IP -> Result. Result of benchmark DESC when run by the
-    #                 shell IP. Usually time in microseconds, but can be
-    #                 a special code as well (ERR, BAD_RES).
-    # ============ ++ =========================================
-
-    return [array get DATA]
-}
-
-# ::bench::locate --
-#
-#	Locate interpreters on the pathlist, based on a pattern.
-#
-# Arguments:
-#	...
-#
-# Results:
-#	List of paths.
-
-proc ::bench::locate {pattern paths} {
-    # Cache of executables already found.
-    array set var {}
-    set res {}
-
-    foreach path $paths {
-	foreach ip [glob -nocomplain [file join $path $pattern]] {
-	    if {[package vsatisfies [package provide Tcl] 8.4]} {
-		set ip [file normalize $ip]
-	    }
-
-	    # Follow soft-links to the actual executable.
-	    while {[string equal link [file type $ip]]} {
-		set link [file readlink $ip]
-		if {[string match relative [file pathtype $link]]} {
-		    set ip [file join [file dirname $ip] $link]
-		} else {
-		    set ip $link
-		}
-	    }
-
-	    if {
-		[file executable $ip] && ![info exists var($ip)]
-	    } {
-		if {[catch {exec $ip << "exit"} dummy]} {
-		    log::debug "$ip: $dummy"
-		    continue
-		}
-		set var($ip) .
-		lappend res $ip
-	    }
-	}
-    }
-
-    return $res
-}
-
-# ::bench::versions --
-#
-#	Take list of interpreters, find their versions.
-#	Removes all interps for which it cannot do so.
-#
-# Arguments:
-#	List of interpreters (paths)
-#
-# Results:
-#	dictionary: interpreter -> version.
-
-proc ::bench::versions {interps} {
-    set res {}
-    foreach ip $interps {
-	if {[catch {
-	    exec $ip << {puts [info patchlevel] ; exit}
-	} patchlevel]} {
-	    log::debug "$ip: $patchlevel"
-	    continue
-	}
-
-	lappend res [list $patchlevel $ip]
-    }
-
-    # -uniq 8.4-ism, replaced with use of array.
-    array set tmp {}
-    set resx {}
-    foreach item [lsort -dictionary -decreasing -index 0 $res] {
-	foreach {p ip} $item break
-	if {[info exists tmp($p)]} continue
-	set tmp($p) .
-	lappend resx $ip $p
-    }
-
-    return $resx
-}
-
-# ::bench::merge --
-#
-#	Take the data of several benchmark runs and merge them into
-#	one data set.
-#
-# Arguments:
-#	One or more data sets to merge
-#
-# Results:
-#	The merged data set.
-
-proc ::bench::merge {args} {
-    if {[llength $args] == 1} {
-	return [lindex $args 0]
-    }
-
-    array set DATA {}
-    foreach data $args {
-	array set DATA $data
-    }
-    return [array get DATA]
-}
-
-# ::bench::norm --
-#
-#	Normalize the time data in the dataset, using one of the
-#	columns as reference.
-#
-# Arguments:
-#	Data to normalize
-#	Index of reference column
-#
-# Results:
-#	The normalized data set.
-
-proc ::bench::norm {data col} {
-
-    if {![string is integer -strict $col]} {
-	return -code error "Ref.column: Expected integer, but got \"$col\""
-    }
-    if {$col < 1} {
-	return -code error "Ref.column out of bounds"
-    }
-
-    array set DATA $data
-    set ipkeys [array names DATA interp*]
-
-    if {$col > [llength $ipkeys]} {
-	return -code error "Ref.column out of bounds"
-    }
-    incr col -1
-    set refip [lindex [lindex [lsort -dict $ipkeys] $col] 1]
-
-    foreach key [array names DATA] {
-	if {[string match "desc*"   $key]} continue
-	if {[string match "interp*" $key]} continue
-
-	foreach {_ desc ip} $key break
-	if {[string equal $ip $refip]}      continue
-
-	set v $DATA($key)
-	if {![string is double -strict $v]} continue
-
-	if {![info exists DATA([list usec $desc $refip])]} {
-	    # We cannot normalize, we do not keep the time value.
-	    # The row will be shown, empty.
-	    set DATA($key) ""
-	    continue
-	}
-	set vref $DATA([list usec $desc $refip])
-
-	if {![string is double -strict $vref]} continue
-
-	set DATA($key) [expr {$v/double($vref)}]
-    }
-
-    foreach key [array names DATA [list * $refip]] {
-	if {![string is double -strict $DATA($key)]} continue
-	set DATA($key) 1
-    }
-
-    return [array get DATA]
-}
-
-# ::bench::edit --
-#
-#	Change the 'path' of an interp to a user-defined value.
-#
-# Arguments:
-#	Data to edit
-#	Index of column to change
-#	The value replacing the current path
-#
-# Results:
-#	The changed data set.
-
-proc ::bench::edit {data col new} {
-
-    if {![string is integer -strict $col]} {
-	return -code error "Ref.column: Expected integer, but got \"$col\""
-    }
-    if {$col < 1} {
-	return -code error "Ref.column out of bounds"
-    }
-
-    array set DATA $data
-    set ipkeys [array names DATA interp*]
-
-    if {$col > [llength $ipkeys]} {
-	return -code error "Ref.column out of bounds"
-    }
-    incr col -1
-    set refip [lindex [lindex [lsort -dict $ipkeys] $col] 1]
-
-    if {[string equal $new $refip]} {
-	# No change, quick return
-	return $data
-    }
-
-    set refkey [list interp $refip]
-    set DATA([list interp $new]) $DATA($refkey)
-    unset                         DATA($refkey)
-
-    foreach key [array names DATA [list * $refip]] {
-	if {![string equal [lindex $key 0] "usec"]} continue
-	foreach {__ desc ip} $key break
-	set DATA([list usec $desc $new]) $DATA($key)
-	unset                             DATA($key)
-    }
-
-    return [array get DATA]
-}
-
-# ::bench::del --
-#
-#	Remove the data for an interp.
-#
-# Arguments:
-#	Data to edit
-#	Index of column to remove
-#
-# Results:
-#	The changed data set.
-
-proc ::bench::del {data col} {
-
-    if {![string is integer -strict $col]} {
-	return -code error "Ref.column: Expected integer, but got \"$col\""
-    }
-    if {$col < 1} {
-	return -code error "Ref.column out of bounds"
-    }
-
-    array set DATA $data
-    set ipkeys [array names DATA interp*]
-
-    if {$col > [llength $ipkeys]} {
-	return -code error "Ref.column out of bounds"
-    }
-    incr col -1
-    set refip [lindex [lindex [lsort -dict $ipkeys] $col] 1]
-
-    unset DATA([list interp $refip])
-
-    # Do not use 'array unset'. Keep 8.2 clean.
-    foreach key [array names DATA [list * $refip]] {
-	if {![string equal [lindex $key 0] "usec"]} continue
-	unset DATA($key)
-    }
-
-    return [array get DATA]
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Result formatting.
-
-# ::bench::out::raw --
-#
-#	Format the result of a benchmark run.
-#	Style: Raw data.
-#
-# Arguments:
-#	DATA dict
-#
-# Results:
-#	String containing the formatted DATA.
-
-proc ::bench::out::raw {data} {
-    return $data
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Internal commands
-
-proc ::bench::CheckPkgDirArg {path {expected {}}} {
-    # Allow empty string, special.
-    if {![string length $path]} return
-
-    if {![file isdirectory $path]} {
-	return -code error \
-	    "The path \"$path\" is not a directory."
-    }
-    if {![file readable $path]} {
-	return -code error \
-	    "The path \"$path\" is not readable."
-    }
-}
-
-proc ::bench::Invoke {ip ver pkgdir} {
-    variable self
-    # Import remainder of the current configuration/settings.
-
-    upvar 1 DATA DATA match match rmatch rmatch \
-	iters iters errors errors threads threads \
-	files files
-
-    if {[string length $pkgdir]} {
-	log::info "Benchmark $ver ($pkgdir) $ip"
-	set idstr "$ip ($pkgdir)"
-    } else {
-	log::info "Benchmark $ver $ip"
-	set idstr $ip
-    }
-
-    set DATA([list interp $idstr]) $ver
-
-    set cmd [list $ip [file join $self libbench.tcl] \
-		 -match   $match   \
-		 -rmatch  $rmatch  \
-		 -iters   $iters   \
-		 -interp  $ip      \
-		 -errors  $errors  \
-		 -threads $threads \
-		 -pkgdir  $pkgdir  \
-		]
-
-    # Determine elapsed time per file, logged.
-    set start [clock seconds]
-
-    array set tmp {}
-
-    if {$threads} {
-	if {[catch {
-	    eval exec $cmd $files
-	} output]} {
-	    if {$errors} {
-		error $::errorInfo
-	    }
-	} else {
-	    array set tmp $output
-	}
-    } else {
-	foreach file $files {
-	    log::info [file tail $file]
-	    if {[catch {
-		eval exec [linsert $cmd end $file]
-	    } output]} {
-		if {$errors} {
-		    error $::errorInfo
-		} else {
-		    continue
-		}
-	    } else {
-		array set tmp $output
-	    }
-	}
-    }
-
-    catch {unset tmp(Sourcing)}
-    catch {unset tmp(__THREADED)}
-
-    foreach desc [array names tmp] {
-	set DATA([list desc $desc]) {}
-	set DATA([list usec $desc $idstr]) $tmp($desc)
-    }
-
-    unset tmp
-    set elapsed [expr {[clock seconds] - $start}]
-
-    set hour [expr {$elapsed / 3600}]
-    set min  [expr {$elapsed / 60}]
-    set sec  [expr {$elapsed % 60}]
-    log::info " [format %.2d:%.2d:%.2d $hour $min $sec] elapsed"
-    return
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Initialize internal data structures.
-
-namespace eval ::bench {
-    variable self [file join [pwd] [file dirname [info script]]]
-
-    logger::init bench
-    logger::import -force -all -namespace log bench
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Ready to run
-
-package provide bench 0.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_read.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_read.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,162 +1,0 @@
-# bench_read.tcl --
-#
-#	Management of benchmarks, reading results in various formats.
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# library derived from runbench.tcl application (C) Jeff Hobbs.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: bench_read.tcl,v 1.3 2006/06/13 23:20:30 andreas_kupries Exp $
-
-# ### ### ### ######### ######### ######### ###########################
-## Requisites - Packages and namespace for the commands and data.
-
-package require Tcl 8.2
-package require csv
-
-namespace eval ::bench::in {}
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Result reading
-
-# ::bench::in::read --
-#
-#	Read a bench result in any of the raw/csv/text formats
-#
-# Arguments:
-#	path to file to read
-#
-# Results:
-#	DATA dictionary, internal representation of the bench results.
-
-proc ::bench::in::read {file} {
-
-    set f [open $file r]
-    set head [gets $f]
-
-    if {![string match "# -\\*- tcl -\\*- bench/*" $head]} {
-	return -code error "Bad file format, not a benchmark file"
-    } else {
-	regexp {bench/(.*)$} $head -> format
-
-	switch -exact -- $format {
-	    raw - csv - text {
-		set res [RD$format $f]
-	    }
-	    default {
-		return -code error "Bad format \"$val\", expected text, csv, or raw"
-	    }
-	}
-    }
-    close $f
-    return $res
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Internal commands
-
-proc ::bench::in::RDraw {chan} {
-    return [string trimright [::read $chan]]
-}
-
-proc ::bench::in::RDcsv {chan} {
-    # Lines                                     Format
-    # First line is number of interpreters #n.  int
-    # Next to 1+n is interpreter data.          id,ver,path
-    # Beyond is benchmark results.              id,desc,res1,...,res#n
-
-    array set DATA {}
-
-    # #Interp ...
-
-    set nip [lindex [csv::split [gets $chan]] 0]
-
-    # Interp data ...
-
-    set iplist {}
-    for {set i 0} {$i < $nip} {incr i} {
-	foreach {__ ver ip} [csv::split [gets $chan]] break
-
-	set DATA([list interp $ip]) $ver
-	lappend iplist $ip
-    }
-
-    # Benchmark data ...
-
-    while {[gets $chan line] >= 0} {
-	set line [string trim $line]
-	if {$line == {}} break
-	set line [csv::split $line]
-	set desc [lindex $line 1]
-
-	set DATA([list desc $desc]) {}
-	foreach val [lrange $line 2 end] ip $iplist {
-	    if {$val == {}} continue
-	    set DATA([list usec $desc $ip]) $val
-	}
-    }
-
-    return [array get DATA]
-}
-
-proc ::bench::in::RDtext {chan} {
-    array set DATA {}
-
-    # Interp data ...
-
-    # Empty line     - ignore
-    # "id: ver path" - interp data.
-    # Empty line     - separator before benchmark data.
-
-    set n 0
-    set iplist {}
-    while {[gets $chan line] >= 0} {
-	set line [string trim $line]
-	if {$line == {}} {
-	    incr n
-	    if {$n == 2} break
-	    continue
-	}
-
-	regexp {[^:]+: ([^ ]+) (.*)$} $line -> ver ip
-	set DATA([list interp $ip]) $ver
-	lappend iplist $ip
-    }
-
-    # Benchmark data ...
-
-    # '---' -> Ignore.
-    # '|' column separators. Remove spaces around it. Then treat line
-    # as CSV data with a particular separator.
-    # Ignore the INTERP line.
-
-    while {[gets $chan line] >= 0} {
-	set line [string trim $line]
-	if {$line == {}}                     continue
-	if {[string match "+---*"    $line]} continue
-	if {[string match "*INTERP*" $line]} continue
-
-	regsub -all "\\| +" $line {|} line
-	regsub -all " +\\|" $line {|} line
-	set line [csv::split [string trim $line |] |]
-	set desc [lindex $line 1]
-
-	set DATA([list desc $desc]) {}
-	foreach val [lrange $line 2 end] ip $iplist {
-	    if {$val == {}} continue
-	    set DATA([list usec $desc $ip]) $val
-	}
-    }
-
-    return [array get DATA]
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Initialize internal data structures.
-
-# ### ### ### ######### ######### ######### ###########################
-## Ready to run
-
-package provide bench::in 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_wcsv.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_wcsv.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,101 +1,0 @@
-# bench_wtext.tcl --
-#
-#	Management of benchmarks, formatted text.
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# library derived from runbench.tcl application (C) Jeff Hobbs.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: bench_wcsv.tcl,v 1.4 2007/01/21 23:29:06 andreas_kupries Exp $
-
-# ### ### ### ######### ######### ######### ###########################
-## Requisites - Packages and namespace for the commands and data.
-
-package require Tcl 8.2
-package require csv
-
-namespace eval ::bench::out {}
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Benchmark execution
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Result formatting.
-
-# ::bench::out::csv --
-#
-#	Format the result of a benchmark run.
-#	Style: CSV
-#
-# Arguments:
-#	DATA dict
-#
-# Results:
-#	String containing the formatted DATA.
-
-proc ::bench::out::csv {data} {
-    array set DATA $data
-    set CSV {}
-
-    # 1st record:              #shells
-    # 2nd record to #shells+1: Interpreter data (id, version, path)
-    # #shells+2 to end:        Benchmark data (id,desc,result1,...,result#shells)
-
-    # --- --- ----
-    # #interpreters used
-
-    set ipkeys [array names DATA interp*]
-    lappend CSV [csv::join [list [llength $ipkeys]]]
-
-    # --- --- ----
-    # Table 1: Interpreter information.
-
-    set n 1
-    set iplist {}
-    foreach key [lsort -dict $ipkeys] {
-	set ip [lindex $key 1]
-	lappend CSV [csv::join [list $n $DATA($key) $ip]]
-	set DATA($key) $n
-	incr n
-	lappend iplist $ip
-    }
-
-    # --- --- ----
-    # Table 2: Benchmark information
-
-    set dlist {}
-    foreach key [lsort -dict -index 1 [array names DATA desc*]] {
-	lappend dlist [lindex $key 1]
-    }
-
-    set n 1
-    foreach desc $dlist { 
-	set record {}
-	lappend record $n
-	lappend record $desc
-	foreach ip $iplist {
-	    if {[catch {
-		lappend record $DATA([list usec $desc $ip])
-	    }]} {
-		lappend record {}
-	    }
-	}
-	lappend CSV [csv::join $record]
-	incr n
-    }
-
-    return [join $CSV \n]
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Internal commands
-
-# ### ### ### ######### ######### ######### ###########################
-## Initialize internal data structures.
-
-# ### ### ### ######### ######### ######### ###########################
-## Ready to run
-
-package provide bench::out::csv 0.1.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_wtext.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/bench_wtext.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,165 +1,0 @@
-# bench_wtext.tcl --
-#
-#	Management of benchmarks, formatted text.
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# library derived from runbench.tcl application (C) Jeff Hobbs.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: bench_wtext.tcl,v 1.4 2007/01/21 23:29:06 andreas_kupries Exp $
-
-# ### ### ### ######### ######### ######### ###########################
-## Requisites - Packages and namespace for the commands and data.
-
-package require Tcl 8.2
-package require struct::matrix
-package require report
-
-namespace eval ::bench::out {}
-
-# ### ### ### ######### ######### ######### ###########################
-## Public API - Result formatting.
-
-# ::bench::out::text --
-#
-#	Format the result of a benchmark run.
-#	Style: TEXT
-#
-#	General structure like CSV, but nicely formatted and aligned
-#	columns.
-#
-# Arguments:
-#	DATA dict
-#
-# Results:
-#	String containing the formatted DATA.
-
-proc ::bench::out::text {data} {
-    array set DATA $data
-    set LINES {}
-
-    # 1st line to #shells: Interpreter data (id, version, path)
-    # #shells+1 to end:    Benchmark data (id,desc,result1,...,result#shells)
-
-    lappend LINES {}
-
-    # --- --- ----
-    # Table 1: Interpreter information.
-
-    set ipkeys [array names DATA interp*]
-    set n 1
-    set iplist {}
-    set vlen 0
-    foreach key [lsort -dict $ipkeys] {
-	lappend iplist [lindex $key 1]
-	incr n
-	set l [string length $DATA($key)]
-	if {$l > $vlen} {set vlen $l}
-    }
-    set idlen [string length $n]
-
-    set dlist {}
-    set n 1
-    foreach key [lsort -dict -index 1 [array names DATA desc*]] {
-	lappend dlist [lindex $key 1]
-	incr n
-    }
-    set didlen [string length $n]
-
-    set n 1
-    set record [list "" INTERP]
-    foreach ip $iplist {
-	set v $DATA([list interp $ip])
-	lappend LINES " [PADL $idlen $n]: [PADR $vlen $v] $ip"
-	lappend record $n
-	incr n
-    }
-
-    lappend LINES {}
-
-    # --- --- ----
-    # Table 2: Benchmark information
-
-    set m [struct::matrix m]
-    $m add columns [expr {2 + [llength $iplist]}]
-    $m add row $record
-
-    set n 1
-    foreach desc $dlist { 
-	set     record [list $n]
-	lappend record $desc
-
-	foreach ip $iplist {
-	    if {[catch {
-		set val $DATA([list usec $desc $ip])
-	    }]} {
-		set val {}
-	    }
-	    if {[string is double -strict $val]} {
-		lappend record [format %.2f $val]
-	    } else {
-		lappend record [format %s   $val]
-	    }
-	}
-	$m add row $record
-	incr n
-    }
-
-    ::report::defstyle simpletable {} {
-	data	set [split "[string repeat "| "   [columns]]|"]
-	top	set [split "[string repeat "+ - " [columns]]+"]
-	bottom	set [top get]
-	top	enable
-	bottom	enable
-
-	set c [columns]
-	justify 0 right
-	pad 0 both
-
-	if {$c > 1} {
-	    justify 1 left
-	    pad 1 both
-	}
-	for {set i 2} {$i < $c} {incr i} {
-	    justify $i right
-	    pad $i both
-	}
-    }
-    ::report::defstyle captionedtable {{n 1}} {
-	simpletable
-	topdata   set [data get]
-	topcapsep set [top get]
-	topcapsep enable
-	tcaption $n
-    }
-
-    set r [report::report r [$m columns] style captionedtable]
-    lappend LINES [$m format 2string $r]
-    $m destroy
-    $r destroy
-
-    return [join $LINES \n]
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Internal commands
-
-proc ::bench::out::PADL {max str} {
-    format "%${max}s" $str
-    #return "[PAD $max $str]$str"
-}
-
-proc ::bench::out::PADR {max str} {
-    format "%-${max}s" $str
-    #return "$str[PAD $max $str]"
-}
-
-# ### ### ### ######### ######### ######### ###########################
-## Initialize internal data structures.
-
-# ### ### ### ######### ######### ######### ###########################
-## Ready to run
-
-package provide bench::out::text 0.1.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/libbench.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/libbench.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,540 +1,0 @@
-# -*- tcl -*-
-# libbench.tcl ?(<option> <value>)...? <benchFile>...
-#
-# This file has to have code that works in any version of Tcl that
-# the user would want to benchmark.
-#
-# RCS: @(#) $Id: libbench.tcl,v 1.3 2007/08/21 20:02:21 andreas_kupries Exp $
-#
-# Copyright (c) 2000-2001 Jeffrey Hobbs.
-# Copyright (c) 2007      Andreas Kupries
-#
-
-# This code provides the supporting commands for the execution of a
-# benchmark files. It is actually an application and is exec'd by the
-# management code.
-
-# Options:
-# -help				Print usage message.
-# -rmatch <regexp-pattern>	Run only tests whose description matches the pattern.
-# -match  <glob-pattern>	Run only tests whose description matches the pattern.
-# -interp <name>		Name of the interp running the benchmarks.
-# -thread <num>                 Invoke threaded benchmarks, number of threads to use.
-# -errors <boolean>             Throw errors, or not.
-
-# Note: If both -match and -rmatch are specified then _both_
-# apply. I.e. a benchmark will be run if and only if it matches both
-# patterns.
-
-# Application activity and results are communicated to the highlevel
-# management via text written to stdout. Each line written is a list
-# and has one of the following forms:
-#
-# __THREADED <version>     - Indicates threaded mode, and version
-#                            of package Thread in use.
-#
-# Sourcing {<desc>: <res>} - Benchmark <desc> has started.
-#                            <res> is the result from executing
-#                            it once (compilation of body.)
-#
-# Sourcing <file>          - Benchmark file <file> starts execution.
-#
-# <desc> <res>             - Result of a benchmark.
-#
-# The above implies that no benchmark may use the strings 'Sourcing'
-# or '__THREADED' as their description.
-
-# We will put our data into these named globals.
-
-global BENCH bench
-
-# 'BENCH' contents:
-#
-# - ERRORS  : Boolean flag. If set benchmark output mismatches are
-#             reported by throwing an error. Otherwise they are simply
-#             listed as BAD_RES. Default true. Can be set/reset via
-#             option -errors.
-#
-# - MATCH   : Match pattern, see -match, default empty, aka everything
-#             matches.
-#
-# - RMATCH  : Match pattern, see -rmatch, default empty, aka
-#             everything matches.
-#
-# - OUTFILE : Name of output file, default is special value "stdout".
-# - OUTFID  : Channel for output.
-#
-# The outfile cannot be set by the caller, thus output is always
-# written to stdout.
-#
-# - FILES   : List of benchmark files to run.
-#
-# - ITERS   : Number of iterations to run a benchmark body, default
-#             1000. Can be overridden by the individual benchmarks.
-#
-# - THREADS : Number of threads to use. 0 signals no threading.
-#             Limited to number of files if there are less files than
-#             requested threads.
-#
-# - EXIT    : Boolean flag. True when appplication is run by wish, for
-#             special exit processing. ... Actually always true.
-#
-# - INTERP  : Name of the interpreter running the benchmarks. Is the
-#             executable running this code. Can be overridden via the
-#             command line option -interp.
-#
-# - uniqid  : Counter for 'bench_tmpfile' to generate unique names of
-#             tmp files.
-#
-# - us      : Thread id of main thread.
-#
-# - inuse   : Number of threads active, present and relevant only in
-#             threaded mode.
-#
-# - file    : Currently executed benchmark file. Relevant only in
-#             non-threaded mode.
-
-#
-# 'bench' contents.
-
-# Benchmark results, mapping from the benchmark descriptions to their
-# results. Usually time in microseconds, but the following special
-# values can occur:
-#
-# - BAD_RES    - Result from benchmark body does not match expectations.
-# - ERR        - Benchmark body aborted with an error.
-# - Any string - Forced by error code 666 to pass to management.
-
-#
-# We claim all procedures starting with bench*
-#
-
-# bench_tmpfile --
-#
-#   Return a temp file name that can be modified at will
-#
-# Arguments:
-#   None
-#
-# Results:
-#   Returns file name
-#
-proc bench_tmpfile {} {
-    global tcl_platform env BENCH
-    if {![info exists BENCH(uniqid)]} { set BENCH(uniqid) 0 }
-    set base "tclbench[incr BENCH(uniqid)].dat"
-    if {[info exists tcl_platform(platform)]} {
-	if {$tcl_platform(platform) == "unix"} {
-	    return "/tmp/$base"
-	} elseif {$tcl_platform(platform) == "windows"} {
-	    return [file join $env(TEMP) $base]
-	} else {
-	    return $base
-	}
-    } else {
-	# The Good Ol' Days (?) when only Unix support existed
-	return "/tmp/$base"
-    }
-}
-
-# bench_rm --
-#
-#   Remove a file silently (no complaining)
-#
-# Arguments:
-#   args	Files to delete
-#
-# Results:
-#   Returns nothing
-#
-proc bench_rm {args} {
-    foreach file $args {
-	if {[info tclversion] > 7.4} {
-	    catch {file delete $file}
-	} else {
-	    catch {exec /bin/rm $file}
-	}
-    }
-}
-
-# bench --
-#
-#   Main bench procedure.
-#   The bench test is expected to exit cleanly.  If an error occurs,
-#   it will be thrown all the way up.  A bench proc may return the
-#   special code 666, which says take the string as the bench value.
-#   This is usually used for N/A feature situations.
-#
-# Arguments:
-#
-#   -pre	script to run before main timed body
-#   -body	script to run as main timed body
-#   -post	script to run after main timed body
-#   -ipre	script to run before timed body, per iteration of the body.
-#   -ipost	script to run after timed body, per iteration of the body.
-#   -desc	message text
-#   -iterations	<#>
-#
-# Note:
-#
-#   Using -ipre and/or -ipost will cause us to compute the average
-#   time ourselves, i.e. 'time body 1' n times. Required to ensure
-#   that prefix/post operation are executed, yet not timed themselves.
-#
-# Results:
-#
-#   Returns nothing
-#
-# Side effects:
-#
-#   Sets up data in bench global array
-#
-proc bench {args} {
-    global BENCH bench errorInfo errorCode
-
-    # -pre script
-    # -body script
-    # -desc msg
-    # -post script
-    # -ipre script
-    # -ipost script
-    # -iterations <#>
-    array set opts {
-	-pre	{}
-	-body	{}
-	-desc	{}
-	-post	{}
-	-ipre	{}
-	-ipost	{}
-    }
-    set opts(-iter) $BENCH(ITERS)
-    while {[llength $args]} {
-	set key [lindex $args 0]
-	switch -glob -- $key {
-	    -res*	{ set opts(-res)  [lindex $args 1] }
-	    -pr*	{ set opts(-pre)  [lindex $args 1] }
-	    -po*	{ set opts(-post) [lindex $args 1] }
-	    -ipr*	{ set opts(-ipre)  [lindex $args 1] }
-	    -ipo*	{ set opts(-ipost) [lindex $args 1] }
-	    -bo*	{ set opts(-body) [lindex $args 1] }
-	    -de*	{ set opts(-desc) [lindex $args 1] }
-	    -it*	{
-		# Only change the iterations when it is smaller than
-		# the requested default
-		set val [lindex $args 1]
-		if {$opts(-iter) > $val} { set opts(-iter) $val }
-	    }
-	    default {
-		error "unknown option $key"
-	    }
-	}
-	set args [lreplace $args 0 1]
-    }
-    if {($BENCH(MATCH) != "") && ![string match $BENCH(MATCH) $opts(-desc)]} {
-	return
-    }
-    if {($BENCH(RMATCH) != "") && ![regexp $BENCH(RMATCH) $opts(-desc)]} {
-	return
-    }
-    if {$opts(-pre) != ""} {
-	uplevel \#0 $opts(-pre)
-    }
-    if {$opts(-body) != ""} {
-	# always run it once to remove compile phase confusion
-	if {$opts(-ipre) != ""} {
-	    uplevel \#0 $opts(-ipre)
-	}
-	set code [catch {uplevel \#0 $opts(-body)} res]
-	if {$opts(-ipost) != ""} {
-	    uplevel \#0 $opts(-ipost)
-	}
-	if {!$code && [info exists opts(-res)] \
-		&& [string compare $opts(-res) $res]} {
-	    if {$BENCH(ERRORS)} {
-		return -code error "Result was:\n$res\nResult\
-			should have been:\n$opts(-res)"
-	    } else {
-		set res "BAD_RES"
-	    }
-	    set bench($opts(-desc)) $res
-	    puts $BENCH(OUTFID) [list Sourcing "$opts(-desc): $res"]
-	} else {
-	    if {($opts(-ipre) != "") || ($opts(-ipost) != "")} {
-
-		# We do the averaging on our own, to allow untimed
-		# pre/post execution per iteration. We catch and
-		# handle problems in the pre/post code as if
-		# everything was executed as one block (like it would
-		# be in the other path). We are using floating point
-		# to avoid integer overflow, easily happening when
-		# accumulating a high number (iterations) of large
-		# integers (microseconds).
-
-		set total 0.0
-		for {set i 0} {$i < $opts(-iter)} {incr i} {
-		    set code 0
-		    if {$opts(-ipre) != ""} {
-			set code [catch {uplevel \#0 $opts(-ipre)} res]
-			if {$code} break
-		    }
-		    set code [catch {uplevel \#0 [list time $opts(-body) 1]} res]
-		    if {$code} break
-		    set total [expr {$total + [lindex $res 0]}]
-		    if {$opts(-ipost) != ""} {
-			set code [catch {uplevel \#0 $opts(-ipost)} res]
-			if {$code} break
-		    }
-		}
-		if {!$code} {
-		    set res [list [expr {int ($total/$opts(-iter))}] microseconds per iteration]
-		}
-	    } else {
-		set code [catch {uplevel \#0 \
-			[list time $opts(-body) $opts(-iter)]} res]
-	    }
-	    if {!$BENCH(THREADS)} {
-		if {$code == 0} {
-		    # Get just the microseconds value from the time result
-		    set res [lindex $res 0]
-		} elseif {$code != 666} {
-		    # A 666 result code means pass it through to the bench
-		    # suite. Otherwise throw errors all the way out, unless
-		    # we specified not to throw errors (option -errors 0 to
-		    # libbench).
-		    if {$BENCH(ERRORS)} {
-			return -code $code -errorinfo $errorInfo \
-				-errorcode $errorCode
-		    } else {
-			set res "ERR"
-		    }
-		}
-		set bench($opts(-desc)) $res
-		puts $BENCH(OUTFID) [list Sourcing "$opts(-desc): $res"]
-	    } else {
-		# Threaded runs report back asynchronously
-		thread::send $BENCH(us) \
-			[list thread_report $opts(-desc) $code $res]
-	    }
-	}
-    }
-    if {($opts(-post) != "") && [catch {uplevel \#0 $opts(-post)} err] \
-	    && $BENCH(ERRORS)} {
-	return -code error "post code threw error:\n$err"
-    }
-    return
-}
-
-proc usage {} {
-    set me [file tail [info script]]
-    puts stderr "Usage: $me ?options?\
-	    \n\t-help			# print out this message\
-	    \n\t-rmatch <regexp>	# only run tests matching this pattern\
-	    \n\t-match <glob>		# only run tests matching this pattern\
-	    \n\t-interp	<name>		# name of interp (tries to get it right)\
-	    \n\t-thread	<num>		# number of threads to use\
-	    \n\tfileList		# files to benchmark"
-    exit 1
-}
-
-#
-# Process args
-#
-if {[catch {set BENCH(INTERP) [info nameofexec]}]} {
-    set BENCH(INTERP) $argv0
-}
-foreach {var val} {
-	ERRORS		1
-	MATCH		{}
-	RMATCH		{}
-	OUTFILE		stdout
-	FILES		{}
-	ITERS		1000
-	THREADS		0
-        PKGDIR          {}
-	EXIT		"[info exists tk_version]"
-} {
-    if {![info exists BENCH($var)]} {
-	set BENCH($var) [subst $val]
-    }
-}
-set BENCH(EXIT) 1
-
-if {[llength $argv]} {
-    while {[llength $argv]} {
-	set key [lindex $argv 0]
-	switch -glob -- $key {
-	    -help*	{ usage }
-	    -err*	{ set BENCH(ERRORS)  [lindex $argv 1] }
-	    -int*	{ set BENCH(INTERP)  [lindex $argv 1] }
-	    -rmat*	{ set BENCH(RMATCH)  [lindex $argv 1] }
-	    -mat*	{ set BENCH(MATCH)   [lindex $argv 1] }
-	    -iter*	{ set BENCH(ITERS)   [lindex $argv 1] }
-	    -thr*	{ set BENCH(THREADS) [lindex $argv 1] }
-            -pkg*       { set BENCH(PKGDIR)  [lindex $argv 1] }
-	    default {
-		foreach arg $argv {
-		    if {![file exists $arg]} { usage }
-		    lappend BENCH(FILES) $arg
-		}
-		break
-	    }
-	}
-	set argv [lreplace $argv 0 1]
-    }
-}
-
-if {[string length $BENCH(PKGDIR)]} {
-    set auto_path [linsert $auto_path 0 $BENCH(PKGDIR)]
-}
-
-if {$BENCH(THREADS)} {
-    # We have to be able to load threads if we want to use threads, and
-    # we don't want to create more threads than we have files.
-    if {[catch {package require Thread}]} {
-	set BENCH(THREADS) 0
-    } elseif {[llength $BENCH(FILES)] < $BENCH(THREADS)} {
-	set BENCH(THREADS) [llength $BENCH(FILES)]
-    }
-}
-
-rename exit exit.true
-proc exit args {
-    error "called \"exit $args\" in benchmark test"
-}
-
-if {[string compare $BENCH(OUTFILE) stdout]} {
-    set BENCH(OUTFID) [open $BENCH(OUTFILE) w]
-} else {
-    set BENCH(OUTFID) stdout
-}
-
-#
-# Everything that gets output must be in pairwise format, because
-# the data will be collected in via an 'array set'.
-#
-
-if {$BENCH(THREADS)} {
-    # Each file must run in it's own thread because of all the extra
-    # header stuff they have.
-    #set DEBUG 1
-    proc thread_one {{id 0}} {
-	global BENCH
-	set file [lindex $BENCH(FILES) 0]
-	set BENCH(FILES) [lrange $BENCH(FILES) 1 end]
-	if {[file exists $file]} {
-	    incr BENCH(inuse)
-	    puts $BENCH(OUTFID) [list Sourcing $file]
-	    if {$id} {
-		set them $id
-	    } else {
-		set them [thread::create]
-		thread::send -async $them { load {} Thread }
-		thread::send -async $them \
-			[list array set BENCH [array get BENCH]]
-		thread::send -async $them \
-			[list proc bench_tmpfile {} [info body bench_tmpfile]]
-		thread::send -async $them \
-			[list proc bench_rm {args} [info body bench_rm]]
-		thread::send -async $them \
-			[list proc bench {args} [info body bench]]
-	    }
-	    if {[info exists ::DEBUG]} {
-		puts stderr "SEND [clock seconds] thread $them $file INUSE\
-		$BENCH(inuse) of $BENCH(THREADS)"
-	    }
-	    thread::send -async $them [list source $file]
-	    thread::send -async $them \
-		    [list thread::send $BENCH(us) [list thread_ready $them]]
-	    #thread::send -async $them { thread::unwind }
-	}
-    }
-
-    proc thread_em {} {
-	global BENCH
-	while {[llength $BENCH(FILES)]} {
-	    if {[info exists ::DEBUG]} {
-		puts stderr "THREAD ONE [lindex $BENCH(FILES) 0]"
-	    }
-	    thread_one
-	    if {$BENCH(inuse) >= $BENCH(THREADS)} {
-		break
-	    }
-	}
-    }
-
-    proc thread_ready {id} {
-	global BENCH
-
-	incr BENCH(inuse) -1
-	if {[llength $BENCH(FILES)]} {
-	    if {[info exists ::DEBUG]} {
-		puts stderr "SEND ONE [clock seconds] thread $id"
-	    }
-	    thread_one $id
-	} else {
-	    if {[info exists ::DEBUG]} {
-		puts stderr "UNWIND thread $id"
-	    }
-	    thread::send -async $id { thread::unwind }
-	}
-    }
-
-    proc thread_report {desc code res} {
-	global BENCH bench errorInfo errorCode
-
-	if {$code == 0} {
-	    # Get just the microseconds value from the time result
-	    set res [lindex $res 0]
-	} elseif {$code != 666} {
-	    # A 666 result code means pass it through to the bench suite.
-	    # Otherwise throw errors all the way out, unless we specified
-	    # not to throw errors (option -errors 0 to libbench).
-	    if {$BENCH(ERRORS)} {
-		return -code $code -errorinfo $errorInfo \
-			-errorcode $errorCode
-	    } else {
-		set res "ERR"
-	    }
-	}
-	set bench($desc) $res
-    }
-
-    proc thread_finish {{delay 4000}} {
-	global BENCH bench
-	set val [expr {[llength [thread::names]] > 1}]
-	#set val [expr {$BENCH(inuse)}]
-	if {$val} {
-	    after $delay [info level 0]
-	} else {
-	    foreach desc [array names bench] {
-		puts $BENCH(OUTFID) [list $desc $bench($desc)]
-	    }
-	    if {$BENCH(EXIT)} {
-		exit.true ; # needed for Tk tests
-	    }
-	}
-    }
-
-    set BENCH(us) [thread::id]
-    set BENCH(inuse) 0 ; # num threads in use
-    puts $BENCH(OUTFID) [list __THREADED [package provide Thread]]
-
-    thread_em
-    thread_finish
-    vwait forever
-} else {
-    foreach BENCH(file) $BENCH(FILES) {
-	if {[file exists $BENCH(file)]} {
-	    puts $BENCH(OUTFID) [list Sourcing $BENCH(file)]
-	    source $BENCH(file)
-	}
-    }
-
-    foreach desc [array names bench] {
-	puts $BENCH(OUTFID) [list $desc $bench($desc)]
-    }
-
-    if {$BENCH(EXIT)} {
-	exit.true ; # needed for Tk tests
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bench/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bench/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    return
-}
-package ifneeded bench            0.3.1 [list source [file join $dir bench.tcl]]
-package ifneeded bench::out::text 0.1.2 [list source [file join $dir bench_wtext.tcl]]
-package ifneeded bench::out::csv  0.1.2 [list source [file join $dir bench_wcsv.tcl]]
-package ifneeded bench::in        0.1   [list source [file join $dir bench_read.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bibtex/bibtex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bibtex/bibtex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,481 +1,0 @@
-#####
-#
-# "BibTeX parser"
-# http://wiki.tcl.tk/13719
-#
-# Tcl code harvested on:   7 Mar 2005, 23:55 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# bibtex.tcl --
-#
-#      A basic parser for BibTeX bibliography databases.
-#
-# Copyright (c) 2005 Neil Madden.
-# Copyright (c) 2005 Andreas Kupries.
-# License: Tcl/BSD style.
-
-### NOTES
-###
-### Need commands to introspect parser state. Especially the string
-### map (for testing of 'addStrings', should be useful in general as
-### well).
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require Tcl 8.4
-package require cmdline
-
-# ### ### ### ######### ######### #########
-## Implementation: Public API
-
-namespace eval ::bibtex {}
-
-# bibtex::parse --
-#
-#	Parse a bibtex file.
-#
-# parse ?options? ?bibtex?
-
-proc ::bibtex::parse {args} {
-    variable data
-    variable id
-
-    # Argument processing
-    if {[llength $args] < 1} {
-	set err "[lindex [info level 0] 0] ?options? ?bibtex?"
-	return -code error "wrong # args: should be \"$err\""
-    }
-
-    array set state {}
-    GetOptions $args state
-
-    # Initialize the parser state from the options, fill in default
-    # values, and handle the input according the specified mode.
-
-    set token bibtex[incr id]
-    foreach {k v} [array get state] {
-	set data($token,$k) $v
-    }
-
-    if {$state(stream)} {
-	# Text not in memory
-	if {!$state(bg)} {
-	    # Text from a channel, no async processing. We read everything
-	    # into memory and the handle it as before.
-
-	    set blockmode [fconfigure $state(-channel) -blocking]
-	    fconfigure $state(-channel) -blocking 1
-	    set data($token,buffer) [read $state(-channel)]
-	    fconfigure $state(-channel) -blocking $blockmode
-
-	    # Tell upcoming processing that the text is in memory.
-	    set state(stream) 0
-	} else {
-	    # Text from a channel, and processing is async. Create an
-	    # event handler for the incoming data.
-
-	    set data($token,done) 0
-	    fileevent $state(-channel) readable \
-		    [list ::bibtex::ReadChan $token]
-
-	    # Initialize the parser internal result buffer if we use plain
-	    # -command, and not the SAX api.
-	    if {!$state(sax)} {
-		set data($token,result) {}
-	    }
-	}
-    }
-
-    # Initialize the string mappings (none known), and the result
-    # accumulator.
-    set data($token,strings) {}
-    set data($token,result)  {}
-
-    if {!$state(stream)} {
-	ParseRecords $token 1
-	if {$state(sax)} {
-	    set result $token
-	} else {
-	    set result $data($token,result)
-	    destroy $token
-	}
-	return $result
-    }
-
-    # Assert: Processing is in background.
-    return $token
-}
-
-# Cleanup a parser, cancelling any callbacks etc.
-
-proc ::bibtex::destroy {token} {
-    variable data
-
-    if {![info exists data($token,stream)]} {
-	return -code error "Illegal bibtex parser \"$token\""
-    }
-    if {$data($token,stream)} {
-	fileevent $data($token,-channel) readable {}
-    }
-
-    array unset data $token,*
-    return
-}
-
-
-proc ::bibtex::wait {token} {
-    variable data
-
-    if {![info exists data($token,stream)]} {
-	return -code error "Illegal bibtex parser \"$token\""
-    }
-    vwait ::bibtex::data($token,done)
-    return
-}
-
-# bibtex::addStrings --
-#
-#	Add strings to the map for a particular parser. All strings are
-#	expanded at parse time.
-
-proc ::bibtex::addStrings {token strings} {
-    variable data
-    eval [linsert $strings 0 lappend data($token,strings)]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Implementation: Private utility routines
-
-proc ::bibtex::AddRecord {token type key recdata} {
-    variable data
-    lappend  data($token,result) [list $type $key $recdata]
-    return
-}
-
-proc ::bibtex::GetOptions {argv statevar} {
-    upvar 1 $statevar state
-
-    # Basic processing of the argument list
-    # and the options found therein.
-
-    set opts [lrange [::cmdline::GetOptionDefaults {
-	{command.arg         {}}
-	{channel.arg         {}}
-	{recordcommand.arg   {}}
-	{preamblecommand.arg {}}
-	{stringcommand.arg   {}}
-	{commentcommand.arg  {}}
-	{progresscommand.arg {}}
-    } result] 2 end] ;# Remove ? and help.
-
-    set argc [llength $argv]
-    while {[set err [::cmdline::getopt argv $opts opt arg]]} {
-	if {$err < 0} {
-	    set olist ""
-	    foreach o [lsort $opts] {
-		if {[string match *.arg $o]} {
-		    set o [string range $o 0 end-4]
-		}
-		lappend olist -$o
-	    }
-	    return -code error "bad option \"$opt\",\
-		    should be one of\
-		    [linsert [join $olist ", "] end-1 or]"
-	}
-	set state(-$opt) $arg
-    }
-
-    # Check the information gained so far
-    # for inconsistencies and/or missing
-    # pieces.
-
-    set sax [expr {
-	[info exists state(-recordcommand)]   ||
-	[info exists state(-preamblecommand)] ||
-	[info exists state(-stringcommand)]   ||
-	[info exists state(-commentcommand)]  ||
-	[info exists state(-progresscommand)]
-    }] ; # {}
-
-    set bg [info exists state(-command)]
-
-    if {$sax && $bg} {
-	# Sax callbacks and channel completion callback exclude each
-	# other.
-	return -code error "The options -command and -TYPEcommand exclude each other"
-    }
-
-    set stream [info exists state(-channel)]
-
-    if {$stream} {
-	# Channel is present, a text is not allowed.
-	if {[llength $argv]} {
-	    return -code error "Option -channel and text exclude each other"
-	}
-
-	# The channel has to exist as well.
-	if {[lsearch -exact [file channels] $state(-channel)] < 0} {
-	    return -code error "Illegal channel handle \"$state(-channel)\""
-	}
-    } else {
-	# Channel is not present, we have to have a text, and only
-	# exactly one. And a general -command callback is not allowed.
-
-	if {![llength $argv]} {
-	    return -code error "Neither -channel nor text specified"
-	} elseif {[llength $argv] > 1} {
-	    return -code error "wrong # args: [lindex [info level 1] 0] ?options? ?bibtex?"
-	}
-
-	# Channel completion callback is not allowed if we are not
-	# reading from a channel.
-
-	if {$bg} {
-	    return -code error "Option -command and text exclude each other"
-	}
-
-	set state(buffer) [lindex $argv 0]
-    }
-
-    set state(stream) $stream
-    set state(sax)    $sax
-    set state(bg)     [expr {$sax || $bg}]
-
-    if {![info exists state(-stringcommand)]} {
-	set state(-stringcommand) [list ::bibtex::addStrings]
-    }
-    if {![info exists state(-recordcommand)] && (!$sax)} {
-	set state(-recordcommand) [list ::bibtex::AddRecord]
-    }
-    return
-}
-
-proc ::bibtex::Callback {token type args} {
-    variable data
-
-    #puts stdout "Callback ($token $type ($args))"
-
-    if {[info exists data($token,-${type}command)]} {
-	eval $data($token,-${type}command) [linsert $args 0 $token]
-    }
-    return
-}
-
-proc ::bibtex::ReadChan {token} {
-    variable data
-
-    # Read the waiting characters into our buffer and process
-    # them. The records are saved either through a user supplied
-    # record callback, or the standard callback for our non-sax
-    # processing.
-
-    set    chan $data($token,-channel)
-    append data($token,buffer) [read $chan]
-
-    if {[eof $chan]} {
-	# Final processing. In non-SAX mode we have to deliver the
-	# completed result before destroying the parser.
-
-	ParseRecords $token 1
-	set data($token,done) 1
-	if {!$data($token,sax)} {
-	    Callback $token {} $data($token,result)
-	}
-	return
-    }
-
-    # Processing of partial data.
-
-    ParseRecords $token 0
-    return
-}
-
-proc ::bibtex::Tidy {str} {
-    return [string tolower [string trim $str]]
-}
-
-proc ::bibtex::ParseRecords {token eof} {
-    # A rough BibTeX grammar (case-insensitive):
-    #
-    # Database      ::= (Junk '@' Entry)*
-    # Junk          ::= .*?
-    # Entry         ::= Record
-    #               |   Comment
-    #               |   String
-    #               |   Preamble
-    # Comment       ::= "comment" [^\n]* \n         -- ignored
-    # String        ::= "string" '{' Field* '}'
-    # Preamble      ::= "preamble" '{' .* '}'       -- (balanced)
-    # Record        ::= Type '{' Key ',' Field* '}'
-    #               |   Type '(' Key ',' Field* ')' -- not handled
-    # Type          ::= Name
-    # Key           ::= Name
-    # Field         ::= Name '=' Value
-    # Name          ::= [^\s\"#%'(){}]*
-    # Value         ::= [0-9]+
-    #               |   '"' ([^'"']|\\'"')* '"'
-    #               |   '{' .* '}'                  -- (balanced)
-
-    # " - Fixup emacs hilit confusion from the grammar above.
-    variable data
-    set bibtex $data($token,buffer)
-
-    # Split at each @ character which is at the beginning of a line,
-    # modulo whitespace. This is a heuristic to distinguish the @'s
-    # starting a new record from the @'s occuring inside a record, as
-    # part of email addresses. Empty pices at beginning or end are
-    # stripped before the split.
-
-    regsub -line -all {^[\n\r\f\t ]*@} $bibtex \000 bibtex
-    set db [split [string trim $bibtex \000] \000]
-
-    if {$eof} {
-	set total [llength $db]
-	set step  [expr {double($total) / 100.0}]
-	set istep [expr {$step > 1 ? int($step) : 1}]
-	set count 0
-    } else {
-	if {[llength $db] < 2} {
-	    # Nothing to process, or data which ay be incomplete.
-	    return
-	}
-
-	set data($token,buffer) [lindex $db end]
-	set db                  [lrange $db 0 end-1]
-
-	# Fake progress meter.
-	set count -1
-    }
-
-    foreach block $db {
-	if {$count < 0} {
-	    Callback $token progress -1
-	} elseif {([incr count] % $istep) == 0} {
-	    Callback $token progress [expr {int($count / $step)}]
-	}
-	if {[regexp -nocase {\s*comment([^\n])*\n(.*)} $block \
-		-> cmnt rest]} {
-	    # Are @comments blocks, or just 1 line?
-	    # Does anyone care?
-	    Callback $token comment $cmnt
-
-	} elseif {[regexp -nocase {\s*string[^\{]*\{(.*)\}[^\}]*} \
-		$block -> rest]} {
-	    # string macro defs
-	    Callback $token string [ParseBlock $rest]
-
-	} elseif {[regexp -nocase {\s*preamble[^\{]*\{(.*)\}[^\}]*} \
-		$block -> rest]} {
-	    Callback $token preamble $rest
-
-	} elseif {[regexp {([^\{]+)\{([^,]*),(.*)\}[^\}]*} \
-		$block -> type key rest]} {
-	    # Do any @string mappings (these are case insensitive)
-	    set rest [string map -nocase $data($token,strings) $rest]
-	    Callback $token record [Tidy $type] [string trim $key] \
-		    [ParseBlock $rest]
-	} else {
-	    ## FUTURE: Use a logger.
-	    puts stderr "Skipping: $block"
-	}
-    }
-}
-
-proc ::bibtex::ParseBlock {block} {
-    set ret   [list]
-    set index 0
-    while {
-	[regexp -start $index -indices -- \
-		{(\S+)[^=]*=(.*)} $block -> key rest]
-    } {
-	foreach {ks ke} $key break
-	set k [Tidy [string range $block $ks $ke]]
-	foreach {rs re} $rest break
-	foreach {v index} \
-		[ParseBibString $rs [string range $block $rs $re]] \
-		break
-	lappend ret $k $v
-    }
-    return $ret
-}
-
-proc ::bibtex::ParseBibString {index str} {
-    set count 0
-    set retstr ""
-    set escape 0
-    set string 0
-    foreach char [split $str ""] {
-	incr index
-	if {$escape} {
-	    set escape 0
-	} else {
-	    if {$char eq "\{"} {
-		incr count
-		continue
-	    } elseif {$char eq "\}"} {
-		incr count -1
-		if {$count < 0} {incr index -1; break}
-		continue
-	    } elseif {$char eq ","} {
-		if {$count == 0} break
-	    } elseif {$char eq "\\"} {
-		set escape 1
-		continue
-	    } elseif {$char eq "\""} {
-		# Managing the count ensures that comma inside of a
-		# string is not considered as the end of the field.
-		if {!$string} {
-		    incr count
-		    set string 1
-		} else {
-		    incr count -1
-		    set string 0
-		}
-		continue
-	    }
-	    # else: Nothing
-	}
-	append retstr $char
-    }
-    regsub -all {\s+} $retstr { } retstr
-    return [list [string trim $retstr] $index]
-}
-
-
-# ### ### ### ######### ######### #########
-## Internal. Package configuration and state.
-
-namespace eval bibtex {
-    # Counter for the generation of parser tokens.
-    variable id 0
-
-    # State of all parsers. Keys for each parser are prefixed with the
-    # parser token.
-    variable  data
-    array set data {}
-
-    # Keys and their meaning (listed without token prefix)
-    ##
-    # buffer
-    # eof
-    # channel    <-\/- Difference ?
-    # strings      |
-    # -async       |
-    # -blocksize   |
-    # -channel   <-/
-    # -recordcommand   -- callback for each record
-    # -preamblecommand -- callback for @preamble blocks
-    # -stringcommand   -- callback for @string macros
-    # -commentcommand  -- callback for @comment blocks
-    # -progresscommand -- callback to indicate progress of parse
-    ##
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-package provide bibtex 0.5
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/bibtex/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/bibtex/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded bibtex 0.5 [list source [file join $dir bibtex.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/blowfish/blowfish.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/blowfish/blowfish.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,720 +1,0 @@
-# blowfish.tcl - 
-#
-#   Pure-Tcl implementation of the Blowfish algorithm.
-#
-#   See http://www.schneier.com/blowfish.html for information about the
-#   Blowfish algorithm.
-#
-#   The implementation is derived from Paul Kocher's implementation,
-#   available at http://www.schneier.com/blowfish-download.html
-#
-# Copyright (C) 2004 Frank Pilhofer
-# Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-
-package require Tcl 8.2
-
-namespace eval blowfish {
-    variable version 1.0.3
-    variable rcsid {$Id: blowfish.tcl,v 1.9 2007/08/20 19:36:49 andreas_kupries Exp $}
-    variable uid ; if {![info exists uid]} { set uid 0 }
-    variable accel
-    array set accel {trf 0}
-
-    namespace export blowfish
-
-    variable ORIG_P {
-        0x243F6A88 0x85A308D3 0x13198A2E 0x03707344
-        0xA4093822 0x299F31D0 0x082EFA98 0xEC4E6C89
-        0x452821E6 0x38D01377 0xBE5466CF 0x34E90C6C
-        0xC0AC29B7 0xC97C50DD 0x3F84D5B5 0xB5470917
-        0x9216D5D9 0x8979FB1B
-    }
-
-    variable ORIG_S {
-        0xD1310BA6 0x98DFB5AC 0x2FFD72DB 0xD01ADFB7
-        0xB8E1AFED 0x6A267E96 0xBA7C9045 0xF12C7F99
-        0x24A19947 0xB3916CF7 0x0801F2E2 0x858EFC16
-        0x636920D8 0x71574E69 0xA458FEA3 0xF4933D7E
-        0x0D95748F 0x728EB658 0x718BCD58 0x82154AEE
-        0x7B54A41D 0xC25A59B5 0x9C30D539 0x2AF26013
-        0xC5D1B023 0x286085F0 0xCA417918 0xB8DB38EF
-        0x8E79DCB0 0x603A180E 0x6C9E0E8B 0xB01E8A3E
-        0xD71577C1 0xBD314B27 0x78AF2FDA 0x55605C60
-        0xE65525F3 0xAA55AB94 0x57489862 0x63E81440
-        0x55CA396A 0x2AAB10B6 0xB4CC5C34 0x1141E8CE
-        0xA15486AF 0x7C72E993 0xB3EE1411 0x636FBC2A
-        0x2BA9C55D 0x741831F6 0xCE5C3E16 0x9B87931E
-        0xAFD6BA33 0x6C24CF5C 0x7A325381 0x28958677
-        0x3B8F4898 0x6B4BB9AF 0xC4BFE81B 0x66282193
-        0x61D809CC 0xFB21A991 0x487CAC60 0x5DEC8032
-        0xEF845D5D 0xE98575B1 0xDC262302 0xEB651B88
-        0x23893E81 0xD396ACC5 0x0F6D6FF3 0x83F44239
-        0x2E0B4482 0xA4842004 0x69C8F04A 0x9E1F9B5E
-        0x21C66842 0xF6E96C9A 0x670C9C61 0xABD388F0
-        0x6A51A0D2 0xD8542F68 0x960FA728 0xAB5133A3
-        0x6EEF0B6C 0x137A3BE4 0xBA3BF050 0x7EFB2A98
-        0xA1F1651D 0x39AF0176 0x66CA593E 0x82430E88
-        0x8CEE8619 0x456F9FB4 0x7D84A5C3 0x3B8B5EBE
-        0xE06F75D8 0x85C12073 0x401A449F 0x56C16AA6
-        0x4ED3AA62 0x363F7706 0x1BFEDF72 0x429B023D
-        0x37D0D724 0xD00A1248 0xDB0FEAD3 0x49F1C09B
-        0x075372C9 0x80991B7B 0x25D479D8 0xF6E8DEF7
-        0xE3FE501A 0xB6794C3B 0x976CE0BD 0x04C006BA
-        0xC1A94FB6 0x409F60C4 0x5E5C9EC2 0x196A2463
-        0x68FB6FAF 0x3E6C53B5 0x1339B2EB 0x3B52EC6F
-        0x6DFC511F 0x9B30952C 0xCC814544 0xAF5EBD09
-        0xBEE3D004 0xDE334AFD 0x660F2807 0x192E4BB3
-        0xC0CBA857 0x45C8740F 0xD20B5F39 0xB9D3FBDB
-        0x5579C0BD 0x1A60320A 0xD6A100C6 0x402C7279
-        0x679F25FE 0xFB1FA3CC 0x8EA5E9F8 0xDB3222F8
-        0x3C7516DF 0xFD616B15 0x2F501EC8 0xAD0552AB
-        0x323DB5FA 0xFD238760 0x53317B48 0x3E00DF82
-        0x9E5C57BB 0xCA6F8CA0 0x1A87562E 0xDF1769DB
-        0xD542A8F6 0x287EFFC3 0xAC6732C6 0x8C4F5573
-        0x695B27B0 0xBBCA58C8 0xE1FFA35D 0xB8F011A0
-        0x10FA3D98 0xFD2183B8 0x4AFCB56C 0x2DD1D35B
-        0x9A53E479 0xB6F84565 0xD28E49BC 0x4BFB9790
-        0xE1DDF2DA 0xA4CB7E33 0x62FB1341 0xCEE4C6E8
-        0xEF20CADA 0x36774C01 0xD07E9EFE 0x2BF11FB4
-        0x95DBDA4D 0xAE909198 0xEAAD8E71 0x6B93D5A0
-        0xD08ED1D0 0xAFC725E0 0x8E3C5B2F 0x8E7594B7
-        0x8FF6E2FB 0xF2122B64 0x8888B812 0x900DF01C
-        0x4FAD5EA0 0x688FC31C 0xD1CFF191 0xB3A8C1AD
-        0x2F2F2218 0xBE0E1777 0xEA752DFE 0x8B021FA1
-        0xE5A0CC0F 0xB56F74E8 0x18ACF3D6 0xCE89E299
-        0xB4A84FE0 0xFD13E0B7 0x7CC43B81 0xD2ADA8D9
-        0x165FA266 0x80957705 0x93CC7314 0x211A1477
-        0xE6AD2065 0x77B5FA86 0xC75442F5 0xFB9D35CF
-        0xEBCDAF0C 0x7B3E89A0 0xD6411BD3 0xAE1E7E49
-        0x00250E2D 0x2071B35E 0x226800BB 0x57B8E0AF
-        0x2464369B 0xF009B91E 0x5563911D 0x59DFA6AA
-        0x78C14389 0xD95A537F 0x207D5BA2 0x02E5B9C5
-        0x83260376 0x6295CFA9 0x11C81968 0x4E734A41
-        0xB3472DCA 0x7B14A94A 0x1B510052 0x9A532915
-        0xD60F573F 0xBC9BC6E4 0x2B60A476 0x81E67400
-        0x08BA6FB5 0x571BE91F 0xF296EC6B 0x2A0DD915
-        0xB6636521 0xE7B9F9B6 0xFF34052E 0xC5855664
-        0x53B02D5D 0xA99F8FA1 0x08BA4799 0x6E85076A
-        0x4B7A70E9 0xB5B32944 0xDB75092E 0xC4192623
-        0xAD6EA6B0 0x49A7DF7D 0x9CEE60B8 0x8FEDB266
-        0xECAA8C71 0x699A17FF 0x5664526C 0xC2B19EE1
-        0x193602A5 0x75094C29 0xA0591340 0xE4183A3E
-        0x3F54989A 0x5B429D65 0x6B8FE4D6 0x99F73FD6
-        0xA1D29C07 0xEFE830F5 0x4D2D38E6 0xF0255DC1
-        0x4CDD2086 0x8470EB26 0x6382E9C6 0x021ECC5E
-        0x09686B3F 0x3EBAEFC9 0x3C971814 0x6B6A70A1
-        0x687F3584 0x52A0E286 0xB79C5305 0xAA500737
-        0x3E07841C 0x7FDEAE5C 0x8E7D44EC 0x5716F2B8
-        0xB03ADA37 0xF0500C0D 0xF01C1F04 0x0200B3FF
-        0xAE0CF51A 0x3CB574B2 0x25837A58 0xDC0921BD
-        0xD19113F9 0x7CA92FF6 0x94324773 0x22F54701
-        0x3AE5E581 0x37C2DADC 0xC8B57634 0x9AF3DDA7
-        0xA9446146 0x0FD0030E 0xECC8C73E 0xA4751E41
-        0xE238CD99 0x3BEA0E2F 0x3280BBA1 0x183EB331
-        0x4E548B38 0x4F6DB908 0x6F420D03 0xF60A04BF
-        0x2CB81290 0x24977C79 0x5679B072 0xBCAF89AF
-        0xDE9A771F 0xD9930810 0xB38BAE12 0xDCCF3F2E
-        0x5512721F 0x2E6B7124 0x501ADDE6 0x9F84CD87
-        0x7A584718 0x7408DA17 0xBC9F9ABC 0xE94B7D8C
-        0xEC7AEC3A 0xDB851DFA 0x63094366 0xC464C3D2
-        0xEF1C1847 0x3215D908 0xDD433B37 0x24C2BA16
-        0x12A14D43 0x2A65C451 0x50940002 0x133AE4DD
-        0x71DFF89E 0x10314E55 0x81AC77D6 0x5F11199B
-        0x043556F1 0xD7A3C76B 0x3C11183B 0x5924A509
-        0xF28FE6ED 0x97F1FBFA 0x9EBABF2C 0x1E153C6E
-        0x86E34570 0xEAE96FB1 0x860E5E0A 0x5A3E2AB3
-        0x771FE71C 0x4E3D06FA 0x2965DCB9 0x99E71D0F
-        0x803E89D6 0x5266C825 0x2E4CC978 0x9C10B36A
-        0xC6150EBA 0x94E2EA78 0xA5FC3C53 0x1E0A2DF4
-        0xF2F74EA7 0x361D2B3D 0x1939260F 0x19C27960
-        0x5223A708 0xF71312B6 0xEBADFE6E 0xEAC31F66
-        0xE3BC4595 0xA67BC883 0xB17F37D1 0x018CFF28
-        0xC332DDEF 0xBE6C5AA5 0x65582185 0x68AB9802
-        0xEECEA50F 0xDB2F953B 0x2AEF7DAD 0x5B6E2F84
-        0x1521B628 0x29076170 0xECDD4775 0x619F1510
-        0x13CCA830 0xEB61BD96 0x0334FE1E 0xAA0363CF
-        0xB5735C90 0x4C70A239 0xD59E9E0B 0xCBAADE14
-        0xEECC86BC 0x60622CA7 0x9CAB5CAB 0xB2F3846E
-        0x648B1EAF 0x19BDF0CA 0xA02369B9 0x655ABB50
-        0x40685A32 0x3C2AB4B3 0x319EE9D5 0xC021B8F7
-        0x9B540B19 0x875FA099 0x95F7997E 0x623D7DA8
-        0xF837889A 0x97E32D77 0x11ED935F 0x16681281
-        0x0E358829 0xC7E61FD6 0x96DEDFA1 0x7858BA99
-        0x57F584A5 0x1B227263 0x9B83C3FF 0x1AC24696
-        0xCDB30AEB 0x532E3054 0x8FD948E4 0x6DBC3128
-        0x58EBF2EF 0x34C6FFEA 0xFE28ED61 0xEE7C3C73
-        0x5D4A14D9 0xE864B7E3 0x42105D14 0x203E13E0
-        0x45EEE2B6 0xA3AAABEA 0xDB6C4F15 0xFACB4FD0
-        0xC742F442 0xEF6ABBB5 0x654F3B1D 0x41CD2105
-        0xD81E799E 0x86854DC7 0xE44B476A 0x3D816250
-        0xCF62A1F2 0x5B8D2646 0xFC8883A0 0xC1C7B6A3
-        0x7F1524C3 0x69CB7492 0x47848A0B 0x5692B285
-        0x095BBF00 0xAD19489D 0x1462B174 0x23820E00
-        0x58428D2A 0x0C55F5EA 0x1DADF43E 0x233F7061
-        0x3372F092 0x8D937E41 0xD65FECF1 0x6C223BDB
-        0x7CDE3759 0xCBEE7460 0x4085F2A7 0xCE77326E
-        0xA6078084 0x19F8509E 0xE8EFD855 0x61D99735
-        0xA969A7AA 0xC50C06C2 0x5A04ABFC 0x800BCADC
-        0x9E447A2E 0xC3453484 0xFDD56705 0x0E1E9EC9
-        0xDB73DBD3 0x105588CD 0x675FDA79 0xE3674340
-        0xC5C43465 0x713E38D8 0x3D28F89E 0xF16DFF20
-        0x153E21E7 0x8FB03D4A 0xE6E39F2B 0xDB83ADF7
-        0xE93D5A68 0x948140F7 0xF64C261C 0x94692934
-        0x411520F7 0x7602D4F7 0xBCF46B2E 0xD4A20068
-        0xD4082471 0x3320F46A 0x43B7D4B7 0x500061AF
-        0x1E39F62E 0x97244546 0x14214F74 0xBF8B8840
-        0x4D95FC1D 0x96B591AF 0x70F4DDD3 0x66A02F45
-        0xBFBC09EC 0x03BD9785 0x7FAC6DD0 0x31CB8504
-        0x96EB27B3 0x55FD3941 0xDA2547E6 0xABCA0A9A
-        0x28507825 0x530429F4 0x0A2C86DA 0xE9B66DFB
-        0x68DC1462 0xD7486900 0x680EC0A4 0x27A18DEE
-        0x4F3FFEA2 0xE887AD8C 0xB58CE006 0x7AF4D6B6
-        0xAACE1E7C 0xD3375FEC 0xCE78A399 0x406B2A42
-        0x20FE9E35 0xD9F385B9 0xEE39D7AB 0x3B124E8B
-        0x1DC9FAF7 0x4B6D1856 0x26A36631 0xEAE397B2
-        0x3A6EFA74 0xDD5B4332 0x6841E7F7 0xCA7820FB
-        0xFB0AF54E 0xD8FEB397 0x454056AC 0xBA489527
-        0x55533A3A 0x20838D87 0xFE6BA9B7 0xD096954B
-        0x55A867BC 0xA1159A58 0xCCA92963 0x99E1DB33
-        0xA62A4A56 0x3F3125F9 0x5EF47E1C 0x9029317C
-        0xFDF8E802 0x04272F70 0x80BB155C 0x05282CE3
-        0x95C11548 0xE4C66D22 0x48C1133F 0xC70F86DC
-        0x07F9C9EE 0x41041F0F 0x404779A4 0x5D886E17
-        0x325F51EB 0xD59BC0D1 0xF2BCC18F 0x41113564
-        0x257B7834 0x602A9C60 0xDFF8E8A3 0x1F636C1B
-        0x0E12B4C2 0x02E1329E 0xAF664FD1 0xCAD18115
-        0x6B2395E0 0x333E92E1 0x3B240B62 0xEEBEB922
-        0x85B2A20E 0xE6BA0D99 0xDE720C8C 0x2DA2F728
-        0xD0127845 0x95B794FD 0x647D0862 0xE7CCF5F0
-        0x5449A36F 0x877D48FA 0xC39DFD27 0xF33E8D1E
-        0x0A476341 0x992EFF74 0x3A6F6EAB 0xF4F8FD37
-        0xA812DC60 0xA1EBDDF8 0x991BE14C 0xDB6E6B0D
-        0xC67B5510 0x6D672C37 0x2765D43B 0xDCD0E804
-        0xF1290DC7 0xCC00FFA3 0xB5390F92 0x690FED0B
-        0x667B9FFB 0xCEDB7D9C 0xA091CF0B 0xD9155EA3
-        0xBB132F88 0x515BAD24 0x7B9479BF 0x763BD6EB
-        0x37392EB3 0xCC115979 0x8026E297 0xF42E312D
-        0x6842ADA7 0xC66A2B3B 0x12754CCC 0x782EF11C
-        0x6A124237 0xB79251E7 0x06A1BBE6 0x4BFB6350
-        0x1A6B1018 0x11CAEDFA 0x3D25BDD8 0xE2E1C3C9
-        0x44421659 0x0A121386 0xD90CEC6E 0xD5ABEA2A
-        0x64AF674E 0xDA86A85F 0xBEBFE988 0x64E4C3FE
-        0x9DBC8057 0xF0F7C086 0x60787BF8 0x6003604D
-        0xD1FD8346 0xF6381FB0 0x7745AE04 0xD736FCCC
-        0x83426B33 0xF01EAB71 0xB0804187 0x3C005E5F
-        0x77A057BE 0xBDE8AE24 0x55464299 0xBF582E61
-        0x4E58F48F 0xF2DDFDA2 0xF474EF38 0x8789BDC2
-        0x5366F9C3 0xC8B38E74 0xB475F255 0x46FCD9B9
-        0x7AEB2661 0x8B1DDF84 0x846A0E79 0x915F95E2
-        0x466E598E 0x20B45770 0x8CD55591 0xC902DE4C
-        0xB90BACE1 0xBB8205D0 0x11A86248 0x7574A99E
-        0xB77F19B6 0xE0A9DC09 0x662D09A1 0xC4324633
-        0xE85A1F02 0x09F0BE8C 0x4A99A025 0x1D6EFE10
-        0x1AB93D1D 0x0BA5A4DF 0xA186F20F 0x2868F169
-        0xDCB7DA83 0x573906FE 0xA1E2CE9B 0x4FCD7F52
-        0x50115E01 0xA70683FA 0xA002B5C4 0x0DE6D027
-        0x9AF88C27 0x773F8641 0xC3604C06 0x61A806B5
-        0xF0177A28 0xC0F586E0 0x006058AA 0x30DC7D62
-        0x11E69ED7 0x2338EA63 0x53C2DD94 0xC2C21634
-        0xBBCBEE56 0x90BCB6DE 0xEBFC7DA1 0xCE591D76
-        0x6F05E409 0x4B7C0188 0x39720A3D 0x7C927C24
-        0x86E3725F 0x724D9DB9 0x1AC15BB4 0xD39EB8FC
-        0xED545578 0x08FCA5B5 0xD83D7CD3 0x4DAD0FC4
-        0x1E50EF5E 0xB161E6F8 0xA28514D9 0x6C51133C
-        0x6FD5C7E7 0x56E14EC4 0x362ABFCE 0xDDC6C837
-        0xD79A3234 0x92638212 0x670EFA8E 0x406000E0
-        0x3A39CE37 0xD3FAF5CF 0xABC27737 0x5AC52D1B
-        0x5CB0679E 0x4FA33742 0xD3822740 0x99BC9BBE
-        0xD5118E9D 0xBF0F7315 0xD62D1C7E 0xC700C47B
-        0xB78C1B6B 0x21A19045 0xB26EB1BE 0x6A366EB4
-        0x5748AB2F 0xBC946E79 0xC6A376D2 0x6549C2C8
-        0x530FF8EE 0x468DDE7D 0xD5730A1D 0x4CD04DC6
-        0x2939BBDB 0xA9BA4650 0xAC9526E8 0xBE5EE304
-        0xA1FAD5F0 0x6A2D519A 0x63EF8CE2 0x9A86EE22
-        0xC089C2B8 0x43242EF6 0xA51E03AA 0x9CF2D0A4
-        0x83C061BA 0x9BE96A4D 0x8FE51550 0xBA645BD6
-        0x2826A2F9 0xA73A3AE1 0x4BA99586 0xEF5562E9
-        0xC72FEFD3 0xF752F7DA 0x3F046F69 0x77FA0A59
-        0x80E4A915 0x87B08601 0x9B09E6AD 0x3B3EE593
-        0xE990FD5A 0x9E34D797 0x2CF0B7D9 0x022B8B51
-        0x96D5AC3A 0x017DA67D 0xD1CF3ED6 0x7C7D2D28
-        0x1F9F25CF 0xADF2B89B 0x5AD6B472 0x5A88F54C
-        0xE029AC71 0xE019A5E6 0x47B0ACFD 0xED93FA9B
-        0xE8D3C48D 0x283B57CC 0xF8D56629 0x79132E28
-        0x785F0191 0xED756055 0xF7960E44 0xE3D35E8C
-        0x15056DD4 0x88F46DBA 0x03A16125 0x0564F0BD
-        0xC3EB9E15 0x3C9057A2 0x97271AEC 0xA93A072A
-        0x1B3F6D9B 0x1E6321F5 0xF59C66FB 0x26DCF319
-        0x7533D928 0xB155FDF5 0x03563482 0x8ABA3CBB
-        0x28517711 0xC20AD9F8 0xABCC5167 0xCCAD925F
-        0x4DE81751 0x3830DC8E 0x379D5862 0x9320F991
-        0xEA7A90C2 0xFB3E7BCE 0x5121CE64 0x774FBE32
-        0xA8B6E37E 0xC3293D46 0x48DE5369 0x6413E680
-        0xA2AE0810 0xDD6DB224 0x69852DFD 0x09072166
-        0xB39A460A 0x6445C0DD 0x586CDECF 0x1C20C8AE
-        0x5BBEF7DD 0x1B588D40 0xCCD2017F 0x6BB4E3BB
-        0xDDA26A7E 0x3A59FF45 0x3E350A44 0xBCB4CDD5
-        0x72EACEA8 0xFA6484BB 0x8D6612AE 0xBF3C6F47
-        0xD29BE463 0x542F5D9E 0xAEC2771B 0xF64E6370
-        0x740E0D8D 0xE75B1357 0xF8721671 0xAF537D5D
-        0x4040CB08 0x4EB4E2CC 0x34D2466A 0x0115AF84
-        0xE1B00428 0x95983A1D 0x06B89FB4 0xCE6EA048
-        0x6F3F3B82 0x3520AB82 0x011A1D4B 0x277227F8
-        0x611560B1 0xE7933FDC 0xBB3A792B 0x344525BD
-        0xA08839E1 0x51CE794B 0x2F32C9B7 0xA01FBAC9
-        0xE01CC87E 0xBCC7D1F6 0xCF0111C3 0xA1E8AAC7
-        0x1A908749 0xD44FBD9A 0xD0DADECB 0xD50ADA38
-        0x0339C32A 0xC6913667 0x8DF9317C 0xE0B12B4F
-        0xF79E59B7 0x43F5BB3A 0xF2D519FF 0x27D9459C
-        0xBF97222C 0x15E6FC2A 0x0F91FC71 0x9B941525
-        0xFAE59361 0xCEB69CEB 0xC2A86459 0x12BAA8D1
-        0xB6C1075E 0xE3056A0C 0x10D25065 0xCB03A442
-        0xE0EC6E0E 0x1698DB3B 0x4C98A0BE 0x3278E964
-        0x9F1F9532 0xE0D392DF 0xD3A0342B 0x8971F21E
-        0x1B0A7441 0x4BA3348C 0xC5BE7120 0xC37632D8
-        0xDF359F8D 0x9B992F2E 0xE60B6F47 0x0FE3F11D
-        0xE54CDA54 0x1EDAD891 0xCE6279CF 0xCD3E7E6F
-        0x1618B166 0xFD2C1D05 0x848FD2C5 0xF6FB2299
-        0xF523F357 0xA6327623 0x93A83531 0x56CCCD02
-        0xACF08162 0x5A75EBB5 0x6E163697 0x88D273CC
-        0xDE966292 0x81B949D0 0x4C50901B 0x71C65614
-        0xE6C6C7BD 0x327A140A 0x45E1D006 0xC3F27B9A
-        0xC9AA53FD 0x62A80F00 0xBB25BFE2 0x35BDD2F6
-        0x71126905 0xB2040222 0xB6CBCF7C 0xCD769C2B
-        0x53113EC0 0x1640E3D3 0x38ABBD60 0x2547ADF0
-        0xBA38209C 0xF746CE76 0x77AFA1C5 0x20756060
-        0x85CBFE4E 0x8AE88DD8 0x7AAAF9B0 0x4CF9AA7E
-        0x1948C25C 0x02FB8A8C 0x01C36AE4 0xD6EBE1F9
-        0x90D4F869 0xA65CDEA0 0x3F09252D 0xC208E69F
-        0xB74E6132 0xCE77E25B 0x578FDFE3 0x3AC372E6
-    }
-}
-
-proc ::blowfish::intEncrypt {P S xl xr} {
-    for {set i 0} {$i < 16} {incr i} {
-        set xl [expr {$xl ^ [lindex $P $i]}]
-
-        set S0a [lindex $S [expr { ($xl >> 24) & 0xff}]]
-        set S1b [lindex $S [expr {(($xl >> 16) & 0xff) + 256}]]
-        set S2c [lindex $S [expr {(($xl >>  8) & 0xff) + 512}]]
-        set S3d [lindex $S [expr { ($xl        & 0xff) + 768}]]
-        set xr [expr {(((($S0a + $S1b) ^ $S2c) + $S3d) & 0xffffffff) ^ $xr}]
-
-        set temp $xl ; set xl $xr ; set xr $temp
-    }
-
-    set temp $xl ; set xl $xr ; set xr $temp
-    return [list [expr {$xl ^ [lindex $P 17]}] [expr {$xr ^ [lindex $P 16]}]]
-}
-
-proc ::blowfish::intDecrypt {P S xl xr} {
-    for {set i 17} {$i > 1} {incr i -1} {
-        set xl [expr {$xl ^ [lindex $P $i]}]
-
-        set S0a [lindex $S [expr { ($xl >> 24) & 0xff}]]
-        set S1b [lindex $S [expr {(($xl >> 16) & 0xff) + 256}]]
-        set S2c [lindex $S [expr {(($xl >>  8) & 0xff) + 512}]]
-        set S3d [lindex $S [expr { ($xl        & 0xff) + 768}]]
-        set xr [expr {(((($S0a + $S1b) ^ $S2c) + $S3d) & 0xffffffff) ^ $xr}]
-
-        set temp $xl ; set xl $xr ; set xr $temp
-    }
-    
-    set temp $xl ; set xl $xr ; set xr $temp
-    return [list [expr {$xl ^ [lindex $P 0]}] [expr {$xr ^ [lindex $P 1]}]]
-}
-
-proc ::blowfish::Init {mode key iv} {
-    variable ORIG_S
-    variable ORIG_P
-    variable uid
-
-    set S $ORIG_S
-    set P [list]
-    
-    set kl [string length $key]
-    binary scan $key c* kc
-    
-    set j 0
-    for {set i 0} {$i < 18} {incr i} {
-        set data 0
-        for {set k 0} {$k < 4} {incr k} {
-            set data [expr {(($data << 8) | ([lindex $kc $j] & 0xff)) & 0xffffffff}]
-            if {[incr j] >= $kl} {
-                set j 0
-            }
-        }
-        set OPi [lindex $ORIG_P $i]
-        lappend P [expr {$OPi ^ $data}]
-    }
-    
-    set datal 0
-    set datar 0
-    
-    for {set i 0} {$i < 18} {incr i} {
-        set ed [intEncrypt $P $S $datal $datar]
-        set datal [lindex $ed 0]
-        set datar [lindex $ed 1]
-        set P [lreplace $P $i [incr i] $datal $datar]
-    }
-    
-    for {set i 0} {$i < 4} {incr i} {
-        for {set j 0} {$j < 256} {incr j 2} {
-            set ed [intEncrypt $P $S $datal $datar]
-            set datal [lindex $ed 0]
-            set datar [lindex $ed 1]
-            set t [expr {$i * 256 + $j}]
-            set S [lreplace $S $t [incr t] $datal $datar]
-        }
-    }
-
-    set token [namespace current]::[incr uid]
-    variable $token
-    upvar #0 $token state
-    array set state [list P $P S $S M $mode I $iv]
-    return $token
-}
-
-proc ::blowfish::Reset {token iv} {
-    upvar #0 $token state
-    set state(I) $iv
-    return
-}
-
-proc ::blowfish::Final {token} {
-    # PRAGMA: nocheck
-    variable $token
-    unset $token
-}
-
-proc ::blowfish::EncryptBlock {token block} {
-    upvar #0 $token state
-    if {[binary scan $block II xl xr] != 2} {
-        error "block must be 8 bytes"
-    }
-    set xl [expr {$xl & 0xffffffff}]
-    set xr [expr {$xr & 0xffffffff}]
-    set d  [intEncrypt $state(P) $state(S) $xl $xr]
-    return [binary format I2 $d]
-}
-
-proc ::blowfish::Encrypt {Key data} {
-    upvar #0 $Key state
-    set P $state(P)
-    set S $state(S)
-    set cbc_mode [string equal "cbc" $state(M)]
-
-    if {[binary scan $state(I) II s0 s1] != 2} {
-        return -code error "invalid initialization vector: must be 8 bytes"
-    }
-
-    set len [string length $data]
-    if {($len % 8) != 0} {
-        return -code error "invalid block size: blocks must be 8 bytes"
-    }
-
-    set s0 [expr {$s0 & 0xffffffff}]
-    set s1 [expr {$s1 & 0xffffffff}]
-    
-    set result ""
-    for {set i 0} {$i < $len} {incr i 8} {
-        if {[binary scan $data @[set i]II xl xr] != 2} {
-            return -code error "oops"
-        }
-        if {$cbc_mode} {
-            set xl [expr {($xl & 0xffffffff) ^ $s0}]
-            set xr [expr {($xr & 0xffffffff) ^ $s1}]
-        }
-        set d  [intEncrypt $P $S $xl $xr]
-        if {$cbc_mode} {
-            set s0 [lindex $d 0]
-            set s1 [lindex $d 1]
-        }
-        append result [binary format I2 $d]
-    }
-    if {$cbc_mode} {
-        set state(I) [binary format II $s0 $s1]
-    }
-    return $result
-}
-
-proc ::blowfish::DecryptBlock {Key block} {
-    upvar #0 $Key state
-    if {[binary scan $block II xl xr] != 2} {
-        return -code error "invalid block size: block must be 8 bytes"
-    }
-    set xl [expr {$xl & 0xffffffff}]
-    set xr [expr {$xr & 0xffffffff}]
-    set d  [intDecrypt $state(P) $state(S) $xl $xr]
-    return [binary format I2 $d]
-}
-
-proc ::blowfish::Decrypt {token data} {
-    upvar #0 $token state
-    set P $state(P)
-    set S $state(S)
-    set cbc_mode [string equal "cbc" $state(M)]
-
-    if {[binary scan $state(I) II s0 s1] != 2} {
-        return -code error "initialization vector must be 8 bytes"
-    }
-
-    set len [string length $data]
-    if {($len % 8) != 0} {
-        return -code error "block size invalid"
-    }
-
-    set s0 [expr {$s0 & 0xffffffff}]
-    set s1 [expr {$s1 & 0xffffffff}]
-
-    set result ""
-    for {set i 0} {$i < $len} {incr i 8} {
-        if {[binary scan $data @[set i]II xl xr] != 2} {
-            error "oops"
-        }
-        set xl [expr {$xl & 0xffffffff}]
-        set xr [expr {$xr & 0xffffffff}]
-        set d  [intDecrypt $P $S $xl $xr]
-        if {$cbc_mode} {
-            set d0 [lindex $d 0]
-            set d1 [lindex $d 1]
-            set c0 [expr {$d0 ^ $s0}]
-            set c1 [expr {$d1 ^ $s1}]
-            set s0 $xl
-            set s1 $xr
-            append result [binary format II $c0 $c1]
-        } else {
-            append result [binary format I2 $d]
-        }
-    }
-    if {$cbc_mode} {
-        set state(I) [binary format II $s0 $s1]
-    }
-    return $result
-}
-
-
-# -------------------------------------------------------------------------
-# Fileevent handler for chunked file reading.
-#
-proc ::blowfish::Chunk {Key in {out {}} {chunksize 4096} {pad \0}} {
-    upvar #0 $Key state
-    
-    if {[eof $in]} {
-        fileevent $in readable {}
-        set state(reading) 0
-    }
-
-    set data [read $in $chunksize]
-    # FIX ME: we should ony pad after eof
-    if {[string length $pad] > 0} {
-        set data [Pad $data 8]
-    }
-    
-    if {$out == {}} {
-        append state(output) [$state(cmd) $Key $data]
-    } else {
-        puts -nonewline $out [$state(cmd) $Key $data]
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::blowfish::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        trf {
-            if {![catch {package require Trfcrypt}]} {
-                set block [string repeat \0 8]
-                set r [expr {![catch {::blowfish -dir enc -mode ecb -key $block $block} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::blowfish::Hex {data} {
-    binary scan $data H* r
-    return $r
-}
-
-proc ::blowfish::SetOneOf {lst item} {                
-    set ndx [lsearch -glob $lst "${item}*"]
-    if {$ndx == -1} {
-        set err [join $lst ", "]
-        return -code error "invalid mode \"$item\": must be one of $err"
-    }
-    return [lindex $lst $ndx]
-}
-
-proc ::blowfish::CheckSize {what size thing} {
-    if {[string length $thing] != $size} {
-        return -code error "invalid value for $what: must be $size bytes long"
-    }
-    return $thing
-}
-
-proc ::blowfish::CheckPad {char} {
-    if {[string length $char] > 1} {
-        return -code error "invalid value: should be a char or empty string"
-    }
-    return $char
-}
-
-proc ::blowfish::Pad {data blocksize {fill \0}} {
-    set len [string length $data]
-    if {$len == 0} {
-        set data [string repeat $fill $blocksize]
-    } elseif {($len % $blocksize) != 0} {
-        set pad [expr {$blocksize - ($len % $blocksize)}]
-        append data [string repeat $fill $pad]
-    }
-    return $data
-}
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::blowfish::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-proc ::blowfish::blowfish {args} {
-    variable accel
-    array set opts {-dir encrypt -mode cbc -key {} -in {} -out {} -hex 0 -pad \0}
-    set opts(-chunksize) 4096
-    set opts(-iv) [string repeat \0 8]
-    set modes {ecb cbc}
-    set dirs  {encrypt decrypt}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -mode       { set opts(-mode) [SetOneOf $modes [Pop args 1]] }
-            -dir        { set opts(-dir) [SetOneOf $dirs [Pop args 1]] }
-            -iv         { set opts(-iv)  [CheckSize -iv 8 [Pop args 1]] }
-            -key        { set opts(-key) [Pop args 1] }
-            -in         { set opts(-in) [Pop args 1] }
-            -out        { set opts(-out) [Pop args 1] }
-            -chunksize  { set opts(-chunksize) [Pop args 1] }
-            -hex        { set opts(-hex) 1 }
-            -pad        { set opts(-pad) [CheckPad [Pop args 1]] }
-            --          { Pop args; break }
-            default {
-                if {[string length $opts(-in)] == 0 && [llength $args] == 1} break
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option \"$option\":\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-    
-    if {$opts(-key) == {}} {
-        return -code error "no key provided: the -key option is required"
-    }
-    
-    set r {}
-    if {$opts(-in) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args:\
-                should be \"blowfish ?options...? -key keydata plaintext\""
-        }
-
-        set data [lindex $args 0]
-        if {[string length $opts(-pad)] > 0} {
-            set data [Pad [lindex $args 0] 8 $opts(-pad)]
-        }
-        if {$accel(trf)} {
-            set r [::blowfish -dir $opts(-dir) -mode $opts(-mode) \
-                       -key $opts(-key) -iv $opts(-iv) -- $data]
-        } else {
-            set Key [Init $opts(-mode) $opts(-key) $opts(-iv)]
-            if {[string equal $opts(-dir) "encrypt"]} {
-                set r [Encrypt $Key $data]
-            } else {
-                set r [Decrypt $Key $data]
-            }
-            Final $Key
-        }
-
-        if {$opts(-out) != {}} {
-            puts -nonewline $opts(-out) $r
-            set r {}
-        }
-        
-    } else {
-
-        if {[llength $args] != 0} {
-            return -code error "wrong \# args:\
-                should be \"blowfish ?options...? -key keydata -in channel\""
-        }
-        
-        set Key [Init $opts(-mode) $opts(-key) $opts(-iv)]
-        upvar $Key state
-        set state(reading) 1
-        if {[string equal $opts(-dir) "encrypt"]} {
-            set state(cmd) Encrypt
-        } else {
-            set state(cmd) Decrypt
-        }
-        set state(output) ""
-        fileevent $opts(-in) readable \
-            [list [namespace origin Chunk] \
-                 $Key $opts(-in) $opts(-out) $opts(-chunksize) $opts(-pad)]
-        if {[info commands ::tkwait] != {}} {
-            tkwait variable [subst $Key](reading)
-        } else {
-            vwait [subst $Key](reading)
-        }
-        if {$opts(-out) == {}} {
-            set r $state(output)
-        }
-        Final $Key
-
-    }
-
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::blowfish {
-    variable e; foreach e {trf} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide blowfish $::blowfish::version
-
-# -------------------------------------------------------------------------
-#
-# Local Variables:
-# mode: tcl
-# indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/blowfish/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/blowfish/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded blowfish 1.0.3 [list source [file join $dir blowfish.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/cmdline/cmdline.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/cmdline/cmdline.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,881 +1,0 @@
-# cmdline.tcl --
-#
-#	This package provides a utility for parsing command line
-#	arguments that are processed by our various applications.
-#	It also includes a utility routine to determine the
-#	application name for use in command line errors.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sf.net>.
-# Copyright (c) 2003      by David N. Welton  <davidw@dedasys.com>
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: cmdline.tcl,v 1.24 2006/09/28 02:19:20 andreas_kupries Exp $
-
-package require Tcl 8.2
-package provide cmdline 1.3
-
-namespace eval ::cmdline {
-    namespace export getArgv0 getopt getKnownOpt getfiles getoptions \
-	    getKnownOptions usage
-}
-
-# ::cmdline::getopt --
-#
-#	The cmdline::getopt works in a fashion like the standard
-#	C based getopt function.  Given an option string and a 
-#	pointer to an array or args this command will process the
-#	first argument and return info on how to proceed.
-#
-# Arguments:
-#	argvVar		Name of the argv list that you
-#			want to process.  If options are found the
-#			arg list is modified and the processed arguments
-#			are removed from the start of the list.
-#	optstring	A list of command options that the application
-#			will accept.  If the option ends in ".arg" the
-#			getopt routine will use the next argument as 
-#			an argument to the option.  Otherwise the option	
-#			is a boolean that is set to 1 if present.
-#	optVar		The variable pointed to by optVar
-#			contains the option that was found (without the
-#			leading '-' and without the .arg extension).
-#	valVar		Upon success, the variable pointed to by valVar
-#			contains the value for the specified option.
-#			This value comes from the command line for .arg
-#			options, otherwise the value is 1.
-#			If getopt fails, the valVar is filled with an
-#			error message.
-#
-# Results:
-# 	The getopt function returns 1 if an option was found, 0 if no more
-# 	options were found, and -1 if an error occurred.
-
-proc ::cmdline::getopt {argvVar optstring optVar valVar} {
-    upvar 1 $argvVar argsList
-    upvar 1 $optVar option
-    upvar 1 $valVar value
-
-    set result [getKnownOpt argsList $optstring option value]
-
-    if {$result < 0} {
-        # Collapse unknown-option error into any-other-error result.
-        set result -1
-    }
-    return $result
-}
-
-# ::cmdline::getKnownOpt --
-#
-#	The cmdline::getKnownOpt works in a fashion like the standard
-#	C based getopt function.  Given an option string and a 
-#	pointer to an array or args this command will process the
-#	first argument and return info on how to proceed.
-#
-# Arguments:
-#	argvVar		Name of the argv list that you
-#			want to process.  If options are found the
-#			arg list is modified and the processed arguments
-#			are removed from the start of the list.  Note that
-#			unknown options and the args that follow them are
-#			left in this list.
-#	optstring	A list of command options that the application
-#			will accept.  If the option ends in ".arg" the
-#			getopt routine will use the next argument as 
-#			an argument to the option.  Otherwise the option	
-#			is a boolean that is set to 1 if present.
-#	optVar		The variable pointed to by optVar
-#			contains the option that was found (without the
-#			leading '-' and without the .arg extension).
-#	valVar		Upon success, the variable pointed to by valVar
-#			contains the value for the specified option.
-#			This value comes from the command line for .arg
-#			options, otherwise the value is 1.
-#			If getopt fails, the valVar is filled with an
-#			error message.
-#
-# Results:
-# 	The getKnownOpt function returns 1 if an option was found,
-#	0 if no more options were found, -1 if an unknown option was
-#	encountered, and -2 if any other error occurred. 
-
-proc ::cmdline::getKnownOpt {argvVar optstring optVar valVar} {
-    upvar 1 $argvVar argsList
-    upvar 1 $optVar  option
-    upvar 1 $valVar  value
-
-    # default settings for a normal return
-    set value ""
-    set option ""
-    set result 0
-
-    # check if we're past the end of the args list
-    if {[llength $argsList] != 0} {
-
-	# if we got -- or an option that doesn't begin with -, return (skipping
-	# the --).  otherwise process the option arg.
-	switch -glob -- [set arg [lindex $argsList 0]] {
-	    "--" {
-		set argsList [lrange $argsList 1 end]
-	    }
-
-	    "-*" {
-		set option [string range $arg 1 end]
-
-		if {[lsearch -exact $optstring $option] != -1} {
-		    # Booleans are set to 1 when present
-		    set value 1
-		    set result 1
-		    set argsList [lrange $argsList 1 end]
-		} elseif {[lsearch -exact $optstring "$option.arg"] != -1} {
-		    set result 1
-		    set argsList [lrange $argsList 1 end]
-		    if {[llength $argsList] != 0} {
-			set value [lindex $argsList 0]
-			set argsList [lrange $argsList 1 end]
-		    } else {
-			set value "Option \"$option\" requires an argument"
-			set result -2
-		    }
-		} else {
-		    # Unknown option.
-		    set value "Illegal option \"-$option\""
-		    set result -1
-		}
-	    }
-	    default {
-		# Skip ahead
-	    }
-	}
-    }
-
-    return $result
-}
-
-# ::cmdline::getoptions --
-#
-#	Process a set of command line options, filling in defaults
-#	for those not specified.  This also generates an error message
-#	that lists the allowed flags if an incorrect flag is specified.
-#
-# Arguments:
-#	arglistVar	The name of the argument list, typically argv.
-#			We remove all known options and their args from it.
-#	optlist		A list-of-lists where each element specifies an option
-#			in the form:
-#				(where flag takes no argument) 
-#					flag comment 
-#
-#				(or where flag takes an argument) 
-#					flag default comment
-#
-#			If flag ends in ".arg" then the value is taken from the
-#			command line. Otherwise it is a boolean and appears in
-#			the result if present on the command line. If flag ends
-#			in ".secret", it will not be displayed in the usage.
-#	usage		Text to include in the usage display. Defaults to
-#			"options:"
-#
-# Results
-#	Name value pairs suitable for using with array set.
-
-proc ::cmdline::getoptions {arglistVar optlist {usage options:}} {
-    upvar 1 $arglistVar argv
-
-    set opts [GetOptionDefaults $optlist result]
-
-    set argc [llength $argv]
-    while {[set err [getopt argv $opts opt arg]]} {
-	if {$err < 0} {
-            set result(?) ""
-            break
-	}
-	set result($opt) $arg
-    }
-    if {[info exist result(?)] || [info exists result(help)]} {
-	error [usage $optlist $usage]
-    }
-    return [array get result]
-}
-
-# ::cmdline::getKnownOptions --
-#
-#	Process a set of command line options, filling in defaults
-#	for those not specified.  This ignores unknown flags, but generates
-#	an error message that lists the correct usage if a known option
-#	is used incorrectly.
-#
-# Arguments:
-#	arglistVar	The name of the argument list, typically argv.  This
-#			We remove all known options and their args from it.
-#	optlist		A list-of-lists where each element specifies an option
-#			in the form:
-#				flag default comment
-#			If flag ends in ".arg" then the value is taken from the
-#			command line. Otherwise it is a boolean and appears in
-#			the result if present on the command line. If flag ends
-#			in ".secret", it will not be displayed in the usage.
-#	usage		Text to include in the usage display. Defaults to
-#			"options:"
-#
-# Results
-#	Name value pairs suitable for using with array set.
-
-proc ::cmdline::getKnownOptions {arglistVar optlist {usage options:}} {
-    upvar 1 $arglistVar argv
-
-    set opts [GetOptionDefaults $optlist result]
-
-    # As we encounter them, keep the unknown options and their
-    # arguments in this list.  Before we return from this procedure,
-    # we'll prepend these args to the argList so that the application
-    # doesn't lose them.
-
-    set unknownOptions [list]
-
-    set argc [llength $argv]
-    while {[set err [getKnownOpt argv $opts opt arg]]} {
-	if {$err == -1} {
-            # Unknown option.
-
-            # Skip over any non-option items that follow it.
-            # For now, add them to the list of unknownOptions.
-            lappend unknownOptions [lindex $argv 0]
-            set argv [lrange $argv 1 end]
-            while {([llength $argv] != 0) \
-                    && ![string match "-*" [lindex $argv 0]]} {
-                lappend unknownOptions [lindex $argv 0]
-                set argv [lrange $argv 1 end]
-            }
-	} elseif {$err == -2} {
-            set result(?) ""
-            break
-        } else {
-            set result($opt) $arg
-        }
-    }
-
-    # Before returning, prepend the any unknown args back onto the
-    # argList so that the application doesn't lose them.
-    set argv [concat $unknownOptions $argv]
-
-    if {[info exist result(?)] || [info exists result(help)]} {
-	error [usage $optlist $usage]
-    }
-    return [array get result]
-}
-
-# ::cmdline::GetOptionDefaults --
-#
-#	This internal procedure processes the option list (that was passed to
-#	the getopt or getKnownOpt procedure).  The defaultArray gets an index
-#	for each option in the option list, the value of which is the option's
-#	default value.
-#
-# Arguments:
-#	optlist		A list-of-lists where each element specifies an option
-#			in the form:
-#				flag default comment
-#			If flag ends in ".arg" then the value is taken from the
-#			command line. Otherwise it is a boolean and appears in
-#			the result if present on the command line. If flag ends
-#			in ".secret", it will not be displayed in the usage.
-#	defaultArrayVar	The name of the array in which to put argument defaults.
-#
-# Results
-#	Name value pairs suitable for using with array set.
-
-proc ::cmdline::GetOptionDefaults {optlist defaultArrayVar} {
-    upvar 1 $defaultArrayVar result
-
-    set opts {? help}
-    foreach opt $optlist {
-	set name [lindex $opt 0]
-	if {[regsub -- .secret$ $name {} name] == 1} {
-	    # Need to hide this from the usage display and getopt
-	}   
-	lappend opts $name
-	if {[regsub -- .arg$ $name {} name] == 1} {
-
-	    # Set defaults for those that take values.
-
-	    set default [lindex $opt 1]
-	    set result($name) $default
-	} else {
-	    # The default for booleans is false
-	    set result($name) 0
-	}
-    }
-    return $opts
-}
-
-# ::cmdline::usage --
-#
-#	Generate an error message that lists the allowed flags.
-#
-# Arguments:
-#	optlist		As for cmdline::getoptions
-#	usage		Text to include in the usage display. Defaults to
-#			"options:"
-#
-# Results
-#	A formatted usage message
-
-proc ::cmdline::usage {optlist {usage {options:}}} {
-    set str "[getArgv0] $usage\n"
-    foreach opt [concat $optlist \
-	    {{help "Print this message"} {? "Print this message"}}] {
-	set name [lindex $opt 0]
-	if {[regsub -- .secret$ $name {} name] == 1} {
-	    # Hidden option
-	    continue
-	}
-	if {[regsub -- .arg$ $name {} name] == 1} {
-	    set default [lindex $opt 1]
-	    set comment [lindex $opt 2]
-	    append str [format " %-20s %s <%s>\n" "-$name value" \
-		    $comment $default]
-	} else {
-	    set comment [lindex $opt 1]
-	    append str [format " %-20s %s\n" "-$name" $comment]
-	}
-    }
-    return $str
-}
-
-# ::cmdline::getfiles --
-#
-#	Given a list of file arguments from the command line, compute
-#	the set of valid files.  On windows, file globbing is performed
-#	on each argument.  On Unix, only file existence is tested.  If
-#	a file argument produces no valid files, a warning is optionally
-#	generated.
-#
-#	This code also uses the full path for each file.  If not
-#	given it prepends [pwd] to the filename.  This ensures that
-#	these files will never conflict with files in our zip file.
-#
-# Arguments:
-#	patterns	The file patterns specified by the user.
-#	quiet		If this flag is set, no warnings will be generated.
-#
-# Results:
-#	Returns the list of files that match the input patterns.
-
-proc ::cmdline::getfiles {patterns quiet} {
-    set result {}
-    if {$::tcl_platform(platform) == "windows"} {
-	foreach pattern $patterns {
-	    set pat [file join $pattern]
-	    set files [glob -nocomplain -- $pat]
-	    if {$files == {}} {
-		if {! $quiet} {
-		    puts stdout "warning: no files match \"$pattern\""
-		}
-	    } else {
-		foreach file $files {
-		    lappend result $file
-		}
-	    }
-	}
-    } else {
-	set result $patterns
-    }
-    set files {}
-    foreach file $result {
-	# Make file an absolute path so that we will never conflict
-	# with files that might be contained in our zip file.
-	set fullPath [file join [pwd] $file]
-	
-	if {[file isfile $fullPath]} {
-	    lappend files $fullPath
-	} elseif {! $quiet} {
-	    puts stdout "warning: no files match \"$file\""
-	}
-    }
-    return $files
-}
-
-# ::cmdline::getArgv0 --
-#
-#	This command returns the "sanitized" version of argv0.  It will strip
-#	off the leading path and remove the ".bin" extensions that our apps
-#	use because they must be wrapped by a shell script.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	The application name that can be used in error messages.
-
-proc ::cmdline::getArgv0 {} {
-    global argv0
-
-    set name [file tail $argv0]
-    return [file rootname $name]
-}
-
-##
-# ### ### ### ######### ######### #########
-##
-# Now the typed versions of the above commands.
-##
-# ### ### ### ######### ######### #########
-##
-
-# typedCmdline.tcl --
-#
-#    This package provides a utility for parsing typed command
-#    line arguments that may be processed by various applications.
-#
-# Copyright (c) 2000 by Ross Palmer Mohn.
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: cmdline.tcl,v 1.24 2006/09/28 02:19:20 andreas_kupries Exp $
-
-namespace eval ::cmdline {
-    namespace export typedGetopt typedGetoptions typedUsage
-
-    # variable cmdline::charclasses --
-    #
-    #    Create regexp list of allowable character classes
-    #    from "string is" error message.
-    #
-    # Results:
-    #    String of character class names separated by "|" characters.
-
-    variable charclasses
-    catch {string is . .} charclasses
-    regexp -- {must be (.+)$} $charclasses dummy charclasses
-    regsub -all -- {, (or )?} $charclasses {|} charclasses
-
-}
-
-# ::cmdline::typedGetopt --
-#
-#	The cmdline::typedGetopt works in a fashion like the standard
-#	C based getopt function.  Given an option string and a
-#	pointer to a list of args this command will process the
-#	first argument and return info on how to proceed. In addition,
-#	you may specify a type for the argument to each option.
-#
-# Arguments:
-#	argvVar		Name of the argv list that you want to process.
-#			If options are found, the arg list is modified
-#			and the processed arguments are removed from the
-#			start of the list.
-#
-#	optstring	A list of command options that the application
-#			will accept.  If the option ends in ".xxx", where
-#			xxx is any valid character class to the tcl
-#			command "string is", then typedGetopt routine will
-#			use the next argument as a typed argument to the
-#			option. The argument must match the specified
-#			character classes (e.g. integer, double, boolean,
-#			xdigit, etc.). Alternatively, you may specify
-#			".arg" for an untyped argument.
-#
-#	optVar		Upon success, the variable pointed to by optVar
-#			contains the option that was found (without the
-#			leading '-' and without the .xxx extension).  If
-#			typedGetopt fails the variable is set to the empty
-#			string. SOMETIMES! Different for each -value!
-#
-#	argVar		Upon success, the variable pointed to by argVar
-#			contains the argument for the specified option.
-#			If typedGetopt fails, the variable is filled with
-#			an error message.
-#
-# Argument type syntax:
-#	Option that takes no argument.
-#		foo
-#
-#	Option that takes a typeless argument.
-#		foo.arg
-#
-#	Option that takes a typed argument. Allowable types are all
-#	valid character classes to the tcl command "string is".
-#	Currently must be one of alnum, alpha, ascii, control,
-#	boolean, digit, double, false, graph, integer, lower, print,
-#	punct, space, true, upper, wordchar, or xdigit.
-#		foo.double
-#
-#	Option that takes an argument from a list.
-#		foo.(bar|blat)
-#
-# Argument quantifier syntax:
-#	Option that takes an optional argument.
-#		foo.arg?
-#
-#	Option that takes a list of arguments terminated by "--".
-#		foo.arg+
-#
-#	Option that takes an optional list of arguments terminated by "--".
-#		foo.arg*
-#
-#	Argument quantifiers work on all argument types, so, for
-#	example, the following is a valid option specification.
-#		foo.(bar|blat|blah)?
-#
-# Argument syntax miscellany:
-#	Options may be specified on the command line using a unique,
-#	shortened version of the option name. Given that program foo
-#	has an option list of {bar.alpha blah.arg blat.double},
-#	"foo -b fob" returns an error, but "foo -ba fob"
-#	successfully returns {bar fob}
-#
-# Results:
-#	The typedGetopt function returns one of the following:
-#	 1	a valid option was found
-#	 0	no more options found to process
-#	-1	invalid option
-#	-2	missing argument to a valid option
-#	-3	argument to a valid option does not match type
-#
-# Known Bugs:
-#	When using options which include special glob characters,
-#	you must use the exact option. Abbreviating it can cause
-#	an error in the "cmdline::prefixSearch" procedure.
-
-proc ::cmdline::typedGetopt {argvVar optstring optVar argVar} {
-    variable charclasses
-
-    upvar $argvVar argsList
-
-    upvar $optVar retvar
-    upvar $argVar optarg
-
-    # default settings for a normal return
-    set optarg ""
-    set retvar ""
-    set retval 0
-
-    # check if we're past the end of the args list
-    if {[llength $argsList] != 0} {
-
-        # if we got -- or an option that doesn't begin with -, return (skipping
-        # the --).  otherwise process the option arg.
-        switch -glob -- [set arg [lindex $argsList 0]] {
-            "--" {
-                set argsList [lrange $argsList 1 end]
-            }
-
-            "-*" {
-                # Create list of options without their argument extensions
-
-                set optstr ""
-                foreach str $optstring {
-                    lappend optstr [file rootname $str]
-                }
-
-                set _opt [string range $arg 1 end]
-
-                set i [prefixSearch $optstr [file rootname $_opt]]
-                if {$i != -1} {
-                    set opt [lindex $optstring $i]
-
-                    set quantifier "none"
-                    if {[regexp -- {\.[^.]+([?+*])$} $opt dummy quantifier]} {
-                        set opt [string range $opt 0 end-1]
-                    }
-
-                    if {[string first . $opt] == -1} {
-                        set retval 1
-                        set retvar $opt
-                        set argsList [lrange $argsList 1 end]
-
-                    } elseif {[regexp -- "\\.(arg|$charclasses)\$" $opt dummy charclass]
-                            || [regexp -- {\.\(([^)]+)\)} $opt dummy charclass]} {
-				if {[string equal arg $charclass]} {
-                            set type arg
-			} elseif {[regexp -- "^($charclasses)\$" $charclass]} {
-                            set type class
-                        } else {
-                            set type oneof
-                        }
-
-                        set argsList [lrange $argsList 1 end]
-                        set opt [file rootname $opt]
-
-                        while {1} {
-                            if {[llength $argsList] == 0
-                                    || [string equal "--" [lindex $argsList 0]]} {
-                                if {[string equal "--" [lindex $argsList 0]]} {
-                                    set argsList [lrange $argsList 1 end]
-                                }
-
-                                set oneof ""
-                                if {$type == "arg"} {
-                                    set charclass an
-                                } elseif {$type == "oneof"} {
-                                    set oneof ", one of $charclass"
-                                    set charclass an
-                                }
-    
-                                if {$quantifier == "?"} {
-                                    set retval 1
-                                    set retvar $opt
-                                    set optarg ""
-                                } elseif {$quantifier == "+"} {
-                                    set retvar $opt
-                                    if {[llength $optarg] < 1} {
-                                        set retval -2
-                                        set optarg "Option requires at least one $charclass argument$oneof -- $opt"
-                                    } else {
-                                        set retval 1
-                                    }
-                                } elseif {$quantifier == "*"} {
-                                    set retval 1
-                                    set retvar $opt
-                                } else {
-                                    set optarg "Option requires $charclass argument$oneof -- $opt"
-                                    set retvar $opt
-                                    set retval -2
-                                }
-                                set quantifier ""
-                            } elseif {($type == "arg")
-                                    || (($type == "oneof")
-                                    && [string first "|[lindex $argsList 0]|" "|$charclass|"] != -1)
-                                    || (($type == "class")
-                                    && [string is $charclass [lindex $argsList 0]])} {
-                                set retval 1
-                                set retvar $opt
-                                lappend optarg [lindex $argsList 0]
-                                set argsList [lrange $argsList 1 end]
-                            } else {
-                                set oneof ""
-                                if {$type == "arg"} {
-                                    set charclass an
-                                } elseif {$type == "oneof"} {
-                                    set oneof ", one of $charclass"
-                                    set charclass an
-                                }
-                                set optarg "Option requires $charclass argument$oneof -- $opt"
-                                set retvar $opt
-                                set retval -3
-    
-                                if {$quantifier == "?"} {
-                                    set retval 1
-                                    set optarg ""
-                                }
-                                set quantifier ""
-                            }
-                             if {![regexp -- {[+*]} $quantifier]} {
-                                break;
-                            }
-                        }
-                    } else {
-                        error "Illegal option type specification:\
-                                must be one of $charclasses"
-                    }
-                } else {
-                    set optarg "Illegal option -- $_opt"
-                    set retvar $_opt
-                    set retval -1
-                }
-            }
-	    default {
-		# Skip ahead
-	    }
-        }
-    }
-
-    return $retval
-}
-
-# ::cmdline::typedGetoptions --
-#
-#	Process a set of command line options, filling in defaults
-#	for those not specified. This also generates an error message
-#	that lists the allowed options if an incorrect option is
-#	specified.
-#
-# Arguments:
-#	arglistVar	The name of the argument list, typically argv
-#	optlist		A list-of-lists where each element specifies an option
-#			in the form:
-#
-#				option default comment
-#
-#			Options formatting is as described for the optstring
-#			argument of typedGetopt. Default is for optionally
-#			specifying a default value. Comment is for optionally
-#			specifying a comment for the usage display. The
-#			options "-help" and "-?" are automatically included
-#			in optlist.
-#
-# Argument syntax miscellany:
-#	Options formatting and syntax is as described in typedGetopt.
-#	There are two additional suffixes that may be applied when
-#	passing options to typedGetoptions.
-#
-#	You may add ".multi" as a suffix to any option. For options
-#	that take an argument, this means that the option may be used
-#	more than once on the command line and that each additional
-#	argument will be appended to a list, which is then returned
-#	to the application.
-#		foo.double.multi
-#
-#	If a non-argument option is specified as ".multi", it is
-#	toggled on and off for each time it is used on the command
-#	line.
-#		foo.multi
-#
-#	If an option specification does not contain the ".multi"
-#	suffix, it is not an error to use an option more than once.
-#	In this case, the behavior for options with arguments is that
-#	the last argument is the one that will be returned. For
-#	options that do not take arguments, using them more than once
-#	has no additional effect.
-#
-#	Options may also be hidden from the usage display by
-#	appending the suffix ".secret" to any option specification.
-#	Please note that the ".secret" suffix must be the last suffix,
-#	after any argument type specification and ".multi" suffix.
-#		foo.xdigit.multi.secret
-#
-# Results
-#	Name value pairs suitable for using with array set.
-
-proc ::cmdline::typedGetoptions {arglistVar optlist {usage options:}} {
-    variable charclasses
-
-    upvar 1 $arglistVar argv
-
-    set opts {? help}
-    foreach opt $optlist {
-        set name [lindex $opt 0]
-        if {[regsub -- {\.secret$} $name {} name] == 1} {
-            # Remove this extension before passing to typedGetopt.
-        }
-        if {[regsub -- {\.multi$} $name {} name] == 1} {
-            # Remove this extension before passing to typedGetopt.
-
-            regsub -- {\..*$} $name {} temp
-            set multi($temp) 1
-        }
-        lappend opts $name
-        if {[regsub -- "\\.(arg|$charclasses|\\(.+).?\$" $name {} name] == 1} {
-            # Set defaults for those that take values.
-            # Booleans are set just by being present, or not
-
-            set dflt [lindex $opt 1]
-            if {$dflt != {}} {
-                set defaults($name) $dflt
-            }
-        }
-    }
-    set argc [llength $argv]
-    while {[set err [typedGetopt argv $opts opt arg]]} {
-        if {$err == 1} {
-            if {[info exists result($opt)]
-                    && [info exists multi($opt)]} {
-                # Toggle boolean options or append new arguments
-
-                if {$arg == ""} {
-                    unset result($opt)
-                } else {
-                    set result($opt) "$result($opt) $arg"
-                }
-            } else {
-                set result($opt) "$arg"
-            }
-        } elseif {($err == -1) || ($err == -3)} {
-            error [typedUsage $optlist $usage]
-        } elseif {$err == -2 && ![info exists defaults($opt)]} {
-            error [typedUsage $optlist $usage]
-        }
-    }
-    if {[info exists result(?)] || [info exists result(help)]} {
-        error [typedUsage $optlist $usage]
-    }
-    foreach {opt dflt} [array get defaults] {
-        if {![info exists result($opt)]} {
-            set result($opt) $dflt
-        }
-    }
-    return [array get result]
-}
-
-# ::cmdline::typedUsage --
-#
-#	Generate an error message that lists the allowed flags,
-#	type of argument taken (if any), default value (if any),
-#	and an optional description.
-#
-# Arguments:
-#	optlist		As for cmdline::typedGetoptions
-#
-# Results
-#	A formatted usage message
-
-proc ::cmdline::typedUsage {optlist {usage {options:}}} {
-    variable charclasses
-
-    set str "[getArgv0] $usage\n"
-    foreach opt [concat $optlist \
-            {{help "Print this message"} {? "Print this message"}}] {
-        set name [lindex $opt 0]
-        if {[regsub -- {\.secret$} $name {} name] == 1} {
-            # Hidden option
-
-        } else {
-            if {[regsub -- {\.multi$} $name {} name] == 1} {
-                # Display something about multiple options
-            }
-
-            if {[regexp -- "\\.(arg|$charclasses)\$" $name dummy charclass]
-                    || [regexp -- {\.\(([^)]+)\)} $opt dummy charclass]} {
-                   regsub -- "\\..+\$" $name {} name
-                set comment [lindex $opt 2]
-                set default "<[lindex $opt 1]>"
-                if {$default == "<>"} {
-                    set default ""
-                }
-                append str [format " %-20s %s %s\n" "-$name $charclass" \
-                        $comment $default]
-            } else {
-                set comment [lindex $opt 1]
-		append str [format " %-20s %s\n" "-$name" $comment]
-            }
-        }
-    }
-    return $str
-}
-
-# ::cmdline::prefixSearch --
-#
-#	Search a Tcl list for a pattern; searches first for an exact match,
-#	and if that fails, for a unique prefix that matches the pattern 
-#	(i.e, first "lsearch -exact", then "lsearch -glob $pattern*"
-#
-# Arguments:
-#	list		list of words
-#	pattern		word to search for
-#
-# Results:
-#	Index of found word is returned. If no exact match or
-#	unique short version is found then -1 is returned.
-
-proc ::cmdline::prefixSearch {list pattern} {
-    # Check for an exact match
-
-    if {[set pos [::lsearch -exact $list $pattern]] > -1} {
-        return $pos
-    }
-
-    # Check for a unique short version
-
-    set slist [lsort $list]
-    if {[set pos [::lsearch -glob $slist $pattern*]] > -1} {
-        # What if there is nothing for the check variable?
-
-        set check [lindex $slist [expr {$pos + 1}]]
-        if {[string first $pattern $check] != 0} {
-            return [::lsearch -exact $list [lindex $slist $pos]]
-        }
-    }
-    return -1
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/cmdline/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/cmdline/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded cmdline 1.3 [list source [file join $dir cmdline.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/comm/comm.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/comm/comm.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1663 +1,0 @@
-# comm.tcl --
-#
-#	socket-based 'send'ing of commands between interpreters.
-#
-# %%_OSF_FREE_COPYRIGHT_%%
-# Copyright (C) 1995-1998 The Open Group.   All Rights Reserved.
-# (Please see the file "comm.LICENSE" that accompanied this source,
-#  or http://www.opengroup.org/www/dist_client/caubweb/COPYRIGHT.free.html)
-# Copyright (c) 2003-2007 ActiveState Corporation
-#
-# This is the 'comm' package written by Jon Robert LoVerso, placed
-# into its own namespace during integration into tcllib.
-#
-# Note that the actual code was changed in several places (Reordered,
-# eval speedup)
-# 
-#	comm works just like Tk's send, except that it uses sockets.
-#	These commands work just like "send" and "winfo interps":
-#
-#		comm send ?-async? <id> <cmd> ?<arg> ...?
-#		comm interps
-#
-#	See the manual page comm.n for further details on this package.
-#
-# RCS: @(#) $Id: comm.tcl,v 1.30 2007/08/15 21:33:37 andreas_kupries Exp $
-
-package require Tcl 8.3
-package require snit ; # comm::future objects.
-
-namespace eval ::comm {
-    namespace export comm comm_send
-
-    variable  comm
-    array set comm {}
-
-    if {![info exists comm(chans)]} {
-	array set comm {
-	    debug 0 chans {} localhost 127.0.0.1
-	    connecting,hook	1
-	    connected,hook	1
-	    incoming,hook	1
-	    eval,hook		1
-	    callback,hook	1
-	    reply,hook		1
-	    lost,hook		1
-	    offerVers		{3 2}
-	    acceptVers		{3 2}
-	    defVers		2
-	    defaultEncoding	"utf-8"
-	    defaultSilent   0
-	}
-	set comm(lastport) [expr {[pid] % 32768 + 9999}]
-	# fast check for acceptable versions
-	foreach comm(_x) $comm(acceptVers) {
-	    set comm($comm(_x),vers) 1
-	}
-	catch {unset comm(_x)}
-    }
-
-    # Class variables:
-    #	lastport		saves last default listening port allocated
-    #	debug			enable debug output
-    #	chans			list of allocated channels
-    #   future,fid,$fid         List of futures a specific peer is waiting for.
-    #
-    # Channel instance variables:
-    # comm()
-    #	$ch,port		listening port (our id)
-    #	$ch,socket		listening socket
-    #   $ch,silent      boolean to indicate whether to throw error on
-    #                   protocol negotiation failure
-    #	$ch,local		boolean to indicate if port is local
-    #	$ch,interp		interpreter to run received scripts in.
-    #				If not empty we own it! = We destroy it
-    #				with the channel
-    #	$ch,events		List of hoks to run in the 'interp', if defined
-    #	$ch,serial		next serial number for commands
-    #
-    #	$ch,hook,$hook		script for hook $hook
-    #
-    #	$ch,peers,$id		open connections to peers; ch,id=>fid
-    #	$ch,fids,$fid		reverse mapping for peers; ch,fid=>id
-    #	$ch,vers,$id		negotiated protocol version for id
-    #	$ch,pending,$id		list of outstanding send serial numbers for id
-    #
-    #	$ch,buf,$fid		buffer to collect incoming data
-    #	$ch,result,$serial	result value set here to wake up sender
-    #	$ch,return,$serial	return codes to go along with result
-
-    if {0} {
-	# Propagate result, code, and errorCode.  Can't just eval
-	# otherwise TCL_BREAK gets turned into TCL_ERROR.
-	global errorInfo errorCode
-	set code [catch [concat commSend $args] res]
-	return -code $code -errorinfo $errorInfo -errorcode $errorCode $res
-    }
-}
-
-# ::comm::comm_send --
-#
-#	Convenience command. Replaces Tk 'send' and 'winfo' with
-#	versions using the 'comm' variants. Multiple calls are
-#	allowed, only the first one will have an effect.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	None.
-
-proc ::comm::comm_send {} {
-    proc send {args} {
-	# Use pure lists to speed this up.
-	uplevel 1 [linsert $args 0 ::comm::comm send]
-    }
-    rename winfo tk_winfo
-    proc winfo {cmd args} {
-	if {![string match in* $cmd]} {
-	    # Use pure lists to speed this up ...
-	    return [uplevel 1 [linsert $args 0 tk_winfo $cmd]]
-	}
-	return [::comm::comm interps]
-    }
-    proc ::comm::comm_send {} {}
-}
-
-# ::comm::comm --
-#
-#	See documentation for public methods of "comm".
-#	This procedure is followed by the definition of
-#	the public methods themselves.
-#
-# Arguments:
-#	cmd	Invoked method
-#	args	Arguments to method.
-#
-# Results:
-#	As of the invoked method.
-
-proc ::comm::comm {cmd args} {
-    set method [info commands ::comm::comm_cmd_$cmd*]
-
-    if {[llength $method] == 1} {
-	set chan ::comm::comm; # passed to methods
-	return [uplevel 1 [linsert $args 0 $method $chan]]
-    } else {
-	foreach c [info commands ::comm::comm_cmd_*] {
-	    # remove ::comm::comm_cmd_
-	    lappend cmds [string range $c 17 end]
-	}
-        return -code error "unknown subcommand \"$cmd\":\
-		must be one of [join [lsort $cmds] {, }]"
-    }
-}
-
-proc ::comm::comm_cmd_connect {chan args} {
-    uplevel 1 [linsert $args 0 [namespace current]::commConnect $chan]
-}
-proc ::comm::comm_cmd_self {chan args} {
-    variable comm
-    return $comm($chan,port)
-}
-proc ::comm::comm_cmd_channels {chan args} {
-    variable comm
-    return $comm(chans)
-}
-proc ::comm::comm_cmd_configure {chan args} {
-    uplevel 1 [linsert $args 0 [namespace current]::commConfigure $chan 0]
-}
-proc ::comm::comm_cmd_ids {chan args} {
-    variable comm
-    set res $comm($chan,port)
-    foreach {i id} [array get comm $chan,fids,*] {lappend res $id}
-    return $res
-}
-interp alias {} ::comm::comm_cmd_interps {} ::comm::comm_cmd_ids
-proc ::comm::comm_cmd_remoteid {chan args} {
-    variable comm
-    if {[info exists comm($chan,remoteid)]} {
-	set comm($chan,remoteid)
-    } else {
-	return -code error "No remote commands processed yet"
-    }
-}
-proc ::comm::comm_cmd_debug {chan bool} {
-    variable comm
-    return [set comm(debug) [string is true -strict $bool]]
-}
-
-# ### ### ### ######### ######### #########
-## API: Setup async result generation for a remotely invoked command.
-
-# (future,fid,<fid>) -> list (future)
-# (current,async)    -> bool (default 0) 
-# (current,state)    -> list (chan fid cmd ser)
-
-proc ::comm::comm_cmd_return_async {chan} {
-    variable comm
-
-    if {![info exists comm(current,async)]} {
-	return -code error "No remote commands processed yet"
-    }
-    if {$comm(current,async)} {
-	# Return the same future which were generated by the first
-	# call.
-	return $comm(current,state)
-    }
-
-    foreach {cmdchan cmdfid cmd ser} $comm(current,state) break
-
-    # Assert that the channel performing the request and the channel
-    # the current command came in are identical. Panic if not.
-
-    if {![string equal $chan $cmdchan]} {
-	return -code error "Internal error: Trying to activate\
-		async return for a command on a different channel"
-    }
-
-    # Establish the future for the command and return a handle for
-    # it. Remember the outstanding futures for a peer, so that we can
-    # cancel them if the peer is lost before the promise implicit in
-    # the future is redeemed.
-
-    set future [::comm::future %AUTO% $chan $cmdfid $cmd $ser]
-
-    lappend comm(future,fid,$cmdfid) $future
-    set     comm(current,state)      $future
-
-    # Mark the current command as using async result return. We do
-    # this last to ensure that all errors in this method are reported
-    # through the regular channels.
-
-    set comm(current,async) 1
-
-    return $future
-}
-
-# hook --
-#
-#	Internal command. Implements 'comm hook'.
-#
-# Arguments:
-#	hook	hook to modify
-#	script	Script to add/remove to/from the hook
-#
-# Results:
-#	None.
-#
-proc ::comm::comm_cmd_hook {chan hook {script +}} {
-    variable comm
-    if {![info exists comm($hook,hook)]} {
-	return -code error "Unknown hook invoked"
-    }
-    if {!$comm($hook,hook)} {
-	return -code error "Unimplemented hook invoked"
-    }
-    if {[string equal + $script]} {
-	if {[catch {set comm($chan,hook,$hook)} ret]} {
-	    return
-	}
-	return $ret
-    }
-    if {[string match +* $script]} {
-	append comm($chan,hook,$hook) \n [string range $script 1 end]
-    } else {
-	set comm($chan,hook,$hook) $script
-    }
-    return
-}
-
-# abort --
-#
-#	Close down all peer connections.
-#	Implements the 'comm abort' method.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	None.
-
-proc ::comm::comm_cmd_abort {chan} {
-    variable comm
-
-    foreach pid [array names comm $chan,peers,*] {
-	commLostConn $chan $comm($pid) "Connection aborted by request"
-    }
-}
-
-# destroy --
-#
-#	Destroy the channel invoking it.
-#	Implements the 'comm destroy' method.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	None.
-#
-proc ::comm::comm_cmd_destroy {chan} {
-    variable comm
-    catch {close $comm($chan,socket)}
-    comm_cmd_abort $chan
-    if {$comm($chan,interp) != {}} {
-	interp delete $comm($chan,interp)
-    }
-    catch {unset comm($chan,port)}
-    catch {unset comm($chan,local)}
-    catch {unset comm($chan,silent)}
-    catch {unset comm($chan,interp)}
-    catch {unset comm($chan,events)}
-    catch {unset comm($chan,socket)}
-    catch {unset comm($chan,remoteid)}
-    unset comm($chan,serial)
-    unset comm($chan,chan)
-    unset comm($chan,encoding)
-    unset comm($chan,listen)
-    # array unset would have been nicer, but is not available in
-    # 8.2/8.3
-    foreach pattern {hook,* interp,* vers,*} {
-	foreach k [array names comm $chan,$pattern] {unset comm($k)}
-    }
-    set pos [lsearch -exact $comm(chans) $chan]
-    set comm(chans) [lreplace $comm(chans) $pos $pos]
-    if {![string equal ::comm::comm $chan]} {
-	rename $chan {}
-    }
-    return
-}
-
-# shutdown --
-#
-#	Close down a peer connection.
-#	Implements the 'comm shutdown' method.
-#
-# Arguments:
-#	id	Reference to the remote interp
-#
-# Results:
-#	None.
-#
-proc ::comm::comm_cmd_shutdown {chan id} {
-    variable comm
-
-    if {[info exists comm($chan,peers,$id)]} {
-	commLostConn $chan $comm($chan,peers,$id) \
-	    "Connection shutdown by request"
-    }
-}
-
-# new --
-#
-#	Create a new comm channel/instance.
-#	Implements the 'comm new' method.
-#
-# Arguments:
-#	ch	Name of the new channel
-#	args	Configuration, in the form of -option value pairs.
-#
-# Results:
-#	None.
-#
-proc ::comm::comm_cmd_new {chan ch args} {
-    variable comm
-
-    if {[lsearch -exact $comm(chans) $ch] >= 0} {
-	return -code error "Already existing channel: $ch"
-    }
-    if {([llength $args] % 2) != 0} {
-	return -code error "Must have an even number of config arguments"
-    }
-    # ensure that the new channel name is fully qualified
-    set ch ::[string trimleft $ch :]
-    if {[string equal ::comm::comm $ch]} {
-	# allow comm to be recreated after destroy
-    } elseif {[string equal $ch [info commands $ch]]} {
-	return -code error "Already existing command: $ch"
-    } else {
-	# Create the new channel with fully qualified proc name
-	proc $ch {cmd args} {
-	    set method [info commands ::comm::comm_cmd_$cmd*]
-
-	    if {[llength $method] == 1} {
-		# this should work right even if aliased
-		# it is passed to methods to identify itself
-		set chan [namespace origin [lindex [info level 0] 0]]
-		return [uplevel 1 [linsert $args 0 $method $chan]]
-	    } else {
-		foreach c [info commands ::comm::comm_cmd_*] {
-		    # remove ::comm::comm_cmd_
-		    lappend cmds [string range $c 17 end]
-		}
-		return -code error "unknown subcommand \"$cmd\":\
-			must be one of [join [lsort $cmds] {, }]"
-	    }
-	}
-    }
-    lappend comm(chans) $ch
-    set chan $ch
-    set comm($chan,serial) 0
-    set comm($chan,chan)   $chan
-    set comm($chan,port)   0
-    set comm($chan,listen) 0
-    set comm($chan,socket) ""
-    set comm($chan,local)  1
-    set comm($chan,silent)   $comm(defaultSilent)
-    set comm($chan,encoding) $comm(defaultEncoding)
-    set comm($chan,interp)   {}
-    set comm($chan,events)   {}
-
-    if {[llength $args] > 0} {
-	if {[catch [linsert $args 0 commConfigure $chan 1] err]} {
-	    comm_cmd_destroy $chan
-	    return -code error $err
-	}
-    }
-    return $chan
-}
-
-# send --
-#
-#	Send command to a specified channel.
-#	Implements the 'comm send' method.
-#
-# Arguments:
-#	args	see inside
-#
-# Results:
-#	varies.
-#
-proc ::comm::comm_cmd_send {chan args} {
-    variable comm
-
-    set cmd send
-
-    # args = ?-async | -command command? id cmd ?arg arg ...?
-    set i 0
-    set opt [lindex $args $i]
-    if {[string equal -async $opt]} {
-	set cmd async
-	incr i
-    } elseif {[string equal -command $opt]} {
-	set cmd command
-	set callback [lindex $args [incr i]]
-	incr i
-    }
-    # args = id cmd ?arg arg ...?
-
-    set id [lindex $args $i]
-    incr i
-    set args [lrange $args $i end]
-
-    if {![info complete $args]} {
-	return -code error "Incomplete command"
-    }
-    if {![llength $args]} {
-	return -code error \
-		"wrong # args: should be \"send ?-async? id arg ?arg ...?\""
-    }
-    if {[catch {commConnect $chan $id} fid]} {
-	return -code error "Connect to remote failed: $fid"
-    }
-
-    set ser [incr comm($chan,serial)]
-    # This is unneeded - wraps from 2147483647 to -2147483648
-    ### if {$comm($chan,serial) == 0x7fffffff} {set comm($chan,serial) 0}
-
-    commDebug {puts stderr "<$chan> send <[list [list $cmd $ser $args]]>"}
-
-    # The double list assures that the command is a single list when read.
-    puts  $fid [list [list $cmd $ser $args]]
-    flush $fid
-
-    commDebug {puts stderr "<$chan> sent"}
-
-    # wait for reply if so requested
-
-    if {[string equal command $cmd]} {
-	# In this case, don't wait on the command result.  Set the callback
-	# in the return and that will be invoked by the result.
-	lappend comm($chan,pending,$id) [list $ser callback]
-	set comm($chan,return,$ser) $callback
-	return $ser
-    } elseif {[string equal send $cmd]} {
-	upvar 0 comm($chan,pending,$id) pending	;# shorter variable name
-
-	lappend pending $ser
-	set comm($chan,return,$ser) ""		;# we're waiting
-
-	commDebug {puts stderr "<$chan> --<<waiting $ser>>--"}
-	vwait ::comm::comm($chan,result,$ser)
-
-	# if connection was lost, pending is gone
-	if {[info exists pending]} {
-	    set pos [lsearch -exact $pending $ser]
-	    set pending [lreplace $pending $pos $pos]
-	}
-
-	commDebug {
-	    puts stderr "<$chan> result\
-		    <$comm($chan,return,$ser);$comm($chan,result,$ser)>"
-	}
-
-	array set return $comm($chan,return,$ser)
-	unset comm($chan,return,$ser)
-	set thisres $comm($chan,result,$ser)
-	unset comm($chan,result,$ser)
-	switch -- $return(-code) {
-	    "" - 0 {return $thisres}
-	    1 {
-		return  -code $return(-code) \
-			-errorinfo $return(-errorinfo) \
-			-errorcode $return(-errorcode) \
-			$thisres
-	    }
-	    default {return -code $return(-code) $thisres}
-	}
-    }
-}
-
-###############################################################################
-
-# ::comm::commDebug --
-#
-#	Internal command. Conditionally executes debugging
-#	statements. Currently this are only puts commands logging the
-#	various interactions. These could be replaced with calls into
-#	the 'log' module.
-#
-# Arguments:
-#	arg	Tcl script to execute.
-#
-# Results:
-#	None.
-
-proc ::comm::commDebug {cmd} {
-    variable comm
-    if {$comm(debug)} {
-	uplevel 1 $cmd
-    }
-}
-
-# ::comm::commConfVars --
-#
-#	Internal command. Used to declare configuration options.
-#
-# Arguments:
-#	v	Name of configuration option.
-#	t	Default value.
-#
-# Results:
-#	None.
-
-proc ::comm::commConfVars {v t} {
-    variable comm
-    set comm($v,var) $t
-    set comm(vars) {}
-    foreach c [array names comm *,var] {
-	lappend comm(vars) [lindex [split $c ,] 0]
-    }
-    return
-}
-::comm::commConfVars port     p
-::comm::commConfVars local    b
-::comm::commConfVars listen   b
-::comm::commConfVars socket   ro
-::comm::commConfVars chan     ro
-::comm::commConfVars serial   ro
-::comm::commConfVars encoding enc
-::comm::commConfVars silent   b
-::comm::commConfVars interp   interp
-::comm::commConfVars events   ev
-
-# ::comm::commConfigure --
-#
-#	Internal command. Implements 'comm configure'.
-#
-# Arguments:
-#	force	Boolean flag. If set the socket is reinitialized.
-#	args	New configuration, as -option value pairs.
-#
-# Results:
-#	None.
-
-proc ::comm::commConfigure {chan {force 0} args} {
-    variable comm
-
-    # query
-    if {[llength $args] == 0} {
-	foreach v $comm(vars) {lappend res -$v $comm($chan,$v)}
-	return $res
-    } elseif {[llength $args] == 1} {
-	set arg [lindex $args 0]
-	set var [string range $arg 1 end]
-	if {![string match -* $arg] || ![info exists comm($var,var)]} {
-	    return -code error "Unknown configuration option: $arg"
-	}
-	return $comm($chan,$var)
-    }
-
-    # set
-    set opt 0
-    foreach arg $args {
-	incr opt
-	if {[info exists skip]} {unset skip; continue}
-	set var [string range $arg 1 end]
-	if {![string match -* $arg] || ![info exists comm($var,var)]} {
-	    return -code error "Unknown configuration option: $arg"
-	}
-	set optval [lindex $args $opt]
-	switch $comm($var,var) {
-	    ev {
-		if {![string equal  $optval ""]} {
-		    set err 0
-		    if {[catch {
-			foreach ev $optval {
-			    if {[lsearch -exact {connecting connected incoming eval callback reply lost} $ev] < 0} {
-				set err 1
-				break
-			    }
-			}
-		    }]} {
-			set err 1
-		    }
-		    if {$err} {
-			return -code error \
-				"Non-event to configuration option: -$var"
-		    }
-		}
-		# FRINK: nocheck
-		set $var $optval
-		set skip 1
-	    }
-	    interp {
-		if {
-		    ![string equal  $optval ""] &&
-		    ![interp exists $optval]
-		} {
-		    return -code error \
-			    "Non-interpreter to configuration option: -$var"
-		}
-		# FRINK: nocheck
-		set $var $optval
-		set skip 1
-	    }
-	    b {
-		# FRINK: nocheck
-		set $var [string is true -strict $optval]
-		set skip 1
-	    }
-	    v {
-		# FRINK: nocheck
-		set $var $optval
-		set skip 1
-	    }
-	    p {
-		if {
-		    ![string equal $optval ""] &&
-		    ![string is integer $optval]
-		} {
-		    return -code error \
-			"Non-port to configuration option: -$var"
-		}
-		# FRINK: nocheck
-		set $var $optval
-		set skip 1
-	    }
-	    i {
-		if {![string is integer $optval]} {
-		    return -code error \
-			"Non-integer to configuration option: -$var"
-		}
-		# FRINK: nocheck
-		set $var $optval
-		set skip 1
-	    }
-	    enc {
-		# to configure encodings, we will need to extend the
-		# protocol to allow for handshaked encoding changes
-		return -code error "encoding not configurable"
-		if {[lsearch -exact [encoding names] $optval] == -1} {
-		    return -code error \
-			"Unknown encoding to configuration option: -$var"
-		}
-		set $var $optval
-		set skip 1
-	    }
-	    ro { return -code error "Readonly configuration option: -$var" }
-	}
-    }
-    if {[info exists skip]} {
-	return -code error "Missing value for option: $arg"
-    }
-
-    foreach var {port listen local} {
-	# FRINK: nocheck
-	if {[info exists $var] && [set $var] != $comm($chan,$var)} {
-	    incr force
-	    # FRINK: nocheck
-	    set comm($chan,$var) [set $var]
-	}
-    }
-
-    foreach var {silent interp events} {
-	# FRINK: nocheck
-	if {[info exists $var] && ([set $var] != $comm($chan,$var))} {
-	    # FRINK: nocheck
-	    set comm($chan,$var) [set ip [set $var]]
-	    if {[string equal $var "interp"] && ($ip != "")} {
-		# Interrogate the interp about its capabilities.
-		#
-		# Like: set, array set, uplevel present ?
-		# Or:   The above, hidden ?
-		#
-		# This is needed to decide how to execute hook scripts
-		# and regular scripts in this interpreter.
-		set comm($chan,interp,set)  [Capability $ip set]
-		set comm($chan,interp,aset) [Capability $ip array]
-		set comm($chan,interp,upl)  [Capability $ip uplevel]
-	    }
-	}
-    }
-
-    if {[info exists encoding] &&
-	![string equal $encoding $comm($chan,encoding)]} {
-	# This should not be entered yet
-	set comm($chan,encoding) $encoding
-	fconfigure $comm($chan,socket) -encoding $encoding
-	foreach {i sock} [array get comm $chan,peers,*] {
-	    fconfigure $sock -encoding $encoding
-	}
-    }
-
-    # do not re-init socket
-    if {!$force} {return ""}
-
-    # User is recycling object, possibly to change from local to !local
-    if {[info exists comm($chan,socket)]} {
-	comm_cmd_abort $chan
-	catch {close $comm($chan,socket)}
-	unset comm($chan,socket)
-    }
-
-    set comm($chan,socket) ""
-    if {!$comm($chan,listen)} {
-	set comm($chan,port) 0
-	return ""
-    }
-
-    if {[info exists port] && [string equal "" $comm($chan,port)]} {
-	set nport [incr comm(lastport)]
-    } else {
-	set userport 1
-	set nport $comm($chan,port)
-    }
-    while {1} {
-	set cmd [list socket -server [list ::comm::commIncoming $chan]]
-	if {$comm($chan,local)} {
-	    lappend cmd -myaddr $comm(localhost)
-	}
-	lappend cmd $nport
-	if {![catch $cmd ret]} {
-	    break
-	}
-	if {[info exists userport] || ![string match "*already in use" $ret]} {
-	    # don't eradicate the class
-	    if {![string equal ::comm::comm $chan]} {
-		rename $chan {}
-	    }
-	    return -code error $ret
-	}
-	set nport [incr comm(lastport)]
-    }
-    set comm($chan,socket) $ret
-    fconfigure $ret -translation lf -encoding $comm($chan,encoding)
-
-    # If port was 0, system allocated it for us
-    set comm($chan,port) [lindex [fconfigure $ret -sockname] 2]
-    return ""
-}
-
-# ::comm::Capability --
-#
-#	Internal command. Interogate an interp for
-#	the commands needed to execute regular and
-#	hook scripts.
-
-proc ::comm::Capability {interp cmd} {
-    if {[lsearch -exact [interp hidden $interp] $cmd] >= 0} {
-	# The command is present, although hidden.
-	return hidden
-    }
-
-    # The command is not a hidden command. Use info to determine if it
-    # is present as regular command. Note that the 'info' command
-    # itself might be hidden.
-
-    if {[catch {
-	set has [llength [interp eval $interp [list info commands $cmd]]]
-    }] && [catch {
-	set has [llength [interp invokehidden $interp info commands $cmd]]
-    }]} {
-	# Unable to interogate the interpreter in any way. Assume that
-	# the command is not present.
-	set has 0
-    }
-    return [expr {$has ? "ok" : "no"}]
-}
-
-# ::comm::commConnect --
-#
-#	Internal command. Called to connect to a remote interp
-#
-# Arguments:
-#	id	Specification of the location of the remote interp.
-#		A list containing either one or two elements.
-#		One element = port, host is localhost.
-#		Two elements = port and host, in this order.
-#
-# Results:
-#	fid	channel handle of the socket the connection goes through.
-
-proc ::comm::commConnect {chan id} {
-    variable comm
-
-    commDebug {puts stderr "<$chan> commConnect $id"}
-
-    # process connecting hook now
-    CommRunHook $chan connecting
-
-    if {[info exists comm($chan,peers,$id)]} {
-	return $comm($chan,peers,$id)
-    }
-    if {[lindex $id 0] == 0} {
-	return -code error "Remote comm is anonymous; cannot connect"
-    }
-
-    if {[llength $id] > 1} {
-	set host [lindex $id 1]
-    } else {
-	set host $comm(localhost)
-    }
-    set port [lindex $id 0]
-    set fid [socket $host $port]
-
-    # process connected hook now
-    if {[catch {
-	CommRunHook $chan connected
-    } err]} {
-	global  errorInfo
-	set ei $errorInfo
-	close $fid
-	error $err $ei
-    }
-
-    # commit new connection
-    commNewConn $chan $id $fid
-
-    # send offered protocols versions and id to identify ourselves to remote
-    puts $fid [list $comm(offerVers) $comm($chan,port)]
-    set comm($chan,vers,$id) $comm(defVers)		;# default proto vers
-    flush  $fid
-    return $fid
-}
-
-# ::comm::commIncoming --
-#
-#	Internal command. Called for an incoming new connection.
-#	Handles connection setup and initialization.
-#
-# Arguments:
-#	chan	logical channel handling the connection.
-#	fid	channel handle of the socket running the connection.
-#	addr	ip address of the socket channel 'fid'
-#	remport	remote port for the socket channel 'fid'
-#
-# Results:
-#	None.
-
-proc ::comm::commIncoming {chan fid addr remport} {
-    variable comm
-
-    commDebug {puts stderr "<$chan> commIncoming $fid $addr $remport"}
-
-    # process incoming hook now
-    if {[catch {
-	CommRunHook $chan incoming
-    } err]} {
-	global errorInfo
-	set ei $errorInfo
-	close $fid
-	error $err $ei
-    }
-
-    # a list of offered proto versions is the first word of first line
-    # remote id is the second word of first line
-    # rest of first line is ignored
-    set protoline   [gets $fid]
-    set offeredvers [lindex $protoline 0]
-    set remid       [lindex $protoline 1]
-
-    commDebug {puts stderr "<$chan> offered <$protoline>"}
-
-    # use the first supported version in the offered list
-    foreach v $offeredvers {
-	if {[info exists comm($v,vers)]} {
-	    set vers $v
-	    break
-	}
-    }
-    if {![info exists vers]} {
-	close $fid
-	if {[info exists comm($chan,silent)] && 
-	    [string is true -strict $comm($chan,silent)]} then return
-	error "Unknown offered protocols \"$protoline\" from $addr/$remport"
-    }
-
-    # If the remote host addr isn't our local host addr,
-    # then add it to the remote id.
-    if {[string equal [lindex [fconfigure $fid -sockname] 0] $addr]} {
-	set id $remid
-    } else {
-	set id [list $remid $addr]
-    }
-
-    # Detect race condition of two comms connecting to each other
-    # simultaneously.  It is OK when we are talking to ourselves.
-
-    if {[info exists comm($chan,peers,$id)] && $id != $comm($chan,port)} {
-
-	puts stderr "commIncoming race condition: $id"
-	puts stderr "peers=$comm($chan,peers,$id) port=$comm($chan,port)"
-
-	# To avoid the race, we really want to terminate one connection.
-	# However, both sides are committed to using it.
-	# commConnect needs to be synchronous and detect the close.
-	# close $fid
-	# return $comm($chan,peers,$id)
-    }
-
-    # Make a protocol response.  Avoid any temptation to use {$vers > 2}
-    # - this forces forwards compatibility issues on protocol versions
-    # that haven't been invented yet.  DON'T DO IT!  Instead, test for
-    # each supported version explicitly.  I.e., {$vers >2 && $vers < 5} is OK.
-
-    switch $vers {
-	3 {
-	    # Respond with the selected version number
-	    puts  $fid [list [list vers $vers]]
-	    flush $fid
-	}
-    }
-
-    # commit new connection
-    commNewConn $chan $id $fid
-    set comm($chan,vers,$id) $vers
-}
-
-# ::comm::commNewConn --
-#
-#	Internal command. Common new connection processing
-#
-# Arguments:
-#	id	Reference to the remote interp
-#	fid	channel handle of the socket running the connection.
-#
-# Results:
-#	None.
-
-proc ::comm::commNewConn {chan id fid} {
-    variable comm
-
-    commDebug {puts stderr "<$chan> commNewConn $id $fid"}
-
-    # There can be a race condition two where comms connect to each other
-    # simultaneously.  This code favors our outgoing connection.
-
-    if {[info exists comm($chan,peers,$id)]} {
-	# abort this connection, use the existing one
-	# close $fid
-	# return -code return $comm($chan,peers,$id)
-    } else {
-	set comm($chan,pending,$id) {}
-    	set comm($chan,peers,$id) $fid
-    }
-    set comm($chan,fids,$fid) $id
-    fconfigure $fid -translation lf -encoding $comm($chan,encoding) -blocking 0
-    fileevent $fid readable [list ::comm::commCollect $chan $fid]
-}
-
-# ::comm::commLostConn --
-#
-#	Internal command. Called to tidy up a lost connection,
-#	including aborting ongoing sends. Each send should clean
-#	themselves up in pending/result.
-#
-# Arguments:
-#	fid	Channel handle of the socket which got lost.
-#	reason	Message describing the reason of the loss.
-#
-# Results:
-#	reason
-
-proc ::comm::commLostConn {chan fid reason} {
-    variable comm
-
-    commDebug {puts stderr "<$chan> commLostConn $fid $reason"}
-
-    catch {close $fid}
-
-    set id $comm($chan,fids,$fid)
-
-    # Invoke the callbacks of all commands which have such and are
-    # still waiting for a response from the lost peer. Use an
-    # appropriate error.
-
-    foreach s $comm($chan,pending,$id) {
-	if {[string equal "callback" [lindex $s end]]} {
-	    set ser [lindex $s 0]
-	    if {[info exists comm($chan,return,$ser)]} {
-		set args [list -id       $id \
-			      -serial    $ser \
-			      -chan      $chan \
-			      -code      -1 \
-			      -errorcode NONE \
-			      -errorinfo "" \
-			      -result    $reason \
-			     ]
-		if {[catch {uplevel \#0 $comm($chan,return,$ser) $args} err]} {
-		    commBgerror $err
-		}
-	    }
-	} else {
-	    set comm($chan,return,$s) {-code error}
-	    set comm($chan,result,$s) $reason
-	}
-    }
-    unset comm($chan,pending,$id)
-    unset comm($chan,fids,$fid)
-    catch {unset comm($chan,peers,$id)}		;# race condition
-    catch {unset comm($chan,buf,$fid)}
-
-    # Cancel all outstanding futures for requests which were made by
-    # the lost peer, if there are any. This does not destroy
-    # them. They will stay around until the long-running operations
-    # they belong too kill them.
-
-    CancelFutures $fid
-
-    # process lost hook now
-    catch {CommRunHook $chan lost}
-
-    return $reason
-}
-
-proc ::comm::commBgerror {err} {
-    # SF Tcllib Patch #526499
-    # (See http://sourceforge.net/tracker/?func=detail&aid=526499&group_id=12883&atid=312883
-    #  for initial request and comments)
-    #
-    # Error in async call. Look for [bgerror] to report it. Same
-    # logic as in Tcl itself. Errors thrown by bgerror itself get
-    # reported to stderr.
-    if {[catch {bgerror $err} msg]} {
-	puts stderr "bgerror failed to handle background error."
-	puts stderr "    Original error: $err"
-	puts stderr "    Error in bgerror: $msg"
-	flush stderr
-    }
-}
-
-# CancelFutures: Mark futures associated with a comm channel as
-# expired, done when the connection to the peer has been lost. The
-# marked futures will not generate result anymore. They will also stay
-# around until destroyed by the script they belong to.
-
-proc ::comm::CancelFutures {fid} {
-    variable comm
-    if {![info exists comm(future,fid,$fid)]} return
-
-    commDebug {puts stderr "\tCanceling futures: [join $comm(future,fid,$fid) \
-                         "\n\t                 : "]"}
-
-    foreach future $comm(future,fid,$fid) {
-	$future Cancel
-    }
-
-    unset comm(future,fid,$fid)
-    return
-}
-
-###############################################################################
-
-# ::comm::commCollect --
-#
-#	Internal command. Called from the fileevent to read from fid
-#	and append to the buffer. This continues until we get a whole
-#	command, which we then invoke.
-#
-# Arguments:
-#	chan	logical channel collecting the data
-#	fid	channel handle of the socket we collect.
-#
-# Results:
-#	None.
-
-proc ::comm::commCollect {chan fid} {
-    variable comm
-    upvar #0 comm($chan,buf,$fid) data
-
-    # Tcl8 may return an error on read after a close
-    if {[catch {read $fid} nbuf] || [eof $fid]} {
-	commDebug {puts stderr "<$chan> collect/lost eof $fid = [eof $fid]"}
-	commDebug {puts stderr "<$chan> collect/lost nbuf = <$nbuf>"}
-	commDebug {puts stderr "<$chan> collect/lost [fconfigure $fid]"}
-
-	fileevent $fid readable {}		;# be safe
-	commLostConn $chan $fid "target application died or connection lost"
-	return
-    }
-    append data $nbuf
-
-    commDebug {puts stderr "<$chan> collect <$data>"}
-
-    # If data contains at least one complete command, we will
-    # be able to take off the first element, which is a list holding
-    # the command.  This is true even if data isn't a well-formed
-    # list overall, with unmatched open braces.  This works because
-    # each command in the protocol ends with a newline, thus allowing
-    # lindex and lreplace to work.
-    #
-    # This isn't true with Tcl8.0, which will return an error until
-    # the whole buffer is a valid list.  This is probably OK, although
-    # it could potentially cause a deadlock.
-
-    while {![catch {set cmd [lindex $data 0]}]} {
-	commDebug {puts stderr "<$chan> cmd <$data>"}
-	if {[string equal "" $cmd]} break
-	if {[info complete $cmd]} {
-	    set data [lreplace $data 0 0]
-	    after idle \
-		    [list ::comm::commExec $chan $fid $comm($chan,fids,$fid) $cmd]
-	}
-    }
-}
-
-# ::comm::commExec --
-#
-#	Internal command. Receives and executes a remote command,
-#	returning the result and/or error. Unknown protocol commands
-#	are silently discarded
-#
-# Arguments:
-#	chan		logical channel collecting the data
-#	fid		channel handle of the socket we collect.
-#	remoteid	id of the other side.
-#	buf		buffer containing the command to execute.
-#
-# Results:
-#	None.
-
-proc ::comm::commExec {chan fid remoteid buf} {
-    variable comm
-
-    # buffer should contain:
-    #	send  # {cmd}		execute cmd and send reply with serial #
-    #	async # {cmd}		execute cmd but send no reply
-    #	reply # {cmd}		execute cmd as reply to serial #
-
-    # these variables are documented in the hook interface
-    set cmd [lindex $buf 0]
-    set ser [lindex $buf 1]
-    set buf [lrange $buf 2 end]
-    set buffer [lindex $buf 0]
-
-    # Save remoteid for "comm remoteid".  This will only be valid
-    # if retrieved before any additional events occur on this channel.
-    # N.B. we could have already lost the connection to remote, making
-    # this id be purely informational!
-    set comm($chan,remoteid) [set id $remoteid]
-
-    # Save state for possible async result generation
-    AsyncPrepare $chan $fid $cmd $ser
-
-    commDebug {puts stderr "<$chan> exec <$cmd,$ser,$buf>"}
-
-    switch -- $cmd {
-	send - async - command {}
-	callback {
-	    if {![info exists comm($chan,return,$ser)]} {
-	        commDebug {puts stderr "<$chan> No one waiting for serial \"$ser\""}
-		return
-	    }
-
-	    # Decompose reply command to assure it only uses "return"
-	    # with no side effects.
-
-	    array set return {-code "" -errorinfo "" -errorcode ""}
-	    set ret [lindex $buffer end]
-	    set len [llength $buffer]
-	    incr len -2
-	    foreach {sw val} [lrange $buffer 1 $len] {
-		if {![info exists return($sw)]} continue
-		set return($sw) $val
-	    }
-
-	    catch {CommRunHook $chan callback}
-
-	    # this wakes up the sender
-	    commDebug {puts stderr "<$chan> --<<wakeup $ser>>--"}
-
-	    # the return holds the callback command
-	    # string map the optional %-subs
-	    set args [list -id       $id \
-			  -serial    $ser \
-			  -chan      $chan \
-			  -code      $return(-code) \
-			  -errorcode $return(-errorcode) \
-			  -errorinfo $return(-errorinfo) \
-			  -result    $ret \
-			 ]
-	    set code [catch {uplevel \#0 $comm($chan,return,$ser) $args} err]
-	    catch {unset comm($chan,return,$ser)}
-
-	    # remove pending serial
-	    upvar 0 comm($chan,pending,$id) pending
-	    if {[info exists pending]} {
-		set pos [lsearch -exact $pending [list $ser callback]]
-		if {$pos != -1} {
-		    set pending [lreplace $pending $pos $pos]
-		}
-	    }
-	    if {$code} {
-		commBgerror $err
-	    }
-	    return
-	}
-	reply {
-	    if {![info exists comm($chan,return,$ser)]} {
-	        commDebug {puts stderr "<$chan> No one waiting for serial \"$ser\""}
-		return
-	    }
-
-	    # Decompose reply command to assure it only uses "return"
-	    # with no side effects.
-
-	    array set return {-code "" -errorinfo "" -errorcode ""}
-	    set ret [lindex $buffer end]
-	    set len [llength $buffer]
-	    incr len -2
-	    foreach {sw val} [lrange $buffer 1 $len] {
-		if {![info exists return($sw)]} continue
-		set return($sw) $val
-	    }
-
-	    catch {CommRunHook $chan reply}
-
-	    # this wakes up the sender
-	    commDebug {puts stderr "<$chan> --<<wakeup $ser>>--"}
-	    set comm($chan,result,$ser) $ret
-	    set comm($chan,return,$ser) [array get return]
-	    return
-	}
-	vers {
-	    set ::comm::comm($chan,vers,$id) $ser
-	    return
-	}
-	default {
-	    commDebug {puts stderr "<$chan> unknown command; discard \"$cmd\""}
-	    return
-	}
-    }
-
-    # process eval hook now
-    set done 0
-    set err  0
-    if {[info exists comm($chan,hook,eval)]} {
-	set err [catch {CommRunHook $chan eval} ret]
-	commDebug {puts stderr "<$chan> eval hook res <$err,$ret>"}
-	switch $err {
-	    1 {
-		# error
-		set done 1
-	    }
-	    2 - 3 {
-		# return / break
-		set err 0
-		set done 1
-	    }
-	}
-    }
-
-    commDebug {puts stderr "<$chan> hook(eval) done=$done, err=$err"}
-
-    # exec command
-    if {!$done} {
-	commDebug {puts stderr "<$chan> exec ($buffer)"}
-
-	# Sadly, the uplevel needs to be in the catch to access the local
-	# variables buffer and ret.  These cannot simply be global because
-	# commExec is reentrant (i.e., they could be linked to an allocated
-	# serial number).
-
-	if {$comm($chan,interp) == {}} {
-	    # Main interpreter
-	    set thecmd [concat [list uplevel \#0] $buffer]
-	    set err    [catch $thecmd ret]
-	} else {
-	    # Redirect execution into the configured slave
-	    # interpreter. The exact command used depends on the
-	    # capabilities of the interpreter. A best effort is made
-	    # to execute the script in the global namespace.
-	    set interp $comm($chan,interp)
-
-	    if {$comm($chan,interp,upl) == "ok"} {
-		set thecmd [concat [list uplevel \#0] $buffer]
-		set err [catch {interp eval $interp $thecmd} ret]
-	    } elseif {$comm($chan,interp,aset) == "hidden"} {
-		set thecmd [linsert $buffer 0 interp invokehidden $interp uplevel \#0]
-		set err [catch $thecmd ret]
-	    } else {
-		set thecmd [concat [list interp eval $interp] $buffer]
-		set err [catch $thecmd ret]
-	    }
-	}
-    }
-
-    # Check and handle possible async result generation.
-    if {[AsyncCheck]} return
-
-    commSendReply $chan $fid $cmd $ser $err $ret
-    return
-}
-
-# ::comm::commSendReply --
-#
-#	Internal command. Executed to construct and send the reply
-#	for a command.
-#
-# Arguments:
-#	fid		channel handle of the socket we are replying to.
-#	cmd		The type of request (send, command) we are replying to.
-#	ser		Serial number of the request the reply is for.
-#	err		result code to place into the reply.
-#	ret		result value to place into the reply.
-#
-# Results:
-#	None.
-
-proc ::comm::commSendReply {chan fid cmd ser err ret} {
-    variable comm
-
-    commDebug {puts stderr "<$chan> res <$err,$ret> /$cmd"}
-
-    # The double list assures that the command is a single list when read.
-    if {[string equal send $cmd] || [string equal command $cmd]} {
-	# The catch here is just in case we lose the target.  Consider:
-	#	comm send $other comm send [comm self] exit
-	catch {
-	    set return [list return -code $err]
-	    # send error or result
-	    if {$err == 1} {
-		global errorInfo errorCode
-		lappend return -errorinfo $errorInfo -errorcode $errorCode
-	    }
-	    lappend return $ret
-	    if {[string equal send $cmd]} {
-		set reply reply
-	    } else {
-		set reply callback
-	    }
-	    puts  $fid [list [list $reply $ser $return]]
-	    flush $fid
-	}
-	commDebug {puts stderr "<$chan> reply sent"}
-    }
-
-    if {$err == 1} {
-	commBgerror $ret
-    }
-    commDebug {puts stderr "<$chan> exec complete"}
-    return
-}
-
-proc ::comm::CommRunHook {chan event} {
-    variable comm
-
-    # The documentation promises the hook scripts to have access to a
-    # number of internal variables. For a regular hook we simply
-    # execute it in the calling level to fulfill this. When the hook
-    # is redirected into an interpreter however we do a best-effort
-    # copying of the variable values into the interpreter. Best-effort
-    # because the 'set' command may not be available in the
-    # interpreter, not even hidden.
-
-    if {![info exists comm($chan,hook,$event)]} return
-    set cmd    $comm($chan,hook,$event)
-    set interp $comm($chan,interp)
-    commDebug {puts stderr "<$chan> hook($event) run <$cmd>"}
-
-    if {
-	($interp != {}) &&
-	([lsearch -exact $comm($chan,events) $event] >= 0)
-    } {
-	# Best-effort to copy the context into the interpreter for
-	# access by the hook script.
-	set vars   {
-	    addr buffer chan cmd fid host
-	    id port reason remport ret var
-	}
-
-	if {$comm($chan,interp,set) == "ok"} {
-	    foreach v $vars {
-		upvar 1 $v V
-		if {![info exists V]} continue
-		interp eval $interp [list set $v $V]
-	    }
-	} elseif {$comm($chan,interp,set) == "hidden"} {
-	    foreach v $vars {
-		upvar 1 $v V
-		if {![info exists V]} continue
-		interp invokehidden $interp set $v $V
-	    }
-	}
-	upvar 1 return AV
-	if {[info exists AV]} {
-	    if {$comm($chan,interp,aset) == "ok"} {
-		interp eval $interp [list array set return [array get AV]]
-	    } elseif {$comm($chan,interp,aset) == "hidden"} {
-		interp invokehidden $interp array set return [array get AV]
-	    }
-	}
-
-	commDebug {puts stderr "<$chan> /interp $interp"}
-	set code [catch {interp eval $interp $cmd} res]
-    } else {
-	commDebug {puts stderr "<$chan> /main"}
-	set code [catch {uplevel 1 $cmd} res]
-    }
-
-    # Perform the return code propagation promised
-    # to the hook scripts.
-    switch -exact -- $code {
-	0 {}
-	1 {
-	    return -errorinfo $::errorInfo -errorcode $::errorCode -code error $res
-	}
-	3 {return}
-	4 {}
-	default {return -code $code $res}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Hooks to link async return and future processing into the regular
-## system.
-
-# AsyncPrepare, AsyncCheck: Initialize state information for async
-# return upon start of a remote invokation, and checking the state for
-# async return.
-
-proc ::comm::AsyncPrepare {chan fid cmd ser} {
-    variable comm
-    set comm(current,async) 0
-    set comm(current,state) [list $chan $fid $cmd $ser]
-    return
-}
-
-proc ::comm::AsyncCheck {} {
-    # Check if the executed command notified us of an async return. If
-    # not we let the regular return processing handle the end of the
-    # script. Otherwise we stop the caller from proceeding, preventing
-    # a regular return.
-
-    variable comm
-    if {!$comm(current,async)} {return 0}
-    return 1
-}
-
-# FutureDone: Action taken by an uncanceled future to deliver the
-# generated result to the proper invoker. This also removes the future
-# from the list of pending futures for the comm channel.
-
-proc comm::FutureDone {future chan fid cmd sid rcode rvalue} {
-    variable comm
-    commSendReply $chan $fid $cmd $sid $rcode $rvalue
-
-    set pos [lsearch -exact $comm(future,fid,$fid) $future]
-    set comm(future,fid,$fid) [lreplace $comm(future,fid,$fid) $pos $pos]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Hooks to save command state across nested eventloops a remotely
-## invoked command may run before finally activating async result
-## generation.
-
-# DANGER !! We have to refer to comm internals using fully-qualified
-# names because the wrappers will execute in the global namespace
-# after their installation.
-
-proc ::comm::Vwait {varname} {
-    variable ::comm::comm
-
-    set hasstate [info exists comm(current,async)]
-    set hasremote 0
-    if {$hasstate} {
-	set chan     [lindex $comm(current,state) 0]
-	set async    $comm(current,async)
-	set state    $comm(current,state)
-	set hasremote [info exists comm($chan,remoteid)]
-	if {$hasremote} {
-	    set remoteid $comm($chan,remoteid)
-	}
-    }
-
-    set code [catch {uplevel 1 [list ::comm::VwaitOrig $varname]} res]
-
-    if {$hasstate} {
-	set comm(current,async)  $async
-	set comm(current,state)	 $state
-    }
-    if {$hasremote} {
-	set comm($chan,remoteid) $remoteid
-    }
-
-    return -code $code $res
-}
-
-proc ::comm::Update {args} {
-    variable ::comm::comm
-
-    set hasstate [info exists comm(current,async)]
-    set hasremote 0
-    if {$hasstate} {
-	set chan     [lindex $comm(current,state) 0]
-	set async    $comm(current,async)
-	set state    $comm(current,state)
-
-	set hasremote [info exists comm($chan,remoteid)]
-	if {$hasremote} {
-	    set remoteid $comm($chan,remoteid)
-	}
-    }
-
-    set code [catch {uplevel 1 [linsert $args 0 ::comm::UpdateOrig]} res]
-
-    if {$hasstate} {
-	set comm(current,async)  $async
-	set comm(current,state)	 $state
-    }
-    if {$hasremote} {
-	set comm($chan,remoteid) $remoteid
-    }
-
-    return -code $code $res
-}
-
-# Install the wrappers.
-
-proc ::comm::InitWrappers {} {
-    rename ::vwait       ::comm::VwaitOrig
-    rename ::comm::Vwait ::vwait
-
-    rename ::update       ::comm::UpdateOrig
-    rename ::comm::Update ::update
-
-    proc ::comm::InitWrappers {} {}
-    return
-}
-
-# ### ### ### ######### ######### #########
-## API: Future objects.
-
-snit::type comm::future {
-    option -command -default {}
-
-    constructor {chan fid cmd ser} {
-	set xfid  $fid
-	set xcmd  $cmd
-	set xser  $ser
-	set xchan $chan
-	return
-    }
-
-    destructor {
-	if {!$canceled} {
-	    return -code error \
-		    "Illegal attempt to destroy unresolved future \"$self\""
-	}
-    }
-
-    method return {args} {
-	# Syntax:             | 0
-	#       : -code x     | 2
-	#       : -code x val | 3
-	#       :         val | 4
-	# Allowing multiple -code settings, last one is taken.
-
-	set rcode  0
-	set rvalue {}
-
-	while {[lindex $args 0] == "-code"} {
-	    set rcode [lindex $args 1]
-	    set args  [lrange $args 2 end]
-	}
-	if {[llength $args] > 1} {
-	    return -code error "wrong\#args, expected \"?-code errcode? ?result?\""
-	}
-	if {[llength $args] == 1} {
-	    set rvalue [lindex $args 0]
-	}
-
-	if {!$canceled} {
-	    comm::FutureDone $self $xchan $xfid $xcmd $xser $rcode $rvalue
-	    set canceled 1
-	}
-	# assert: canceled == 1
-	$self destroy
-	return
-    }
-
-    variable xfid  {}
-    variable xcmd  {}
-    variable xser  {}
-    variable xchan {}
-    variable canceled 0
-
-    # Internal method for use by comm channels. Marks the future as
-    # expired, no peer to return a result back to.
-
-    method Cancel {} {
-	set canceled 1
-	if {![llength $options(-command)]} {return}
-	uplevel #0 [linsert $options(-command) end $self]
-	return
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Setup
-::comm::InitWrappers
-
-###############################################################################
-#
-# Finish creating "comm" using the default port for this interp.
-#
-
-if {![info exists ::comm::comm(comm,port)]} {
-    if {[string equal macintosh $tcl_platform(platform)]} {
-	::comm::comm new ::comm::comm -port 0 -local 0 -listen 1
-	set ::comm::comm(localhost) \
-	    [lindex [fconfigure $::comm::comm(::comm::comm,socket) -sockname] 0]
-	::comm::comm config -local 1
-    } else {
-	::comm::comm new ::comm::comm -port 0 -local 1 -listen 1
-    }
-}
-
-#eof
-package provide comm 4.5.6
Index: tolsh/tolsh.vfs/lib/tcllib1.10/comm/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/comm/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded comm 4.5.6 [list source [file join $dir comm.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/ascaller.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/ascaller.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,72 +1,0 @@
-# ascaller.tcl - 
-#
-#       A few utility procs that manage the evaluation of a command
-#	or a script in the context of a caller, taking care of all 
-#	the ugly details of proper return codes, errorcodes, and
-#	a good stack trace in ::errorInfo as appropriate.
-# -------------------------------------------------------------------------
-#
-# RCS: @(#) $Id: ascaller.tcl,v 1.3 2004/01/15 06:36:12 andreas_kupries Exp $
-
-namespace eval ::control {
-
-    proc CommandAsCaller {cmdVar resultVar {where {}} {codeVar code}} {
-	set x [expr {[string equal "" $where] 
-		? {} : [subst -nobackslashes {\n    ($where)}]}]
-	set script [subst -nobackslashes -nocommands {
-	    set $codeVar [catch {uplevel 1 $$cmdVar} $resultVar]
-	    if {$$codeVar > 1} {
-		return -code $$codeVar $$resultVar
-	    }
-	    if {$$codeVar == 1} {
-		if {[string equal {"uplevel 1 $$cmdVar"} \
-			[lindex [split [set ::errorInfo] \n] end]]} {
-		    set $codeVar [join \
-			    [lrange [split [set ::errorInfo] \n] 0 \
-			    end-[expr {4+[llength [split $$cmdVar \n]]}]] \n]
-		} else {
-		    set $codeVar [join \
-			    [lrange [split [set ::errorInfo] \n] 0 end-1] \n]
-		}
-		return -code error -errorcode [set ::errorCode] \
-			-errorinfo "$$codeVar$x" $$resultVar
-	    }
-	}]
-	return $script
-    }
-
-    proc BodyAsCaller {bodyVar resultVar codeVar {where {}}} {
-	set x [expr {[string equal "" $where]
-		? {} : [subst -nobackslashes -nocommands \
-		{\n    ($where[string map {{    ("uplevel"} {}} \
-		[lindex [split [set ::errorInfo] \n] end]]}]}]
-	set script [subst -nobackslashes -nocommands {
-	    set $codeVar [catch {uplevel 1 $$bodyVar} $resultVar]
-	    if {$$codeVar == 1} {
-		if {[string equal {"uplevel 1 $$bodyVar"} \
-			[lindex [split [set ::errorInfo] \n] end]]} {
-		    set ::errorInfo [join \
-			    [lrange [split [set ::errorInfo] \n] 0 end-2] \n]
-		} 
-		set $codeVar [join \
-			[lrange [split [set ::errorInfo] \n] 0 end-1] \n]
-		return -code error -errorcode [set ::errorCode] \
-			-errorinfo "$$codeVar$x" $$resultVar
-	    }
-	}]
-	return $script
-    }
-
-    proc ErrorInfoAsCaller {find replace} {
-	set info $::errorInfo
-	set i [string last "\n    (\"$find" $info]
-	if {$i == -1} {return $info}
-	set result [string range $info 0 [incr i 6]]	;# keep "\n    (\""
-	append result $replace			;# $find -> $replace
-	incr i [string length $find]
-	set j [string first ) $info [incr i]]	;# keep rest of parenthetical
-	append result [string range $info $i $j]
-        return $result
-    }
-
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/assert.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/assert.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,91 +1,0 @@
-# assert.tcl --
-#
-#	The [assert] command of the package "control".
-#
-# RCS: @(#) $Id: assert.tcl,v 1.3 2004/01/15 06:36:12 andreas_kupries Exp $
-
-namespace eval ::control {
-
-    namespace eval assert {
-	namespace export EnabledAssert DisabledAssert
-	variable CallbackCmd [list return -code error]
-
-	namespace import [namespace parent]::no-op
-	rename no-op DisabledAssert
-
-	proc EnabledAssert {expr args} {
-	    variable CallbackCmd
-
-	    set code [catch {uplevel 1 [list expr $expr]} res]
-	    if {$code} {
-		return -code $code $res
-	    }
-	    if {![string is boolean -strict $res]} {
-		return -code error "invalid boolean expression: $expr"
-	    }
-	    if {$res} {return}
-	    if {[llength $args]} {
-		set msg [join $args]
-	    } else {
-		set msg "assertion failed: $expr"
-	    }
-	    # Might want to catch this
-	    namespace eval :: $CallbackCmd [list $msg]
-	}
-
-	proc enabled {args} {
-	    set n [llength $args]
-	    if {$n > 1} {
-		return -code error "wrong # args: should be\
-			\"[lindex [info level 0] 0] ?boolean?\""
-	    }
-	    if {$n} {
-		set val [lindex $args 0]
-		if {![string is boolean -strict $val]} {
-		    return -code error "invalid boolean value: $val"
-		}
-		if {$val} {
-		    [namespace parent]::AssertSwitch Disabled Enabled
-		} else {
-		    [namespace parent]::AssertSwitch Enabled Disabled
-		}
-	    } else {
-		return [string equal [namespace origin EnabledAssert] \
-			[namespace origin [namespace parent]::assert]]
-	    }
-	    return ""
-	}
-
-	proc callback {args} {
-	    set n [llength $args]
-	    if {$n > 1} {
-		return -code error "wrong # args: should be\
-			\"[lindex [info level 0] 0] ?command?\""
-	    }
-	    if {$n} {
-	        return [variable CallbackCmd [lindex $args 0]]
-	    }
-	    variable CallbackCmd
-	    return $CallbackCmd
-	}
-
-    }
-
-    proc AssertSwitch {old new} {
-	if {[string equal [namespace origin assert] \
-		[namespace origin assert::${new}Assert]]} {return}
-	rename assert ${old}Assert
-	rename ${new}Assert assert
-    }
-
-    namespace import assert::DisabledAssert assert::EnabledAssert
-
-    # For indexer
-    proc assert args #
-    rename assert {}
-
-    # Initial default: disabled asserts
-    rename DisabledAssert assert
-
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/control.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/control.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,27 +1,0 @@
-# control.tcl --
-#
-#	This is the main package provide script for the package
-#	"control".  It provides commands that govern the flow of
-#	control of a program.
-#
-# RCS: @(#) $Id: control.tcl,v 1.15 2005/09/30 05:36:38 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::control {
-    variable version 0.1.3
-    namespace export assert control do no-op rswitch
-
-    proc control {command args} {
-	# Need to add error handling here
-	namespace eval [list $command] $args
-    }
-
-    # Set up for auto-loading the commands
-    variable home [file join [pwd] [file dirname [info script]]]
-    if {[lsearch -exact $::auto_path $home] == -1} {
-	lappend ::auto_path $home
-    }
-
-    package provide [namespace tail [namespace current]] $version
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/do.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/do.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,81 +1,0 @@
-# do.tcl --
-#
-#        Tcl implementation of a "do ... while|until" loop.
-#
-# Originally written for the "Texas Tcl Shootout" programming contest
-# at the 2000 Tcl Conference in Austin/Texas.
-#
-# Copyright (c) 2001 by Reinhard Max <Reinhard.Max@gmx.de>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: do.tcl,v 1.6 2004/01/15 06:36:12 andreas_kupries Exp $
-#
-namespace eval ::control {
-
-    proc do {body args} {
-
-	#
-	# Implements a "do body while|until test" loop
-	# 
-	# It is almost as fast as builtin "while" command for loops with
-	# more than just a few iterations.
-	#
-
-	set len [llength $args]
-	if {$len !=2 && $len != 0} {
-	    set proc [namespace current]::[lindex [info level 0] 0]
-	    return -code error "wrong # args: should be \"$proc body\" or \"$proc body \[until|while\] test\""
-	}
-	set test 0
-	foreach {whileOrUntil test} $args {
-	    switch -exact -- $whileOrUntil {
-		"while" {}
-		"until" { set test !($test) }
-		default {
-		    return -code error \
-			"bad option \"$whileOrUntil\": must be until, or while"
-		}
-	    }
-	    break
-	}
-
-	# the first invocation of the body
-	set code [catch { uplevel 1 $body } result]
-
-	# decide what to do upon the return code:
-	#
-	#               0 - the body executed successfully
-	#               1 - the body raised an error
-	#               2 - the body invoked [return]
-	#               3 - the body invoked [break]
-	#               4 - the body invoked [continue]
-	# everything else - return and pass on the results
-	#
-	switch -exact -- $code {
-	    0 {}
-	    1 {
-		return -errorinfo [ErrorInfoAsCaller uplevel do]  \
-		    -errorcode $::errorCode -code error $result
-	    }
-	    3 {
-		# FRINK: nocheck
-		return
-	    }
-	    4 {}
-	    default {
-		return -code $code $result
-	    }
-	}
-	# the rest of the loop
-	set code [catch {uplevel 1 [list while $test $body]} result]
-	if {$code == 1} {
-	    return -errorinfo [ErrorInfoAsCaller while do] \
-		-errorcode $::errorCode -code error $result
-	}
-	return -code $code $result
-	
-    }
-
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/no-op.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/no-op.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# no-op.tcl --
-#
-#	The [no-op] command of the package "control".
-#	It accepts any number of arguments and does nothing.
-#	It returns an empty string.
-#
-# RCS: @(#) $Id: no-op.tcl,v 1.2 2004/01/15 06:36:12 andreas_kupries Exp $
-
-namespace eval ::control {
-
-    proc no-op args {}
-
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded control 0.1.3 [list source [file join $dir control.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/control/tclIndex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/control/tclIndex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,18 +1,0 @@
-# Tcl autoload index file, version 2.0
-# This file is generated by the "auto_mkindex" command
-# and sourced to set up indexing information for one or
-# more commands.  Typically each line is a command that
-# sets an element in the auto_index array, where the
-# element name is the name of a command and the value is
-# a script that loads the command.
-
-set auto_index(::control::CommandAsCaller) [list source [file join $dir ascaller.tcl]]
-set auto_index(::control::BodyAsCaller) [list source [file join $dir ascaller.tcl]]
-set auto_index(::control::ErrorInfoAsCaller) [list source [file join $dir ascaller.tcl]]
-set auto_index(::control::assert::EnabledAssert) [list source [file join $dir assert.tcl]]
-set auto_index(::control::assert::enabled) [list source [file join $dir assert.tcl]]
-set auto_index(::control::assert::callback) [list source [file join $dir assert.tcl]]
-set auto_index(::control::AssertSwitch) [list source [file join $dir assert.tcl]]
-set auto_index(::control::assert) [list source [file join $dir assert.tcl]]
-set auto_index(::control::do) [list source [file join $dir do.tcl]]
-set auto_index(::control::no-op) [list source [file join $dir no-op.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/counter/counter.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/counter/counter.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1265 +1,0 @@
-# counter.tcl --
-#
-#   Procedures to manage simple counters and histograms.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: counter.tcl,v 1.23 2005/09/30 05:36:38 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::counter {
-
-    # Variables of name counter::T-$tagname
-    # are created as arrays to support each counter.
-
-    # Time-based histograms are kept in sync with each other,
-    # so these variables are shared among them.
-    # These base times record the time corresponding to the first bucket 
-    # of the per-minute, per-hour, and per-day time-based histograms.
-
-    variable startTime
-    variable minuteBase
-    variable hourBase
-    variable hourEnd
-    variable dayBase
-    variable hourIndex
-    variable dayIndex
-
-    # The time-based histogram uses an after event and a list
-    # of counters to do mergeing on.
-
-    variable tagsToMerge
-    if {![info exists tagsToMerge]} {
-    set tagsToMerge {}
-    }
-    variable mergeInterval
-
-    namespace export init reset count exists get names start stop
-    namespace export histHtmlDisplay histHtmlDisplayRow histHtmlDisplayBarChart
-}
-
-# ::counter::init --
-#
-#   Set up a counter.
-#
-# Arguments:
-#   tag The identifier for the counter.  Pass this to counter::count
-#   args    option values pairs that define characteristics of the counter:
-#       See the man page for definitons.
-#
-# Results:
-#   None.
-#
-# Side Effects:
-#   Initializes state about a counter.
-
-proc ::counter::init {tag args} {
-    upvar #0 counter::T-$tag counter
-    if {[info exists counter]} {
-    unset counter
-    }
-    set counter(N) 0    ;# Number of samples
-    set counter(total) 0
-    set counter(type) {}
-
-    # With an empty type the counter is a simple accumulator
-    # for which we can compute an average.  Here we loop through
-    # the args to determine what additional counter attributes
-    # we need to maintain in counter::count
-
-    foreach {option value} $args {
-    switch -- $option {
-        -timehist {
-        variable tagsToMerge
-        variable secsPerMinute
-        variable startTime
-        variable minuteBase
-        variable hourBase
-        variable dayBase
-        variable hourIndex
-        variable dayIndex
-
-        upvar #0 counter::H-$tag histogram
-        upvar #0 counter::Hour-$tag hourhist
-        upvar #0 counter::Day-$tag dayhist
-
-        # Clear the histograms.
-
-        for {set i 0} {$i < 60} {incr i} {
-            set histogram($i) 0
-        }
-        for {set i 0} {$i < 24} {incr i} {
-            set hourhist($i) 0
-        }
-        if {[info exists dayhist]} {
-            unset dayhist
-        }
-        set dayhist(0) 0
-
-        # Clear all-time high records
-
-        set counter(maxPerMinute) 0
-        set counter(maxPerHour) 0
-        set counter(maxPerDay) 0
-
-        # The value associated with -timehist is the number of seconds
-        # in each bucket.  Normally this is 60, but for
-        # testing, we compress minutes.  The value is limited at
-        # 60 because the per-minute buckets are accumulated into
-        # per-hour buckets later.
-
-        if {$value == "" || $value == 0 || $value > 60} {
-            set value 60
-        }
-
-        # Histogram state variables.
-        # All time-base histograms share the same bucket size
-        # and starting times to keep them all synchronized.
-        # So, we only initialize these parameters once.
-
-        if {![info exists secsPerMinute]} {
-            set secsPerMinute $value
-
-            set startTime [clock seconds]
-            set dayIndex 0
-
-            set dayStart [clock scan [clock format $startTime \
-                -format 00:00]]
-            
-            # Figure out what "hour" we are
-
-            set delta [expr {$startTime - $dayStart}]
-            set hourIndex [expr {$delta / ($secsPerMinute * 60)}]
-            set day [expr {$hourIndex / 24}]
-            set hourIndex [expr {$hourIndex % 24}]
-
-            set hourBase [expr {$dayStart + $day * $secsPerMinute * 60 * 24}]
-            set minuteBase [expr {$hourBase + $hourIndex * 60 * $secsPerMinute}]
-
-            set partialHour [expr {$startTime -
-            ($hourBase + $hourIndex * 60 * $secsPerMinute)}]
-            set secs [expr {(60 * $secsPerMinute) - $partialHour}]
-            if {$secs <= 0} {
-            set secs 1
-            }
-
-            # After the first timer, the event occurs once each "hour"
-
-            set mergeInterval [expr {60 * $secsPerMinute * 1000}]
-            after [expr {$secs * 1000}] [list counter::MergeHour $mergeInterval]
-        }
-        if {[lsearch $tagsToMerge $tag] < 0} {
-            lappend tagsToMerge $tag
-        }
-
-        # This records the last used slots in order to zero-out the
-        # buckets that are skipped during idle periods.
-
-        set counter(lastMinute) -1
-
-        # The following is referenced when bugs cause histogram
-        # hits outside the expect range (overflow and underflow)
-
-        set counter(bucketsize)  0
-        }
-        -group {
-        # Cluster a set of counters with a single total
-
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        set counter(group) $value
-        }
-        -lastn {
-        # The lastN samples are kept if a vector to form a running average.
-
-        upvar #0 counter::V-$tag vector
-        set counter(lastn) $value
-        set counter(index) 0
-        if {[info exists vector]} {
-            unset vector
-        }
-        for {set i 0} {$i < $value} {incr i} {
-            set vector($i) 0
-        }
-        }
-        -hist {
-        # A value-based histogram with buckets for different values.
-
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        set counter(bucketsize) $value
-        set counter(mult) 1
-        }
-        -hist2x {
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        set counter(bucketsize) $value
-        set counter(mult) 2
-        }
-        -hist10x {
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        set counter(bucketsize) $value
-        set counter(mult) 10
-        }
-        -histlog {
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        set counter(bucketsize) $value
-        }
-        -simple {
-        # Useful when disabling predefined -timehist or -group counter
-        }
-        default {
-        return -code error "Unsupported option $option.\
-        Must be -timehist, -group, -lastn, -hist, -hist2x, -hist10x, -histlog, or -simple."
-        }
-    }
-    if {[string length $option]} {
-        # In case an option doesn't change the type, but
-        # this feature of the interface isn't used, etc.
-
-        lappend counter(type) $option
-    }
-    }
-
-    # Instead of supporting a counter that could have multiple attributes,
-    # we support a single type to make counting more efficient.
-
-    if {[llength $counter(type)] > 1} {
-    return -code error "Multiple type attributes not supported.  Use only one of\
-        -timehist, -group, -lastn, -hist, -hist2x, -hist10x, -histlog, -disabled."
-    }
-    return ""
-}
-
-# ::counter::reset --
-#
-#   Reset a counter.
-#
-# Arguments:
-#   tag The identifier for the counter.
-#
-# Results:
-#   None.
-#
-# Side Effects:
-#   Deletes the counter and calls counter::init again for it.
-
-proc ::counter::reset {tag args} {
-    upvar #0 counter::T-$tag counter
-
-    # Layer reset on top of init.  Here we figure out what
-    # we need to pass into the init procedure to recreate it.
-
-    switch -- $counter(type) {
-    ""  {
-        set args ""
-    }
-    -group {
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-        unset histogram
-        }
-        set args [list -group $counter(group)]
-    }
-    -lastn {
-        upvar #0 counter::V-$tag vector
-        if {[info exists vector]} {
-        unset vector
-        }
-        set args [list -lastn $counter(lastn)]
-    }
-    -hist -
-    -hist10x -
-    -histlog -
-    -hist2x {
-        upvar #0 counter::H-$tag histogram
-        if {[info exists histogram]} {
-        unset histogram
-        }
-        set args [list $counter(type) $counter(bucketsize)]
-    }
-    -timehist {
-        foreach h [list counter::H-$tag counter::Hour-$tag counter::Day-$tag] {
-        upvar #0 $h histogram
-        if {[info exists histogram]} {
-            unset histogram
-        }
-        }
-        set args [list -timehist $counter::secsPerMinute]
-    }
-    default {#ignore}
-    }
-    unset counter
-    eval {counter::init $tag} $args
-    set counter(resetDate) [clock seconds]
-    return ""
-}
-
-# ::counter::count --
-#
-#   Accumulate statistics.
-#
-# Arguments:
-#   tag The counter identifier.
-#   delta   The increment amount.  Defaults to 1.
-#   arg For -group types, this is the histogram index.
-#
-# Results:
-#   None
-#
-# Side Effects:
-#   Accumlate statistics.
-
-proc ::counter::count {tag {delta 1} args} {
-    upvar #0 counter::T-$tag counter
-    set counter(total) [expr {$counter(total) + $delta}]
-    incr counter(N)
-
-    # Instead of supporting a counter that could have multiple attributes,
-    # we support a single type to make counting a skosh more efficient.
-
-#    foreach option $counter(type) {
-    switch -- $counter(type) {
-        ""  {
-        # Simple counter
-        return
-        }
-        -group {
-        upvar #0 counter::H-$tag histogram
-        set subIndex [lindex $args 0]
-        if {![info exists histogram($subIndex)]} {
-            set histogram($subIndex) 0
-        }
-        set histogram($subIndex) [expr {$histogram($subIndex) + $delta}]
-        }
-        -lastn {
-        upvar #0 counter::V-$tag vector
-        set vector($counter(index)) $delta
-        set counter(index) [expr {($counter(index) +1)%$counter(lastn)}]
-        }
-        -hist {
-        upvar #0 counter::H-$tag histogram
-        set bucket [expr {int($delta / $counter(bucketsize))}]
-        if {![info exists histogram($bucket)]} {
-            set histogram($bucket) 0
-        }
-        incr histogram($bucket)
-        }
-        -hist10x -
-        -hist2x {
-        upvar #0 counter::H-$tag histogram
-        set bucket 0
-        for {set max $counter(bucketsize)} {$delta > $max} \
-            {set max [expr {$max * $counter(mult)}]} {
-            incr bucket
-        }
-        if {![info exists histogram($bucket)]} {
-            set histogram($bucket) 0
-        }
-        incr histogram($bucket)
-        }
-        -histlog {
-        upvar #0 counter::H-$tag histogram
-        set bucket [expr {int(log($delta)*$counter(bucketsize))}]
-        if {![info exists histogram($bucket)]} {
-            set histogram($bucket) 0
-        }
-        incr histogram($bucket)
-        }
-        -timehist {
-        upvar #0 counter::H-$tag histogram
-        variable minuteBase
-        variable secsPerMinute
-
-        set minute [expr {([clock seconds] - $minuteBase) / $secsPerMinute}]
-        if {$minute > 59} {
-            # this occurs while debugging if the process is
-            # stopped at a breakpoint too long.
-            set minute 59
-        }
-
-        # Initialize the current bucket and 
-        # clear any buckets we've skipped since the last sample.
-        
-        if {$minute != $counter(lastMinute)} {
-            set histogram($minute) 0
-            for {set i [expr {$counter(lastMinute)+1}]} \
-                {$i < $minute} \
-                {incr i} {
-            set histogram($i) 0
-            }
-            set counter(lastMinute) $minute
-        }
-        set histogram($minute) [expr {$histogram($minute) + $delta}]
-        }
-        default {#ignore}
-    }
-#   }
-    return
-}
-
-# ::counter::exists --
-#
-#   Return true if the counter exists.
-#
-# Arguments:
-#   tag The counter identifier.
-#
-# Results:
-#   1 if it has been defined.
-#
-# Side Effects:
-#   None.
-
-proc ::counter::exists {tag} {
-    upvar #0 counter::T-$tag counter
-    return [info exists counter]
-}
-
-# ::counter::get --
-#
-#   Return statistics.
-#
-# Arguments:
-#   tag The counter identifier.
-#   option  What statistic to get
-#   args    Needed by some options.
-#
-# Results:
-#   With no args, just the counter value.
-#
-# Side Effects:
-#   None.
-
-proc ::counter::get {tag {option -total} args} {
-    upvar #0 counter::T-$tag counter
-    switch -- $option {
-    -total {
-        return $counter(total)
-    }
-    -totalVar {
-        return ::counter::T-$tag\(total)
-    }
-    -N {
-        return $counter(N)
-    }
-    -avg {
-        if {$counter(N) == 0} {
-        return 0
-        } else {
-        return [expr {$counter(total) / double($counter(N))}]
-        }
-    }
-    -avgn {
-        if {$counter(type) != "-lastn"} {
-        return -code error "The -avgn option is only supported for -lastn counters."
-        }
-        upvar #0 counter::V-$tag vector
-        set sum 0
-        for {set i 0} {($i < $counter(N)) && ($i < $counter(lastn))} {incr i} {
-        set sum [expr {$sum + $vector($i)}]
-        }
-        if {$i == 0} {
-        return 0
-        } else {
-        return [expr {$sum / double($i)}]
-        }
-    }
-    -hist {
-        upvar #0 counter::H-$tag histogram
-        if {[llength $args]} {
-        # Return particular bucket
-        set bucket [lindex $args 0]
-        if {[info exists histogram($bucket)]} {
-            return $histogram($bucket)
-        } else {
-            return 0
-        }
-        } else {
-        # Dump the whole histogram
-
-        set result {}
-        if {$counter(type) == "-group"} {
-            set sort -dictionary
-        } else {
-            set sort -integer
-        }
-        foreach x [lsort $sort [array names histogram]] {
-            lappend result $x $histogram($x)
-        }
-        return $result
-        }
-    }
-    -histVar {
-        return ::counter::H-$tag
-    }
-    -histHour {
-        upvar #0 counter::Hour-$tag histogram
-        set result {}
-        foreach x [lsort -integer [array names histogram]] {
-        lappend result $x $histogram($x)
-        }
-        return $result
-    }
-    -histHourVar {
-        return ::counter::Hour-$tag
-    }
-    -histDay {
-        upvar #0 counter::Day-$tag histogram
-        set result {}
-        foreach x [lsort -integer [array names histogram]] {
-        lappend result $x $histogram($x)
-        }
-        return $result
-    }
-    -histDayVar {
-        return ::counter::Day-$tag
-    }
-    -maxPerMinute {
-        return $counter(maxPerMinute)
-    }
-    -maxPerHour {
-        return $counter(maxPerHour)
-    }
-    -maxPerDay {
-        return $counter(maxPerDay)
-    }
-    -resetDate {
-        if {[info exists counter(resetDate)]} {
-        return $counter(resetDate)
-        } else {
-        return ""
-        }
-    }
-    -all {
-        return [array get counter]
-    }
-    default {
-        return -code error "Invalid option $option.\
-        Should be -all, -total, -N, -avg, -avgn, -hist, -histHour,\
-        -histDay, -totalVar, -histVar, -histHourVar, -histDayVar -resetDate."
-    }
-    }
-}
-
-# ::counter::names --
-#
-#   Return the list of defined counters.
-#
-# Arguments:
-#   none
-#
-# Results:
-#   A list of counter tags.
-#
-# Side Effects:
-#   None.
-
-proc ::counter::names {} {
-    set result {}
-    foreach v [info vars ::counter::T-*] {
-    if {[info exists $v]} {
-        # Declared arrays might not exist, yet
-        # strip prefix from name
-        set v [string range $v [string length "::counter::T-"] end]
-        lappend result $v
-    }
-    }
-    return $result
-}
-
-# ::counter::MergeHour --
-#
-#   Sum the per-minute histogram into the next hourly bucket.
-#   On 24-hour boundaries, sum the hourly buckets into the next day bucket.
-#   This operates on all time-based histograms.
-#
-# Arguments:
-#   none
-#
-# Results:
-#   none
-#
-# Side Effects:
-#   See description.
-
-proc ::counter::MergeHour {interval} {
-    variable hourIndex
-    variable minuteBase
-    variable hourBase
-    variable tagsToMerge
-    variable secsPerMinute
-
-    after $interval [list counter::MergeHour $interval]
-    if {![info exists hourBase] || $hourIndex == 0} {
-    set hourBase $minuteBase
-    }
-    set minuteBase [clock seconds]
-
-    foreach tag $tagsToMerge {
-    upvar #0 counter::T-$tag counter
-    upvar #0 counter::H-$tag histogram
-    upvar #0 counter::Hour-$tag hourhist
-
-    # Clear any buckets we've skipped since the last sample.
-
-    for {set i [expr {$counter(lastMinute)+1}]} {$i < 60} {incr i} {
-        set histogram($i) 0
-    }
-    set counter(lastMinute) -1
-
-    # Accumulate into the next hour bucket.
-
-    set hourhist($hourIndex) 0
-    set max 0
-    foreach i [array names histogram] {
-        set hourhist($hourIndex) [expr {$hourhist($hourIndex) + $histogram($i)}]
-        if {$histogram($i) > $max} {
-        set max $histogram($i)
-        }
-    }
-    set perSec [expr {$max / $secsPerMinute}]
-    if {$perSec > $counter(maxPerMinute)} {
-        set counter(maxPerMinute) $perSec
-    }
-    }
-    set hourIndex [expr {($hourIndex + 1) % 24}]
-    if {$hourIndex == 0} {
-    counter::MergeDay
-    }
-
-}
-# ::counter::MergeDay --
-#
-#   Sum the per-minute histogram into the next hourly bucket.
-#   On 24-hour boundaries, sum the hourly buckets into the next day bucket.
-#   This operates on all time-based histograms.
-#
-# Arguments:
-#   none
-#
-# Results:
-#   none
-#
-# Side Effects:
-#   See description.
-
-proc ::counter::MergeDay {} {
-    variable dayIndex
-    variable dayBase
-    variable hourBase
-    variable tagsToMerge
-    variable secsPerMinute
-
-    # Save the hours histogram into a bucket for the last day
-    # counter(day,$day) is the starting time for that day bucket
-
-    if {![info exists dayBase]} {
-    set dayBase $hourBase
-    }
-    foreach tag $tagsToMerge {
-    upvar #0 counter::T-$tag counter
-    upvar #0 counter::Day-$tag dayhist
-    upvar #0 counter::Hour-$tag hourhist
-    set dayhist($dayIndex) 0
-    set max 0
-    for {set i 0} {$i < 24} {incr i} {
-        if {[info exists hourhist($i)]} {
-        set dayhist($dayIndex) [expr {$dayhist($dayIndex) + $hourhist($i)}]
-        if {$hourhist($i) > $max} { 
-            set max $hourhist($i) 
-        }
-        }
-    }
-    set perSec [expr {double($max) / ($secsPerMinute * 60)}]
-    if {$perSec > $counter(maxPerHour)} {
-        set counter(maxPerHour) $perSec
-    }
-    }
-    set perSec [expr {double($dayhist($dayIndex)) / ($secsPerMinute * 60 * 24)}]
-    if {$perSec > $counter(maxPerDay)} {
-    set counter(maxPerDay) $perSec
-    }
-    incr dayIndex
-}
-
-# ::counter::histHtmlDisplay --
-#
-#   Create an html display of the histogram.
-#
-# Arguments:
-#   tag The counter tag
-#   args    option, value pairs that affect the display:
-#       -title  Label to display above bar chart
-#       -unit   minutes, hours, or days select time-base histograms.
-#           Specify anything else for value-based histograms.
-#       -images URL of /images directory.
-#       -gif    Image for normal histogram bars
-#       -ongif  Image for the active histogram bar
-#       -max    Maximum number of value-based buckets to display
-#       -height Pixel height of the highest bar
-#       -width  Pixel width of each bar
-#       -skip   Buckets to skip when labeling value-based histograms
-#       -format Format used to display labels of buckets.
-#       -text   If 1, a text version of the histogram is dumped,
-#           otherwise a graphical one is generated.
-#
-# Results:
-#   HTML for the display as a complete table.
-#
-# Side Effects:
-#   None.
-
-proc ::counter::histHtmlDisplay {tag args} {
-    append result "<p>\n<table border=0 cellpadding=0 cellspacing=0>\n"
-    append result [eval {counter::histHtmlDisplayRow $tag} $args]
-    append result </table>
-    return $result
-}
-
-# ::counter::histHtmlDisplayRow --
-#
-#   Create an html display of the histogram.
-#
-# Arguments:
-#   See counter::histHtmlDisplay
-#
-# Results:
-#   HTML for the display.  Ths is one row of a 2-column table,
-#   the calling page must define the <table> tag.
-#
-# Side Effects:
-#   None.
-
-proc ::counter::histHtmlDisplayRow {tag args} {
-    upvar #0 counter::T-$tag counter
-    variable secsPerMinute
-    variable minuteBase
-    variable hourBase
-    variable dayBase
-    variable hourIndex
-    variable dayIndex
-
-    array set options [list \
-    -title  $tag \
-    -unit   "" \
-    -images /images \
-    -gif    Blue.gif \
-    -ongif  Red.gif \
-    -max    -1 \
-    -height 100 \
-    -width  4 \
-    -skip   4 \
-    -format %.2f \
-    -text   0
-    ]
-    array set options $args
-
-    # Support for self-posting pages that can clear counters.
-
-    append result "<!-- resetCounter [ncgi::value resetCounter] -->"
-    if {[ncgi::value resetCounter] == $tag} {
-    counter::reset $tag
-    return "<!-- Reset $tag counter -->"
-    }
-
-    switch -glob -- $options(-unit) {
-    min* {
-        upvar #0 counter::H-$tag histogram
-        set histname counter::H-$tag
-        if {![info exists minuteBase]} {
-        return "<!-- No time-based histograms defined -->"
-        }
-        set time $minuteBase
-        set secsForMax $secsPerMinute
-        set periodMax $counter(maxPerMinute)
-        set curIndex [expr {([clock seconds] - $minuteBase) / $secsPerMinute}]
-        set options(-max) 60
-        set options(-min) 0
-    }
-    hour* {
-        upvar #0 counter::Hour-$tag histogram
-        set histname counter::Hour-$tag
-        if {![info exists hourBase]} {
-        return "<!-- Hour merge has not occurred -->"
-        }
-        set time $hourBase
-        set secsForMax [expr {$secsPerMinute * 60}]
-        set periodMax $counter(maxPerHour)
-        set curIndex [expr {$hourIndex - 1}]
-        if {$curIndex < 0} {
-        set curIndex 23
-        }
-        set options(-max) 24
-        set options(-min) 0
-    }
-    day* {
-        upvar #0 counter::Day-$tag histogram
-        set histname counter::Day-$tag
-        if {![info exists dayBase]} {
-        return "<!-- Hour merge has not occurred -->"
-        }
-        set time $dayBase
-        set secsForMax [expr {$secsPerMinute * 60 * 24}]
-        set periodMax $counter(maxPerDay)
-        set curIndex dayIndex
-        set options(-max) $dayIndex
-        set options(-min) 0
-    }
-    default {
-        # Value-based histogram with arbitrary units.
-
-        upvar #0 counter::H-$tag histogram
-        set histname counter::H-$tag
-
-        set unit $options(-unit)
-        set curIndex ""
-        set time ""
-    }
-    }
-    if {! [info exists histogram]} {
-    return "<!-- $histname doesn't exist -->\n"
-    }
-
-    set max 0
-    set maxName 0
-    foreach {name value} [array get histogram] {
-    if {$value > $max} {
-        set max $value
-        set maxName $name
-    }
-    }
-
-    # Start 2-column HTML display.  A summary table at the left, the histogram on the right.
-
-    append result "<tr><td valign=top>\n"
-
-    append result "<table bgcolor=#EEEEEE>\n"
-    append result "<tr><td colspan=2 align=center>[html::font]<b>$options(-title)</b></font></td></tr>\n"
-    append result "<tr><td>[html::font]<b>Total</b></font></td>"
-    append result "<td>[html::font][format $options(-format) $counter(total)]</font></td></tr>\n"
-
-    if {[info exists secsForMax]} {
-
-    # Time-base histogram
-
-    set string {}
-    set t $secsForMax
-    set days [expr {$t / (60 * 60 * 24)}]
-    if {$days == 1} {
-        append string "1 Day "
-    } elseif {$days > 1} {
-        append string "$days Days "
-    }
-    set t [expr {$t - $days * (60 * 60 * 24)}]
-    set hours [expr {$t / (60 * 60)}]
-    if {$hours == 1} {
-        append string "1 Hour "
-    } elseif {$hours > 1} {
-        append string "$hours Hours "
-    }
-    set t [expr {$t - $hours * (60 * 60)}]
-    set mins [expr {$t / 60}]
-    if {$mins == 1} {
-        append string "1 Minute "
-    } elseif {$mins > 1} {
-        append string "$mins Minutes "
-    }
-    set t [expr {$t - $mins * 60}]
-    if {$t == 1} {
-        append string "1 Second "
-    } elseif {$t > 1} {
-        append string "$t Seconds "
-    }
-    append result "<tr><td>[html::font]<b>Bucket Size</b></font></td>"
-    append result "<td>[html::font]$string</font></td></tr>\n"
-
-    append result "<tr><td>[html::font]<b>Max Per Sec</b></font></td>"
-    append result "<td>[html::font][format %.2f [expr {$max/double($secsForMax)}]]</font></td></tr>\n"
-
-    if {$periodMax > 0} {
-        append result "<tr><td>[html::font]<b>Best Per Sec</b></font></td>"
-        append result "<td>[html::font][format %.2f $periodMax]</font></td></tr>\n"
-    }
-    append result "<tr><td>[html::font]<b>Starting Time</b></font></td>"
-    switch -glob -- $options(-unit) {
-        min* {
-        append result "<td>[html::font][clock format $time \
-            -format %k:%M:%S]</font></td></tr>\n"
-        }
-        hour* {
-        append result "<td>[html::font][clock format $time \
-            -format %k:%M:%S]</font></td></tr>\n"
-        }
-        day* {
-        append result "<td>[html::font][clock format $time \
-            -format "%b %d %k:%M"]</font></td></tr>\n"
-        }
-        default {#ignore}
-    }
-
-    } else {
-
-    # Value-base histogram
-
-    set ix [lsort -integer [array names histogram]]
-
-    set mode [expr {$counter(bucketsize) * $maxName}]
-    set first [expr {$counter(bucketsize) * [lindex $ix 0]}]
-    set last [expr {$counter(bucketsize) * [lindex $ix end]}]
-
-    append result "<tr><td>[html::font]<b>Average</b></font></td>"
-    append result "<td>[html::font][format $options(-format) [counter::get $tag -avg]]</font></td></tr>\n"
-
-    append result "<tr><td>[html::font]<b>Mode</b></font></td>"
-    append result "<td>[html::font]$mode</font></td></tr>\n"
-
-    append result "<tr><td>[html::font]<b>Minimum</b></font></td>"
-    append result "<td>[html::font]$first</font></td></tr>\n"
-
-    append result "<tr><td>[html::font]<b>Maximum</b></font></td>"
-    append result "<td>[html::font]$last</font></td></tr>\n"
-
-    append result "<tr><td>[html::font]<b>Unit</b></font></td>"
-    append result "<td>[html::font]$unit</font></td></tr>\n"
-
-    append result "<tr><td colspan=2 align=center>[html::font]<b>"
-    append result "<a href=[ncgi::urlStub]?resetCounter=$tag>Reset</a></td></tr>\n"
-
-    if {$options(-max) < 0} {
-        set options(-max) [lindex $ix end]
-    }
-    if {![info exists options(-min)]} {
-        set options(-min) [lindex $ix 0]
-    }
-    }
-
-    # End table nested inside left-hand column
-
-    append result </table>\n
-    append result </td>\n
-    append result "<td valign=bottom>\n"
-
-
-    # Display the histogram
-
-    if {$options(-text)} {
-    } else {
-    append result [eval \
-        {counter::histHtmlDisplayBarChart $tag histogram $max $curIndex $time} \
-        [array get options]]
-    }
-
-    # Close the right hand column, but leave our caller's table open.
-
-    append result </td></tr>\n
-
-    return $result
-}
-
-# ::counter::histHtmlDisplayBarChart --
-#
-#   Create an html display of the histogram.
-#
-# Arguments:
-#   tag     The counter tag.
-#   histVar     The name of the histogram array
-#   max     The maximum counter value in a histogram bucket.
-#   curIndex    The "current" histogram index, for time-base histograms.
-#   time        The base, or starting time, for the time-based histograms.
-#   args        The array get of the options passed into histHtmlDisplay
-#
-# Results:
-#   HTML for the bar chart.
-#
-# Side Effects:
-#   See description.
-
-proc ::counter::histHtmlDisplayBarChart {tag histVar max curIndex time args} {
-    upvar #0 counter::T-$tag counter
-    upvar 1 $histVar histogram
-    variable secsPerMinute
-    array set options $args
-
-    append result "<table cellpadding=0 cellspacing=0 bgcolor=#eeeeee><tr>\n"
-
-    set ix [lsort -integer [array names histogram]]
-
-    for {set t $options(-min)} {$t < $options(-max)} {incr t} {
-    if {![info exists histogram($t)]} {
-        set value 0
-    } else {
-        set value $histogram($t)
-    }
-    if {$max == 0 || $value == 0} {
-        set height 1
-    } else {
-        set percent [expr {round($value * 100.0 / $max)}]
-        set height [expr {$percent * $options(-height) / 100}]
-    }
-    if {$t == $curIndex} {
-        set img src=$options(-images)/$options(-ongif)
-    } else {
-        set img src=$options(-images)/$options(-gif)
-    }
-    append result "<td valign=bottom><img $img height=$height\
-        width=$options(-width) title=$value alt=$value></td>\n"
-    }
-    append result "</tr>"
-
-    # Count buckets outside the range requested
-
-    set overflow 0
-    set underflow 0
-    foreach t [lsort -integer [array names histogram]] {
-    if {($options(-max) > 0) && ($t > $options(-max))} {
-        incr overflow
-    }
-    if {($options(-min) >= 0) && ($t < $options(-min))} {
-        incr underflow
-    }
-    }
-
-    # Append a row of labels at the bottom.
-
-    set colors {black #CCCCCC}
-    set bgcolors {#CCCCCC black}
-    set colori 0
-    if {$counter(type) != "-timehist"} {
-
-    # Label each bucket with its value
-    # This is probably wrong for hist2x and hist10x
-
-    append result "<tr>"
-    set skip $options(-skip)
-    if {![info exists counter(mult)]} {
-        set counter(mult) 1
-    }
-
-    # These are tick marks
-
-    set img src=$options(-images)/$options(-gif)
-    append result "<tr>"
-    for {set i $options(-min)} {$i < $options(-max)} {incr i} {
-        if {(($i % $skip) == 0)} {
-        append result "<td valign=bottom><img $img height=3 \
-            width=1></td>\n"
-        } else {
-        append result "<td valign=bottom></td>"
-        }
-    }
-    append result </tr>
-
-    # These are the labels
-
-    append result "<tr>"
-    for {set i $options(-min)} {$i < $options(-max)} {incr i} {
-        if {$counter(type) == "-histlog"} {
-        if {[catch {expr {int(log($i) * $counter(bucketsize))}} x]} {
-            # Out-of-bounds
-            break
-        }
-        } else {
-        set x [expr {$i * $counter(bucketsize) * $counter(mult)}]
-        }
-        set label [format $options(-format) $x]
-        if {(($i % $skip) == 0)} {
-        set color [lindex $colors $colori]
-        set bg [lindex $bgcolors $colori]
-        set colori [expr {($colori+1) % 2}]
-        append result "<td colspan=$skip><font size=1 color=$color>$label</font></td>"
-        }
-    }
-    append result </tr>
-    } else {
-    switch -glob -- $options(-unit) {
-        min*    {
-        if {$secsPerMinute != 60} {
-            set format %k:%M:%S
-            set skip 12
-        } else {
-            set format %k:%M
-            set skip 4
-        }
-        set deltaT $secsPerMinute
-        set wrapDeltaT [expr {$secsPerMinute * -59}]
-        }
-        hour*   {
-        if {$secsPerMinute != 60} {
-            set format %k:%M
-            set skip 4
-        } else {
-            set format %k
-            set skip 2
-        }
-        set deltaT [expr {$secsPerMinute * 60}]
-        set wrapDeltaT [expr {$secsPerMinute * 60 * -23}]
-        }
-        day* {
-        if {$secsPerMinute != 60} {
-            set format "%m/%d %k:%M"
-            set skip 10
-        } else {
-            set format %k
-            set skip $options(-skip)
-        }
-        set deltaT [expr {$secsPerMinute * 60 * 24}]
-        set wrapDeltaT 0
-        }
-        default {#ignore}
-    }
-    # These are tick marks
-
-    set img src=$options(-images)/$options(-gif)
-    append result "<tr>"
-    foreach t [lsort -integer [array names histogram]] {
-        if {(($t % $skip) == 0)} {
-        append result "<td valign=bottom><img $img height=3 \
-            width=1></td>\n"
-        } else {
-        append result "<td valign=bottom></td>"
-        }
-    }
-    append result </tr>
-
-    set lastLabel ""
-    append result "<tr>"
-    foreach t [lsort -integer [array names histogram]] {
-
-        # Label each bucket with its time
-
-        set label [clock format $time -format $format]
-        if {(($t % $skip) == 0) && ($label != $lastLabel)} {
-        set color [lindex $colors $colori]
-        set bg [lindex $bgcolors $colori]
-        set colori [expr {($colori+1) % 2}]
-        append result "<td colspan=$skip><font size=1 color=$color>$label</font></td>"
-        set lastLabel $label
-        }
-        if {$t == $curIndex} {
-        incr time $wrapDeltaT
-        } else {
-        incr time $deltaT
-        }
-    }
-    append result </tr>\n
-    }
-    append result "</table>"
-    if {$underflow > 0} {
-    append result "<br>Skipped $underflow samples <\
-        [expr {$options(-min) * $counter(bucketsize)}]\n"
-    }
-    if {$overflow > 0} {
-    append result "<br>Skipped $overflow samples >\
-        [expr {$options(-max) * $counter(bucketsize)}]\n"
-    }
-    return $result
-}
-
-# ::counter::start --
-#
-#   Start an interval timer.  This should be pre-declared with
-#   type either -hist, -hist2x, or -hist20x
-#
-# Arguments:
-#   tag     The counter identifier.
-#   instance    There may be multiple intervals outstanding
-#           at any time.  This serves to distinquish them.
-#
-# Results:
-#   None
-#
-# Side Effects:
-#   Records the starting time for the instance of this interval.
-
-proc ::counter::start {tag instance} {
-    upvar #0 counter::Time-$tag time
-    # clock clicks can return negative values if the sign bit is set
-    # Here we turn it into a 31-bit counter because we only want
-    # relative differences
-    set msec [expr {[clock clicks -milliseconds] & 0x7FFFFFFF}]
-    set time($instance) [list $msec [clock seconds]]
-}
-
-# ::counter::stop --
-#
-#   Record an interval timer.
-#
-# Arguments:
-#   tag     The counter identifier.
-#   instance    There may be multiple intervals outstanding
-#           at any time.  This serves to distinquish them.
-#   func        An optional function used to massage the time
-#           stamp before putting into the histogram.
-#
-# Results:
-#   None
-#
-# Side Effects:
-#   Computes the current interval and adds it to the histogram.
-
-proc ::counter::stop {tag instance {func ::counter::Identity}} {
-    upvar #0 counter::Time-$tag time
-
-    if {![info exists time($instance)]} {
-	# Extra call. Ignore so we can debug error cases.
-	return
-    }
-    set msec [expr {[clock clicks -milliseconds] & 0x7FFFFFFF}]
-    set now [list $msec [clock seconds]]
-    set delMicros [expr {[lindex $now 0] - [lindex $time($instance) 0]}]
-    if {$delMicros < 0} {
-      # Microsecond counter wrapped.
-      set delMicros [expr {0x7FFFFFFF - [lindex $time($instance) 0] +
-                            [lindex $now 0]}]
-    }
-    set delSecond [expr {[lindex $now 1] - [lindex $time($instance) 1]}]
-    unset time($instance)
-
-    # It is quite possible that the millisecond counter is much
-    # larger than 1000, so we just use it unless our microsecond
-    # calculation is screwed up.
-
-    if {$delMicros >= 0} {
-      counter::count $tag [$func [expr {$delMicros / 1000.0}]]
-    } else {
-      counter::count $tag [$func $delSecond]
-    }
-}
-
-# ::counter::Identity --
-#
-#   Return its argument.  This is used as the default function
-#   to apply to an interval timer.
-#
-# Arguments:
-#   x       Some value.
-#
-# Results:
-#   $x
-#
-# Side Effects:
-#   None
-
-
-proc ::counter::Identity {x} {
-    return $x
-}
-
-package provide counter 2.0.4
Index: tolsh/tolsh.vfs/lib/tcllib1.10/counter/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/counter/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded counter 2.0.4 [list source [file join $dir counter.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/cksum.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/cksum.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,199 +1,0 @@
-# cksum.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provides a Tcl only implementation of the unix cksum(1) command. This is
-# similar to the sum(1) command but the algorithm is better defined and
-# standardized across multiple platforms by POSIX 1003.2/D11.2
-#
-# This command has been verified against the cksum command from the GNU
-# textutils package version 2.0
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# $Id: cksum.tcl,v 1.9 2006/09/19 23:36:15 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::crc {
-    variable cksum_version 1.1.1
-
-    namespace export cksum
-
-    variable cksum_tbl [list 0x0 \
-           0x04C11DB7 0x09823B6E 0x0D4326D9 0x130476DC 0x17C56B6B \
-           0x1A864DB2 0x1E475005 0x2608EDB8 0x22C9F00F 0x2F8AD6D6 \
-           0x2B4BCB61 0x350C9B64 0x31CD86D3 0x3C8EA00A 0x384FBDBD \
-           0x4C11DB70 0x48D0C6C7 0x4593E01E 0x4152FDA9 0x5F15ADAC \
-           0x5BD4B01B 0x569796C2 0x52568B75 0x6A1936C8 0x6ED82B7F \
-           0x639B0DA6 0x675A1011 0x791D4014 0x7DDC5DA3 0x709F7B7A \
-           0x745E66CD 0x9823B6E0 0x9CE2AB57 0x91A18D8E 0x95609039 \
-           0x8B27C03C 0x8FE6DD8B 0x82A5FB52 0x8664E6E5 0xBE2B5B58 \
-           0xBAEA46EF 0xB7A96036 0xB3687D81 0xAD2F2D84 0xA9EE3033 \
-           0xA4AD16EA 0xA06C0B5D 0xD4326D90 0xD0F37027 0xDDB056FE \
-           0xD9714B49 0xC7361B4C 0xC3F706FB 0xCEB42022 0xCA753D95 \
-           0xF23A8028 0xF6FB9D9F 0xFBB8BB46 0xFF79A6F1 0xE13EF6F4 \
-           0xE5FFEB43 0xE8BCCD9A 0xEC7DD02D 0x34867077 0x30476DC0 \
-           0x3D044B19 0x39C556AE 0x278206AB 0x23431B1C 0x2E003DC5 \
-           0x2AC12072 0x128E9DCF 0x164F8078 0x1B0CA6A1 0x1FCDBB16 \
-           0x018AEB13 0x054BF6A4 0x0808D07D 0x0CC9CDCA 0x7897AB07 \
-           0x7C56B6B0 0x71159069 0x75D48DDE 0x6B93DDDB 0x6F52C06C \
-           0x6211E6B5 0x66D0FB02 0x5E9F46BF 0x5A5E5B08 0x571D7DD1 \
-           0x53DC6066 0x4D9B3063 0x495A2DD4 0x44190B0D 0x40D816BA \
-           0xACA5C697 0xA864DB20 0xA527FDF9 0xA1E6E04E 0xBFA1B04B \
-           0xBB60ADFC 0xB6238B25 0xB2E29692 0x8AAD2B2F 0x8E6C3698 \
-           0x832F1041 0x87EE0DF6 0x99A95DF3 0x9D684044 0x902B669D \
-           0x94EA7B2A 0xE0B41DE7 0xE4750050 0xE9362689 0xEDF73B3E \
-           0xF3B06B3B 0xF771768C 0xFA325055 0xFEF34DE2 0xC6BCF05F \
-           0xC27DEDE8 0xCF3ECB31 0xCBFFD686 0xD5B88683 0xD1799B34 \
-           0xDC3ABDED 0xD8FBA05A 0x690CE0EE 0x6DCDFD59 0x608EDB80 \
-           0x644FC637 0x7A089632 0x7EC98B85 0x738AAD5C 0x774BB0EB \
-           0x4F040D56 0x4BC510E1 0x46863638 0x42472B8F 0x5C007B8A \
-           0x58C1663D 0x558240E4 0x51435D53 0x251D3B9E 0x21DC2629 \
-           0x2C9F00F0 0x285E1D47 0x36194D42 0x32D850F5 0x3F9B762C \
-           0x3B5A6B9B 0x0315D626 0x07D4CB91 0x0A97ED48 0x0E56F0FF \
-           0x1011A0FA 0x14D0BD4D 0x19939B94 0x1D528623 0xF12F560E \
-           0xF5EE4BB9 0xF8AD6D60 0xFC6C70D7 0xE22B20D2 0xE6EA3D65 \
-           0xEBA91BBC 0xEF68060B 0xD727BBB6 0xD3E6A601 0xDEA580D8 \
-           0xDA649D6F 0xC423CD6A 0xC0E2D0DD 0xCDA1F604 0xC960EBB3 \
-           0xBD3E8D7E 0xB9FF90C9 0xB4BCB610 0xB07DABA7 0xAE3AFBA2 \
-           0xAAFBE615 0xA7B8C0CC 0xA379DD7B 0x9B3660C6 0x9FF77D71 \
-           0x92B45BA8 0x9675461F 0x8832161A 0x8CF30BAD 0x81B02D74 \
-           0x857130C3 0x5D8A9099 0x594B8D2E 0x5408ABF7 0x50C9B640 \
-           0x4E8EE645 0x4A4FFBF2 0x470CDD2B 0x43CDC09C 0x7B827D21 \
-           0x7F436096 0x7200464F 0x76C15BF8 0x68860BFD 0x6C47164A \
-           0x61043093 0x65C52D24 0x119B4BE9 0x155A565E 0x18197087 \
-           0x1CD86D30 0x029F3D35 0x065E2082 0x0B1D065B 0x0FDC1BEC \
-           0x3793A651 0x3352BBE6 0x3E119D3F 0x3AD08088 0x2497D08D \
-           0x2056CD3A 0x2D15EBE3 0x29D4F654 0xC5A92679 0xC1683BCE \
-           0xCC2B1D17 0xC8EA00A0 0xD6AD50A5 0xD26C4D12 0xDF2F6BCB \
-           0xDBEE767C 0xE3A1CBC1 0xE760D676 0xEA23F0AF 0xEEE2ED18 \
-           0xF0A5BD1D 0xF464A0AA 0xF9278673 0xFDE69BC4 0x89B8FD09 \
-           0x8D79E0BE 0x803AC667 0x84FBDBD0 0x9ABC8BD5 0x9E7D9662 \
-           0x933EB0BB 0x97FFAD0C 0xAFB010B1 0xAB710D06 0xA6322BDF \
-           0xA2F33668 0xBCB4666D 0xB8757BDA 0xB5365D03 0xB1F740B4 ]
-
-    variable uid ; if {![info exists uid]} {set uid 0}
-}
-
-# crc::CksumInit -- 
-#
-#	Create and initialize a cksum context. This is cleaned up when we
-#	call CksumFinal to obtain the result.
-#
-proc ::crc::CksumInit {} {
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-    array set state {t 0 l 0}
-    return $token
-}
-
-proc ::crc::CksumUpdate {token data} {
-    variable cksum_tbl
-    upvar #0 $token state
-    set t $state(t)
-    binary scan $data c* r
-    foreach {n} $r {
-        set t [expr {($t << 8)
-                     ^ [lindex $cksum_tbl [expr {
-                                                 (($t >> 24) \
-                                                      ^ ($n & 0xFF)) & 0xFF
-                                             }]]}]
-        incr state(l)
-    }
-    set state(t) $t
-    return
-}
-
-proc ::crc::CksumFinal {token} {
-    variable cksum_tbl
-    upvar #0 $token state
-    set t $state(t)
-    for {set i $state(l)} {$i > 0} {set i [expr {$i>>8}]} {
-        set t [expr {($t << 8) \
-                         ^ [lindex $cksum_tbl \
-                                [expr {(($t >> 24) ^ $i) & 0xFF}]]}]
-    }
-    return [expr {~$t & 0xFFFFFFFF}]
-}
-
-# crc::Pop --
-#
-#	Pop the nth element off a list. Used in options processing.
-#
-proc ::crc::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# Description:
-#  Provide a Tcl equivalent of the unix cksum(1) command.
-# Options:
-#  -filename name  - return a checksum for the specified file.
-#  -format string  - return the checksum using this format string.
-#  -chunksize size - set the chunking read size
-#
-proc ::crc::cksum {args} {
-    array set opts [list -filename {} -channel {} -chunksize 4096 \
-                        -format %u -command {}]
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -file*   { set opts(-filename) [Pop args 1] }
-            -chan*   { set opts(-filename) [Pop args 1] }
-            -chunk*  { set opts(-filename) [Pop args 1] }
-            -for*    { set opts(-format)   [Pop args 1] }
-            -command { set opts(-command)  [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args ; break }
-                set err [join [lsort [array names opts -*]] ", "]
-                return -code error "bad option \"option\": must be $err"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args: should be\
-                cksum ?-format string?\
-                -channel chan | -filename file | string"
-        }
-        set tok [CksumInit]
-        CksumUpdate $tok [lindex $args 0]
-        set r [CksumFinal $tok]
-    
-    } else {
-
-        set tok [CksumInit]
-        while {![eof $opts(-channel)]} {
-            CksumUpdate $tok [read $opts(-channel) $opts(-chunksize)]
-        }
-        set r [CksumFinal $tok]
-
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-
-    return [format $opts(-format) $r]
-}
-
-# -------------------------------------------------------------------------
-
-package provide cksum $::crc::cksum_version
-
-# -------------------------------------------------------------------------
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/crc16.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/crc16.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,305 +1,0 @@
-# crc16.tcl -- Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Cyclic Redundancy Check - this is a Tcl implementation of a general
-# table-driven CRC implementation. This code should be able to generate
-# the lookup table and implement the correct algorithm for most types
-# of CRC. CRC-16, CRC-32 and the CCITT version of CRC-16. [1][2][3]
-# Most transmission CRCs use the CCITT polynomial (including X.25, SDLC
-# and Kermit).
-#
-# [1] http://www.microconsultants.com/tips/crc/crc.txt for the reference
-#     implementation 
-# [2] http://www.embedded.com/internet/0001/0001connect.htm
-#     for another good discussion of why things are the way they are.
-# [3] "Numerical Recipes in C", Press WH et al. Chapter 20.
-#
-# Checks: a crc for the string "123456789" should give:
-#   CRC16:     0xBB3D
-#   CRC-CCITT: 0x29B1
-#   XMODEM:    0x31C3
-#   CRC-32:    0xCBF43926
-#
-# eg: crc::crc16 "123456789"
-#     crc::crc-ccitt "123456789"
-# or  crc::crc16 -file tclsh.exe
-#
-# Note:
-#  The CCITT CRC can very easily be checked for the accuracy of transmission
-#  as the CRC of the message plus the CRC values will be 0. That is:
-#   % set msg {123456789]
-#   % set crc [crc::crc-ccitt $msg]
-#   % crc::crc-ccitt $msg[binary format S $crc]
-#   0
-#
-#  The same is true of other CRCs but some operate in reverse bit order:
-#   % crc::crc16 $msg[binary format s [crc::crc16 $msg]]
-#   0
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# $Id: crc16.tcl,v 1.15 2006/04/20 10:19:51 patthoyts Exp $
-
-# @mdgen EXCLUDE: crcc.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::crc {
-    
-    namespace export crc16 crc-ccitt crc-32
-
-    variable crc16_version 1.1.1
-
-    # Standard CRC generator polynomials.
-    variable polynomial
-    set polynomial(crc16) [expr {(1<<16) | (1<<15) | (1<<2) | 1}]
-    set polynomial(ccitt) [expr {(1<<16) | (1<<12) | (1<<5) | 1}]
-    set polynomial(crc32) [expr {(1<<32) | (1<<26) | (1<<23) | (1<<22) 
-                                 | (1<<16) | (1<<12) | (1<<11) | (1<<10)
-                                 | (1<<8) | (1<<7) | (1<<5) | (1<<4)
-                                 | (1<<2) | (1<<1) | 1}]
-
-    # Array to hold the generated tables
-    variable table
-    if {![info exists table]} { array set table {}}
-
-    # calculate the sign bit for the current platform.
-    variable signbit
-    if {![info exists signbit]} {
-	variable v
-        for {set v 1} {int($v) != 0} {set signbit $v; set v [expr {$v<<1}]} {}
-        unset v
-    }
-}
-
-# -------------------------------------------------------------------------
-# Generate a CRC lookup table.
-# This creates a CRC algorithm lookup table for a 'width' bits checksum
-# using the 'poly' polynomial for all values of an input byte.
-# Setting 'reflected' changes the bit order for input bytes.
-# Returns a list or 255 elements.
-#
-# CRC-32:      Crc_table 32 $crc::polynomial(crc32) 1
-# CRC-16:      Crc_table 16 $crc::polynomial(crc16) 1
-# CRC16/CCITT: Crc_table 16 $crc::polynomial(ccitt) 0
-#
-proc ::crc::Crc_table {width poly reflected} {
-    set tbl {}
-    if {$width < 32} {
-        set mask   [expr {(1 << $width) - 1}]
-        set topbit [expr {1 << ($width - 1)}]
-    } else {
-        set mask   0xffffffff
-        set topbit 0x80000000
-    }
-
-    for {set i 0} {$i < 256} {incr i} {
-        if {$reflected} {
-            set r [reflect $i 8]
-        } else {
-            set r $i
-        }
-        set r [expr {$r << ($width - 8)}]
-        for {set k 0} {$k < 8} {incr k} {
-            if {[expr {$r & $topbit}] != 0} {
-                set r [expr {($r << 1) ^ $poly}]
-            } else {
-                set r [expr {$r << 1}]
-            }
-        }
-        if {$reflected} {
-            set r [reflect $r $width]
-        }
-        lappend tbl [expr {$r & $mask}]
-    }
-    return $tbl
-}
-
-# -------------------------------------------------------------------------
-# Calculate the CRC checksum for the data in 's' using a precalculated
-# table.
-#  s the input data
-#  width - the width in bits of the CRC algorithm
-#  table - the name of the variable holding the calculated table
-#  init  - the start value (or the last CRC for sequential blocks)
-#  xorout - the final value may be XORd with this value
-#  reflected - a boolean indicating that the bit order is reversed.
-#              For hardware optimised CRC checks, the bits are handled
-#              in transmission order (ie: bit0, bit1, ..., bit7)
-proc ::crc::Crc {s width table {init 0} {xorout 0} {reflected 0}} {
-    upvar $table tbl
-    variable signbit
-    set signmask [expr {~$signbit>>7}]
-
-    if {$width < 32} {
-        set mask   [expr {(1 << $width) - 1}]
-        set rot    [expr {$width - 8}]
-    } else {
-        set mask   0xffffffff
-        set rot    24
-    }
-
-    set crc $init
-    binary scan $s c* data
-    foreach {datum} $data {
-        if {$reflected} {
-            set ndx [expr {($crc ^ $datum) & 0xFF}]
-            set lkp [lindex $tbl $ndx]
-            set crc [expr {($lkp ^ ($crc >> 8 & $signmask)) & $mask}]
-        } else {
-            set ndx [expr {(($crc >> $rot) ^ $datum) & 0xFF}]
-            set lkp [lindex $tbl $ndx]
-            set crc [expr {($lkp ^ ($crc << 8 & $signmask)) & $mask}]
-        }
-    }
-
-    return [expr {$crc ^ $xorout}]
-}
-
-# -------------------------------------------------------------------------
-# Reverse the bit ordering for 'b' bits of the input value 'v'
-proc ::crc::reflect {v b} {
-    set t $v
-    for {set i 0} {$i < $b} {incr i} {
-        set v [expr {($t & 1) ? ($v | (1<<(($b-1)-$i))) : ($v & ~(1<<(($b-1)-$i))) }]
-        set t [expr {$t >> 1}]
-    }
-    return $v
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::crc::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Specialisation of the general crc procedure to perform the standard CRC16
-# checksum
-proc ::crc::CRC16 {s {seed 0}} {
-    variable table
-    if {![info exists table(crc16)]} {
-        variable polynomial
-        set table(crc16) [Crc_table 16 $polynomial(crc16) 1]
-    }
-
-    return [Crc $s 16 [namespace current]::table(crc16) $seed 0 1]
-}
-
-# -------------------------------------------------------------------------
-# Specialisation of the general crc procedure to perform the CCITT telecoms
-# flavour of the CRC16 checksum
-proc ::crc::CRC-CCITT {s {seed 0} {xor 0}} {
-    variable table
-    if {![info exists table(ccitt)]} {
-        variable polynomial
-        set table(ccitt) [Crc_table 16 $polynomial(ccitt) 0]
-    }
-
-    return [Crc $s 16 [namespace current]::table(ccitt) $seed $xor 0]
-}
-
-# -------------------------------------------------------------------------
-# Demostrates the parameters used for the 32 bit checksum CRC-32.
-# This can be used to show the algorithm is working right by comparison with
-# other crc32 implementations
-proc ::crc::CRC-32 {s {seed 0xFFFFFFFF}} {
-    variable table
-    if {![info exists table(crc32)]} {
-        variable polynomial
-        set table(crc32) [Crc_table 32 $polynomial(crc32) 1]
-    }
-
-    return [Crc $s 32 [namespace current]::table(crc32) $seed 0xFFFFFFFF 1]
-}
-
-# -------------------------------------------------------------------------
-# User level CRC command.
-proc ::crc::crc {args} {
-    array set opts [list filename {} channel {} chunksize 4096 \
-                        format %u  seed 0 \
-                        impl [namespace origin CRC16]]
-    
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -fi*  { set opts(filename) [Pop args 1] }
-            -cha* { set opts(channel) [Pop args 1] }
-            -chu* { set opts(chunksize) [Pop args 1] }
-            -fo*  { set opts(format) [Pop args 1] }
-            -i*   { set opts(impl) [uplevel 1 namespace origin [Pop args 1]] }
-            -s*   { set opts(seed) [Pop args 1] }
-            --    { Pop args ; break }
-            default {
-                set options [join [lsort [array names opts]] ", -"]
-                return -code error "bad option $option:\
-                       must be one of -$options"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(filename) != {}} {
-        set opts(channel) [open $opts(filename) r]
-        fconfigure $opts(channel) -translation binary
-    }
-
-    if {$opts(channel) != {}} {
-        set r $opts(seed)
-        set trans [fconfigure $opts(channel) -translation]
-        fconfigure $opts(channel) -translation binary
-        while {![eof $opts(channel)]} {
-            set chunk [read $opts(channel) $opts(chunksize)]
-            set r [$opts(impl) $chunk $r]
-        }
-        fconfigure $opts(channel) -translation $trans
-        if {$opts(filename) != {}} {
-            close $opts(channel)
-        }
-    } else {
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args: should be\
-                   \"crc16 ?-format string? ?-seed value? ?-impl procname?\
-                   -file name | data\""
-        }
-        set r [$opts(impl) [lindex $args 0] $opts(seed)]
-    }
-    return [format $opts(format) $r]
-}
-
-# -------------------------------------------------------------------------
-# The user commands. See 'crc'
-#
-proc ::crc::crc16 {args} {
-    return [eval [list crc -impl [namespace origin CRC16]] $args]
-}
-
-proc ::crc::crc-ccitt {args} {
-    return [eval [list crc -impl [namespace origin CRC-CCITT] -seed 0xFFFF]\
-                $args]
-}
-
-proc ::crc::xmodem {args} {
-    return [eval [list crc -impl [namespace origin CRC-CCITT] -seed 0] $args]
-}
-
-proc ::crc::crc-32 {args} {
-    return [eval [list crc -impl [namespace origin CRC-32] -seed 0xFFFFFFFF]\
-                $args]
-}
-
-# -------------------------------------------------------------------------
-
-package provide crc16 $crc::crc16_version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/crc32.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/crc32.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,371 +1,0 @@
-# crc32.tcl -- Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# CRC32 Cyclic Redundancy Check. 
-# (for algorithm see http://www.rad.com/networks/1994/err_con/crc.htm)
-#
-# From http://mini.net/tcl/2259.tcl
-# Written by Wayland Augur and Pat Thoyts.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# $Id: crc32.tcl,v 1.21 2005/10/25 01:26:40 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::crc {
-    variable crc32_version 1.3
-    variable accel
-    array set accel {critcl 0 trf 0}
-
-    namespace export crc32
-
-    variable crc32_tbl [list 0x00000000 0x77073096 0xEE0E612C 0x990951BA \
-                           0x076DC419 0x706AF48F 0xE963A535 0x9E6495A3 \
-                           0x0EDB8832 0x79DCB8A4 0xE0D5E91E 0x97D2D988 \
-                           0x09B64C2B 0x7EB17CBD 0xE7B82D07 0x90BF1D91 \
-                           0x1DB71064 0x6AB020F2 0xF3B97148 0x84BE41DE \
-                           0x1ADAD47D 0x6DDDE4EB 0xF4D4B551 0x83D385C7 \
-                           0x136C9856 0x646BA8C0 0xFD62F97A 0x8A65C9EC \
-                           0x14015C4F 0x63066CD9 0xFA0F3D63 0x8D080DF5 \
-                           0x3B6E20C8 0x4C69105E 0xD56041E4 0xA2677172 \
-                           0x3C03E4D1 0x4B04D447 0xD20D85FD 0xA50AB56B \
-                           0x35B5A8FA 0x42B2986C 0xDBBBC9D6 0xACBCF940 \
-                           0x32D86CE3 0x45DF5C75 0xDCD60DCF 0xABD13D59 \
-                           0x26D930AC 0x51DE003A 0xC8D75180 0xBFD06116 \
-                           0x21B4F4B5 0x56B3C423 0xCFBA9599 0xB8BDA50F \
-                           0x2802B89E 0x5F058808 0xC60CD9B2 0xB10BE924 \
-                           0x2F6F7C87 0x58684C11 0xC1611DAB 0xB6662D3D \
-                           0x76DC4190 0x01DB7106 0x98D220BC 0xEFD5102A \
-                           0x71B18589 0x06B6B51F 0x9FBFE4A5 0xE8B8D433 \
-                           0x7807C9A2 0x0F00F934 0x9609A88E 0xE10E9818 \
-                           0x7F6A0DBB 0x086D3D2D 0x91646C97 0xE6635C01 \
-                           0x6B6B51F4 0x1C6C6162 0x856530D8 0xF262004E \
-                           0x6C0695ED 0x1B01A57B 0x8208F4C1 0xF50FC457 \
-                           0x65B0D9C6 0x12B7E950 0x8BBEB8EA 0xFCB9887C \
-                           0x62DD1DDF 0x15DA2D49 0x8CD37CF3 0xFBD44C65 \
-                           0x4DB26158 0x3AB551CE 0xA3BC0074 0xD4BB30E2 \
-                           0x4ADFA541 0x3DD895D7 0xA4D1C46D 0xD3D6F4FB \
-                           0x4369E96A 0x346ED9FC 0xAD678846 0xDA60B8D0 \
-                           0x44042D73 0x33031DE5 0xAA0A4C5F 0xDD0D7CC9 \
-                           0x5005713C 0x270241AA 0xBE0B1010 0xC90C2086 \
-                           0x5768B525 0x206F85B3 0xB966D409 0xCE61E49F \
-                           0x5EDEF90E 0x29D9C998 0xB0D09822 0xC7D7A8B4 \
-                           0x59B33D17 0x2EB40D81 0xB7BD5C3B 0xC0BA6CAD \
-                           0xEDB88320 0x9ABFB3B6 0x03B6E20C 0x74B1D29A \
-                           0xEAD54739 0x9DD277AF 0x04DB2615 0x73DC1683 \
-                           0xE3630B12 0x94643B84 0x0D6D6A3E 0x7A6A5AA8 \
-                           0xE40ECF0B 0x9309FF9D 0x0A00AE27 0x7D079EB1 \
-                           0xF00F9344 0x8708A3D2 0x1E01F268 0x6906C2FE \
-                           0xF762575D 0x806567CB 0x196C3671 0x6E6B06E7 \
-                           0xFED41B76 0x89D32BE0 0x10DA7A5A 0x67DD4ACC \
-                           0xF9B9DF6F 0x8EBEEFF9 0x17B7BE43 0x60B08ED5 \
-                           0xD6D6A3E8 0xA1D1937E 0x38D8C2C4 0x4FDFF252 \
-                           0xD1BB67F1 0xA6BC5767 0x3FB506DD 0x48B2364B \
-                           0xD80D2BDA 0xAF0A1B4C 0x36034AF6 0x41047A60 \
-                           0xDF60EFC3 0xA867DF55 0x316E8EEF 0x4669BE79 \
-                           0xCB61B38C 0xBC66831A 0x256FD2A0 0x5268E236 \
-                           0xCC0C7795 0xBB0B4703 0x220216B9 0x5505262F \
-                           0xC5BA3BBE 0xB2BD0B28 0x2BB45A92 0x5CB36A04 \
-                           0xC2D7FFA7 0xB5D0CF31 0x2CD99E8B 0x5BDEAE1D \
-                           0x9B64C2B0 0xEC63F226 0x756AA39C 0x026D930A \
-                           0x9C0906A9 0xEB0E363F 0x72076785 0x05005713 \
-                           0x95BF4A82 0xE2B87A14 0x7BB12BAE 0x0CB61B38 \
-                           0x92D28E9B 0xE5D5BE0D 0x7CDCEFB7 0x0BDBDF21 \
-                           0x86D3D2D4 0xF1D4E242 0x68DDB3F8 0x1FDA836E \
-                           0x81BE16CD 0xF6B9265B 0x6FB077E1 0x18B74777 \
-                           0x88085AE6 0xFF0F6A70 0x66063BCA 0x11010B5C \
-                           0x8F659EFF 0xF862AE69 0x616BFFD3 0x166CCF45 \
-                           0xA00AE278 0xD70DD2EE 0x4E048354 0x3903B3C2 \
-                           0xA7672661 0xD06016F7 0x4969474D 0x3E6E77DB \
-                           0xAED16A4A 0xD9D65ADC 0x40DF0B66 0x37D83BF0 \
-                           0xA9BCAE53 0xDEBB9EC5 0x47B2CF7F 0x30B5FFE9 \
-                           0xBDBDF21C 0xCABAC28A 0x53B39330 0x24B4A3A6 \
-                           0xBAD03605 0xCDD70693 0x54DE5729 0x23D967BF \
-                           0xB3667A2E 0xC4614AB8 0x5D681B02 0x2A6F2B94 \
-                           0xB40BBE37 0xC30C8EA1 0x5A05DF1B 0x2D02EF8D]
-
-    # calculate the sign bit for the current platform.
-    variable signbit
-    if {![info exists signbit]} {
-	variable v
-        for {set v 1} {int($v) != 0} {set signbit $v; set v [expr {$v<<1}]} {}
-        unset v
-    }
-    
-    variable uid ; if {![info exists uid]} {set uid 0}
-}
-
-# -------------------------------------------------------------------------
-
-# crc::Crc32Init --
-#
-#	Create and initialize a crc32 context. This is cleaned up
-#	when we we call Crc32Final to obtain the result.
-#
-proc ::crc::Crc32Init {{seed 0xFFFFFFFF}} {
-    variable uid
-    variable accel
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-    array set state [list sum $seed]
-    # If the initial seed is set to some other value we cannot use Trf.
-    if {$accel(trf) && $seed == 0xFFFFFFFF} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::crc-zlib -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-# crc::Crc32Update --
-#
-#	This is called to add more data into the checksum. You may
-#	call this as many times as you require. Note that passing in
-#	"ABC" is equivalent to passing these letters in as separate
-#	calls -- hence this proc permits summing of chunked data.
-#
-#	If we have a C-based implementation available, then we will
-#	use it here in preference to the pure-Tcl implementation.
-#
-proc ::crc::Crc32Update {token data} {
-    variable accel
-    upvar #0 $token state
-    set sum $state(sum)
-    if {$accel(critcl)} {
-        set sum [Crc32_c $data $sum]
-    } elseif {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    } else {
-        set sum [Crc32_tcl $data $sum]
-    }
-    set state(sum) [expr {$sum ^ 0xFFFFFFFF}]
-    return
-}
-
-# crc::Crc32Final -- 
-#
-#	This procedure is used to close the context and returns the
-#	checksum value. Once this procedure has been called the checksum
-#	context is freed and cannot be used again.  
-#
-proc ::crc::Crc32Final {token} {
-    upvar #0 $token state
-    if {[info exists state(trf)]} {
-        close $state(trf)
-        binary scan $state(trfwrite) i sum
-        set sum [expr {$sum & 0xFFFFFFFF}]
-    } else {
-        set sum [expr {($state(sum) ^ 0xFFFFFFFF) & 0xFFFFFFFF}]
-    }
-    unset state
-    return $sum
-}
-
-# crc::Crc32_tcl --
-#
-#	The pure-Tcl implementation of a table based CRC-32 checksum.
-#	The seed should always be 0xFFFFFFFF to begin with, but for
-#	successive chunks of data the seed should be set to the result
-#	of the last chunk.
-#
-proc ::crc::Crc32_tcl {data {seed 0xFFFFFFFF}} {
-    variable crc32_tbl
-    variable signbit
-    set signmask [expr {~$signbit>>7}]
-    set crcval $seed
-
-    binary scan $data c* nums
-    foreach {n} $nums {
-        set ndx [expr {($crcval ^ $n) & 0xFF}]
-        set lkp [lindex $crc32_tbl $ndx]
-        set crcval [expr {($lkp ^ ($crcval >> 8 & $signmask)) & 0xFFFFFFFF}]
-    }
-    
-    return [expr {$crcval ^ 0xFFFFFFFF}]
-}
-
-# crc::Crc32_c --
-#
-#	A C version of the CRC-32 code using the same table. This is
-#	designed to be compiled using critcl.
-#
-if {[package provide critcl] != {}} {
-    namespace eval ::crc {
-        critcl::ccommand Crc32_c {dummy interp objc objv} {
-            int r = TCL_OK;
-            unsigned long t = 0xFFFFFFFFL;
-
-            if (objc < 2 || objc > 3) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data ?seed?");
-                return TCL_ERROR;
-            }
-            
-            if (objc == 3)
-                r = Tcl_GetLongFromObj(interp, objv[2], (long *)&t);
-
-            if (r == TCL_OK) {
-                int cn, size, ndx;
-                unsigned char *data;
-                unsigned long lkp;
-                Tcl_Obj *tblPtr, *lkpPtr;
-
-                tblPtr = Tcl_GetVar2Ex(interp, "::crc::crc32_tbl", NULL,
-                                       TCL_LEAVE_ERR_MSG );
-                if (tblPtr == NULL)
-                    r = TCL_ERROR;
-                if (r == TCL_OK)
-                    data = Tcl_GetByteArrayFromObj(objv[1], &size);
-                for (cn = 0; r == TCL_OK && cn < size; cn++) {
-                    ndx = (t ^ data[cn]) & 0xFF;
-                    r = Tcl_ListObjIndex(interp, tblPtr, ndx, &lkpPtr);
-                    if (r == TCL_OK)
-                        r = Tcl_GetLongFromObj(interp, lkpPtr, &lkp);
-                    if (r == TCL_OK)
-                        t = lkp ^ (t >> 8);
-                }
-            }
-
-            if (r == TCL_OK)
-                Tcl_SetLongObj(Tcl_GetObjResult(interp), t ^ 0xFFFFFFFF);
-            return r;
-        }
-    }
-}
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::crc::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require crcc}]} {
-                set r [expr {[info command ::crc::Crc32_c] != {}}]
-            }
-        }
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::crc-zlib aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# crc::Pop --
-#
-#	Pop the nth element off a list. Used in options processing.
-#
-proc ::crc::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# crc::crc32 --
-#
-#	Provide a Tcl implementation of a crc32 checksum similar to the
-#	cksum and sum unix commands.
-#
-# Options:
-#  -filename name - return a checksum for the specified file.
-#  -format string - return the checksum using this format string.
-#  -seed value    - seed the algorithm using value (default is 0xffffffff)
-#
-proc ::crc::crc32 {args} {
-    array set opts [list -filename {} -format %u -seed 0xffffffff \
-                        -channel {} -chunksize 4096 -timeout 30000]
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -file*  { set opts(-filename) [Pop args 1] }
-            -for*   { set opts(-format) [Pop args 1] }
-            -chan*  { set opts(-channel) [Pop args 1] }
-            -chunk* { set opts(-chunksize) [Pop args 1] }
-            -time*  { set opts(-timeout) [Pop args 1] }
-            -seed   { set opts(-seed) [Pop args 1] }
-            -impl*  { set junk [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts -*]] ", "]
-                return -code error "bad option \"$option\": must be $err"
-            }
-        }
-        Pop args
-    }
-
-    # If a file was given - open it
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-        
-        if {[llength $args] != 1} {
-            return -code error "wrong # args: should be \
-                 \"crc32 ?-format string? ?-seed value? \
-                 -channel chan | -file name | data\""
-        }
-        set tok [Crc32Init $opts(-seed)]
-        Crc32Update $tok [lindex $args 0]
-        set r [Crc32Final $tok]
-
-    } else {
-
-        set r $opts(-seed)
-        set tok [Crc32Init $opts(-seed)]
-        while {![eof $opts(-channel)]} {
-            Crc32Update $tok [read $opts(-channel) $opts(-chunksize)]
-        }
-        set r [Crc32Final $tok]
-
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-
-    return [format $opts(-format) $r]
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help (note - trf is fastest)
-namespace eval ::crc {
-    foreach e {trf critcl} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide crc32 $::crc::crc32_version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/crcc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/crcc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,21 +1,0 @@
-# crcc.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Place holder for building a critcl C module for this tcllib module.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# $Id: crcc.tcl,v 1.3 2006/11/04 15:20:36 patthoyts Exp $
-
-package require critcl 
-
-namespace eval ::crc {
-    variable rcsid {$Id: crcc.tcl,v 1.3 2006/11/04 15:20:36 patthoyts Exp $}
-
-    critcl::ccode {
-        /* no code required in this file */
-    }
-}
-
-package provide crcc 1.0.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded cksum 1.1.1 [list source [file join $dir cksum.tcl]]
-package ifneeded crc16 1.1.1 [list source [file join $dir crc16.tcl]]
-package ifneeded crc32 1.3   [list source [file join $dir crc32.tcl]]
-package ifneeded sum   1.1.0 [list source [file join $dir sum.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/crc/sum.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/crc/sum.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,278 +1,0 @@
-# sum.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provides a Tcl only implementation of the unix sum(1) command. There are
-# a number of these and they use differing algorithms to get a checksum of
-# the input data. We provide two: one using the BSD algorithm and the other
-# using the SysV algorithm. More consistent results across multiple
-# implementations can be obtained by using cksum(1).
-#
-# These commands have been checked against the GNU sum program from the GNU
-# textutils package version 2.0 to ensure the same results.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-# $Id: sum.tcl,v 1.7 2004/01/15 06:36:12 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-catch {package require tcllibc};        # critcl enhancements to tcllib
-#catch {package require crcc};           # critcl enhanced crc module
-
-namespace eval ::crc {
-    variable sum_version 1.1.0
-    namespace export sum
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  The SysV algorithm is fairly naive. The byte values are summed and any
-#  overflow is discarded. The lowest 16 bits are returned as the checksum.
-# Notes:
-#  Input with the same content but different ordering will give the same 
-#  result.
-#
-proc ::crc::SumSysV {s {seed 0}} {
-    set t $seed
-    binary scan $s c* r
-    foreach n $r {
-        incr t [expr {$n & 0xFF}]
-    }
-    return [expr {$t % 0xFFFF}]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  This algorithm is similar to the SysV version but includes a bit rotation
-#  step which provides a dependency on the order of the data values.
-#
-proc ::crc::SumBsd {s {seed 0}} {
-    set t $seed
-    binary scan $s c* r
-    foreach n $r {
-        set t [expr {($t & 1) ? (($t >> 1) + 0x8000) : ($t >> 1)}]
-        set t [expr {($t + ($n & 0xFF)) & 0xFFFF}]
-    }
-    return $t
-}
-
-# -------------------------------------------------------------------------
-
-if {[package provide critcl] != {}} {
-    namespace eval ::crc {
-        critcl::ccommand SumSysV_c {dummy interp objc objv} {
-            int r = TCL_OK;
-            unsigned int t = 0;
-
-            if (objc < 2 || objc > 3) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data ?seed?");
-                return TCL_ERROR;
-            }
-            
-            if (objc == 3)
-                r = Tcl_GetIntFromObj(interp, objv[2], (int *)&t);
-
-            if (r == TCL_OK) {
-                int cn, size;
-                unsigned char *data;
-
-                data = Tcl_GetByteArrayFromObj(objv[1], &size);
-                for (cn = 0; cn < size; cn++)
-                    t += data[cn];
-            }
-
-            Tcl_SetIntObj(Tcl_GetObjResult(interp), t & 0xFFFF);
-            return r;
-        }
-
-        critcl::ccommand SumBsd_c {dummy interp objc objv} {
-            int r = TCL_OK;
-            unsigned int t = 0;
-
-            if (objc < 2 || objc > 3) {
-                Tcl_WrongNumArgs(interp, 1, objv, "data ?seed?");
-                return TCL_ERROR;
-            }
-            
-            if (objc == 3)
-                r = Tcl_GetIntFromObj(interp, objv[2], (int *)&t);
-
-            if (r == TCL_OK) {
-                int cn, size;
-                unsigned char *data;
-
-                data = Tcl_GetByteArrayFromObj(objv[1], &size);
-                for (cn = 0; cn < size; cn++) {
-                    t = (t & 1) ? ((t >> 1) + 0x8000) : (t >> 1);
-                    t = (t + data[cn]) & 0xFFFF;
-                }
-            }
-
-            Tcl_SetIntObj(Tcl_GetObjResult(interp), t & 0xFFFF);
-            return r;
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Switch from pure tcl to compiled if available.
-#
-if {[info command ::crc::SumBsd_c] == {}} {
-    interp alias {} ::crc::sum-bsd  {} ::crc::SumBsd
-} else {
-    interp alias {} ::crc::sum-bsd  {} ::crc::SumBsd_c
-}
-
-if {[info command ::crc::SumSysV_c] == {}} {
-    interp alias {} ::crc::sum-sysv {} ::crc::SumSysV
-} else {
-    interp alias {} ::crc::sum-sysv {} ::crc::SumSysV_c
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::crc::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# timeout handler for the chunked file handling
-# This avoids us waiting for ever
-#
-proc ::crc::SumTimeout {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    set state(error) "operation timed out"
-    set state(reading) 0
-}
-
-# -------------------------------------------------------------------------
-# fileevent handler for chunked file handling.
-#
-proc ::crc::SumChunk {token channel} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-    
-    after cancel $state(after)
-    set state(after) [after $state(timeout) \
-                          [list [namespace origin SumTimeout] $token]]
-    set state(result) [$state(algorithm) \
-                           [read $channel $state(chunksize)] \
-                           $state(result)]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Provide a Tcl equivalent of the unix sum(1) command. We default to the
-#  BSD algorithm and return a checkum for the input string unless a filename
-#  has been provided. Using sum on a file should give the same results as
-#  the unix sum command with equivalent algorithm.
-# Options:
-#  -bsd           - use the BSD algorithm to calculate the checksum (default)
-#  -sysv          - use the SysV algorithm to calculate the checksum
-#  -filename name - return a checksum for the specified file
-#  -format string - return the checksum using this format string
-#
-proc ::crc::sum {args} {
-    array set opts [list -filename {} -channel {} -chunksize 4096 \
-                        -timeout 30000 -bsd 1 -sysv 0 -format %u \
-                        algorithm [namespace origin sum-bsd]]
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -bsd    { set opts(-bsd) 1 ; set opts(-sysv) 0 }
-            -sysv   { set opts(-bsd) 0 ; set opts(-sysv) 1 }
-            -file*  { set opts(-filename) [Pop args 1] }
-            -for*   { set opts(-format) [Pop args 1] }
-            -chan*  { set opts(-channel) [Pop args 1] }
-            -chunk* { set opts(-chunksize) [Pop args 1] }
-            -time*  { set opts(-timeout) [Pop args 1] }
-            --      { Pop args ; break }
-            default {
-                set err [join [lsort [array names opts -*]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    # Set the correct sum algorithm
-    if {$opts(-sysv)} {
-        set opts(algorithm) [namespace origin sum-sysv]
-    }
-
-    # If a file was given - open it for binary reading.
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args: should be \
-                 \"sum ?-bsd|-sysv? ?-format string? ?-chunksize size? \
-                 ?-timeout ms? -file name | -channel chan | data\""
-        }
-        set r [$opts(algorithm) [lindex $args 0]]
-
-    } else {
-
-        # Create a unique token for the event handling
-        variable uid
-        set token [namespace current]::[incr uid]
-        upvar #0 $token tok
-        array set tok [list reading 1 result 0 timeout $opts(-timeout) \
-                           chunksize $opts(-chunksize) \
-                           algorithm $opts(algorithm)]
-        set tok(after) [after $tok(timeout) \
-                            [list [namespace origin SumTimeout] $token]]
-
-        fileevent $opts(-channel) readable \
-            [list [namespace origin SumChunk] $token $opts(-channel)]
-        vwait [subst $token](reading)
-
-        # If we opened the channel we must close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-
-        # Extract the result or error message if there was a problem.
-        set r $tok(result)
-        if {[info exists tok(error)]} {
-            return -code error $tok(error)
-        }
-
-        unset tok
-    }
-
-    return [format $opts(-format) $r]
-}
-
-# -------------------------------------------------------------------------
-
-package provide sum $::crc::sum_version
-
-# -------------------------------------------------------------------------    
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/csv/csv.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/csv/csv.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,759 +1,0 @@
-# csv.tcl --
-#
-#	Tcl implementations of CSV reader and writer
-#
-# Copyright (c) 2001      by Jeffrey Hobbs
-# Copyright (c) 2001-2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: csv.tcl,v 1.25 2006/09/19 23:36:15 andreas_kupries Exp $
-
-package require Tcl 8.3
-package provide csv 0.7
-
-namespace eval ::csv {
-    namespace export join joinlist read2matrix read2queue report 
-    namespace export split split2matrix split2queue writematrix writequeue
-}
-
-# ::csv::join --
-#
-#	Takes a list of values and generates a string in CSV format.
-#
-# Arguments:
-#	values		A list of the values to join
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A string containing the values in CSV format.
-
-proc ::csv::join {values {sepChar ,} {delChar \"}} {
-    set out ""
-    set sep {}
-    foreach val $values {
-	if {[string match "*\[${delChar}$sepChar\]*" $val]} {
-	    append out $sep${delChar}[string map [list $delChar ${delChar}${delChar}] $val]${delChar}
-	} else {
-	    append out $sep${val}
-	}
-	set sep $sepChar
-    }
-    return $out
-}
-
-# ::csv::joinlist --
-#
-#	Takes a list of lists of values and generates a string in CSV
-#	format. Each item in the list is made into a single CSV
-#	formatted record in the final string, the records being
-#	separated by newlines.
-#
-# Arguments:
-#	values		A list of the lists of the values to join
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A string containing the values in CSV format, the records
-#	separated by newlines.
-
-proc ::csv::joinlist {values {sepChar ,} {delChar \"}} {
-    set out ""
-    foreach record $values {
-	# note that this is ::csv::join
-	append out "[join $record $sepChar $delChar]\n"
-    }
-    return $out
-}
-
-# ::csv::joinmatrix --
-#
-#	Takes a matrix object following the API specified for the
-#	struct::matrix package. Each row of the matrix is converted
-#	into a single CSV formatted record in the final string, the
-#	records being separated by newlines.
-#
-# Arguments:
-#	matrix		Matrix object command.
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A string containing the values in CSV format, the records
-#	separated by newlines.
-
-proc ::csv::joinmatrix {matrix {sepChar ,} {delChar \"}} {
-    return [joinlist [$matrix get rect 0 0 end end] $sepChar $delChar]
-}
-
-# ::csv::iscomplete --
-#
-#	A predicate checking if the argument is a complete csv record.
-#
-# Arguments
-#	data	The (partial) csv record to check.
-#
-# Results:
-#	A boolean flag indicating the completeness of the data. The
-#	result is true if the data is complete.
-
-proc ::csv::iscomplete {data} {
-    expr {1 - [regexp -all \" $data] % 2}
-}
-
-# ::csv::read2matrix --
-#
-#	A wrapper around "Split2matrix" reading CSV formatted
-#	lines from the specified channel and adding it to the given
-#	matrix.
-#
-# Arguments:
-#	m		The matrix to add the read data too.
-#	chan		The channel to read from.
-#	sepChar		The separator character, defaults to comma
-#	expand		The expansion mode. The default is none
-#
-# Results:
-#	A list of the values in 'line'.
-
-proc ::csv::read2matrix {args} {
-    # FR #481023
-    # See 'split2matrix' for the available expansion modes.
-
-    # Argument syntax:
-    #
-    #2)            chan m
-    #3)            chan m sepChar
-    #3) -alternate chan m
-    #4) -alternate chan m sepChar
-    #4)            chan m sepChar expand
-    #5) -alternate chan m sepChar expand
-
-    set alternate 0
-    set sepChar   ,
-    set expand    none
-
-    switch -exact -- [llength $args] {
-	2 {
-	    foreach {chan m} $args break
-	}
-	3 {
-	    foreach {a b c} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set chan      $b
-		set m         $c
-	    } else {
-		set chan    $a
-		set m       $b
-		set sepChar $c
-	    }
-	}
-	4 {
-	    foreach {a b c d} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set chan      $b
-		set m         $c
-		set sepChar   $d
-	    } else {
-		set chan    $a
-		set m       $b
-		set sepChar $c
-		set expand  $d
-	    }
-	}
-	5 {
-	    foreach {a b c d e} $args break
-	    if {![string equal $a "-alternate"]} {
-		return -code error "wrong#args: Should be ?-alternate? chan m ?separator? ?expand?"
-	    }
-	    set alternate 1
-
-	    set chan    $b
-	    set m       $c
-	    set sepChar $d
-	    set expand  $e
-	}
-	0 - 1 -
-	default {
-	    return -code error "wrong#args: Should be ?-alternate? chan m ?separator? ?expand?"
-	}
-    }
-
-    set data ""
-    while {![eof $chan]} {
-	if {[gets $chan line] < 0} {continue}
-
-	# Why skip empty lines? They may be in data. Except if the
-	# buffer is empty, i.e. we are between records.
-	if {$line == {} && $data == {}} {continue}
-
-       append data $line
-       if {![iscomplete $data]} {
-           # Odd number of quotes - must have embedded newline
-           append data \n
-           continue
-       }
-
-       Split2matrix $alternate $m $data $sepChar $expand
-       set data ""
-    }
-    return
-}
-
-# ::csv::read2queue --
-#
-#	A wrapper around "::csv::split2queue" reading CSV formatted
-#	lines from the specified channel and adding it to the given
-#	queue.
-#
-# Arguments:
-#	q		The queue to add the read data too.
-#	chan		The channel to read from.
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A list of the values in 'line'.
-
-proc ::csv::read2queue {args} {
-    # Argument syntax:
-    #
-    #2)            chan q
-    #3)            chan q sepChar
-    #3) -alternate chan q
-    #4) -alternate chan q sepChar
-
-    set alternate 0
-    set sepChar   ,
-
-    switch -exact -- [llength $args] {
-	2 {
-	    foreach {chan q} $args break
-	}
-	3 {
-	    foreach {a b c} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set chan      $b
-		set q         $c
-	    } else {
-		set chan    $a
-		set q       $b
-		set sepChar $c
-	    }
-	}
-	4 {
-	    foreach {a b c d} $args break
-	    if {![string equal $a "-alternate"]} {
-		return -code error "wrong#args: Should be ?-alternate? chan q ?separator?"
-	    }
-	    set alternate 1
-	    set chan    $b
-	    set q       $c
-	    set sepChar $d
-	}
-	0 - 1 -
-	default {
-	    return -code error "wrong#args: Should be ?-alternate? chan q ?separator?"
-	}
-    }
-
-    set data ""
-    while {![eof $chan]} {
-	if {[gets $chan line] < 0} {continue}
-
-	# Why skip empty lines? They may be in data. Except if the
-	# buffer is empty, i.e. we are between records.
-	if {$line == {} && $data == {}} {continue}
-
-	append data $line
-	if {![iscomplete $data]} {
-	    # Odd number of quotes - must have embedded newline
-	    append data \n
-	    continue
-	}
-
-	$q put [Split $alternate $line $sepChar]
-	set data ""
-    }
-    return
-}
-
-# ::csv::report --
-#
-#	A report command which can be used by the matrix methods
-#	"format-via" and "format2chan-via". For the latter this
-#	command delegates the work to "::csv::writematrix". "cmd" is
-#	expected to be either "printmatrix" or
-#	"printmatrix2channel". The channel argument, "chan", has to
-#	be present for the latter and must not be present for the first.
-#
-# Arguments:
-#	cmd		Either 'printmatrix' or 'printmatrix2channel'
-#	matrix		The matrix to format.
-#	args		0 (chan): The channel to write to
-#
-# Results:
-#	None for 'printmatrix2channel', else the CSV formatted string.
-
-proc ::csv::report {cmd matrix args} {
-    switch -exact -- $cmd {
-	printmatrix {
-	    if {[llength $args] > 0} {
-		return -code error "wrong # args:\
-			::csv::report printmatrix matrix"
-	    }
-	    return [joinlist [$matrix get rect 0 0 end end]]
-	}
-	printmatrix2channel {
-	    if {[llength $args] != 1} {
-		return -code error "wrong # args:\
-			::csv::report printmatrix2channel matrix chan"
-	    }
-	    writematrix $matrix [lindex $args 0]
-	    return ""
-	}
-	default {
-	    return -code error "Unknown method $cmd"
-	}
-    }
-}
-
-# ::csv::split --
-#
-#	Split a string according to the rules for CSV processing.
-#	This assumes that the string contains a single line of CSVs
-#
-# Arguments:
-#	line		The string to split
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A list of the values in 'line'.
-
-proc ::csv::split {args} {
-    # Argument syntax:
-    #
-    # (1)            line
-    # (2)            line sepChar
-    # (2) -alternate line
-    # (3) -alternate line sepChar
-
-    # (3)            line sepChar delChar
-    # (4) -alternate line sepChar delChar
-
-    set alternate 0
-    set sepChar   ,
-    set delChar   \"
-
-    switch -exact -- [llength $args] {
-	1 {
-	    set line [lindex $args 0]
-	}
-	2 {
-	    foreach {a b} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set line     $b
-	    } else {
-		set line    $a
-		set sepChar $b
-	    }
-	}
-	3 {
-	    foreach {a b c} $args break
-	    if {[string equal $a "-alternate"]} {
-	        set alternate 1
-		set line    $b
-		set sepChar $c
-	    } else {
-		set line    $a
-		set sepChar $b
-		set delChar $c
-            }
-	}
-	4 {
-	    foreach {a b c d} $args break
-	    if {![string equal $a "-alternate"]} {
-		return -code error "wrong#args: Should be ?-alternate? line ?separator? ?delimiter?"
-	    }
-	    set alternate 1
-	    set line    $b
-	    set sepChar $c
-	    set delChar $d
-	}
-	0 -
-	default {
-	    return -code error "wrong#args: Should be ?-alternate? line ?separator? ?delimiter?"
-	}
-    }
-
-    if {[string length $sepChar] < 1} {
-	return -code error "illegal separator character ${delChar}$sepChar${delChar}, is empty"
-    } elseif {[string length $sepChar] > 1} {
-	return -code error "illegal separator character ${delChar}$sepChar${delChar}, is a string"
-    }
-
-    if {[string length $delChar] < 1} {
-	return -code error "illegal separator character \"$delChar\", is empty"
-    } elseif {[string length $delChar] > 1} {
-	return -code error "illegal separator character \"$delChar\", is a string"
-    }
-
-    return [Split $alternate $line $sepChar $delChar]
-}
-
-proc ::csv::Split {alternate line sepChar {delChar \"}} {
-    # Protect the sepchar from special interpretation by
-    # the regex calls below.
-
-    set sepRE \\$sepChar
-    set delRE \\$delChar
-
-    if {$alternate} {
-	# The alternate syntax requires a different parser.
-	# A variation of the string map / regsub parser for the
-	# regular syntax was tried but does not handle embedded
-	# doubled " well (testcase csv-91.3 was 'knownBug', sole
-	# one, still a bug). Now we just tokenize the input into
-	# the primary parts (sep char, "'s and the rest) and then
-	# use an explicitly coded state machine (DFA) to parse
-	# and convert token sequences.
-
-	## puts 1->>$line<<
-	set line [string map [list \
-		$sepChar \0$sepChar\0 \
-		$delChar \0${delChar}\0 \
-		] $line]
-
-	## puts 2->>$line<<
-	set line [string map [list \0\0 \0] $line]
-	regsub "^\0" $line {} line
-	regsub "\0$" $line {} line
-
-	## puts 3->>$line<<
-
-	set val ""
-	set res ""
-	set state base
-
-	## puts 4->>[::split $line \0]
-	foreach token [::split $line \0] {
-
-	    ## puts "\t*= $state\t>>$token<<"
-	    switch -exact -- $state {
-		base {
-		    if {[string equal $token "${delChar}"]} {
-			set state qvalue
-			continue
-		    }
-		    if {[string equal $token $sepChar]} {
-			lappend res $val
-			set val ""
-			continue
-		    }
-		    append val $token
-		}
-		qvalue {
-		    if {[string equal $token "${delChar}"]} {
-			# May end value, may be a doubled "
-			set state endordouble
-			continue
-		    }
-		    append val $token
-		}
-		endordouble {
-		    if {[string equal $token "${delChar}"]} {
-			# Doubled ", append to current value
-			append val ${delChar} 
-			set state qvalue
-			continue
-		    }
-		    # Last " was end of quoted value. Close it.
-		    # We expect current as $sepChar
-
-		    lappend res $val
-		    set          val ""
-		    set state base
-
-		    if {[string equal $token $sepChar]} {continue}
-
-		    # Undoubled " in middle of text. Just assume that
-		    # remainder is another qvalue.
-		    set state qvalue
-		}
-		default {
-		    return -code error "Internal error, illegal parsing state"
-		}
-	    }
-	}
-
-	## puts "/= $state\t>>$val<<"
-
-	lappend res $val
-
-	## puts 5->>$res<<
-	return $res
-    } else {
-	regsub -- "$sepRE${delRE}${delRE}$" $line $sepChar\0${delChar}${delChar}\0 line
-	regsub -- "^${delRE}${delRE}$sepRE" $line \0${delChar}${delChar}\0$sepChar line
-	regsub -all -- {(^${delChar}|${delChar}$)} $line \0 line
-
-	set line [string map [list \
-		$sepChar${delChar}${delChar}${delChar} $sepChar\0${delChar} \
-		${delChar}${delChar}${delChar}$sepChar ${delChar}\0$sepChar \
-		${delChar}${delChar}           ${delChar} \
-		${delChar}             \0 \
-		] $line]
-
-	set end 0
-	while {[regexp -indices -start $end -- {(\0)[^\0]*(\0)} $line \
-		-> start end]} {
-	    set start [lindex $start 0]
-	    set end   [lindex $end 0]
-	    set range [string range $line $start $end]
-	    if {[string first $sepChar $range] >= 0} {
-		set line [string replace $line $start $end \
-			[string map [list $sepChar \1] $range]]
-	    }
-	    incr end
-	}
-	set line [string map [list $sepChar \0 \1 $sepChar \0 {} ] $line]
-	return [::split $line \0]
-
-    }
-}
-
-# ::csv::split2matrix --
-#
-#	Split a string according to the rules for CSV processing.
-#	This assumes that the string contains a single line of CSVs.
-#	The resulting list of values is appended to the specified
-#	matrix, as a new row. The code assumes that the matrix provides
-#	the same interface as the queue provided by the 'struct'
-#	module of tcllib, "add row" in particular.
-#
-# Arguments:
-#	m		The matrix to write the resulting list to.
-#	line		The string to split
-#	sepChar		The separator character, defaults to comma
-#	expand		The expansion mode. The default is none
-#
-# Results:
-#	A list of the values in 'line', written to 'q'.
-
-proc ::csv::split2matrix {args} {
-    # FR #481023
-
-    # Argument syntax:
-    #
-    #2)            m line
-    #3)            m line sepChar
-    #3) -alternate m line
-    #4) -alternate m line sepChar
-    #4)            m line sepChar expand
-    #5) -alternate m line sepChar expand
-
-    set alternate 0
-    set sepChar   ,
-    set expand    none
-
-    switch -exact -- [llength $args] {
-	2 {
-	    foreach {m line} $args break
-	}
-	3 {
-	    foreach {a b c} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set m         $b
-		set line      $c
-	    } else {
-		set m       $a
-		set line    $b
-		set sepChar $c
-	    }
-	}
-	4 {
-	    foreach {a b c d} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set m         $b
-		set line      $c
-		set sepChar   $d
-	    } else {
-		set m       $a
-		set line    $b
-		set sepChar $c
-		set expand  $d
-	    }
-	}
-	4 {
-	    foreach {a b c d e} $args break
-	    if {![string equal $a "-alternate"]} {
-		return -code error "wrong#args: Should be ?-alternate? m line ?separator? ?expand?"
-	    }
-	    set alternate 1
-
-	    set m       $b
-	    set line    $c
-	    set sepChar $d
-	    set expand  $e
-	}
-	0 - 1 -
-	default {
-	    return -code error "wrong#args: Should be ?-alternate? m line ?separator? ?expand?"
-	}
-    }
-
-    Split2matrix $alternate $m $line $sepChar $expand
-    return
-}
-
-proc ::csv::Split2matrix {alternate m line sepChar expand} {
-    set csv [Split $alternate $line $sepChar]
-
-    # Expansion modes
-    # - none  : default, behaviour of original implementation.
-    #           no expansion is done, lines are silently truncated
-    #           to the number of columns in the matrix.
-    #
-    # - empty : A matrix without columns is expanded to the number
-    #           of columns in the first line added to it. All
-    #           following lines are handled as if "mode == none"
-    #           was set.
-    #
-    # - auto  : Full auto-mode. The matrix is expanded as needed to
-    #           hold all columns of all lines.
-
-    switch -exact -- $expand {
-	none {}
-	empty {
-	    if {[$m columns] == 0} {
-		$m add columns [llength $csv]
-	    }
-	}
-	auto {
-	    if {[$m columns] < [llength $csv]} {
-		$m add columns [expr {[llength $csv] - [$m columns]}]
-	    }
-	}
-    }
-    $m add row $csv
-    return
-}
-
-# ::csv::split2queue --
-#
-#	Split a string according to the rules for CSV processing.
-#	This assumes that the string contains a single line of CSVs.
-#	The resulting list of values is appended to the specified
-#	queue, as a single item. IOW each item in the queue represents
-#	a single CSV record. The code assumes that the queue provides
-#	the same interface as the queue provided by the 'struct'
-#	module of tcllib, "put" in particular.
-#
-# Arguments:
-#	q		The queue to write the resulting list to.
-#	line		The string to split
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	A list of the values in 'line', written to 'q'.
-
-proc ::csv::split2queue {args} {
-    # Argument syntax:
-    #
-    #2)            q line
-    #3)            q line sepChar
-    #3) -alternate q line
-    #4) -alternate q line sepChar
-
-    set alternate 0
-    set sepChar   ,
-
-    switch -exact -- [llength $args] {
-	2 {
-	    foreach {q line} $args break
-	}
-	3 {
-	    foreach {a b c} $args break
-	    if {[string equal $a "-alternate"]} {
-		set alternate 1
-		set q         $b
-		set line      $c
-	    } else {
-		set q       $a
-		set line    $b
-		set sepChar $c
-	    }
-	}
-	4 {
-	    foreach {a b c d} $args break
-	    if {![string equal $a "-alternate"]} {
-		return -code error "wrong#args: Should be ?-alternate? q line ?separator?"
-	    }
-	    set alternate 1
-
-	    set q       $b
-	    set line    $c
-	    set sepChar $d
-	}
-	0 - 1 -
-	default {
-	    return -code error "wrong#args: Should be ?-alternate? q line ?separator?"
-	}
-    }
-
-    $q put [Split $alternate $line $sepChar]
-    return
-}
-
-# ::csv::writematrix --
-#
-#	A wrapper around "::csv::join" taking the rows in a matrix and
-#	writing them as CSV formatted lines into the channel.
-#
-# Arguments:
-#	m		The matrix to take the data to write from.
-#	chan		The channel to write into.
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	None.
-
-proc ::csv::writematrix {m chan {sepChar ,} {delChar \"}} {
-    set n [$m rows]
-    for {set r 0} {$r < $n} {incr r} {
-	puts $chan [join [$m get row $r] $sepChar $delChar]
-    }
-
-    # Memory intensive alternative:
-    # puts $chan [joinlist [m get rect 0 0 end end] $sepChar $delChar]
-    return
-}
-
-# ::csv::writequeue --
-#
-#	A wrapper around "::csv::join" taking the rows in a queue and
-#	writing them as CSV formatted lines into the channel.
-#
-# Arguments:
-#	q		The queue to take the data to write from.
-#	chan		The channel to write into.
-#	sepChar		The separator character, defaults to comma
-#
-# Results:
-#	None.
-
-proc ::csv::writequeue {q chan {sepChar ,} {delChar \"}} {
-    while {[$q size] > 0} {
-	puts $chan [join [$q get] $sepChar $delChar]
-    }
-
-    # Memory intensive alternative:
-    # puts $chan [joinlist [$q get [$q size]] $sepChar $delChar]
-    return
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/csv/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/csv/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded csv 0.7 [list source [file join $dir csv.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/des/des.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/des/des.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,273 +1,0 @@
-# des.tcl - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Tcllib wrapper for the DES package. This wrapper provides the same 
-# programming API that tcllib uses for AES and Blowfish. We require a
-# DES implementation and use either TclDES or TclDESjr to get DES 
-# and/or 3DES
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.2
-
-if {[catch {package require tclDES 1.0.0}]} {
-    package require tclDESjr 1.0.0
-}
-
-namespace eval DES {
-    variable version 1.1.0
-    variable rcsid {$Id: des.tcl,v 1.14 2007/08/20 19:58:54 andreas_kupries Exp $}
-    variable uid ; if {![info exists uid]} { set uid 0 }
-}
-
-proc ::DES::Init {mode key iv {weak 0}} {
-    variable uid
-    set Key [namespace current]::[incr uid]
-    upvar #0 $Key state
-    if {[string length $key] % 8 != 0} {
-        return -code error "invalid key length of\
-             [expr {[string length $key] * 8}] bits:\
-             DES requires 64 bit keys (56 bits plus parity bits)"
-    }
-    array set state [list M $mode I $iv K [des::keyset create $key $weak]]
-    return $Key
-}
-
-proc ::DES::Encrypt {Key data} {
-    upvar #0 $Key state
-    set iv $state(I)
-    set r [des::encrypt $state(K) $data $state(M) iv]
-    set state(I) $iv
-    return $r
-}
-
-proc ::DES::Decrypt {Key data} {
-    upvar #0 $Key state
-    set iv $state(I)
-    set r [des::decrypt $state(K) $data $state(M) iv]
-    set state(I) $iv
-    return $r
-}
-
-proc ::DES::Reset {Key iv} {
-    upvar #0 $Key state
-    set state(I) $iv
-    return
-}
-
-proc ::DES::Final {Key} {
-    upvar #0 $Key state
-    des::keyset destroy $state(K)
-    # FRINK: nocheck
-    unset $Key
-}
-# -------------------------------------------------------------------------
-
-# Backwards compatability - here we re-implement the DES 0.8 procs using the
-# current implementation.
-#
-# -- DO NOT USE THESE FUNCTIONS IN NEW CODE--
-#
-proc ::DES::GetKey {mode keydata keyvarname} {
-    set weak 1
-    switch -exact -- $mode {
-        -encrypt    { set dir encrypt ; set vnc 0 }
-        -encryptVNC { set dir encrypt ; set vnc 1 }
-        -decrypt    { set dir decrypt ; set vnc 0 }
-        -decryptVNC { set dir decrypt ; set vnc 1 }
-        default {
-            return -code error "invalid mode \"$mode\":\
-                must be one of -encrypt, -decrypt, -encryptVNC or -decryptVNC"
-        }
-    }
-    if {$vnc} { set keydata [ReverseBytes $keydata] }
-    upvar $keyvarname Key
-    set Key [Init ecb $keydata [string repeat \0 8] $weak]
-    upvar $Key state
-    array set state [list dir $dir]
-    return
-}
-
-proc ::DES::DesBlock {data keyvarname} {
-    upvar $keyvarname Key
-    upvar #0 $Key state
-    if {[string equal $state(dir) "encrypt"]} {
-        set r [Encrypt $Key $data]
-    } else {
-        set r [Decrypt $Key $data]
-    }
-    return $r
-}
-
-proc ::DES::ReverseBytes {data} {
-    binary scan $data b* bin
-    return [binary format B* $bin]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::DES::SetOneOf {lst item} {
-    set ndx [lsearch -glob $lst "${item}*"]
-    if {$ndx == -1} {
-        set err [join $lst ", "]
-        return -code error "invalid mode \"$item\": must be one of $err"
-    }
-    return [lindex $lst $ndx]
-}
-
-proc ::DES::CheckSize {what size thing} {
-    if {[string length $thing] != $size} {
-        return -code error "invalid value for $what: must be $size bytes long"
-    }
-    return $thing
-}
-
-proc ::DES::Pad {data blocksize {fill \0}} {
-    set len [string length $data]
-    if {$len == 0} {
-        set data [string repeat $fill $blocksize]
-    } elseif {($len % $blocksize) != 0} {
-        set pad [expr {$blocksize - ($len % $blocksize)}]
-        append data [string repeat $fill $pad]
-    }
-    return $data
-}
-
-proc ::DES::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-proc ::DES::Hex {data} {
-    binary scan $data H* r
-    return $r 
-}
-
-proc ::DES::des {args} {
-    array set opts {
-        -dir encrypt -mode cbc -key {} -in {} -out {} -chunksize 4096 -hex 0 -weak 0 old 0
-    }
-    set blocksize 8
-    set opts(-iv) [string repeat \0 $blocksize]
-    set modes {ecb cbc cfb ofb}
-    set dirs {encrypt decrypt}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -mode      { 
-                set M [Pop args 1]
-                if {[catch {set mode [SetOneOf $modes $M]} err]} {
-                    if {[catch {SetOneOf {encode decode} $M}]} {
-                        return -code error $err
-                    } else {
-                        # someone is using the old interface, therefore ecb
-                        set mode ecb
-                        set opts(-weak) 1
-                        set opts(old) 1
-                        set opts(-dir) [expr {[string match en* $M] ? "encrypt" : "decrypt"}]
-                    }
-                }
-                set opts(-mode) $mode
-            }
-            -dir       { set opts(-dir) [SetOneOf $dirs [Pop args 1]] }
-            -iv        { set opts(-iv) [Pop args 1] }
-            -key       { set opts(-key) [Pop args 1] }
-            -in        { set opts(-in) [Pop args 1] }
-            -out       { set opts(-out) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            -weak      { set opts(-weak) 1 }
-            --         { Pop args ; break }
-            default {
-                set err [join [lsort [array names opts -*]] ", "]
-                return -code error "bad option \"$option\":\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-key) == {}} {
-        return -code error "no key provided: the -key option is required"
-    }
-
-    # pad the key if backwards compat required
-    if {$opts(old)} {
-        set pad [expr {8 - ([string length $opts(-key)] % 8)}]
-        if {$pad != 8} {
-            append opts(-key) [string repeat \0 $pad]
-        }
-    }
-
-    set r {}
-    if {$opts(-in) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong \# args:\
-                should be \"des ?options...? -key keydata plaintext\""
-        }
-
-        set data [Pad [lindex $args 0] $blocksize]
-        set Key [Init $opts(-mode) $opts(-key) $opts(-iv) $opts(-weak)]
-        if {[string equal $opts(-dir) "encrypt"]} {
-            set r [Encrypt $Key $data]
-        } else {
-            set r [Decrypt $Key $data]
-        }
-
-        if {$opts(-out) != {}} {
-            puts -nonewline $opts(-out) $r
-            set r {}
-        }
-        Final $Key
-
-    } else {
-
-        if {[llength $args] != 0} {
-            return -code error "wrong \# args:\
-                should be \"des ?options...? -key keydata -in channel\""
-        }
-
-        set Key [Init $opts(-mode) $opts(-key) $opts(-iv) $opts(-weak)]
-        upvar $Key state
-        set state(reading) 1
-        if {[string equal $opts(-dir) "encrypt"]} {
-            set state(cmd) Encrypt
-        } else {
-            set state(cmd) Decrypt
-        }
-        set state(output) ""
-        fileevent $opts(-in) readable \
-            [list [namespace origin Chunk] \
-                 $Key $opts(-in) $opts(-out) $opts(-chunksize)]
-        if {[info commands ::tkwait] != {}} {
-            tkwait variable [subst $Key](reading)
-        } else {
-            vwait [subst $Key](reading)
-        }
-        if {$opts(-out) == {}} {
-            set r $state(output)
-        }
-        Final $Key
-
-    }
-
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-package provide des $DES::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/des/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/des/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded des 1.1.0 [list source [file join $dir des.tcl]]
-package ifneeded tclDES 1.0.0 [list source [file join $dir tcldes.tcl]]
-package ifneeded tclDESjr 1.0.0 [list source [file join $dir tcldesjr.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/des/tcldes.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/des/tcldes.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1089 +1,0 @@
-# des.tcl
-# $Revision: 1.1 $
-# $Date: 2005/09/26 09:16:59 $
-#
-# Port of Javascript implementation to Tcl 8.4 by Mac A. Cody,
-# October, 2002 - February, 2003
-# August, 2003 - Separated key set generation from encryption/decryption.
-#                Renamed "des" procedure to "block" to differentiate from the
-#                "stream" procedure used for CFB and OFB modes.
-#                Modified the "encrypt" and "decrypt" procedures to support
-#                CFB and OFB modes. Changed the procedure arguments.
-#                Added the "stream" procedure to support CFB and OFB modes.
-# June, 2004 - Corrected input vector bug in stream-mode processing.  Added
-#              support for feedback vector storage and management function.
-#              This enables a stream of data to be processed over several calls
-#              to the encryptor or decryptor.
-# September, 2004 - Added feedback vector to the CBC mode of operation to allow
-#                   a large data set to be processed over several calls to the
-#                   encryptor or decryptor.
-# October, 2004 - Added test for weak keys in the createKeys procedure.
-#
-# Paul Tero, July 2001
-# http://www.shopable.co.uk/des.html
-#
-# Optimised for performance with large blocks by Michael Hayworth,
-# November 2001, http://www.netdealing.com
-#
-# This software is copyrighted (c) 2003, 2004 by Mac A. Cody.  All rights
-# reserved.  The following terms apply to all files associated with
-# the software unless explicitly disclaimed in individual files or
-# directories.
-
-# The authors hereby grant permission to use, copy, modify, distribute,
-# and license this software for any purpose, provided that existing
-# copyright notices are retained in all copies and that this notice is
-# included verbatim in any distributions. No written agreement, license,
-# or royalty fee is required for any of the authorized uses.
-# Modifications to this software may be copyrighted by their authors and
-# need not follow the licensing terms described here, provided that the
-# new terms are clearly indicated on the first page of each file where
-# they apply.
-
-# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-# MODIFICATIONS.
-
-# GOVERNMENT USE: If you are acquiring this software on behalf of the
-# U.S. government, the Government shall have only "Restricted Rights"
-# in the software and related documentation as defined in the Federal 
-# Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
-# are acquiring the software on behalf of the Department of Defense, the
-# software shall be classified as "Commercial Computer Software" and the
-# Government shall have only "Restricted Rights" as defined in Clause
-# 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
-# authors grant the U.S. Government and others acting in its behalf
-# permission to use and distribute the software in accordance with the
-# terms specified in this license. 
-namespace eval des {
-    variable keysets
-    variable WeakKeysError
-    if {![info exists WeakKeysError]} { set WeakKeysError 1 }
-    set keysets(ndx) 1
-    # Produre: keyset - Create or destroy a keyset created from a 64-bit
-    #                   DES key or a 192-bit 3DES key.
-    # Inputs:
-    #   oper  : The operation to be performed.  This will be either "create"
-    #           (make a new keyset) or "destroy" (delete an existing keyset).
-    #           The meaning of the argument "value" depends of the operation
-    #           performed.  An error is generated if "oper" is not "create"
-    #           or "destroy".
-    #             
-    #   value : If the argument "oper" is "create", then "value" is the 64-bit
-    #           DES key or the 192-bit 3DES key.  (Note: The lsb of each byte
-    #           is ignored; odd parity is not required).  If the argument
-    #           "oper" is "destroy", then "value" is a handle to a keyset that
-    #           was created previously.
-    #
-    #   weak:   If true then weak keys are allowed. The default is to raise an
-    #           error when a weak key is seen.
-    # Output:
-    #   If the argument "oper" is "create", then the output is a handle to the
-    #   keyset stored in the des namespace.  If the argument "oper" is
-    #   "destroy", then nothing is returned.
-    proc keyset {oper value {weak 0}} {
-	variable keysets
-	set newset {}
-	switch -exact -- $oper {
-	    create {
-		# Create a new keyset handle.
-		set newset keyset$keysets(ndx)
-		# Create key set
-		set keysets($newset) [createKeys $value $weak]
-		# Never use that keyset handle index again.
-		incr keysets(ndx)
-	    }
-	    destroy {
-		# Determine if the keyset handle is valid.
-		if {[array names keysets $value] != {}} {
-		    # Delete the handle and corresponding keyset.
-                    unset keysets($value)
-		} else {
-		    error "The keyset handle \"$value\" is invalid!"
-		}
-	    }
-	    default {
-		error {The operator must be either "create" or "destroy".}
-	    }
-	}
-	return $newset
-    }
-
-    # Procedure: encrypt - Encryption front-end for the des procedure
-    # Inputs:
-    #   keyset  : Handle to an existing keyset.
-    #   message : String to be encrypted.
-    #   mode    : DES mode ecb (default), cbc, cfb, or ofb.
-    #   iv      : Name of the initialization vector used in CBC, CFB,
-    #             and OFB modes.
-    #   kbits   : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted data string.
-    proc encrypt {keyset message {mode ecb} {iv {}} {kbits 64}} {
-	switch -exact -- $mode {
-	    ecb {
-		return [block $keyset $message 1 0]
-	    }
-	    cbc -
-	    ofb -
-	    cfb {
-		# Is the initialization/feedback vector variable is valid?
-		if {[string length $iv] == 0} {
-		    error "An initialization variable must be specified."
-		} else {
-		    upvar $iv ivec
-		    if {![info exists ivec]} {
-			error "The variable $iv does not exist."
-		    }
-		}
-		switch -exact -- $mode {
-		    cbc {
-			return [block $keyset $message 1 1 ivec]
-		    }
-		    ofb {
-			return [stream $keyset $message 1 0 ivec $kbits]
-		    }
-		    cfb {
-			return [stream $keyset $message 1 1 ivec $kbits]
-		    }
-		}
-	    }
-	    default {
-		error {Mode must be ecb, cbc, cfb, or ofb.}
-	    }
-	}
-    }
-
-    # Procedure: decrypt - Decryption front-end for the des procedure
-    # Inputs:
-    #   keyset  : Handle to an existing keyset.
-    #   message : String to be decrypted.
-    #   mode    : DES mode ecb (default), cbc, cfb, or ofb.
-    #   iv      : Name of the initialization vector used in CBC, CFB,
-    #             and OFB modes.
-    #   kbits   : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc decrypt {keyset message {mode ecb} {iv {}} {kbits 64}} {
-	switch -exact -- $mode {
-	    ecb {
-		return [block $keyset $message 0 0]
-	    }
-	    cbc -
-	    ofb -
-	    cfb {
-		# Is the initialization/feedback vector variable is valid?
-		if {[string length $iv] < 1} {
-		    error "An initialization variable must be specified."
-		} else {
-		    upvar $iv ivec
-		    if {![info exists ivec]} {
-			error "The variable $iv does not exist."
-		    }
-		}
-		switch -exact -- $mode {
-		    cbc {
-			return [block $keyset $message 0 1 ivec]
-		    }
-		    ofb {
-			return [stream $keyset $message 0 0 ivec $kbits]
-		    }
-		    cfb {
-			return [stream $keyset $message 0 1 ivec $kbits]
-		    }
-		}
-	    }
-	    default {
-		error {Mode must be ecb, cbc, cfb, or ofb.}
-	    }
-	}
-    }
-
-    variable spfunction1 [list 0x1010400 0 0x10000 0x1010404 0x1010004 0x10404 0x4 0x10000 0x400 0x1010400 0x1010404 0x400 0x1000404 0x1010004 0x1000000 0x4 0x404 0x1000400 0x1000400 0x10400 0x10400 0x1010000 0x1010000 0x1000404 0x10004 0x1000004 0x1000004 0x10004 0 0x404 0x10404 0x1000000 0x10000 0x1010404 0x4 0x1010000 0x1010400 0x1000000 0x1000000 0x400 0x1010004 0x10000 0x10400 0x1000004 0x400 0x4 0x1000404 0x10404 0x1010404 0x10004 0x1010000 0x1000404 0x1000004 0x404 0x10404 0x1010400 0x404 0x1000400 0x1000400 0 0x10004 0x10400 0 0x1010004];
-    variable spfunction2 [list 0x80108020 0x80008000 0x8000 0x108020 0x100000 0x20 0x80100020 0x80008020 0x80000020 0x80108020 0x80108000 0x80000000 0x80008000 0x100000 0x20 0x80100020 0x108000 0x100020 0x80008020 0 0x80000000 0x8000 0x108020 0x80100000 0x100020 0x80000020 0 0x108000 0x8020 0x80108000 0x80100000 0x8020 0 0x108020 0x80100020 0x100000 0x80008020 0x80100000 0x80108000 0x8000 0x80100000 0x80008000 0x20 0x80108020 0x108020 0x20 0x8000 0x80000000 0x8020 0x80108000 0x100000 0x80000020 0x100020 0x80008020 0x80000020 0x100020 0x108000 0 0x80008000 0x8020 0x80000000 0x80100020 0x80108020 0x108000];
-    variable spfunction3 [list 0x208 0x8020200 0 0x8020008 0x8000200 0 0x20208 0x8000200 0x20008 0x8000008 0x8000008 0x20000 0x8020208 0x20008 0x8020000 0x208 0x8000000 0x8 0x8020200 0x200 0x20200 0x8020000 0x8020008 0x20208 0x8000208 0x20200 0x20000 0x8000208 0x8 0x8020208 0x200 0x8000000 0x8020200 0x8000000 0x20008 0x208 0x20000 0x8020200 0x8000200 0 0x200 0x20008 0x8020208 0x8000200 0x8000008 0x200 0 0x8020008 0x8000208 0x20000 0x8000000 0x8020208 0x8 0x20208 0x20200 0x8000008 0x8020000 0x8000208 0x208 0x8020000 0x20208 0x8 0x8020008 0x20200];
-    variable spfunction4 [list 0x802001 0x2081 0x2081 0x80 0x802080 0x800081 0x800001 0x2001 0 0x802000 0x802000 0x802081 0x81 0 0x800080 0x800001 0x1 0x2000 0x800000 0x802001 0x80 0x800000 0x2001 0x2080 0x800081 0x1 0x2080 0x800080 0x2000 0x802080 0x802081 0x81 0x800080 0x800001 0x802000 0x802081 0x81 0 0 0x802000 0x2080 0x800080 0x800081 0x1 0x802001 0x2081 0x2081 0x80 0x802081 0x81 0x1 0x2000 0x800001 0x2001 0x802080 0x800081 0x2001 0x2080 0x800000 0x802001 0x80 0x800000 0x2000 0x802080];
-    variable spfunction5 [list 0x100 0x2080100 0x2080000 0x42000100 0x80000 0x100 0x40000000 0x2080000 0x40080100 0x80000 0x2000100 0x40080100 0x42000100 0x42080000 0x80100 0x40000000 0x2000000 0x40080000 0x40080000 0 0x40000100 0x42080100 0x42080100 0x2000100 0x42080000 0x40000100 0 0x42000000 0x2080100 0x2000000 0x42000000 0x80100 0x80000 0x42000100 0x100 0x2000000 0x40000000 0x2080000 0x42000100 0x40080100 0x2000100 0x40000000 0x42080000 0x2080100 0x40080100 0x100 0x2000000 0x42080000 0x42080100 0x80100 0x42000000 0x42080100 0x2080000 0 0x40080000 0x42000000 0x80100 0x2000100 0x40000100 0x80000 0 0x40080000 0x2080100 0x40000100];
-    variable spfunction6 [list 0x20000010 0x20400000 0x4000 0x20404010 0x20400000 0x10 0x20404010 0x400000 0x20004000 0x404010 0x400000 0x20000010 0x400010 0x20004000 0x20000000 0x4010 0 0x400010 0x20004010 0x4000 0x404000 0x20004010 0x10 0x20400010 0x20400010 0 0x404010 0x20404000 0x4010 0x404000 0x20404000 0x20000000 0x20004000 0x10 0x20400010 0x404000 0x20404010 0x400000 0x4010 0x20000010 0x400000 0x20004000 0x20000000 0x4010 0x20000010 0x20404010 0x404000 0x20400000 0x404010 0x20404000 0 0x20400010 0x10 0x4000 0x20400000 0x404010 0x4000 0x400010 0x20004010 0 0x20404000 0x20000000 0x400010 0x20004010];
-    variable spfunction7 [list 0x200000 0x4200002 0x4000802 0 0x800 0x4000802 0x200802 0x4200800 0x4200802 0x200000 0 0x4000002 0x2 0x4000000 0x4200002 0x802 0x4000800 0x200802 0x200002 0x4000800 0x4000002 0x4200000 0x4200800 0x200002 0x4200000 0x800 0x802 0x4200802 0x200800 0x2 0x4000000 0x200800 0x4000000 0x200800 0x200000 0x4000802 0x4000802 0x4200002 0x4200002 0x2 0x200002 0x4000000 0x4000800 0x200000 0x4200800 0x802 0x200802 0x4200800 0x802 0x4000002 0x4200802 0x4200000 0x200800 0 0x2 0x4200802 0 0x200802 0x4200000 0x800 0x4000002 0x4000800 0x800 0x200002];
-    variable spfunction8 [list 0x10001040 0x1000 0x40000 0x10041040 0x10000000 0x10001040 0x40 0x10000000 0x40040 0x10040000 0x10041040 0x41000 0x10041000 0x41040 0x1000 0x40 0x10040000 0x10000040 0x10001000 0x1040 0x41000 0x40040 0x10040040 0x10041000 0x1040 0 0 0x10040040 0x10000040 0x10001000 0x41040 0x40000 0x41040 0x40000 0x10041000 0x1000 0x40 0x10040040 0x1000 0x41040 0x10001000 0x40 0x10000040 0x10040000 0x10040040 0x10000000 0x40000 0x10001040 0 0x10041040 0x40040 0x10000040 0x10040000 0x10001000 0x10001040 0 0x10041040 0x41000 0x41000 0x1040 0x1040 0x40040 0x10000000 0x10041000];
-
-    variable desEncrypt {0 32 2}
-    variable desDecrypt {30 -2 -2}
-    variable des3Encrypt {0 32 2 62 30 -2 64 96 2}
-    variable des3Decrypt {94 62 -2 32 64 2 30 -2 -2}
-
-    # Procedure: block - DES ECB and CBC mode support
-    # Inputs:
-    #   keyset   : Handle to an existing keyset.
-    #   message  : String to be encrypted or decrypted (Note: For encryption,
-    #              the string is extended with null characters to an integral
-    #              multiple of eight bytes.  For decryption, the string length
-    #              must be an integral multiple of eight bytes.
-    #   encrypt  : Perform encryption (1) or decryption (0)
-    #   mode     : DES mode 1=CBC, 0=ECB (default).
-    #   iv       : Name of the variable containing the initialization vector
-    #              used in CBC mode.  The value must be 64 bits in length.
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc block {keyset message encrypt {mode 0} {iv {}}} {
-	variable spfunction1
-	variable spfunction2
-	variable spfunction3
-	variable spfunction4
-	variable spfunction5
-	variable spfunction6
-	variable spfunction7
-	variable spfunction8
-	variable desEncrypt
-	variable desDecrypt
-	variable des3Encrypt
-	variable des3Decrypt
-	variable keysets
-
-	# Determine if the keyset handle is valid.
-	if {[array names keysets $keyset] != {}} {
-	    # Acquire the 16 or 48 subkeys we will need
-	    set keys $keysets($keyset)
-	} else {
-	    error "The keyset handle \"$keyset\" is invalid!"
-	}
-	set m 0
-	set cbcleft 0x00; set cbcleft2 0x00
-	set cbcright 0x00; set cbcright2 0x00
-	set len [string length $message];
-        if {$len == 0} {
-            return -code error "invalid message size: the message may not be empty"
-        }
-	set chunk 0;
-	# Set up the loops for single and triple des
-	set iterations [expr {[llength $keys] == 32 ? 3 : 9}];
-	if {$iterations == 3} {
-	    expr {$encrypt ? [set looping $desEncrypt] : \
-		      [set looping $desDecrypt]}
-	} else {
-	    expr {$encrypt ? [set looping $des3Encrypt] : \
-		      [set looping $des3Decrypt]}
-	}
-
-	# Pad the message out with null bytes.
-	append message "\0\0\0\0\0\0\0\0"
-
-	# Store the result here
-	set result {};
-	set tempresult {};
-
-	# CBC mode
-	if {$mode == 1} {
-	    # Is the initialization/feedback vector variable is valid?
-	    if {[string length $iv] < 1} {
-		error "An initialization variable must be specified."
-	    } else {
-		upvar $iv ivec
-		if {![info exists ivec]} {
-		    error "The variable $iv does not exist."
-		}
-                if {[string length $ivec] != 8} {
-                    return -code error "invalid initialization vector size:\
-                        the initialization vector must be 8 bytes"
-                }
-	    }
-	    # Use the input vector as the intial vector.
-	    binary scan $ivec H8H8 cbcleftTemp cbcrightTemp
-	    set cbcleft "0x$cbcleftTemp"
-	    set cbcright "0x$cbcrightTemp"
-	}
-
-	# Loop through each 64 bit chunk of the message
-	while {$m < $len} {
-	    binary scan $message x${m}H8H8 lefttemp righttemp
-	    set left {}
-	    append left "0x" $lefttemp
-	    set right {}
-	    append right "0x" $righttemp
-	    incr m 8
-
-	    #puts "Left start: $left";
-	    #puts "Right start: $right";
-	    # For Cipher Block Chaining mode, xor the
-	    # message with the previous result.
-	    if {$mode == 1} {
-		if {$encrypt} {
-		    set left [expr {$left ^ $cbcleft}]
-		    set right [expr {$right ^ $cbcright}]
-		} else {
-		    set cbcleft2 $cbcleft;
-		    set cbcright2 $cbcright;
-		    set cbcleft $left;
-		    set cbcright $right;
-		}
-	    }
-
-	    #puts "Left mode: $left";
-	    #puts "Right mode: $right";
-	    #puts "cbcleft: $cbcleft";
-	    #puts "cbcleft2: $cbcleft2";
-	    #puts "cbcright: $cbcright";
-	    #puts "cbcright2: $cbcright2";
-
-	    # First each 64 but chunk of the message
-	    # must be permuted according to IP.
-	    set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-	    set temp [expr {(($left >> 16) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {(($right >> 2) ^ $left) & 0x33333333}];
-	    set left [expr {$left ^ $temp}]
-	    set right [expr {$right ^ ($temp << 2)}];
-
-	    set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-
-	    set left [expr {((($left << 1) & 0xffffffff) | \
-				 (($left >> 31) & 0x00000001))}]; 
-	    set right [expr {((($right << 1) & 0xffffffff) | \
-				  (($right >> 31) & 0x00000001))}]; 
-
-	    #puts "Left IP: [format %x $left]";
-	    #puts "Right IP: [format %x $right]";
-
-	    # Do this either 1 or 3 times for each chunk of the message
-	    for {set j 0} {$j < $iterations} {incr j 3} {
-		set endloop [lindex $looping [expr {$j + 1}]];
-		set loopinc [lindex $looping [expr {$j + 2}]];
-
-		#puts "endloop: $endloop";
-		#puts "loopinc: $loopinc";
-
-		# Now go through and perform the encryption or decryption  
-		for {set i [lindex $looping $j]} \
-		    {$i != $endloop} {incr i $loopinc} {
-		    # For efficiency
-		    set right1 [expr {$right ^ [lindex $keys $i]}]; 
-		    set right2 [expr {((($right >> 4) & 0x0fffffff) | \
-					   (($right << 28) & 0xffffffff)) ^ \
-					  [lindex $keys [expr {$i + 1}]]}];
- 
-		    # puts "right1: [format %x $right1]";
-		    # puts "right2: [format %x $right2]";
-
-		    # The result is attained by passing these
-		    # bytes through the S selection functions.
-		    set temp $left;
-		    set left $right;
-		    set right [expr {$temp ^ ([lindex $spfunction2 [expr {($right1 >> 24) & 0x3f}]] | \
-                                                  [lindex $spfunction4 [expr {($right1 >> 16) & 0x3f}]] | \
-                                                  [lindex $spfunction6 [expr {($right1 >>  8) & 0x3f}]] | \
-                                                  [lindex $spfunction8 [expr {$right1 & 0x3f}]] | \
-                                                  [lindex $spfunction1 [expr {($right2 >> 24) & 0x3f}]] | \
-                                                  [lindex $spfunction3 [expr {($right2 >> 16) & 0x3f}]] | \
-                                                  [lindex $spfunction5 [expr {($right2 >>  8) & 0x3f}]] | \
-						  [lindex $spfunction7 [expr {$right2 & 0x3f}]])}];
- 
-		    # puts "Left iter: [format %x $left]";
-		    # puts "Right iter: [format %x $right]";
-
-		}
-		set temp $left;
-		set left $right;
-		set right $temp; # Unreverse left and right
-	    }; # For either 1 or 3 iterations
-
-	    #puts "Left Iterated: [format %x $left]";
-	    #puts "Right Iterated: [format %x $right]";
-
-	    # Move then each one bit to the right
-	    set left [expr {((($left >> 1) & 0x7fffffff) \
-				 | (($left << 31) & 0xffffffff))}]; 
-	    set right [expr {((($right >> 1) & 0x7fffffff) \
-				  | (($right << 31) & 0xffffffff))}]; 
-
-	    #puts "Left shifted: [format %x $left]";
-	    #puts "Right shifted: [format %x $right]";
-
-	    # Now perform IP-1, which is IP in the opposite direction
-	    set temp [expr {((($left >> 1) & 0x7fffffff) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-	    set temp [expr {((($right >> 8) & 0x00ffffff) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {((($right >> 2) & 0x3fffffff) ^ $left) & 0x33333333}]; 
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-	    set temp [expr {((($left >> 16) & 0x0000ffff) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {((($left >> 4) & 0x0fffffff) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-
-	    #puts "Left IP-1: [format %x $left]";
-	    #puts "Right IP-1: [format %x $right]";
-
-	    # For Cipher Block Chaining mode, xor
-	    # the message with the previous result.
-	    if {$mode == 1} {
-		if {$encrypt} {
-		    set cbcleft $left;
-		    set cbcright $right;
-		} else {
-		    set left [expr {$left ^ $cbcleft2}];
-		    set right [expr {$right ^ $cbcright2}];
-		}
-	    }
-
-	    append tempresult \
-		[binary format H16 [format %08x%08x $left $right]]
-
-	    #puts "Left final: [format %x $left]";
-	    #puts "Right final: [format %x $right]";
-
-	    incr chunk 8;
-	    if {$chunk == 512} {
-		append result $tempresult
-		set tempresult {};
-		set chunk 0;
-	    }
-	}; # For every 8 characters, or 64 bits in the message
-
-	if {$mode == 1} {
-	    if {$encrypt} {
-		# Save the left and right registers to the feedback vector.
-		set ivec [binary format H* \
-			      [format %08x $left][format %08x $right]]
-	    } else {
-		set ivec [binary format H* \
-			      [format %08x $cbcleft][format %08x $cbcright]]
-	    }
-	}
-
-	# Return the result as an array
-	return ${result}$tempresult
-    }; # End of block
-
-    # Procedure: stream - DES CFB and OFB mode support
-    # Inputs:
-    #   keyset   : Handle to an existing keyset.
-    #   message  : String to be encrypted or decrypted (Note: The length of the
-    #              string is dependent upon the value of kbits.  Remember that
-    #              the string is part of a stream of data, so it must be sized
-    #              properly for subsequent encryptions/decryptions to be
-    #              correct.  See the man page for correct message lengths for
-    #              values of kbits).
-    #   encrypt  : Perform encryption (1) or decryption (0)
-    #   mode     : DES mode 0=OFB, 1=CFB.
-    #   iv       : Name of variable containing the initialization vector.  The
-    #              value must be 64 bits in length with the first 64-L bits set
-    #              to zero.
-    #   kbits    : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc stream {keyset message encrypt mode iv {kbits 64}} {
-	variable spfunction1
-	variable spfunction2
-	variable spfunction3
-	variable spfunction4
-	variable spfunction5
-	variable spfunction6
-	variable spfunction7
-	variable spfunction8
-	variable desEncrypt
-	variable des3Encrypt
-	variable keysets
-
-	# Determine if the keyset handle is valid.
-	if {[array names keysets $keyset] != {}} {
-	    # Acquire the 16 or 48 subkeys we will need.
-	    set keys $keysets($keyset)
-	} else {
-	    error "The keyset handle \"$keyset\" is invalid!"
-	}
-
-	# Is the initialization/feedback vector variable is valid?
-	if {[string length $iv] < 1} {
-	    error "An initialization variable must be specified."
-	} else {
-	    upvar $iv ivec
-	    if {![info exists ivec]} {
-		error "The variable $iv does not exist."
-	    }
-	}
-
-        # Determine if message length (in bits)
-	# is not an integral number of kbits.
-	set len [string length $message];
-        #puts "len: $len, kbits: $kbits"
-	if {($kbits < 1) || ($kbits > 64)} {
-	    error "The valid values of kbits are 1 through 64."
-        } elseif {($kbits % 8) != 0} {
-	    set blockSize [expr {$kbits + (8 - ($kbits % 8))}]
-	    set fail [expr {(($len * 8) / $blockSize) % $kbits}]
-	} else {
-	    set blockSize [expr {$kbits / 8}]
-	    set fail [expr {$len % $blockSize}]
-	}
-        if {$fail} {
-	    error "Data length (in bits) is not an integral number of kbits."
-	}
-
-	set m 0
-	set n 0
-	set chunk 0;
-	# Set up the loops for single and triple des
-	set iterations [expr {[llength $keys] == 32 ? 3 : 9}];
-	if {$iterations == 3} {
-	    set looping $desEncrypt
-	} else {
-	    set looping $des3Encrypt
-	}
-
-        # Set up shifting values.  Used for both CFB and OFB modes.
-        if {$kbits < 32} {
-	    # Only some bits from left output are needed.
-	    set kOutShift [expr {32 - $kbits}]
-	    set kOutMask [expr {0x7fffffff >> (31 - $kbits)}]
-	    # Determine number of message bytes needed per iteration.
-	    set msgBytes [expr {int(ceil(double($kbits) / 8.0))}]
-	    # Determine number of message bits needed per iteration.
-	    set msgBits [expr {$msgBytes * 8}]
-	    set msgBitsSub1 [expr {$msgBits - 1}]
-	    # Define bit caches.
-	    set bitCacheIn {}
-	    set bitCacheOut {}
-	    # Variable used to remove bits 0 through
-	    # kbits-1 in the input bit cache.
-	    set kbitsSub1 [expr {$kbits - 1}]
-	    # Variable used to remove leading dummy binary bits.
-	    set xbits [expr {32 - $kbits}]
-	} elseif {$kbits == 32} {
-	    # Only bits of left output are used.
-	    # Four messages bytes are needed per iteration.
-	    set msgBytes 4
-	    set xbits 32
-	} elseif {$kbits < 64} {
-	    # All bits from left output are needed.
-	    set kOutShiftLeft [expr {$kbits - 32}]
-	    # Some bits from right output are needed.
-	    set kOutShiftRight [expr {64 - $kbits}]
-	    set kOutMaskRight [expr {0x7fffffff >> (63 - $kbits)}]
-	    # Determine number of message bytes needed per iteration.
-	    set msgBytes [expr {int(ceil(double($kbits) / 8.0))}]
-	    # Determine number of message bits needed per iteration.
-	    set msgBits [expr {$msgBytes * 8}]
-	    set msgBitsSub1 [expr {$msgBits - 1}]
-	    # Define bit caches.
-	    set bitCacheIn {}
-	    set bitCacheOut {}
-	    # Variable used to remove bits 0 through
-	    # kbits-1 in the input bit cache.
-	    set kbitsSub1 [expr {$kbits - 1}]
-	    # Variable used to remove leading dummy binary bits.
-	    set xbits [expr {64 - $kbits}]
-	} else {
-	    # All 64 bits of output are used.
-	    # Eight messages bytes are needed per iteration.
-	    set msgBytes 8
-	    set xbits 0
-	}
-
-	# Store the result here
-	set result {}
-	set tempresult {}
-
-	# Set up the initialization vector bitstream
-	binary scan $ivec H8H8 leftTemp rightTemp
-	set left "0x$leftTemp"
-	set right "0x$rightTemp"
-        #puts "Retrieved Feedback vector: $fbvec"
-        #puts "Start: |$left| |$right|"
-	
-	# Loop through each 64 bit chunk of the message
-	while {$m < $len} {
-	    # puts "Left start: $left";
-	    # puts "Right start: $right";
-
-	    # First each 64 but chunk of the
-	    # message must be permuted according to IP.
-	    set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-	    set temp [expr {(($left >> 16) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {(($right >> 2) ^ $left) & 0x33333333}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-
-	    set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-
-	    set left [expr {((($left << 1) & 0xffffffff) | \
-				 (($left >> 31) & 0x00000001))}]; 
-	    set right [expr {((($right << 1) & 0xffffffff) | \
-				  (($right >> 31) & 0x00000001))}]; 
-
-	    #puts "Left IP: [format %x $left]";
-	    #puts "Right IP: [format %x $right]";
-
-	    # Do this either 1 or 3 times for each chunk of the message
-	    for {set j 0} {$j < $iterations} {incr j 3} {
-		set endloop [lindex $looping [expr {$j + 1}]];
-		set loopinc [lindex $looping [expr {$j + 2}]];
-
-		#puts "endloop: $endloop";
-		#puts "loopinc: $loopinc";
-
-		# Now go through and perform the encryption or decryption  
-		for {set i [lindex $looping $j]} \
-		    {$i != $endloop} {incr i $loopinc} {
-		    # For efficiency
-		    set right1 [expr {$right ^ [lindex $keys $i]}]; 
-		    set right2 [expr {((($right >> 4) & 0x0fffffff) | \
-					   (($right << 28) & 0xffffffff)) ^ \
-					  [lindex $keys [expr {$i + 1}]]}];
- 
-		    # puts "right1: [format %x $right1]";
-		    # puts "right2: [format %x $right2]";
-
-		    # The result is attained by passing these
-		    # bytes through the S selection functions.
-		    set temp $left;
-		    set left $right;
-		    set right [expr {$temp ^ ([lindex $spfunction2 [expr {($right1 >> 24) & 0x3f}]] | \
-						  [lindex $spfunction4 [expr {($right1 >> 16) & 0x3f}]] | \
-						  [lindex $spfunction6 [expr {($right1 >>  8) & 0x3f}]] | \
-						  [lindex $spfunction8 [expr {$right1 & 0x3f}]] | \
-						  [lindex $spfunction1 [expr {($right2 >> 24) & 0x3f}]] | \
-						  [lindex $spfunction3 [expr {($right2 >> 16) & 0x3f}]] | \
-						  [lindex $spfunction5 [expr {($right2 >>  8) & 0x3f}]] | \
-						  [lindex $spfunction7 [expr {$right2 & 0x3f}]])}];
- 
-		    # puts "Left iter: [format %x $left]";
-		    # puts "Right iter: [format %x $right]";
-
-		}
-		set temp $left;
-		set left $right;
-		set right $temp; # Unreverse left and right
-	    }; # For either 1 or 3 iterations
-
-	    #puts "Left Iterated: [format %x $left]";
-	    #puts "Right Iterated: [format %x $right]";
-
-	    # Move then each one bit to the right
-	    set left [expr {((($left >> 1) & 0x7fffffff) | \
-				 (($left << 31) & 0xffffffff))}]; 
-	    set right [expr {((($right >> 1) & 0x7fffffff) | \
-				  (($right << 31) & 0xffffffff))}]; 
-
-	    #puts "Left shifted: [format %x $left]";
-	    #puts "Right shifted: [format %x $right]";
-
-	    # Now perform IP-1, which is IP in the opposite direction
-	    set temp [expr {((($left >> 1) & 0x7fffffff) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-	    set temp [expr {((($right >> 8) & 0x00ffffff) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {((($right >> 2) & 0x3fffffff) ^ $left) & 0x33333333}]; 
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-	    set temp [expr {((($left >> 16) & 0x0000ffff) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {((($left >> 4) & 0x0fffffff) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-
-	    #puts "Left IP-1: [format %x $left]";
-	    #puts "Right IP-1: [format %x $right]";
-
-	    # Extract the "kbits" most significant bits from the output block.
-	    if {$kbits < 32} {
-		# Only some bits from left output are needed.
-		set kData [expr {($left >> $kOutShift) & $kOutMask}]
-		set newBits {}
-		# If necessary, copy message bytes into input bit cache.
-		if {([string length $bitCacheIn] < $kbits) && ($n < $len)} {
-		    if {$len - $n < $msgBytes} {
-			set lastBits [expr {($len - $n) * 8}]
-			###puts -nonewline [binary scan $message x${n}B$lastBits newBits]
-			binary scan $message x${n}B$lastBits newBits
-		    } else {
-			# Extract "msgBytes" whole bytes as bits
-			###puts -nonewline [binary scan $message x${n}B$msgBits newBits]
-			binary scan $message x${n}B$msgBits newBits
-		    }
-		    incr n $msgBytes
-		    #puts " $newBits  $n [expr {$len - $n}]"
-		    # Add the bits to the input bit cache.
-		    append bitCacheIn $newBits
-		}
-		#puts -nonewline "In bit cache: $bitCacheIn"
-		# Set up message data from input bit cache.
-		binary scan [binary format B32 [format %032s [string range $bitCacheIn 0 $kbitsSub1]]] H8 temp
-		set msgData "0x$temp"
-		# Mix message bits with crypto bits.
-		set mixData [expr {$msgData ^ $kData}]
-		# Discard collected bits from the input bit cache.
-		set bitCacheIn [string range $bitCacheIn $kbits end]
-		#puts "  After: $bitCacheIn"
-		# Convert back to a bit stream and append to the output bit cache.
-		# Only the lower kbits are wanted.
-		binary scan [binary format H8 [format %08x $mixData]] B32 msgOut
-		append bitCacheOut [string range $msgOut $xbits end]
-		#puts -nonewline "Out bit cache: $bitCacheOut"
-		# If there are sufficient bits, move bytes to the temporary holding string.
-		if {[string length $bitCacheOut] >= $msgBits} {
-		    append tempresult [binary format B$msgBits [string range $bitCacheOut 0 $msgBitsSub1]]
-		    set bitCacheOut [string range $bitCacheOut $msgBits end]
-                    #puts -nonewline "  After: $bitCacheOut"
-		    incr m $msgBytes
-		    ###puts "$m bytes output"
-		    incr chunk $msgBytes
-		}
-		#puts ""
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set temp [expr {($right << $kbits) & 0xffffffff}]
-			set left [expr {(($left << $kbits) & 0xffffffff) | (($right >> $kOutShift) & $kOutMask)}]
-			set right [expr {$temp | $mixData}]
-		    } else {
-			set temp [expr {($right << $kbits) & 0xffffffff}]
-			set left [expr {(($left << $kbits) & 0xffffffff) | (($right >> $kOutShift) & $kOutMask)}]
-			set right [expr {$temp | $msgData}]
-		    }
-		}
-	    } elseif {$kbits == 32} {
-		# Only bits of left output are used.
-		set kData $left
-		# Four messages bytes are needed per iteration.
-		binary scan $message x${m}H8 temp
-		incr m 4
-		incr chunk 4
-		set msgData "0x$temp"
-		# Mix message bits with crypto bits.
-		set mixData [expr {$msgData ^ $kData}]
-		# Move bytes to the temporary holding string.
-		append tempresult [binary format H8 [format %08x $mixData]]
-		# For CFB mode
-		if {$mode == 1} {
-		    set left $right
-		    if {$encrypt} {
-			set right $mixData
-		    } else {
-			set right $msgData
-		    }
-		}
-	    } elseif {$kbits < 64} {
-		set kDataLeft [expr {($left >> $kOutShiftRight) & $kOutMaskRight}]
-		set temp [expr {($left << $kOutShiftLeft) & 0xffffffff}]
-		set kDataRight [expr {(($right >> $kOutShiftRight) & $kOutMaskRight) | $temp}]
-		# If necessary, copy message bytes into input bit cache.
-		if {([string length $bitCacheIn] < $kbits)  && ($n < $len)} {
-		    if {$len - $n < $msgBytes} {
-			set lastBits [expr {($len - $n) * 8}]
-			###puts -nonewline [binary scan $message x${n}B$lastBits newBits]
-			binary scan $message x${n}B$lastBits newBits
-		    } else {
-			# Extract "msgBytes" whole bytes as bits
-			###puts -nonewline [binary scan $message x${n}B$msgBits newBits]
-			binary scan $message x${n}B$msgBits newBits
-		    }
-		    incr n $msgBytes
-		    # Add the bits to the input bit cache.
-		    append bitCacheIn $newBits
-		}
-		# Set up message data from input bit cache.
-		# puts "Bits from cache: [set temp [string range $bitCacheIn 0 $kbitsSub1]]"
-		# puts "Length of bit string: [string length $temp]"
-		binary scan [binary format B64 [format %064s [string range $bitCacheIn 0 $kbitsSub1]]] H8H8 leftTemp rightTemp
-		set msgDataLeft "0x$leftTemp"
-		set msgDataRight "0x$rightTemp"
-		# puts "msgDataLeft: $msgDataLeft"
-		# puts "msgDataRight: $msgDataRight"
-		# puts "kDataLeft: [format 0x%08x $kDataLeft]"
-		# puts "kDataRight: [format 0x%08x $kDataRight]"
-		# Mix message bits with crypto bits.
-		set mixDataLeft [expr {$msgDataLeft ^ $kDataLeft}]
-		set mixDataRight [expr {$msgDataRight ^ $kDataRight}]
-		# puts "mixDataLeft: $mixDataLeft"
-		# puts "mixDataRight: $mixDataRight"
-		# puts "mixDataLeft: [format 0x%08x $mixDataLeft]"
-		# puts "mixDataRight: [format 0x%08x $mixDataRight]"
-		# Discard collected bits from the input bit cache.
-		set bitCacheIn [string range $bitCacheIn $kbits end]
-		# Convert back to a bit stream and
-		# append to the output bit cache.
-		# Only the lower kbits are wanted.
-		binary scan \
-		    [binary format H8H8 \
-			 [format %08x $mixDataLeft] \
-			 [format %08x $mixDataRight]] B64 msgOut
-		append bitCacheOut [string range $msgOut $xbits end]
-		# If there are sufficient bits, move
-		# bytes to the temporary holding string.
-		if {[string length $bitCacheOut] >= $msgBits} {
-		    append tempresult \
-			[binary format B$msgBits \
-			     [string range $bitCacheOut 0 $msgBitsSub1]]
-		    set bitCacheOut [string range $bitCacheOut $msgBits end]
-		    incr m $msgBytes
-		    incr chunk $msgBytes
-		}
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set temp \
-			    [expr {($right << $kOutShiftRight) & 0xffffffff}]
-			set left [expr {$temp | $mixDataLeft}]
-			set right $mixDataRight
-		    } else {
-			set temp \
-			    [expr {($right << $kOutShiftRight) & 0xffffffff}]
-			set left [expr {$temp | $msgDataLeft}]
-			set right $msgDataRight
-		    }
-		}
-	    } else {
-		# All 64 bits of output are used.
-		set kDataLeft $left
-		set kDataRight $right
-		# Eight messages bytes are needed per iteration.
-		binary scan $message x${m}H8H8 leftTemp rightTemp
-		incr m 8
-		incr chunk 8
-		set msgDataLeft "0x$leftTemp"
-		set msgDataRight "0x$rightTemp"
-		# Mix message bits with crypto bits.
-		set mixDataLeft [expr {$msgDataLeft ^ $kDataLeft}]
-		set mixDataRight [expr {$msgDataRight ^ $kDataRight}]
-		# Move bytes to the temporary holding string.
-		append tempresult \
-		    [binary format H16 \
-			 [format %08x%08x $mixDataLeft $mixDataRight]]
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set left $mixDataLeft
-			set right $mixDataRight
-		    } else {
-			set left $msgDataLeft
-			set right $msgDataRight
-		    }
-		}
-	    }
-
-	    #puts "Left final: [format %x $left]";
-	    #puts "Right final: [format %x $right]";
-
-	    if {$chunk >= 512} {
-		append result $tempresult
-		set tempresult {};
-		set chunk 0;
-	    }
-	}; # For every 8 characters, or 64 bits in the message
-        #puts "End: |[format 0x%08x $left]| |[format 0x%08x $right]|"
-	# Save the left and right registers to the feedback vector.
-	set ivec [binary format H* [format %08x $left][format %08x $right]]
-	#puts "Saved Feedback vector: $fbvectors($fbvector)"
-
-        append result $tempresult
-	if {[string length $result] > $len} {
-	    set result [string replace $result $len end]
-	}
-	# Return the result as an array
-	return $result
-    }; # End of stream
-
-    variable pc2bytes0 [list 0 0x4 0x20000000 0x20000004 0x10000 0x10004 0x20010000 0x20010004 0x200 0x204 0x20000200 0x20000204 0x10200 0x10204 0x20010200 0x20010204]
-    variable pc2bytes1 [list 0 0x1 0x100000 0x100001 0x4000000 0x4000001 0x4100000 0x4100001 0x100 0x101 0x100100 0x100101 0x4000100 0x4000101 0x4100100 0x4100101]
-    variable pc2bytes2 [list 0 0x8 0x800 0x808 0x1000000 0x1000008 0x1000800 0x1000808 0 0x8 0x800 0x808 0x1000000 0x1000008 0x1000800 0x1000808]
-    variable pc2bytes3 [list 0 0x200000 0x8000000 0x8200000 0x2000 0x202000 0x8002000 0x8202000 0x20000 0x220000 0x8020000 0x8220000 0x22000 0x222000 0x8022000 0x8222000]
-    variable pc2bytes4 [list 0 0x40000 0x10 0x40010 0 0x40000 0x10 0x40010 0x1000 0x41000 0x1010 0x41010 0x1000 0x41000 0x1010 0x41010]
-    variable pc2bytes5 [list 0 0x400 0x20 0x420 0 0x400 0x20 0x420 0x2000000 0x2000400 0x2000020 0x2000420 0x2000000 0x2000400 0x2000020 0x2000420]
-    variable pc2bytes6 [list 0 0x10000000 0x80000 0x10080000 0x2 0x10000002 0x80002 0x10080002 0 0x10000000 0x80000 0x10080000 0x2 0x10000002 0x80002 0x10080002]
-    variable pc2bytes7 [list 0 0x10000 0x800 0x10800 0x20000000 0x20010000 0x20000800 0x20010800 0x20000 0x30000 0x20800 0x30800 0x20020000 0x20030000 0x20020800 0x20030800]
-    variable pc2bytes8 [list 0 0x40000 0 0x40000 0x2 0x40002 0x2 0x40002 0x2000000 0x2040000 0x2000000 0x2040000 0x2000002 0x2040002 0x2000002 0x2040002]
-    variable pc2bytes9 [list 0 0x10000000 0x8 0x10000008 0 0x10000000 0x8 0x10000008 0x400 0x10000400 0x408 0x10000408 0x400 0x10000400 0x408 0x10000408]
-    variable pc2bytes10 [list 0 0x20 0 0x20 0x100000 0x100020 0x100000 0x100020 0x2000 0x2020 0x2000 0x2020 0x102000 0x102020 0x102000 0x102020]
-    variable pc2bytes11 [list 0 0x1000000 0x200 0x1000200 0x200000 0x1200000 0x200200 0x1200200 0x4000000 0x5000000 0x4000200 0x5000200 0x4200000 0x5200000 0x4200200 0x5200200]
-    variable pc2bytes12 [list 0 0x1000 0x8000000 0x8001000 0x80000 0x81000 0x8080000 0x8081000 0x10 0x1010 0x8000010 0x8001010 0x80010 0x81010 0x8080010 0x8081010]
-    variable pc2bytes13 [list 0 0x4 0x100 0x104 0 0x4 0x100 0x104 0x1 0x5 0x101 0x105 0x1 0x5 0x101 0x105]
-
-    # Now define the left shifts which need to be done
-    variable shifts {0  0  1  1  1  1  1  1  0  1  1  1  1  1  1  0};
-
-    # Procedure: createKeys
-    # Input:
-    #   key     : The 64-bit DES key or the 192-bit 3DES key
-    #             (Note: The lsb of each byte is ignored; odd parity
-    #             is not required).
-    #
-    #   weak:   If true then weak keys are allowed. The default is to raise an
-    #           error when a weak key is seen.
-    # Output:
-    # The 16 (DES) or 48 (3DES) subkeys.
-    proc createKeys {key {weak 0}} {
-	variable pc2bytes0
-	variable pc2bytes1
-	variable pc2bytes2
-	variable pc2bytes3
-	variable pc2bytes4
-	variable pc2bytes5
-	variable pc2bytes6
-	variable pc2bytes7
-	variable pc2bytes8
-	variable pc2bytes9
-	variable pc2bytes10
-	variable pc2bytes11
-	variable pc2bytes12
-	variable pc2bytes13
-	variable shifts
-
-	# How many iterations (1 for des, 3 for triple des)
-	set iterations [expr {([string length $key] >= 24) ? 3 : 1}];
-	# Stores the return keys
-	set keys {}
-	# Other variables
-	set lefttemp {}; set righttemp {}
-	set m 0
-	# Either 1 or 3 iterations
-	for {set j 0} {$j < $iterations} {incr j} {
-	    binary scan $key x${m}H8H8 lefttemp righttemp
-	    set left {}
-	    append left "0x" $lefttemp
-	    set right {}
-	    append right "0x" $righttemp
-	    incr m 8
-
-	    #puts "Left key: $left"
-	    #puts "Right key: $right"
-
-	    # Test for weak keys
-            if {! $weak} {
-                set maskedLeft [expr {$left & 0xfefefefe}]
-                set maskedRight [expr {$right & 0xfefefefe}]
-                if {($maskedLeft == 0x00000000) \
-                        && ($maskedRight == 0x00000000)} {
-                    error "Key [expr {$j + 1}] is weak!"
-                } elseif {($maskedLeft == 0x1e1e1e1e) \
-                              && ($maskedRight == 0x0e0e0e0e)} {
-                    error "Key [expr {$j + 1}] is weak!"
-                } elseif {($maskedLeft == 0xe0e0e0e0) \
-                              && ($maskedRight == 0xf0f0f0f0)} {
-                    error "Key [expr {$j + 1}] is weak!"
-                } elseif {($maskedLeft == 0xfefefefe) \
-                              && ($maskedRight == 0xfefefefe)} {
-                    error "Key [expr {$j + 1}] is weak!"
-                }
-            }
-
-	    set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}]
-	    set right [expr {$right ^ $temp}]
-	    set left [expr {$left ^ ($temp << 4)}]
-	    set temp [expr {(($right >> 16) ^ $left) & 0x0000ffff}]
-	    set left [expr {$left ^ $temp}]
-	    set right [expr {$right ^ ($temp << 16)}]
-	    set temp [expr {(($left >> 2) ^ $right) & 0x33333333}]
-	    set right [expr {$right ^ $temp}]
-	    set left [expr {$left ^ ($temp << 2)}]
-	    set temp [expr {(($right >> 16) ^ $left) & 0x0000ffff}]
-	    set left [expr {$left ^ $temp}]
-	    set right [expr {$right ^ ($temp << 16)}]
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}]
-	    set right [expr {$right ^ $temp}]
-	    set left [expr {$left ^ ($temp << 1)}]
-	    set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}]
-	    set left [expr {$left ^ $temp}]
-	    set right [expr {$right ^ ($temp << 8)}]
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}]
-	    set right [expr {$right ^ $temp}]
-	    set left [expr {$left ^ ($temp << 1)}]
-	    
-	    #puts "Left key PC1: [format %x $left]"
-	    #puts "Right key PC1: [format %x $right]"
-
-	    # The right side needs to be shifted and to get
-	    # the last four bits of the left side
-	    set temp [expr {($left << 8) | (($right >> 20) & 0x000000f0)}];
-	    # Left needs to be put upside down
-	    set left [expr {($right << 24) | (($right << 8) & 0x00ff0000) | \
-				(($right >> 8) & 0x0000ff00) \
-				| (($right >> 24) & 0x000000f0)}];
-	    set right $temp;
-
-	    #puts "Left key juggle: [format %x $left]"
-	    #puts "Right key juggle: [format %x $right]"
-
-	    # Now go through and perform these
-	    # shifts on the left and right keys.
-	    foreach i $shifts  {
-		# Shift the keys either one or two bits to the left.
-		if {$i} {
-		    set left [expr {($left << 2) \
-					| (($left >> 26) & 0x0000003f)}];
-		    set right [expr {($right << 2) \
-					 | (($right >> 26) & 0x0000003f)}];
-		} else {
-		    set left [expr {($left << 1) \
-					| (($left >> 27) & 0x0000001f)}];
-		    set right [expr {($right << 1) \
-					 | (($right >> 27) & 0x0000001f)}];
-		}
-		set left [expr {$left & 0xfffffff0}];
-		set right [expr {$right & 0xfffffff0}];
-
-		# Now apply PC-2, in such a way that E is easier when
-		# encrypting or decrypting this conversion will look like PC-2
-		# except only the last 6 bits of each byte are used rather than
-		# 48 consecutive bits and the order of lines will be according
-		# to how the S selection functions will be applied: S2, S4, S6,
-		# S8, S1, S3, S5, S7.
-		set lefttemp [expr {[lindex $pc2bytes0 [expr {($left >> 28) & 0x0000000f}]] | \
-					[lindex $pc2bytes1 [expr {($left >> 24) & 0x0000000f}]] | \
-					[lindex $pc2bytes2 [expr {($left >> 20) & 0x0000000f}]] | \
-					[lindex $pc2bytes3 [expr {($left >> 16) & 0x0000000f}]] | \
-					[lindex $pc2bytes4 [expr {($left >> 12) & 0x0000000f}]] | \
-					[lindex $pc2bytes5 [expr {($left >> 8) & 0x0000000f}]] | \
-					[lindex $pc2bytes6 [expr {($left >> 4) & 0x0000000f}]]}];
-		set righttemp [expr {[lindex $pc2bytes7 [expr {($right >> 28) & 0x0000000f}]] | \
-					 [lindex $pc2bytes8 [expr {($right >> 24) & 0x0000000f}]] | \
-					 [lindex $pc2bytes9 [expr {($right >> 20) & 0x0000000f}]] | \
-					 [lindex $pc2bytes10 [expr {($right >> 16) & 0x0000000f}]] | \
-					 [lindex $pc2bytes11 [expr {($right >> 12) & 0x0000000f}]] | \
-					 [lindex $pc2bytes12 [expr {($right >> 8) & 0x0000000f}]] | \
-					 [lindex $pc2bytes13 [expr {($right >> 4) & 0x0000000f}]]}];
-		set temp [expr {(($righttemp >> 16) ^ $lefttemp) & 0x0000ffff}];
-		lappend keys [expr {$lefttemp ^ $temp}];
-		lappend keys [expr {$righttemp ^ ($temp << 16)}];
-	    }
-	}; # For each iteration.
-	# Return the keys we've created.
-	return $keys;
-    }; # End of createKeys.
-}; # End of des namespace eval.
-
-package provide tclDES 1.0.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/des/tcldesjr.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/des/tcldesjr.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1055 +1,0 @@
-# desjr.tcl
-# $Revision: 1.1 $
-# $Date: 2005/09/26 09:16:59 $
-#
-# Port of Javascript implementation to Tcl 8.4 by Mac A. Cody,
-# 3DES functionality removed, February, 2003
-# July, 2003   - Separated key set generation from encryption/decryption.
-#                Renamed "des" procedure to "block" to differentiate from the
-#                "stream" procedure used for CFB and OFB modes.
-#                Modified the "encrypt" and "decrypt" procedures to support
-#                CFB and OFB modes. Changed the procedure arguments.
-# August, 2003 - Added the "stream" procedure to support CFB and OFB modes.
-# June, 2004 - Corrected input vector bug in stream-mode processing.  Added
-#              support for feedback vector storage and management function.
-#              This enables a stream of data to be processed over several calls
-#              to the encryptor or decryptor.
-# September, 2004 - Added feedback vector to the CBC mode of operation to allow
-#                   a large data set to be processed over several calls to the
-#                   encryptor or decryptor.
-# October, 2004 - Added test for weak keys in the createKeys procedure.
-#
-# Paul Tero, July 2001
-# http://www.shopable.co.uk/des.html
-#
-# Optimised for performance with large blocks by Michael Hayworth,
-# November 2001, http://www.netdealing.com
-#
-# This software is copyrighted (c) 2003, 2004 by Mac A. Cody.  All rights
-# reserved.  The following terms apply to all files associated with
-# the software unless explicitly disclaimed in individual files or
-# directories.
-
-# The authors hereby grant permission to use, copy, modify, distribute,
-# and license this software for any purpose, provided that existing
-# copyright notices are retained in all copies and that this notice is
-# included verbatim in any distributions. No written agreement, license,
-# or royalty fee is required for any of the authorized uses.
-# Modifications to this software may be copyrighted by their authors and
-# need not follow the licensing terms described here, provided that the
-# new terms are clearly indicated on the first page of each file where
-# they apply.
-
-# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-# MODIFICATIONS.
-
-# GOVERNMENT USE: If you are acquiring this software on behalf of the
-# U.S. government, the Government shall have only "Restricted Rights"
-# in the software and related documentation as defined in the Federal 
-# Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
-# are acquiring the software on behalf of the Department of Defense, the
-# software shall be classified as "Commercial Computer Software" and the
-# Government shall have only "Restricted Rights" as defined in Clause
-# 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
-# authors grant the U.S. Government and others acting in its behalf
-# permission to use and distribute the software in accordance with the
-# terms specified in this license. 
-namespace eval des {
-    variable keysets
-    set keysets(ndx) 1
-    # Produre: keyset - Create or destroy a keyset created
-    #                   from a 64-bit DES key.
-    # Inputs:
-    #   oper  : The operation to be performed.  This will be either "create"
-    #           (make a new keyset) or "destroy" (delete an existing keyset).
-    #           The meaning of the argument "value" depends of the operation
-    #           performed.  An error is generated if "oper" is not "create"
-    #           or "destroy".
-    #             
-    #   value : If the argument "oper" is "create", then "value" is the 64-bit
-    #           DES key.  (Note: The lsb of each byte is ignored; odd parity is
-    #           not required).  If the argument "oper" is "destroy", then
-    #           "value" is a handle to a keyset that was created previously.
-    #
-    #   weak:   If true then weak keys are allowed. The default is to raise an
-    #           error when a weak key is seen.
-    # Output:
-    #   If the argument "oper" is "create", then the output is a handle to the
-    #   keyset stored in the des namespace.  If the argument "oper" is
-    #   "destroy", then nothing is returned.
-    proc keyset {oper value {weak 0}} {
-	variable keysets
-	set newset {}
-	switch -exact -- $oper {
-	    create {
-		# Create a new keyset handle.
-		set newset keyset$keysets(ndx)
-		# Create key set
-		set keysets($newset) [createKeys $value $weak]
-		# Never use that keyset handle index again.
-		incr keysets(ndx)
-	    }
-	    destroy {
-		# Determine if the keyset handle is valid.
-		if {[array names keysets $value] != {}} {
-		    # Delete the handle and corresponding keyset.
-                    unset keysets($value)
-		} else {
-		    error "The keyset handle \"$value\" is invalid!"
-		}
-	    }
-	    default {
-		error {The operator must be either "create" or "destroy".}
-	    }
-	}
-	return $newset
-    }
-
-    # Procedure: encrypt - Encryption front-end for the des procedure
-    # Inputs:
-    #   keyset  : Handle to an existing keyset.
-    #   message : String to be encrypted.
-    #   mode    : DES mode ecb (default), cbc, cfb, or ofb.
-    #   iv      : Name of the initialization vector used in CBC, CFB,
-    #             and OFB modes.
-    #   kbits   : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted data string.
-    proc encrypt {keyset message {mode ecb} {iv {}} {kbits 64}} {
-	switch -exact -- $mode {
-	    ecb {
-		return [block $keyset $message 1 0]
-	    }
-	    cbc -
-	    ofb -
-	    cfb {
-		# Is the initialization/feedback vector variable is valid?
-		if {[string length $iv] == 0} {
-		    error "An initialization variable must be specified."
-		} else {
-		    upvar $iv ivec
-		    if {![info exists ivec]} {
-			error "The variable $iv does not exist."
-		    }
-		}
-		switch -exact -- $mode {
-		    cbc {
-			return [block $keyset $message 1 1 ivec]
-		    }
-		    ofb {
-			return [stream $keyset $message 1 0 ivec $kbits]
-		    }
-		    cfb {
-			return [stream $keyset $message 1 1 ivec $kbits]
-		    }
-		}
-	    }
-	    default {
-		error {Mode must be ecb, cbc, cfb, or ofb.}
-	    }
-	}
-    }
-
-    # Procedure: decrypt - Decryption front-end for the des procedure
-    # Inputs:
-    #   keyset  : Handle to an existing keyset.
-    #   message : String to be decrypted.
-    #   mode    : DES mode ecb (default), cbc, cfb, or ofb.
-    #   iv      : Name of the initialization vector used in CBC, CFB,
-    #             and OFB modes.
-    #   kbits   : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc decrypt {keyset message {mode ecb} {iv {}} {kbits 64}} {
-	switch -exact -- $mode {
-	    ecb {
-		return [block $keyset $message 0 0]
-	    }
-	    cbc -
-	    ofb -
-	    cfb {
-		# Is the initialization/feedback vector variable is valid?
-		if {[string length $iv] < 1} {
-		    error "An initialization variable must be specified."
-		} else {
-		    upvar $iv ivec
-		    if {![info exists ivec]} {
-			error "The variable $iv does not exist."
-		    }
-		}
-		switch -exact -- $mode {
-		    cbc {
-			return [block $keyset $message 0 1 ivec]
-		    }
-		    ofb {
-			return [stream $keyset $message 0 0 ivec $kbits]
-		    }
-		    cfb {
-			return [stream $keyset $message 0 1 ivec $kbits]
-		    }
-		}
-	    }
-	    default {
-		error {Mode must be ecb, cbc, cfb, or ofb.}
-	    }
-	}
-    }
-
-    variable spfunction1 [list 0x1010400 0 0x10000 0x1010404 0x1010004 0x10404 0x4 0x10000 0x400 0x1010400 0x1010404 0x400 0x1000404 0x1010004 0x1000000 0x4 0x404 0x1000400 0x1000400 0x10400 0x10400 0x1010000 0x1010000 0x1000404 0x10004 0x1000004 0x1000004 0x10004 0 0x404 0x10404 0x1000000 0x10000 0x1010404 0x4 0x1010000 0x1010400 0x1000000 0x1000000 0x400 0x1010004 0x10000 0x10400 0x1000004 0x400 0x4 0x1000404 0x10404 0x1010404 0x10004 0x1010000 0x1000404 0x1000004 0x404 0x10404 0x1010400 0x404 0x1000400 0x1000400 0 0x10004 0x10400 0 0x1010004];
-    variable spfunction2 [list 0x80108020 0x80008000 0x8000 0x108020 0x100000 0x20 0x80100020 0x80008020 0x80000020 0x80108020 0x80108000 0x80000000 0x80008000 0x100000 0x20 0x80100020 0x108000 0x100020 0x80008020 0 0x80000000 0x8000 0x108020 0x80100000 0x100020 0x80000020 0 0x108000 0x8020 0x80108000 0x80100000 0x8020 0 0x108020 0x80100020 0x100000 0x80008020 0x80100000 0x80108000 0x8000 0x80100000 0x80008000 0x20 0x80108020 0x108020 0x20 0x8000 0x80000000 0x8020 0x80108000 0x100000 0x80000020 0x100020 0x80008020 0x80000020 0x100020 0x108000 0 0x80008000 0x8020 0x80000000 0x80100020 0x80108020 0x108000];
-    variable spfunction3 [list 0x208 0x8020200 0 0x8020008 0x8000200 0 0x20208 0x8000200 0x20008 0x8000008 0x8000008 0x20000 0x8020208 0x20008 0x8020000 0x208 0x8000000 0x8 0x8020200 0x200 0x20200 0x8020000 0x8020008 0x20208 0x8000208 0x20200 0x20000 0x8000208 0x8 0x8020208 0x200 0x8000000 0x8020200 0x8000000 0x20008 0x208 0x20000 0x8020200 0x8000200 0 0x200 0x20008 0x8020208 0x8000200 0x8000008 0x200 0 0x8020008 0x8000208 0x20000 0x8000000 0x8020208 0x8 0x20208 0x20200 0x8000008 0x8020000 0x8000208 0x208 0x8020000 0x20208 0x8 0x8020008 0x20200];
-    variable spfunction4 [list 0x802001 0x2081 0x2081 0x80 0x802080 0x800081 0x800001 0x2001 0 0x802000 0x802000 0x802081 0x81 0 0x800080 0x800001 0x1 0x2000 0x800000 0x802001 0x80 0x800000 0x2001 0x2080 0x800081 0x1 0x2080 0x800080 0x2000 0x802080 0x802081 0x81 0x800080 0x800001 0x802000 0x802081 0x81 0 0 0x802000 0x2080 0x800080 0x800081 0x1 0x802001 0x2081 0x2081 0x80 0x802081 0x81 0x1 0x2000 0x800001 0x2001 0x802080 0x800081 0x2001 0x2080 0x800000 0x802001 0x80 0x800000 0x2000 0x802080];
-    variable spfunction5 [list 0x100 0x2080100 0x2080000 0x42000100 0x80000 0x100 0x40000000 0x2080000 0x40080100 0x80000 0x2000100 0x40080100 0x42000100 0x42080000 0x80100 0x40000000 0x2000000 0x40080000 0x40080000 0 0x40000100 0x42080100 0x42080100 0x2000100 0x42080000 0x40000100 0 0x42000000 0x2080100 0x2000000 0x42000000 0x80100 0x80000 0x42000100 0x100 0x2000000 0x40000000 0x2080000 0x42000100 0x40080100 0x2000100 0x40000000 0x42080000 0x2080100 0x40080100 0x100 0x2000000 0x42080000 0x42080100 0x80100 0x42000000 0x42080100 0x2080000 0 0x40080000 0x42000000 0x80100 0x2000100 0x40000100 0x80000 0 0x40080000 0x2080100 0x40000100];
-    variable spfunction6 [list 0x20000010 0x20400000 0x4000 0x20404010 0x20400000 0x10 0x20404010 0x400000 0x20004000 0x404010 0x400000 0x20000010 0x400010 0x20004000 0x20000000 0x4010 0 0x400010 0x20004010 0x4000 0x404000 0x20004010 0x10 0x20400010 0x20400010 0 0x404010 0x20404000 0x4010 0x404000 0x20404000 0x20000000 0x20004000 0x10 0x20400010 0x404000 0x20404010 0x400000 0x4010 0x20000010 0x400000 0x20004000 0x20000000 0x4010 0x20000010 0x20404010 0x404000 0x20400000 0x404010 0x20404000 0 0x20400010 0x10 0x4000 0x20400000 0x404010 0x4000 0x400010 0x20004010 0 0x20404000 0x20000000 0x400010 0x20004010];
-    variable spfunction7 [list 0x200000 0x4200002 0x4000802 0 0x800 0x4000802 0x200802 0x4200800 0x4200802 0x200000 0 0x4000002 0x2 0x4000000 0x4200002 0x802 0x4000800 0x200802 0x200002 0x4000800 0x4000002 0x4200000 0x4200800 0x200002 0x4200000 0x800 0x802 0x4200802 0x200800 0x2 0x4000000 0x200800 0x4000000 0x200800 0x200000 0x4000802 0x4000802 0x4200002 0x4200002 0x2 0x200002 0x4000000 0x4000800 0x200000 0x4200800 0x802 0x200802 0x4200800 0x802 0x4000002 0x4200802 0x4200000 0x200800 0 0x2 0x4200802 0 0x200802 0x4200000 0x800 0x4000002 0x4000800 0x800 0x200002];
-    variable spfunction8 [list 0x10001040 0x1000 0x40000 0x10041040 0x10000000 0x10001040 0x40 0x10000000 0x40040 0x10040000 0x10041040 0x41000 0x10041000 0x41040 0x1000 0x40 0x10040000 0x10000040 0x10001000 0x1040 0x41000 0x40040 0x10040040 0x10041000 0x1040 0 0 0x10040040 0x10000040 0x10001000 0x41040 0x40000 0x41040 0x40000 0x10041000 0x1000 0x40 0x10040040 0x1000 0x41040 0x10001000 0x40 0x10000040 0x10040000 0x10040040 0x10000000 0x40000 0x10001040 0 0x10041040 0x40040 0x10000040 0x10040000 0x10001000 0x10001040 0 0x10041040 0x41000 0x41000 0x1040 0x1040 0x40040 0x10000000 0x10041000];
-
-    variable desEncrypt {0 32 2}
-    variable desDecrypt {30 -2 -2}
-
-    # Procedure: block - DES ECB and CBC mode support
-    # Inputs:
-    #   keyset   : Handle to an existing keyset.
-    #   message  : String to be encrypted or decrypted (Note: For encryption,
-    #              the string is extended with null characters to an integral
-    #              multiple of eight bytes.  For decryption, the string length
-    #              must be an integral multiple of eight bytes.
-    #   encrypt  : Perform encryption (1) or decryption (0)
-    #   mode     : DES mode 1=CBC, 0=ECB (default).
-    #   iv       : Name of the variable containing the initialization vector
-    #              used in CBC mode.  The value must be 64 bits in length.
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc block {keyset message encrypt {mode 0} {iv {}}} {
-	variable spfunction1
-	variable spfunction2
-	variable spfunction3
-	variable spfunction4
-	variable spfunction5
-	variable spfunction6
-	variable spfunction7
-	variable spfunction8
-	variable desEncrypt
-	variable desDecrypt
-	variable keysets
-
-	# Determine if the keyset handle is valid.
-	if {[array names keysets $keyset] != {}} {
-	    # Acquire the 16 or 48 subkeys we will need
-	    set keys $keysets($keyset)
-	} else {
-	    error "The keyset handle \"$keyset\" is invalid!"
-	}
-	set m 0
-	set cbcleft 0x00; set cbcleft2 0x00
-	set cbcright 0x00; set cbcright2 0x00
-	set len [string length $message];
-        if {$len == 0} {
-            return -code error "invalid message size: the message may not be empty"
-        }
-	set chunk 0;
-	# Set up the loops for des
-	expr {$encrypt ? [set looping $desEncrypt] : [set looping $desDecrypt]}
-
-	# Pad the message out with null bytes.
-	append message "\0\0\0\0\0\0\0\0"
-
-	# Store the result here
-	set result {};
-	set tempresult {};
-
-	# CBC mode
-	if {$mode == 1} {
-	    # Is the initialization/feedback vector variable is valid?
-	    if {[string length $iv] < 1} {
-		error "An initialization variable must be specified."
-	    } else {
-		upvar $iv ivec
-		if {![info exists ivec]} {
-		    error "The variable $iv does not exist."
-		}
-                if {[string length $ivec] != 8} {
-                    return -code error "invalid initialization vector size:\
-                        the initialization vector must be 8 bytes"
-                }
-	    }
-	    # Use the input vector as the intial vector.
-	    binary scan $ivec H8H8 cbcleftTemp cbcrightTemp
-	    set cbcleft "0x$cbcleftTemp"
-	    set cbcright "0x$cbcrightTemp"
-	}
-
-	# Loop through each 64 bit chunk of the message
-	while {$m < $len} {
-	    binary scan $message x${m}H8H8 lefttemp righttemp
-	    set left {}
-	    append left "0x" $lefttemp
-	    set right {}
-	    append right "0x" $righttemp
-	    incr m 8
-
-	    #puts "Left start: $left";
-	    #puts "Right start: $right";
-	    # For Cipher Block Chaining mode, xor the
-	    # message with the previous result.
-	    if {$mode == 1} {
-		if {$encrypt} {
-		    set left [expr {$left ^ $cbcleft}]
-		    set right [expr {$right ^ $cbcright}]
-		} else {
-		    set cbcleft2 $cbcleft;
-		    set cbcright2 $cbcright;
-		    set cbcleft $left;
-		    set cbcright $right;
-		}
-	    }
-
-	    #puts "Left mode: $left";
-	    #puts "Right mode: $right";
-	    #puts "cbcleft: $cbcleft";
-	    #puts "cbcleft2: $cbcleft2";
-	    #puts "cbcright: $cbcright";
-	    #puts "cbcright2: $cbcright2";
-
-	    # First each 64 but chunk of the message
-	    # must be permuted according to IP.
-	    set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-	    set temp [expr {(($left >> 16) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {(($right >> 2) ^ $left) & 0x33333333}];
-	    set left [expr {$left ^ $temp}]
-	    set right [expr {$right ^ ($temp << 2)}];
-
-	    set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-
-	    set left [expr {((($left << 1) & 0xffffffff) | \
-				 (($left >> 31) & 0x00000001))}]; 
-	    set right [expr {((($right << 1) & 0xffffffff) | \
-				  (($right >> 31) & 0x00000001))}]; 
-
-	    #puts "Left IP: [format %x $left]";
-	    #puts "Right IP: [format %x $right]";
-
-	    # Do this 1 time for each chunk of the message.
-	    set endloop [lindex $looping 1];
-	    set loopinc [lindex $looping 2];
-
-	    #puts "endloop: $endloop";
-	    #puts "loopinc: $loopinc";
-
-	    # Now go through and perform the encryption or decryption. 
-	    for {set i [lindex $looping 0]} \
-		{$i != $endloop} {incr i $loopinc} {
-		# For efficiency
-		set right1 [expr {$right ^ [lindex $keys $i]}]; 
-		set right2 [expr {((($right >> 4) & 0x0fffffff) | \
-				       (($right << 28) & 0xffffffff)) ^ \
-				      [lindex $keys [expr {$i + 1}]]}];
- 
-		# puts "right1: [format %x $right1]";
-		# puts "right2: [format %x $right2]";
-
-		# The result is attained by passing these
-		# bytes through the S selection functions.
-		set temp $left;
-		set left $right;
-		set right [expr {$temp ^ ([lindex $spfunction2 [expr {($right1 >> 24) & 0x3f}]] | \
-					      [lindex $spfunction4 [expr {($right1 >> 16) & 0x3f}]] | \
-					      [lindex $spfunction6 [expr {($right1 >>  8) & 0x3f}]] | \
-					      [lindex $spfunction8 [expr {$right1 & 0x3f}]] | \
-					      [lindex $spfunction1 [expr {($right2 >> 24) & 0x3f}]] | \
-					      [lindex $spfunction3 [expr {($right2 >> 16) & 0x3f}]] | \
-					      [lindex $spfunction5 [expr {($right2 >>  8) & 0x3f}]] | \
-					      [lindex $spfunction7 [expr {$right2 & 0x3f}]])}];
- 
-		# puts "Left iter: [format %x $left]";
-		# puts "Right iter: [format %x $right]";
-		
-	    }
-	    set temp $left;
-	    set left $right;
-	    set right $temp; # Unreverse left and right.
-
-	    #puts "Left Iterated: [format %x $left]";
-	    #puts "Right Iterated: [format %x $right]";
-
-	    # Move then each one bit to the right
-	    set left [expr {((($left >> 1) & 0x7fffffff) \
-				 | (($left << 31) & 0xffffffff))}]; 
-	    set right [expr {((($right >> 1) & 0x7fffffff) \
-				  | (($right << 31) & 0xffffffff))}]; 
-
-	    #puts "Left shifted: [format %x $left]";
-	    #puts "Right shifted: [format %x $right]";
-
-	    # Now perform IP-1, which is IP in the opposite direction
-	    set temp [expr {((($left >> 1) & 0x7fffffff) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-	    set temp [expr {((($right >> 8) & 0x00ffffff) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {((($right >> 2) & 0x3fffffff) ^ $left) & 0x33333333}]; 
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-	    set temp [expr {((($left >> 16) & 0x0000ffff) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {((($left >> 4) & 0x0fffffff) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-
-	    #puts "Left IP-1: [format %x $left]";
-	    #puts "Right IP-1: [format %x $right]";
-
-	    # For Cipher Block Chaining mode, xor
-	    # the message with the previous result.
-	    if {$mode == 1} {
-		if {$encrypt} {
-		    set cbcleft $left;
-		    set cbcright $right;
-		} else {
-		    set left [expr {$left ^ $cbcleft2}];
-		    set right [expr {$right ^ $cbcright2}];
-		}
-	    }
-
-	    append tempresult \
-		[binary format H16 [format %08x%08x $left $right]]
-
-	    #puts "Left final: [format %x $left]";
-	    #puts "Right final: [format %x $right]";
-
-	    incr chunk 8;
-	    if {$chunk == 512} {
-		append result $tempresult
-		set tempresult {};
-		set chunk 0;
-	    }
-	}; # For every 8 characters, or 64 bits in the message
-
-	if {$mode == 1} {
-	    if {$encrypt} {
-		# Save the left and right registers to the feedback vector.
-		set ivec [binary format H* \
-			      [format %08x $left][format %08x $right]]
-	    } else {
-		set ivec [binary format H* \
-			      [format %08x $cbcleft][format %08x $cbcright]]
-	    }
-	}
-
-	# Return the result as an array
-	return ${result}$tempresult
-    }; # End of block
-
-    # Procedure: stream - DES CFB and OFB mode support
-    # Inputs:
-    #   keyset   : Handle to an existing keyset.
-    #   message  : String to be encrypted or decrypted (Note: The length of the
-    #              string is dependent upon the value of kbits.  Remember that
-    #              the string is part of a stream of data, so it must be sized
-    #              properly for subsequent encryptions/decryptions to be
-    #              correct.  See the man page for correct message lengths for
-    #              values of kbits).
-    #   encrypt  : Perform encryption (1) or decryption (0)
-    #   mode     : DES mode 0=OFB, 1=CFB.
-    #   iv       : Name of variable containing the initialization vector.  The
-    #              value must be 64 bits in length with the first 64-L bits set
-    #              to zero.
-    #   kbits    : Number of bits in a data block (default of 64).
-    # Output:
-    #   The encrypted or decrypted data string.
-    proc stream {keyset message encrypt mode iv {kbits 64}} {
-	variable spfunction1
-	variable spfunction2
-	variable spfunction3
-	variable spfunction4
-	variable spfunction5
-	variable spfunction6
-	variable spfunction7
-	variable spfunction8
-	variable desEncrypt
-	variable keysets
-
-	# Determine if the keyset handle is valid.
-	if {[array names keysets $keyset] != {}} {
-	    # Acquire the 16 subkeys we will need.
-	    set keys $keysets($keyset)
-	} else {
-	    error "The keyset handle \"$keyset\" is invalid!"
-	}
-
-	# Is the initialization/feedback vector variable is valid?
-	if {[string length $iv] < 1} {
-	    error "An initialization variable must be specified."
-	} else {
-	    upvar $iv ivec
-	    if {![info exists ivec]} {
-		error "The variable $iv does not exist."
-	    }
-	}
-
-        # Determine if message length (in bits)
-	# is not an integral number of kbits.
-	set len [string length $message];
-        #puts "len: $len, kbits: $kbits"
-	if {($kbits < 1) || ($kbits > 64)} {
-	    error "The valid values of kbits are 1 through 64."
-        } elseif {($kbits % 8) != 0} {
-	    set blockSize [expr {$kbits + (8 - ($kbits % 8))}]
-	    set fail [expr {(($len * 8) / $blockSize) % $kbits}]
-	} else {
-	    set blockSize [expr {$kbits / 8}]
-	    set fail [expr {$len % $blockSize}]
-	}
-        if {$fail} {
-	    error "Data length (in bits) is not an integral number of kbits."
-	}
-
-	set m 0
-	set n 0
-	set chunk 0;
-	# Set up the loops for des
-	set looping $desEncrypt
-
-        # Set up shifting values.  Used for both CFB and OFB modes.
-        if {$kbits < 32} {
-	    # Only some bits from left output are needed.
-	    set kOutShift [expr {32 - $kbits}]
-	    set kOutMask [expr {0x7fffffff >> (31 - $kbits)}]
-	    # Determine number of message bytes needed per iteration.
-	    set msgBytes [expr {int(ceil(double($kbits) / 8.0))}]
-	    # Determine number of message bits needed per iteration.
-	    set msgBits [expr {$msgBytes * 8}]
-	    set msgBitsSub1 [expr {$msgBits - 1}]
-	    # Define bit caches.
-	    set bitCacheIn {}
-	    set bitCacheOut {}
-	    # Variable used to remove bits 0 through
-	    # kbits-1 in the input bit cache.
-	    set kbitsSub1 [expr {$kbits - 1}]
-	    # Variable used to remove leading dummy binary bits.
-	    set xbits [expr {32 - $kbits}]
-	} elseif {$kbits == 32} {
-	    # Only bits of left output are used.
-	    # Four messages bytes are needed per iteration.
-	    set msgBytes 4
-	    set xbits 32
-	} elseif {$kbits < 64} {
-	    # All bits from left output are needed.
-	    set kOutShiftLeft [expr {$kbits - 32}]
-	    # Some bits from right output are needed.
-	    set kOutShiftRight [expr {64 - $kbits}]
-	    set kOutMaskRight [expr {0x7fffffff >> (63 - $kbits)}]
-	    # Determine number of message bytes needed per iteration.
-	    set msgBytes [expr {int(ceil(double($kbits) / 8.0))}]
-	    # Determine number of message bits needed per iteration.
-	    set msgBits [expr {$msgBytes * 8}]
-	    set msgBitsSub1 [expr {$msgBits - 1}]
-	    # Define bit caches.
-	    set bitCacheIn {}
-	    set bitCacheOut {}
-	    # Variable used to remove bits 0 through
-	    # kbits-1 in the input bit cache.
-	    set kbitsSub1 [expr {$kbits - 1}]
-	    # Variable used to remove leading dummy binary bits.
-	    set xbits [expr {64 - $kbits}]
-	} else {
-	    # All 64 bits of output are used.
-	    # Eight messages bytes are needed per iteration.
-	    set msgBytes 8
-	    set xbits 0
-	}
-
-	# Store the result here
-	set result {}
-	set tempresult {}
-
-	# Set up the initialization vector bitstream
-	binary scan $ivec H8H8 leftTemp rightTemp
-	set left "0x$leftTemp"
-	set right "0x$rightTemp"
-        #puts "Retrieved Feedback vector: $fbvec"
-        #puts "Start: |$left| |$right|"
-	
-	# Loop through each 64 bit chunk of the message
-	while {$m < $len} {
-	    # puts "Left start: $left";
-	    # puts "Right start: $right";
-
-	    # First each 64 but chunk of the
-	    # message must be permuted according to IP.
-	    set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-	    set temp [expr {(($left >> 16) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {(($right >> 2) ^ $left) & 0x33333333}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-
-	    set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {(($left >> 1) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-
-	    set left [expr {((($left << 1) & 0xffffffff) | \
-				 (($left >> 31) & 0x00000001))}]; 
-	    set right [expr {((($right << 1) & 0xffffffff) | \
-				  (($right >> 31) & 0x00000001))}]; 
-
-	    #puts "Left IP: [format %x $left]";
-	    #puts "Right IP: [format %x $right]";
-
-	    # Do this 1 time for each chunk of the message
-	    set endloop [lindex $looping 1];
-	    set loopinc [lindex $looping 2];
-
-	    # puts "endloop: $endloop";
-	    # puts "loopinc: $loopinc";
-
-	    # Now go through and perform the encryption or decryption  
-	    for {set i [lindex $looping 0]} \
-		{$i != $endloop} {incr i $loopinc} {
-		# For efficiency
-		set right1 [expr {$right ^ [lindex $keys $i]}]; 
-		set right2 [expr {((($right >> 4) & 0x0fffffff) | \
-				       (($right << 28) & 0xffffffff)) ^ \
-				      [lindex $keys [expr {$i + 1}]]}];
- 
-		# puts "right1: [format %x $right1]";
-		# puts "right2: [format %x $right2]";
-
-		# The result is attained by passing these
-		# bytes through the S selection functions.
-		set temp $left;
-		set left $right;
-		set right [expr {$temp ^ ([lindex $spfunction2 [expr {($right1 >> 24) & 0x3f}]] | \
-					      [lindex $spfunction4 [expr {($right1 >> 16) & 0x3f}]] | \
-					      [lindex $spfunction6 [expr {($right1 >>  8) & 0x3f}]] | \
-					      [lindex $spfunction8 [expr {$right1 & 0x3f}]] | \
-					      [lindex $spfunction1 [expr {($right2 >> 24) & 0x3f}]] | \
-					      [lindex $spfunction3 [expr {($right2 >> 16) & 0x3f}]] | \
-					      [lindex $spfunction5 [expr {($right2 >>  8) & 0x3f}]] | \
-					      [lindex $spfunction7 [expr {$right2 & 0x3f}]])}];
- 
-		# puts "Left iter: [format %x $left]";
-		# puts "Right iter: [format %x $right]";
-	    }
-	    set temp $left;
-	    set left $right;
-	    set right $temp; # Unreverse left and right
-
-	    #puts "Left Iterated: [format %x $left]";
-	    #puts "Right Iterated: [format %x $right]";
-
-	    # Move then each one bit to the right
-	    set left [expr {((($left >> 1) & 0x7fffffff) | \
-				 (($left << 31) & 0xffffffff))}]; 
-	    set right [expr {((($right >> 1) & 0x7fffffff) | \
-				  (($right << 31) & 0xffffffff))}]; 
-
-	    #puts "Left shifted: [format %x $left]";
-	    #puts "Right shifted: [format %x $right]";
-
-	    # Now perform IP-1, which is IP in the opposite direction
-	    set temp [expr {((($left >> 1) & 0x7fffffff) ^ $right) & 0x55555555}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 1)}];
-	    set temp [expr {((($right >> 8) & 0x00ffffff) ^ $left) & 0x00ff00ff}];
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 8)}];
-	    set temp [expr {((($right >> 2) & 0x3fffffff) ^ $left) & 0x33333333}]; 
-	    set left [expr {$left ^ $temp}];
-	    set right [expr {$right ^ ($temp << 2)}];
-	    set temp [expr {((($left >> 16) & 0x0000ffff) ^ $right) & 0x0000ffff}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 16)}];
-	    set temp [expr {((($left >> 4) & 0x0fffffff) ^ $right) & 0x0f0f0f0f}];
-	    set right [expr {$right ^ $temp}];
-	    set left [expr {$left ^ ($temp << 4)}];
-
-	    #puts "Left IP-1: [format %x $left]";
-	    #puts "Right IP-1: [format %x $right]";
-
-	    # Extract the "kbits" most significant bits from the output block.
-	    if {$kbits < 32} {
-		# Only some bits from left output are needed.
-		set kData [expr {($left >> $kOutShift) & $kOutMask}]
-		set newBits {}
-		# If necessary, copy message bytes into input bit cache.
-		if {([string length $bitCacheIn] < $kbits) && ($n < $len)} {
-		    if {$len - $n < $msgBytes} {
-			set lastBits [expr {($len - $n) * 8}]
-			###puts -nonewline [binary scan $message x${n}B$lastBits newBits]
-			binary scan $message x${n}B$lastBits newBits
-		    } else {
-			# Extract "msgBytes" whole bytes as bits
-			###puts -nonewline [binary scan $message x${n}B$msgBits newBits]
-			binary scan $message x${n}B$msgBits newBits
-		    }
-		    incr n $msgBytes
-		    #puts " $newBits  $n [expr {$len - $n}]"
-		    # Add the bits to the input bit cache.
-		    append bitCacheIn $newBits
-		}
-		#puts -nonewline "In bit cache: $bitCacheIn"
-		# Set up message data from input bit cache.
-		binary scan [binary format B32 [format %032s [string range $bitCacheIn 0 $kbitsSub1]]] H8 temp
-		set msgData "0x$temp"
-		# Mix message bits with crypto bits.
-		set mixData [expr {$msgData ^ $kData}]
-		# Discard collected bits from the input bit cache.
-		set bitCacheIn [string range $bitCacheIn $kbits end]
-		#puts "  After: $bitCacheIn"
-		# Convert back to a bit stream and append to the output bit cache.
-		# Only the lower kbits are wanted.
-		binary scan [binary format H8 [format %08x $mixData]] B32 msgOut
-		append bitCacheOut [string range $msgOut $xbits end]
-		#puts -nonewline "Out bit cache: $bitCacheOut"
-		# If there are sufficient bits, move bytes to the temporary holding string.
-		if {[string length $bitCacheOut] >= $msgBits} {
-		    append tempresult [binary format B$msgBits [string range $bitCacheOut 0 $msgBitsSub1]]
-		    set bitCacheOut [string range $bitCacheOut $msgBits end]
-                    #puts -nonewline "  After: $bitCacheOut"
-		    incr m $msgBytes
-		    ###puts "$m bytes output"
-		    incr chunk $msgBytes
-		}
-		#puts ""
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set temp [expr {($right << $kbits) & 0xffffffff}]
-			set left [expr {(($left << $kbits) & 0xffffffff) | (($right >> $kOutShift) & $kOutMask)}]
-			set right [expr {$temp | $mixData}]
-		    } else {
-			set temp [expr {($right << $kbits) & 0xffffffff}]
-			set left [expr {(($left << $kbits) & 0xffffffff) | (($right >> $kOutShift) & $kOutMask)}]
-			set right [expr {$temp | $msgData}]
-		    }
-		}
-	    } elseif {$kbits == 32} {
-		# Only bits of left output are used.
-		set kData $left
-		# Four messages bytes are needed per iteration.
-		binary scan $message x${m}H8 temp
-		incr m 4
-		incr chunk 4
-		set msgData "0x$temp"
-		# Mix message bits with crypto bits.
-		set mixData [expr {$msgData ^ $kData}]
-		# Move bytes to the temporary holding string.
-		append tempresult [binary format H8 [format %08x $mixData]]
-		# For CFB mode
-		if {$mode == 1} {
-		    set left $right
-		    if {$encrypt} {
-			set right $mixData
-		    } else {
-			set right $msgData
-		    }
-		}
-	    } elseif {$kbits < 64} {
-		set kDataLeft [expr {($left >> $kOutShiftRight) & $kOutMaskRight}]
-		set temp [expr {($left << $kOutShiftLeft) & 0xffffffff}]
-		set kDataRight [expr {(($right >> $kOutShiftRight) & $kOutMaskRight) | $temp}]
-		# If necessary, copy message bytes into input bit cache.
-		if {([string length $bitCacheIn] < $kbits)  && ($n < $len)} {
-		    if {$len - $n < $msgBytes} {
-			set lastBits [expr {($len - $n) * 8}]
-			###puts -nonewline [binary scan $message x${n}B$lastBits newBits]
-			binary scan $message x${n}B$lastBits newBits
-		    } else {
-			# Extract "msgBytes" whole bytes as bits
-			###puts -nonewline [binary scan $message x${n}B$msgBits newBits]
-			binary scan $message x${n}B$msgBits newBits
-		    }
-		    incr n $msgBytes
-		    # Add the bits to the input bit cache.
-		    append bitCacheIn $newBits
-		}
-		# Set up message data from input bit cache.
-		# puts "Bits from cache: [set temp [string range $bitCacheIn 0 $kbitsSub1]]"
-		# puts "Length of bit string: [string length $temp]"
-		binary scan [binary format B64 [format %064s [string range $bitCacheIn 0 $kbitsSub1]]] H8H8 leftTemp rightTemp
-		set msgDataLeft "0x$leftTemp"
-		set msgDataRight "0x$rightTemp"
-		# puts "msgDataLeft: $msgDataLeft"
-		# puts "msgDataRight: $msgDataRight"
-		# puts "kDataLeft: [format 0x%08x $kDataLeft]"
-		# puts "kDataRight: [format 0x%08x $kDataRight]"
-		# Mix message bits with crypto bits.
-		set mixDataLeft [expr {$msgDataLeft ^ $kDataLeft}]
-		set mixDataRight [expr {$msgDataRight ^ $kDataRight}]
-		# puts "mixDataLeft: $mixDataLeft"
-		# puts "mixDataRight: $mixDataRight"
-		# puts "mixDataLeft: [format 0x%08x $mixDataLeft]"
-		# puts "mixDataRight: [format 0x%08x $mixDataRight]"
-		# Discard collected bits from the input bit cache.
-		set bitCacheIn [string range $bitCacheIn $kbits end]
-		# Convert back to a bit stream and
-		# append to the output bit cache.
-		# Only the lower kbits are wanted.
-		binary scan \
-		    [binary format H8H8 \
-			 [format %08x $mixDataLeft] \
-			 [format %08x $mixDataRight]] B64 msgOut
-		append bitCacheOut [string range $msgOut $xbits end]
-		# If there are sufficient bits, move
-		# bytes to the temporary holding string.
-		if {[string length $bitCacheOut] >= $msgBits} {
-		    append tempresult \
-			[binary format B$msgBits \
-			     [string range $bitCacheOut 0 $msgBitsSub1]]
-		    set bitCacheOut [string range $bitCacheOut $msgBits end]
-		    incr m $msgBytes
-		    incr chunk $msgBytes
-		}
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set temp \
-			    [expr {($right << $kOutShiftRight) & 0xffffffff}]
-			set left [expr {$temp | $mixDataLeft}]
-			set right $mixDataRight
-		    } else {
-			set temp \
-			    [expr {($right << $kOutShiftRight) & 0xffffffff}]
-			set left [expr {$temp | $msgDataLeft}]
-			set right $msgDataRight
-		    }
-		}
-	    } else {
-		# All 64 bits of output are used.
-		set kDataLeft $left
-		set kDataRight $right
-		# Eight messages bytes are needed per iteration.
-		binary scan $message x${m}H8H8 leftTemp rightTemp
-		incr m 8
-		incr chunk 8
-		set msgDataLeft "0x$leftTemp"
-		set msgDataRight "0x$rightTemp"
-		# Mix message bits with crypto bits.
-		set mixDataLeft [expr {$msgDataLeft ^ $kDataLeft}]
-		set mixDataRight [expr {$msgDataRight ^ $kDataRight}]
-		# Move bytes to the temporary holding string.
-		append tempresult \
-		    [binary format H16 \
-			 [format %08x%08x $mixDataLeft $mixDataRight]]
-		# For CFB mode
-		if {$mode == 1} {
-		    if {$encrypt} {
-			set left $mixDataLeft
-			set right $mixDataRight
-		    } else {
-			set left $msgDataLeft
-			set right $msgDataRight
-		    }
-		}
-	    }
-
-	    #puts "Left final: [format %08x $left]";
-	    #puts "Right final: [format %08x $right]"
-
-	    if {$chunk >= 512} {
-		append result $tempresult
-		set tempresult {};
-		set chunk 0;
-	    }
-	}; # For every 8 characters, or 64 bits in the message
-        #puts "End: |[format 0x%08x $left]| |[format 0x%08x $right]|"
-	# Save the left and right registers to the feedback vector.
-	set ivec [binary format H* [format %08x $left][format %08x $right]]
-	#puts "Saved Feedback vector: $fbvectors($fbvector)"
-
-        append result $tempresult
-	if {[string length $result] > $len} {
-	    set result [string replace $result $len end]
-	}
-	# Return the result as an array
-	return $result
-    }; # End of stream
-
-    variable pc2bytes0 [list 0 0x4 0x20000000 0x20000004 0x10000 0x10004 0x20010000 0x20010004 0x200 0x204 0x20000200 0x20000204 0x10200 0x10204 0x20010200 0x20010204]
-    variable pc2bytes1 [list 0 0x1 0x100000 0x100001 0x4000000 0x4000001 0x4100000 0x4100001 0x100 0x101 0x100100 0x100101 0x4000100 0x4000101 0x4100100 0x4100101]
-    variable pc2bytes2 [list 0 0x8 0x800 0x808 0x1000000 0x1000008 0x1000800 0x1000808 0 0x8 0x800 0x808 0x1000000 0x1000008 0x1000800 0x1000808]
-    variable pc2bytes3 [list 0 0x200000 0x8000000 0x8200000 0x2000 0x202000 0x8002000 0x8202000 0x20000 0x220000 0x8020000 0x8220000 0x22000 0x222000 0x8022000 0x8222000]
-    variable pc2bytes4 [list 0 0x40000 0x10 0x40010 0 0x40000 0x10 0x40010 0x1000 0x41000 0x1010 0x41010 0x1000 0x41000 0x1010 0x41010]
-    variable pc2bytes5 [list 0 0x400 0x20 0x420 0 0x400 0x20 0x420 0x2000000 0x2000400 0x2000020 0x2000420 0x2000000 0x2000400 0x2000020 0x2000420]
-    variable pc2bytes6 [list 0 0x10000000 0x80000 0x10080000 0x2 0x10000002 0x80002 0x10080002 0 0x10000000 0x80000 0x10080000 0x2 0x10000002 0x80002 0x10080002]
-    variable pc2bytes7 [list 0 0x10000 0x800 0x10800 0x20000000 0x20010000 0x20000800 0x20010800 0x20000 0x30000 0x20800 0x30800 0x20020000 0x20030000 0x20020800 0x20030800]
-    variable pc2bytes8 [list 0 0x40000 0 0x40000 0x2 0x40002 0x2 0x40002 0x2000000 0x2040000 0x2000000 0x2040000 0x2000002 0x2040002 0x2000002 0x2040002]
-    variable pc2bytes9 [list 0 0x10000000 0x8 0x10000008 0 0x10000000 0x8 0x10000008 0x400 0x10000400 0x408 0x10000408 0x400 0x10000400 0x408 0x10000408]
-    variable pc2bytes10 [list 0 0x20 0 0x20 0x100000 0x100020 0x100000 0x100020 0x2000 0x2020 0x2000 0x2020 0x102000 0x102020 0x102000 0x102020]
-    variable pc2bytes11 [list 0 0x1000000 0x200 0x1000200 0x200000 0x1200000 0x200200 0x1200200 0x4000000 0x5000000 0x4000200 0x5000200 0x4200000 0x5200000 0x4200200 0x5200200]
-    variable pc2bytes12 [list 0 0x1000 0x8000000 0x8001000 0x80000 0x81000 0x8080000 0x8081000 0x10 0x1010 0x8000010 0x8001010 0x80010 0x81010 0x8080010 0x8081010]
-    variable pc2bytes13 [list 0 0x4 0x100 0x104 0 0x4 0x100 0x104 0x1 0x5 0x101 0x105 0x1 0x5 0x101 0x105]
-
-    # Now define the left shifts which need to be done
-    variable shifts {0  0  1  1  1  1  1  1  0  1  1  1  1  1  1  0};
-
-    # Procedure: createKeys
-    # Input:
-    #   key     : The 64-bit DES key (Note: The lsb of each byte
-    #             is ignored; odd parity is not required).
-    #
-    #   weak:   If true then weak keys are allowed. The default is to raise an
-    #           error when a weak key is seen.
-    # Output:
-    # The 16 (DES) subkeys.
-    proc createKeys {key {weak 0}} {
-	variable pc2bytes0
-	variable pc2bytes1
-	variable pc2bytes2
-	variable pc2bytes3
-	variable pc2bytes4
-	variable pc2bytes5
-	variable pc2bytes6
-	variable pc2bytes7
-	variable pc2bytes8
-	variable pc2bytes9
-	variable pc2bytes10
-	variable pc2bytes11
-	variable pc2bytes12
-	variable pc2bytes13
-	variable shifts
-
-	# Stores the return keys
-	set keys {}
-	# Other variables
-	set lefttemp {}; set righttemp {}
-	binary scan $key H8H8 lefttemp righttemp
-	set left {}
-	append left "0x" $lefttemp
-	set right {}
-	append right "0x" $righttemp
-
-	#puts "Left key: $left"
-	#puts "Right key: $right"
-
-	# Test for weak keys
-        if {! $weak} {
-            set maskedLeft [expr {$left & 0xfefefefe}]
-            set maskedRight [expr {$right & 0xfefefefe}]
-            if {($maskedLeft == 0x00000000) \
-                    && ($maskedRight == 0x00000000)} {
-                error "The key is weak!"
-            } elseif {($maskedLeft == 0x1e1e1e1e) \
-                          && ($maskedRight == 0x0e0e0e0e)} {
-                error "The key is weak!"
-            } elseif {($maskedLeft == 0xe0e0e0e0) \
-                          && ($maskedRight == 0xf0f0f0f0)} {
-                error "The key is weak!"
-            } elseif {($maskedLeft == 0xfefefefe) \
-                          && ($maskedRight == 0xfefefefe)} {
-                error "The key is weak!"
-            }
-        }
-
-	set temp [expr {(($left >> 4) ^ $right) & 0x0f0f0f0f}]
-	set right [expr {$right ^ $temp}]
-	set left [expr {$left ^ ($temp << 4)}]
-	set temp [expr {(($right >> 16) ^ $left) & 0x0000ffff}]
-	set left [expr {$left ^ $temp}]
-	set right [expr {$right ^ ($temp << 16)}]
-	set temp [expr {(($left >> 2) ^ $right) & 0x33333333}]
-	set right [expr {$right ^ $temp}]
-	set left [expr {$left ^ ($temp << 2)}]
-	set temp [expr {(($right >> 16) ^ $left) & 0x0000ffff}]
-	set left [expr {$left ^ $temp}]
-	set right [expr {$right ^ ($temp << 16)}]
-	set temp [expr {(($left >> 1) ^ $right) & 0x55555555}]
-	set right [expr {$right ^ $temp}]
-	set left [expr {$left ^ ($temp << 1)}]
-	set temp [expr {(($right >> 8) ^ $left) & 0x00ff00ff}]
-	set left [expr {$left ^ $temp}]
-	set right [expr {$right ^ ($temp << 8)}]
-	set temp [expr {(($left >> 1) ^ $right) & 0x55555555}]
-	set right [expr $right ^ $temp]
-	set left [expr {$left ^ ($temp << 1)}]
-	    
-	# puts "Left key PC1: [format %x $left]"
-	# puts "Right key PC1: [format %x $right]"
-
-	# The right side needs to be shifted and to get
-	# the last four bits of the left side
-	set temp [expr {($left << 8) | (($right >> 20) & 0x000000f0)}];
-	# Left needs to be put upside down
-	set left [expr {($right << 24) | (($right << 8) & 0x00ff0000) | \
-			    (($right >> 8) & 0x0000ff00) \
-			    | (($right >> 24) & 0x000000f0)}];
-	set right $temp;
-
-	#puts "Left key juggle: [format %x $left]"
-	#puts "Right key juggle: [format %x $right]"
-
-	# Now go through and perform these
-	# shifts on the left and right keys.
-	foreach i $shifts  {
-	    # Shift the keys either one or two bits to the left.
-	    if {$i} {
-		set left [expr {($left << 2) \
-				    | (($left >> 26) & 0x0000003f)}];
-		set right [expr {($right << 2) \
-				     | (($right >> 26) & 0x0000003f)}];
-	    } else {
-		set left [expr {($left << 1) \
-				    | (($left >> 27) & 0x0000001f)}];
-		set right [expr {($right << 1) \
-				     | (($right >> 27) & 0x0000001f)}];
-	    }
-	    set left [expr {$left & 0xfffffff0}];
-	    set right [expr {$right & 0xfffffff0}];
-
-	    # Now apply PC-2, in such a way that E is easier when encrypting or
-	    # decrypting this conversion will look like PC-2 except only the
-	    # last 6 bits of each byte are used rather than 48 consecutive bits
-	    # and the order of lines will be according to how the S selection
-	    # functions will be applied: S2, S4, S6, S8, S1, S3, S5, S7.
-	    set lefttemp [expr {[lindex $pc2bytes0 [expr {($left >> 28) & 0x0000000f}]] | \
-				    [lindex $pc2bytes1 [expr {($left >> 24) & 0x0000000f}]] | \
-				    [lindex $pc2bytes2 [expr {($left >> 20) & 0x0000000f}]] | \
-				    [lindex $pc2bytes3 [expr {($left >> 16) & 0x0000000f}]] | \
-				    [lindex $pc2bytes4 [expr {($left >> 12) & 0x0000000f}]] | \
-				    [lindex $pc2bytes5 [expr {($left >> 8) & 0x0000000f}]] | \
-				    [lindex $pc2bytes6 [expr {($left >> 4) & 0x0000000f}]]}];
-	    set righttemp [expr {[lindex $pc2bytes7 [expr {($right >> 28) & 0x0000000f}]] | \
-				     [lindex $pc2bytes8 [expr {($right >> 24) & 0x0000000f}]] | \
-				     [lindex $pc2bytes9 [expr {($right >> 20) & 0x0000000f}]] | \
-				     [lindex $pc2bytes10 [expr {($right >> 16) & 0x0000000f}]] | \
-				     [lindex $pc2bytes11 [expr {($right >> 12) & 0x0000000f}]] | \
-				     [lindex $pc2bytes12 [expr {($right >> 8) & 0x0000000f}]] | \
-				     [lindex $pc2bytes13 [expr {($right >> 4) & 0x0000000f}]]}];
-	    set temp [expr {(($righttemp >> 16) ^ $lefttemp) & 0x0000ffff}];
-	    lappend keys [expr {$lefttemp ^ $temp}];
-	    lappend keys [expr {$righttemp ^ ($temp << 16)}];
-	}
-	# Return the keys we've created.
-	return $keys;
-    }; # End of createKeys.
-}; # End of des namespace eval.
-
-package provide tclDESjr 1.0.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/dns.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/dns.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1422 +1,0 @@
-# dns.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Provide a Tcl only Domain Name Service client. See RFC 1034 and RFC 1035
-# for information about the DNS protocol. This should insulate Tcl scripts
-# from problems with using the system library resolver for slow name servers.
-#
-# This implementation uses TCP only for DNS queries. The protocol reccommends
-# that UDP be used in these cases but Tcl does not include UDP sockets by
-# default. The package should be simple to extend to use a TclUDP extension
-# in the future.
-#
-# Support for SPF (http://spf.pobox.com/rfcs.html) will need updating
-# if or when the proposed draft becomes accepted.
-#
-# Support added for RFC1886 - DNS Extensions to support IP version 6
-# Support added for RFC2782 - DNS RR for specifying the location of services
-# Support added for RFC1995 - Incremental Zone Transfer in DNS
-#
-# TODO:
-#  - When using tcp we should make better use of the open connection and
-#    send multiple queries along the same connection.
-#
-#  - We must switch to using TCP for truncated UDP packets.
-#
-#  - Read RFC 2136 - dynamic updating of DNS
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: dns.tcl,v 1.35 2007/08/26 00:44:34 patthoyts Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-package require logger;                 # tcllib 1.3
-package require uri;                    # tcllib 1.1
-package require uri::urn;               # tcllib 1.2
-package require ip;                     # tcllib 1.7
-
-namespace eval ::dns {
-    variable version 1.3.2
-    variable rcsid {$Id: dns.tcl,v 1.35 2007/08/26 00:44:34 patthoyts Exp $}
-
-    namespace export configure resolve name address cname \
-        status reset wait cleanup errorcode
-
-    variable options
-    if {![info exists options]} {
-        array set options {
-            port       53
-            timeout    30000
-            protocol   tcp
-            search     {}
-            nameserver {localhost}
-            loglevel   warn
-        }
-        variable log [logger::init dns]
-        ${log}::setlevel $options(loglevel)
-    }
-
-    # We can use either ceptcl or tcludp for UDP support.
-    if {![catch {package require udp 1.0.4} msg]} { ;# tcludp 1.0.4+
-        # If TclUDP 1.0.4 or better is available, use it.
-        set options(protocol) udp
-    } else {
-        if {![catch {package require ceptcl} msg]} {
-            set options(protocol) udp
-        }
-    }
-
-    variable types
-    array set types { 
-        A 1  NS 2  MD 3  MF 4  CNAME 5  SOA 6  MB 7  MG 8  MR 9 
-        NULL 10  WKS 11  PTR 12  HINFO 13  MINFO 14  MX 15  TXT 16
-        SPF 16 AAAA 28 SRV 33 IXFR 251 AXFR 252  MAILB 253  MAILA 254
-        ANY 255 * 255
-    } 
-
-    variable classes
-    array set classes { IN 1  CS 2  CH  3  HS 4  * 255}
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Configure the DNS package. In particular the local nameserver will need
-#  to be set. With no options, returns a list of all current settings.
-#
-proc ::dns::configure {args} {
-    variable options
-    variable log
-
-    if {[llength $args] < 1} {
-        set r {}
-        foreach opt [lsort [array names options]] {
-            lappend r -$opt $options($opt)
-        }
-        return $r
-    }
-
-    set cget 0
-    if {[llength $args] == 1} {
-        set cget 1
-    }
-   
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -n* -
-            -ser* {
-                if {$cget} {
-                    return $options(nameserver) 
-                } else {
-                    set options(nameserver) [Pop args 1] 
-                }
-            }
-            -po*  { 
-                if {$cget} {
-                    return $options(port)
-                } else {
-                    set options(port) [Pop args 1] 
-                }
-            }
-            -ti*  { 
-                if {$cget} {
-                    return $options(timeout)
-                } else {
-                    set options(timeout) [Pop args 1]
-                }
-            }
-            -pr*  {
-                if {$cget} {
-                    return $options(protocol)
-                } else {
-                    set proto [string tolower [Pop args 1]]
-                    if {[string compare udp $proto] == 0 \
-                            && [string compare tcp $proto] == 0} {
-                        return -code error "invalid protocol \"$proto\":\
-                            protocol must be either \"udp\" or \"tcp\""
-                    }
-                    set options(protocol) $proto 
-                }
-            }
-            -sea* { 
-                if {$cget} {
-                    return $options(search)
-                } else {
-                    set options(search) [Pop args 1] 
-                }
-            }
-            -log* {
-                if {$cget} {
-                    return $options(loglevel)
-                } else {
-                    set options(loglevel) [Pop args 1]
-                    ${log}::setlevel $options(loglevel)
-                }
-            }
-            --    { Pop args ; break }
-            default {
-                set opts [join [lsort [array names options]] ", -"]
-                return -code error "bad option [lindex $args 0]:\
-                        must be one of -$opts"
-            }
-        }
-        Pop args
-    }
-
-    return
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Create a DNS query and send to the specified name server. Returns a token
-#  to be used to obtain any further information about this query.
-#
-proc ::dns::resolve {query args} {
-    variable uid
-    variable options
-    variable log
-
-    # get a guaranteed unique and non-present token id.
-    set id [incr uid]
-    while {[info exists [set token [namespace current]::$id]]} {
-        set id [incr uid]
-    }
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    # Setup token/state defaults.
-    set state(id)          $id
-    set state(query)       $query
-    set state(qdata)       ""
-    set state(opcode)      0;                   # 0 = query, 1 = inverse query.
-    set state(-type)       A;                   # DNS record type (A address)
-    set state(-class)      IN;                  # IN (internet address space)
-    set state(-recurse)    1;                   # Recursion Desired
-    set state(-command)    {};                  # asynchronous handler
-    set state(-timeout)    $options(timeout);   # connection timeout default.
-    set state(-nameserver) $options(nameserver);# default nameserver
-    set state(-port)       $options(port);      # default namerservers port
-    set state(-search)     $options(search);    # domain search list
-    set state(-protocol)   $options(protocol);  # which protocol udp/tcp
-
-    # Handle DNS URL's
-    if {[string match "dns:*" $query]} {
-        array set URI [uri::split $query]
-        foreach {opt value} [uri::split $query] {
-            if {$value != {} && [info exists state(-$opt)]} {
-                set state(-$opt) $value
-            }   
-        }
-        set state(query) $URI(query)
-        ${log}::debug "parsed query: $query"
-    }
-
-    while {[string match -* [lindex $args 0]]} {
-        switch -glob -- [lindex $args 0] {
-            -n* - ns -
-            -ser* { set state(-nameserver) [Pop args 1] }
-            -po*  { set state(-port) [Pop args 1] }
-            -ti*  { set state(-timeout) [Pop args 1] }
-            -co*  { set state(-command) [Pop args 1] }
-            -cl*  { set state(-class) [Pop args 1] }
-            -ty*  { set state(-type) [Pop args 1] }
-            -pr*  { set state(-protocol) [Pop args 1] }
-            -sea* { set state(-search) [Pop args 1] }
-            -re*  { set state(-recurse) [Pop args 1] }
-            -inv* { set state(opcode) 1 }
-            -status {set state(opcode) 2}
-            -data { set state(qdata) [Pop args 1] }
-            default {
-                set opts [join [lsort [array names state -*]] ", "]
-                return -code error "bad option [lindex $args 0]: \
-                        must be $opts"
-            }
-        }
-        Pop args
-    }
-
-    if {$state(-nameserver) == {}} {
-        return -code error "no nameserver specified"
-    }
-
-    if {$state(-protocol) == "udp"} {
-        if {[llength [package provide ceptcl]] == 0 \
-                && [llength [package provide udp]] == 0} {
-            return -code error "udp support is not available,\
-                get ceptcl or tcludp"
-        }
-    }
-    
-    # Check for reverse lookups
-    if {[regexp {^(?:\d{0,3}\.){3}\d{0,3}$} $state(query)]} {
-        set addr [lreverse [split $state(query) .]]
-        lappend addr in-addr arpa
-        set state(query) [join $addr .]
-        set state(-type) PTR
-    }
-
-    BuildMessage $token
-    
-    if {$state(-protocol) == "tcp"} {
-        TcpTransmit $token
-        if {$state(-command) == {}} {
-            wait $token
-        }
-    } else {
-        UdpTransmit $token
-    }
-    
-    return $token
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Return a list of domain names returned as results for the last query.
-#
-proc ::dns::name {token} {
-    set r {}
-    Flags $token flags
-    array set reply [Decode $token]
-
-    switch -exact -- $flags(opcode) {
-        0 {
-            # QUERY
-            foreach answer $reply(AN) {
-                array set AN $answer
-                if {![info exists AN(type)]} {set AN(type) {}}
-                switch -exact -- $AN(type) {
-                    MX - NS - PTR {
-                        if {[info exists AN(rdata)]} {lappend r $AN(rdata)}
-                    }
-                    default {
-                        if {[info exists AN(name)]} {
-                            lappend r $AN(name)
-                        }
-                    }
-                }
-            }
-        }
-
-        1 {
-            # IQUERY
-            foreach answer $reply(QD) {
-                array set QD $answer
-                lappend r $QD(name)
-            }
-        }
-        default {
-            return -code error "not supported for this query type"
-        }
-    }
-    return $r
-}
-
-# Description:
-#  Return a list of the IP addresses returned for this query.
-#
-proc ::dns::address {token} {
-    set r {}
-    array set reply [Decode $token]
-    foreach answer $reply(AN) {
-        array set AN $answer
-
-        if {[info exists AN(type)]} {
-            switch -exact -- $AN(type) {
-                "A" {
-                    lappend r $AN(rdata)
-                }
-                "AAAA" {
-                    lappend r $AN(rdata)
-                }
-            }
-        }
-    }
-    return $r
-}
-
-# Description:
-#  Return a list of all CNAME results returned for this query.
-#
-proc ::dns::cname {token} {
-    set r {}
-    array set reply [Decode $token]
-    foreach answer $reply(AN) {
-        array set AN $answer
-
-        if {[info exists AN(type)]} {
-            if {$AN(type) == "CNAME"} {
-                lappend r $AN(rdata)
-            }
-        }
-    }
-    return $r
-}
-
-# Description:
-#   Return the decoded answer records. This can be used for more complex
-#   queries where the answer isn't supported byb cname/address/name.
-proc ::dns::result {token args} {
-    array set reply [eval [linsert $args 0 Decode $token]]
-    return $reply(AN)
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Get the status of the request.
-#
-proc ::dns::status {token} {
-    upvar #0 $token state
-    return $state(status)
-}
-
-# Description:
-#  Get the error message. Empty if no error.
-#
-proc ::dns::error {token} {
-    upvar #0 $token state
-    if {[info exists state(error)]} {
-	return $state(error)
-    }
-    return ""
-}
-
-# Description
-#  Get the error code. This is 0 for a successful transaction.
-#
-proc ::dns::errorcode {token} {
-    upvar #0 $token state
-    set flags [Flags $token]
-    set ndx [lsearch -exact $flags errorcode]
-    incr ndx
-    return [lindex $flags $ndx]
-}
-
-# Description:
-#  Reset a connection with optional reason.
-#
-proc ::dns::reset {token {why reset} {errormsg {}}} {
-    upvar #0 $token state
-    set state(status) $why
-    if {[string length $errormsg] > 0 && ![info exists state(error)]} {
-        set state(error) $errormsg
-    }
-    catch {fileevent $state(sock) readable {}}
-    Finish $token
-}
-
-# Description:
-#  Wait for a request to complete and return the status.
-#
-proc ::dns::wait {token} {
-    upvar #0 $token state
-
-    if {$state(status) == "connect"} {
-        vwait [subst $token](status)
-    }
-
-    return $state(status)
-}
-
-# Description:
-#  Remove any state associated with this token.
-#
-proc ::dns::cleanup {token} {
-    upvar #0 $token state
-    if {[info exists state]} {
-        catch {close $state(sock)}
-        catch {after cancel $state(after)}
-        unset state
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Dump the raw data of the request and reply packets.
-#
-proc ::dns::dump {args} {
-    if {[llength $args] == 1} {
-        set type -reply
-        set token [lindex $args 0]
-    } elseif { [llength $args] == 2 } {
-        set type [lindex $args 0]
-        set token [lindex $args 1]
-    } else {
-        return -code error "wrong # args:\
-            should be \"dump ?option? methodName\""
-    }
-
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    set result {}
-    switch -glob -- $type {
-        -qu*    -
-        -req*   {
-            set result [DumpMessage $state(request)]
-        }
-        -rep*   {
-            set result [DumpMessage $state(reply)]
-        }
-        default {
-            error "unrecognised option: must be one of \
-                    \"-query\", \"-request\" or \"-reply\""
-        }
-    }
-
-    return $result
-}
-
-# Description:
-#  Perform a hex dump of binary data.
-#
-proc ::dns::DumpMessage {data} {
-    set result {}
-    binary scan $data c* r
-    foreach c $r {
-        append result [format "%02x " [expr {$c & 0xff}]]
-    }
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Contruct a DNS query packet.
-#
-proc ::dns::BuildMessage {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    variable types
-    variable classes
-    variable options
-
-    if {! [info exists types($state(-type))] } {
-        return -code error "invalid DNS query type"
-    }
-
-    if {! [info exists classes($state(-class))] } {
-        return -code error "invalid DNS query class"
-    }
-
-    set qdcount 0
-    set qsection {}
-    set nscount 0
-    set nsdata {}
-
-    # In theory we can send multiple queries. In practice, named doesn't
-    # appear to like that much. If it did work we'd do this:
-    #  foreach domain [linsert $options(search) 0 {}] ...
-
-
-    # Pack the query: QNAME QTYPE QCLASS
-    set qsection [PackName $state(query)]
-    append qsection [binary format SS \
-                         $types($state(-type))\
-                         $classes($state(-class))]
-    incr qdcount
-
-    if {[string length $state(qdata)] > 0} {
-        set nsdata [eval [linsert $state(qdata) 0 PackRecord]]
-        incr nscount
-    }
-
-    switch -exact -- $state(opcode) {
-        0 {
-            # QUERY
-            set state(request) [binary format SSSSSS $state(id) \
-                [expr {($state(opcode) << 11) | ($state(-recurse) << 8)}] \
-                                    $qdcount 0 $nscount 0]
-            append state(request) $qsection $nsdata
-        }
-        1 {
-            # IQUERY            
-            set state(request) [binary format SSSSSS $state(id) \
-                [expr {($state(opcode) << 11) | ($state(-recurse) << 8)}] \
-                0 $qdcount 0 0 0]
-            append state(request) \
-                [binary format cSSI 0 \
-                     $types($state(-type)) $classes($state(-class)) 0]
-            switch -exact -- $state(-type) {
-                A {
-                    append state(request) \
-                        [binary format Sc4 4 [split $state(query) .]]
-                }
-                PTR {
-                    append state(request) \
-                        [binary format Sc4 4 [split $state(query) .]]
-                }
-                default {
-                    return -code error "inverse query not supported for this type"
-                }
-            }
-        }
-        default {
-            return -code error "operation not supported"
-        }
-    }
-
-    return
-}
-
-# Pack a human readable dns name into a DNS resource record format.
-proc ::dns::PackName {name} {
-    set data ""
-    foreach part [split [string trim $name .] .] {
-        set len [string length $part]
-        append data [binary format ca$len $len $part]
-    }
-    append data \x00
-    return $data
-}
-
-# Pack a character string - byte length prefixed
-proc ::dns::PackString {text} {
-    set len [string length $text]
-    set data [binary format ca$len $len $text]
-    return $data
-}
-
-# Pack up a single DNS resource record. See RFC1035: 3.2 for the format
-# of each type.
-# eg: PackRecord name wiki.tcl.tk type MX class IN rdata {10 mail.example.com}
-#
-proc ::dns::PackRecord {args} {
-    variable types
-    variable classes
-    array set rr {name "" type A class IN ttl 0 rdlength 0 rdata ""}
-    array set rr $args
-    set data [PackName $rr(name)]
-
-    switch -exact -- $rr(type) {
-        CNAME - MB - MD - MF - MG - MR - NS - PTR {
-            set rr(rdata) [PackName $rr(rdata)] 
-        }
-        HINFO { 
-            array set r {CPU {} OS {}}
-            array set r $rr(rdata)
-            set rr(rdata) [PackString $r(CPU)]
-            append rr(rdata) [PackString $r(OS)]
-        }
-        MINFO {
-            array set r {RMAILBX {} EMAILBX {}}
-            array set r $rr(rdata)
-            set rr(rdata) [PackString $r(RMAILBX)]
-            append rr(rdata) [PackString $r(EMAILBX)]
-        }
-        MX {
-            foreach {pref exch} $rr(rdata) break
-            set rr(rdata) [binary format S $pref]
-            append rr(rdata) [PackName $exch]
-        }
-        TXT {
-            set str $rr(rdata)
-            set len [string length [set str $rr(rdata)]]
-            set rr(rdata) ""
-            for {set n 0} {$n < $len} {incr n} {
-                set s [string range $str $n [incr n 253]]
-                append rr(rdata) [PackString $s]
-            }
-        }          
-        NULL {}
-        SOA {
-            array set r {MNAME {} RNAME {}
-                SERIAL 0 REFRESH 0 RETRY 0 EXPIRE 0 MINIMUM 0}
-            array set r $rr(rdata)
-            set rr(rdata) [PackName $r(MNAME)]
-            append rr(rdata) [PackName $r(RNAME)]
-            append rr(rdata) [binary format IIIII $r(SERIAL) \
-                                  $r(REFRESH) $r(RETRY) $r(EXPIRE) $r(MINIMUM)]
-        }
-    }
-
-    # append the root label and the type flag and query class.
-    append data [binary format SSIS $types($rr(type)) \
-                     $classes($rr(class)) $rr(ttl) [string length $rr(rdata)]]
-    append data $rr(rdata)
-    return $data
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Transmit a DNS request over a tcp connection.
-#
-proc ::dns::TcpTransmit {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    # setup the timeout
-    if {$state(-timeout) > 0} {
-        set state(after) [after $state(-timeout) \
-                              [list [namespace origin reset] \
-                                   $token timeout\
-                                   "operation timed out"]]
-    }
-
-    # Sometimes DNS servers drop TCP requests. So it's better to
-    # use asynchronous connect
-    set s [socket -async $state(-nameserver) $state(-port)]
-    fileevent $s writable [list [namespace origin TcpConnected] $token $s]
-    set state(sock) $s
-    set state(status) connect
-
-    return $token
-}
-
-proc ::dns::TcpConnected {token s} {
-    variable $token
-    upvar 0 $token state
-
-    fileevent $s writable {}
-    if {[catch {fconfigure $s -peername}]} {
-	# TCP connection failed
-        Finish $token "can't connect to server"
-	return
-    }
-
-    fconfigure $s -blocking 0 -translation binary -buffering none
-
-    # For TCP the message must be prefixed with a 16bit length field.
-    set req [binary format S [string length $state(request)]]
-    append req $state(request)
-
-    puts -nonewline $s $req
-
-    fileevent $s readable [list [namespace current]::TcpEvent $token]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Transmit a DNS request using UDP datagrams
-#
-# Note:
-#  This requires a UDP implementation that can transmit binary data.
-#  As yet I have been unable to test this myself and the tcludp package
-#  cannot do this.
-#
-proc ::dns::UdpTransmit {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    # setup the timeout
-    if {$state(-timeout) > 0} {
-        set state(after) [after $state(-timeout) \
-                              [list [namespace origin reset] \
-                                   $token timeout\
-                                  "operation timed out"]]
-    }
-    
-    if {[llength [package provide ceptcl]] > 0} {
-        # using ceptcl
-        set state(sock) [cep -type datagram $state(-nameserver) $state(-port)]
-        fconfigure $state(sock) -blocking 0
-    } else {
-        # using tcludp
-        set state(sock) [udp_open]
-        udp_conf $state(sock) $state(-nameserver) $state(-port)
-    }
-    fconfigure $state(sock) -translation binary -buffering none
-    set state(status) connect
-    puts -nonewline $state(sock) $state(request)
-    
-    fileevent $state(sock) readable [list [namespace current]::UdpEvent $token]
-    
-    return $token
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Tidy up after a tcp transaction.
-#
-proc ::dns::Finish {token {errormsg ""}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    global errorInfo errorCode
-
-    if {[string length $errormsg] != 0} {
-	set state(error) $errormsg
-	set state(status) error
-    }
-    catch {close $state(sock)}
-    catch {after cancel $state(after)}
-    if {[info exists state(-command)] && $state(-command) != {}} {
-	if {[catch {eval $state(-command) {$token}} err]} {
-	    if {[string length $errormsg] == 0} {
-		set state(error) [list $err $errorInfo $errorCode]
-		set state(status) error
-	    }
-	}
-        if {[info exists state(-command)]} {
-            unset state(-command)
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Handle end-of-file on a tcp connection.
-#
-proc ::dns::Eof {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    set state(status) eof
-    Finish $token
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Process a DNS reply packet (protocol independent)
-#
-proc ::dns::Receive {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    binary scan $state(reply) SS id flags
-    set status [expr {$flags & 0x000F}]
-
-    switch -- $status {
-        0 {
-            set state(status) ok
-            Finish $token 
-        }
-        1 { Finish $token "Format error - unable to interpret the query." }
-        2 { Finish $token "Server failure - internal server error." }
-        3 { Finish $token "Name Error - domain does not exist" }
-        4 { Finish $token "Not implemented - the query type is not available." }
-        5 { Finish $token "Refused - your request has been refused by the server." }
-        default {
-            Finish $token "unrecognised error code: $err"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  file event handler for tcp socket. Wait for the reply data.
-#
-proc ::dns::TcpEvent {token} {
-    variable log
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    set s $state(sock)
-
-    if {[eof $s]} {
-        Eof $token
-        return
-    }
-
-    set status [catch {read $state(sock)} result]
-    if {$status != 0} {
-        ${log}::debug "Event error: $result"
-        Finish $token "error reading data: $result"
-    } elseif { [string length $result] >= 0 } {
-        if {[catch {
-            # Handle incomplete reads - check the size and keep reading.
-            if {![info exists state(size)]} {
-                binary scan $result S state(size)
-                set result [string range $result 2 end]            
-            }
-            append state(reply) $result
-            
-            # check the length and flags and chop off the tcp length prefix.
-            if {[string length $state(reply)] >= $state(size)} {
-                binary scan $result S id
-                set id [expr {$id & 0xFFFF}]
-                if {$id != [expr {$state(id) & 0xFFFF}]} {
-                    ${log}::error "received packed with incorrect id"
-                }
-                # bug #1158037 - doing this causes problems > 65535 requests!
-                #Receive [namespace current]::$id
-                Receive $token
-            } else {
-                ${log}::debug "Incomplete tcp read:\
-                   [string length $state(reply)] should be $state(size)"
-            }
-        } err]} {
-            Finish $token "Event error: $err"
-        }
-    } elseif { [eof $state(sock)] } {
-        Eof $token
-    } elseif { [fblocked $state(sock)] } {
-        ${log}::debug "Event blocked"
-    } else {
-        ${log}::critical "Event error: this can't happen!"
-        Finish $token "Event error: this can't happen!"
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  file event handler for udp sockets.
-proc ::dns::UdpEvent {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    set s $state(sock)
-
-    set payload [read $state(sock)]
-    append state(reply) $payload
-
-    binary scan $payload S id
-    set id [expr {$id & 0xFFFF}]
-    if {$id != [expr {$state(id) & 0xFFFF}]} {
-        ${log}::error "received packed with incorrect id"
-    }
-    # bug #1158037 - doing this causes problems > 65535 requests!
-    #Receive [namespace current]::$id
-    Receive $token
-}
-    
-# -------------------------------------------------------------------------
-
-proc ::dns::Flags {token {varname {}}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    if {$varname != {}} {
-        upvar $varname flags
-    }
-
-    array set flags {query 0 opcode 0 authoritative 0 errorcode 0
-        truncated 0 recursion_desired 0 recursion_allowed 0}
-
-    binary scan $state(reply) SSSSSS mid hdr nQD nAN nNS nAR
-
-    set flags(response)           [expr {($hdr & 0x8000) >> 15}]
-    set flags(opcode)             [expr {($hdr & 0x7800) >> 11}]
-    set flags(authoritative)      [expr {($hdr & 0x0400) >> 10}]
-    set flags(truncated)          [expr {($hdr & 0x0200) >> 9}]
-    set flags(recursion_desired)  [expr {($hdr & 0x0100) >> 8}]
-    set flafs(recursion_allowed)  [expr {($hdr & 0x0080) >> 7}]
-    set flags(errorcode)          [expr {($hdr & 0x000F)}]
-
-    return [array get flags]
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Decode a DNS packet (either query or response).
-#
-proc ::dns::Decode {token args} {
-    variable log
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set opts {-rdata 0 -query 0}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -rdata { set opts(-rdata) 1 }
-            -query { set opts(-query) 1 }
-            default {
-                return -code error "bad option \"$option\":\
-                    must be -rdata"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-query)} {
-        binary scan $state(request) SSSSSSc* mid hdr nQD nAN nNS nAR data
-    } else {
-        binary scan $state(reply) SSSSSSc* mid hdr nQD nAN nNS nAR data
-    }
-
-    set fResponse      [expr {($hdr & 0x8000) >> 15}]
-    set fOpcode        [expr {($hdr & 0x7800) >> 11}]
-    set fAuthoritative [expr {($hdr & 0x0400) >> 10}]
-    set fTrunc         [expr {($hdr & 0x0200) >> 9}]
-    set fRecurse       [expr {($hdr & 0x0100) >> 8}]
-    set fCanRecurse    [expr {($hdr & 0x0080) >> 7}]
-    set fRCode         [expr {($hdr & 0x000F)}]
-    set flags ""
-
-    if {$fResponse} {set flags "QR"} else {set flags "Q"}
-    set opcodes [list QUERY IQUERY STATUS]
-    lappend flags [lindex $opcodes $fOpcode]
-    if {$fAuthoritative} {lappend flags "AA"}
-    if {$fTrunc} {lappend flags "TC"}
-    if {$fRecurse} {lappend flags "RD"}
-    if {$fCanRecurse} {lappend flags "RA"}
-
-    set info "ID: $mid\
-              Fl: [format 0x%02X [expr {$hdr & 0xFFFF}]] ($flags)\
-              NQ: $nQD\
-              NA: $nAN\
-              NS: $nNS\
-              AR: $nAR"
-    ${log}::debug $info
-
-    set ndx 12
-    set r {}
-    set QD [ReadQuestion $nQD $state(reply) ndx]
-    lappend r QD $QD
-    set AN [ReadAnswer $nAN $state(reply) ndx $opts(-rdata)]
-    lappend r AN $AN
-    set NS [ReadAnswer $nNS $state(reply) ndx $opts(-rdata)]
-    lappend r NS $NS
-    set AR [ReadAnswer $nAR $state(reply) ndx $opts(-rdata)]
-    lappend r AR $AR
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::dns::Expand {data} {
-    set r {}
-    binary scan $data c* d
-    foreach c $d {
-        lappend r [expr {$c & 0xFF}]
-    }
-    return $r
-}
-
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::dns::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Reverse a list. Code from http://wiki.tcl.tk/tcl/43
-#
-proc ::dns::lreverse {lst} {
-    set res {}
-    set i [llength $lst]
-    while {$i} {lappend res [lindex $lst [incr i -1]]}
-    return $res
-}
-
-# -------------------------------------------------------------------------
-
-proc ::dns::KeyOf {arrayname value {default {}}} {
-    upvar $arrayname array
-    set lst [array get array]
-    set ndx [lsearch -exact $lst $value]
-    if {$ndx != -1} {
-        incr ndx -1
-        set r [lindex $lst $ndx]
-    } else {
-        set r $default
-    }
-    return $r
-}
-
-
-# -------------------------------------------------------------------------
-# Read the question section from a DNS message. This always starts at index
-# 12 of a message but may be of variable length.
-#
-proc ::dns::ReadQuestion {nitems data indexvar} {
-    variable types
-    variable classes
-    upvar $indexvar index
-    set result {}
-
-    for {set cn 0} {$cn < $nitems} {incr cn} {
-        set r {}
-        lappend r name [ReadName data $index offset]
-        incr index $offset
-        
-        # Read off QTYPE and QCLASS for this query.
-        set ndx $index
-        incr index 3
-        binary scan [string range $data $ndx $index] SS qtype qclass
-        set qtype [expr {$qtype & 0xFFFF}]
-        set qclass [expr {$qclass & 0xFFFF}]
-        incr index
-        lappend r type [KeyOf types $qtype $qtype] \
-                  class [KeyOf classes $qclass $qclass]
-        lappend result $r
-    }
-    return $result
-}
-        
-# -------------------------------------------------------------------------
-
-# Read an answer section from a DNS message. 
-#
-proc ::dns::ReadAnswer {nitems data indexvar {raw 0}} {
-    variable types
-    variable classes
-    upvar $indexvar index
-    set result {}
-
-    for {set cn 0} {$cn < $nitems} {incr cn} {
-        set r {}
-        lappend r name [ReadName data $index offset]
-        incr index $offset
-        
-        # Read off TYPE, CLASS, TTL and RDLENGTH
-        binary scan [string range $data $index end] SSIS type class ttl rdlength
-
-        set type [expr {$type & 0xFFFF}]
-        set type [KeyOf types $type $type]
-
-        set class [expr {$class & 0xFFFF}]
-        set class [KeyOf classes $class $class]
-
-        set ttl [expr {$ttl & 0xFFFFFFFF}]
-        set rdlength [expr {$rdlength & 0xFFFF}]
-        incr index 10
-        set rdata [string range $data $index [expr {$index + $rdlength - 1}]]
-
-        if {! $raw} {
-            switch -- $type {
-                A {
-                    set rdata [join [Expand $rdata] .]
-                }
-                AAAA {
-                    set rdata [ip::contract [ip::ToString $rdata]]
-                }
-                NS - CNAME - PTR {
-                    set rdata [ReadName data $index off] 
-                }
-                MX {
-                    binary scan $rdata S preference
-                    set exchange [ReadName data [expr {$index + 2}] off]
-                    set rdata [list $preference $exchange]
-                }
-                SRV {
-                    set x $index
-                    set rdata [list priority [ReadUShort data $x off]]
-                    incr x $off
-                    lappend rdata weight [ReadUShort data $x off]
-                    incr x $off
-                    lappend rdata port [ReadUShort data $x off]
-                    incr x $off
-                    lappend rdata target [ReadName data $x off]
-                    incr x $off
-                }
-                TXT {
-                    set rdata [ReadString data $index $rdlength]
-                }
-                SOA {
-                    set x $index
-                    set rdata [list MNAME [ReadName data $x off]]
-                    incr x $off 
-                    lappend rdata RNAME [ReadName data $x off]
-                    incr x $off
-                    lappend rdata SERIAL [ReadULong data $x off]
-                    incr x $off
-                    lappend rdata REFRESH [ReadLong data $x off]
-                    incr x $off
-                    lappend rdata RETRY [ReadLong data $x off]
-                    incr x $off
-                    lappend rdata EXPIRE [ReadLong data $x off]
-                    incr x $off
-                    lappend rdata MINIMUM [ReadULong data $x off]
-                    incr x $off
-                }
-            }
-        }
-
-        incr index $rdlength
-        lappend r type $type class $class ttl $ttl rdlength $rdlength rdata $rdata
-        lappend result $r
-    }
-    return $result
-}
-
-
-# Read a 32bit integer from a DNS packet. These are compatible with
-# the ReadName proc. Additionally - ReadULong takes measures to ensure 
-# the unsignedness of the value obtained.
-#
-proc ::dns::ReadLong {datavar index usedvar} {
-    upvar $datavar data
-    upvar $usedvar used
-    set r {}
-    set used 0
-    if {[binary scan $data @${index}I r]} {
-        set used 4
-    }
-    return $r
-}
-
-proc ::dns::ReadULong {datavar index usedvar} {
-    upvar $datavar data
-    upvar $usedvar used
-    set r {}
-    set used 0
-    if {[binary scan $data @${index}cccc b1 b2 b3 b4]} {
-        set used 4
-        # This gets us an unsigned value.
-        set r [expr {($b4 & 0xFF) + (($b3 & 0xFF) << 8) 
-                     + (($b2 & 0xFF) << 16) + ($b1 << 24)}] 
-    }
-    return $r
-}
-
-proc ::dns::ReadUShort {datavar index usedvar} {
-    upvar $datavar data
-    upvar $usedvar used
-    set r {}
-    set used 0
-    if {[binary scan [string range $data $index end] cc b1 b2]} {
-        set used 2
-        # This gets us an unsigned value.
-        set r [expr {(($b2 & 0xff) + (($b1 & 0xff) << 8)) & 0xffff}] 
-    }
-    return $r
-}
-
-# Read off the NAME or QNAME element. This reads off each label in turn, 
-# dereferencing pointer labels until we have finished. The length of data
-# used is passed back using the usedvar variable.
-#
-proc ::dns::ReadName {datavar index usedvar} {
-    upvar $datavar data
-    upvar $usedvar used
-    set startindex $index
-
-    set r {}
-    set len 1
-    set max [string length $data]
-    
-    while {$len != 0 && $index < $max} {
-        # Read the label length (and preread the pointer offset)
-        binary scan [string range $data $index end] cc len lenb
-        set len [expr {$len & 0xFF}]
-        incr index
-        
-        if {$len != 0} {
-            if {[expr {$len & 0xc0}]} {
-                binary scan [binary format cc [expr {$len & 0x3f}] [expr {$lenb & 0xff}]] S offset
-                incr index
-                lappend r [ReadName data $offset junk]
-                set len 0
-            } else {
-                lappend r [string range $data $index [expr {$index + $len - 1}]]
-                incr index $len
-            }
-        }
-    }
-    set used [expr {$index - $startindex}]
-    return [join $r .]
-}
-
-proc ::dns::ReadString {datavar index length} {
-    upvar $datavar data
-    set startindex $index
-
-    set r {}
-    set max [expr {$index + $length}]
-
-    while {$index < $max} {
-        binary scan [string range $data $index end] c len
-        set len [expr {$len & 0xFF}]
-        incr index
-
-        if {$len != 0} {
-            append r [string range $data $index [expr {$index + $len - 1}]]
-            incr index $len
-        }
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Support for finding the local nameservers
-#
-# For unix we can just parse the /etc/resolv.conf if it exists.
-# Of course, some unices use /etc/resolver and other things (NIS for instance)
-# On Windows, we can examine the Internet Explorer settings from the registry.
-#
-switch -exact $::tcl_platform(platform) {
-    windows {
-        proc ::dns::nameservers {} {
-            package require registry
-            set base {HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services}
-            set param "$base\\Tcpip\\Parameters"
-            set interfaces "$param\\Interfaces"
-            set nameservers {}
-            if {[string equal $::tcl_platform(os) "Windows NT"]} {
-                AppendRegistryValue $param NameServer nameservers
-                AppendRegistryValue $param DhcpNameServer nameservers
-                foreach i [registry keys $interfaces] {
-                    AppendRegistryValue "$interfaces\\$i" NameServer nameservers
-                    AppendRegistryValue "$interfaces\\$i" DhcpNameServer nameservers
-                }
-            } else {
-                set param "$base\\VxD\\MSTCP"
-                AppendRegistryValue $param NameServer nameservers
-            }
-            return $nameservers
-        }
-        proc ::dns::AppendRegistryValue {key val listName} {
-            upvar $listName lst
-            if {![catch {registry get $key $val} v]} {
-                foreach ns [split $v ", "] {
-                    if {[lsearch -exact $lst $ns] == -1} {
-                        lappend lst $ns
-                    }
-                }
-            }
-        }
-    }
-    unix {
-        proc ::dns::nameservers {} {
-            set nameservers {}
-            if {[file readable /etc/resolv.conf]} {
-                set f [open /etc/resolv.conf r]
-                while {![eof $f]} {
-                    gets $f line
-                    if {[regexp {^\s*nameserver\s+(.*)$} $line -> ns]} {
-                        lappend nameservers $ns
-                    }
-                }
-                close $f
-            }
-            if {[llength $nameservers] < 1} {
-                lappend nameservers 127.0.0.1
-            }
-            return $nameservers
-        }
-    }
-    default {
-        proc ::dns::nameservers {} {
-            return -code error "command not supported for this platform."
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Possible support for the DNS URL scheme.
-# Ref: http://www.ietf.org/internet-drafts/draft-josefsson-dns-url-04.txt
-# eg: dns:target?class=IN;type=A
-#     dns://nameserver/target?type=A
-#
-# URI quoting to be accounted for.
-#
-
-catch {
-    uri::register {dns} {
-        set escape     [set [namespace parent [namespace current]]::basic::escape]
-        set host       [set [namespace parent [namespace current]]::basic::host]
-        set hostOrPort [set [namespace parent [namespace current]]::basic::hostOrPort]
-
-        set class [string map {* \\\\*} \
-                       "class=([join [array names ::dns::classes] {|}])"]
-        set type  [string map {* \\\\*} \
-                       "type=([join [array names ::dns::types] {|}])"]
-        set classOrType "(?:${class}|${type})"
-        set classOrTypeSpec "(?:${class}|${type})(?:;(?:${class}|${type}))?"
-
-        set query "${host}(${classOrTypeSpec})?"
-        variable schemepart "(//${hostOrPort}/)?(${query})"
-        variable url "dns:$schemepart"
-    }
-}
-
-namespace eval ::uri {} ;# needed for pkg_mkIndex.
-
-proc ::uri::SplitDns {uri} {
-    upvar \#0 [namespace current]::dns::schemepart schemepart
-    upvar \#0 [namespace current]::dns::class classOrType
-    upvar \#0 [namespace current]::dns::class classRE
-    upvar \#0 [namespace current]::dns::type typeRE
-    upvar \#0 [namespace current]::dns::classOrTypeSpec classOrTypeSpec
-
-    array set parts {nameserver {} query {} class {} type {} port {}}
-
-    # validate the uri
-    if {[regexp -- $dns::schemepart $uri r] == 1} {
-
-        # deal with the optional class and type specifiers
-        if {[regexp -indices -- "${classOrTypeSpec}$" $uri range]} {
-            set spec [string range $uri [lindex $range 0] [lindex $range 1]]
-            set uri [string range $uri 0 [expr {[lindex $range 0] - 2}]]
-
-            if {[regexp -- "$classRE" $spec -> class]} {
-                set parts(class) $class
-            }
-            if {[regexp -- "$typeRE" $spec -> type]} {
-                set parts(type) $type
-            }
-        }
-
-        # Handle the nameserver specification
-        if {[string match "//*" $uri]} {
-            set uri [string range $uri 2 end]
-            array set tmp [GetHostPort uri]
-            set parts(nameserver) $tmp(host)
-            set parts(port) $tmp(port)
-        }
-        
-        # what's left is the query domain name.
-        set parts(query) [string trimleft $uri /]
-    }
-
-    return [array get parts]
-}
-
-proc ::uri::JoinDns {args} {
-    array set parts {nameserver {} port {} query {} class {} type {}}
-    array set parts $args
-    set query [::uri::urn::quote $parts(query)]
-    if {$parts(type) != {}} {
-        append query "?type=$parts(type)"
-    }
-    if {$parts(class) != {}} {
-        if {$parts(type) == {}} {
-            append query "?class=$parts(class)"
-        } else {
-            append query ";class=$parts(class)"
-        }
-    }
-    if {$parts(nameserver) != {}} {
-        set ns "$parts(nameserver)"
-        if {$parts(port) != {}} {
-            append ns ":$parts(port)"
-        }
-        set query "//${ns}/${query}"
-    }
-    return "dns:$query"
-}
-
-# -------------------------------------------------------------------------
-
-catch {dns::configure -nameserver [lindex [dns::nameservers] 0]}
-
-package provide dns $dns::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/ip.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/ip.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,369 +1,0 @@
-# ip.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Internet address manipulation.
-#
-# RFC 3513: IPv6 addressing.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: ip.tcl,v 1.12 2007/08/20 20:03:04 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: ipMoreC.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ip {
-    variable version 1.1.2
-    variable rcsid {$Id: ip.tcl,v 1.12 2007/08/20 20:03:04 andreas_kupries Exp $}
-
-    namespace export is version normalize equal type contract mask
-    #catch {namespace ensemble create}
-
-    variable IPv4Ranges
-    if {![info exists IPv4Ranges]} {
-        array set IPv4Ranges {
-            0/8        private
-            10/8       private
-            127/8      private
-            172.16/12  private
-            192.168/16 private
-            223/8      reserved
-            224/3      reserved
-        }
-    }
-
-    variable IPv6Ranges
-    if {![info exists IPv6Ranges]} {
-        # RFC 3513: 2.4
-        # RFC 3056: 2
-        array set IPv6Ranges {
-            2002::/16 "6to4 unicast"
-            fe80::/10 "link local"
-            fec0::/10 "site local"
-            ff00::/8  "multicast"
-            ::/128    "unspecified"
-            ::1/128   "localhost"
-        }
-    }
-}
-
-proc ::ip::is {class ip} {
-    foreach {ip mask} [split $ip /] break
-    switch -exact -- $class {
-        ipv4 - IPv4 - 4 {
-            return [IPv4? $ip]
-        }
-        ipv6 - IPv6 - 6 {
-            return [IPv6? $ip]
-        }
-        default {
-            return -code error "bad class \"$class\": must be ipv4 or ipv6"
-        }
-    }
-}
-
-proc ::ip::version {ip} {
-    set version -1
-    foreach {addr mask} [split $ip /] break
-    if {[string first $addr :] < 0 && [IPv4? $addr]} {
-        set version 4
-    } elseif {[IPv6? $addr]} {
-        set version 6
-    }
-    return $version
-}
-        
-proc ::ip::equal {lhs rhs} {
-    foreach {LHS LM} [SplitIp $lhs] break
-    foreach {RHS RM} [SplitIp $rhs] break
-    if {[set version [version $LHS]] != [version $RHS]} {
-        return -code error "type mismatch:\
-            cannot compare different address types"
-    }
-    if {$version == 4} {set fmt I} else {set fmt I4}
-    set LHS [Mask$version [Normalize $LHS $version] $LM]
-    set RHS [Mask$version [Normalize $RHS $version] $RM]
-    binary scan $LHS $fmt LLL
-    binary scan $RHS $fmt RRR
-    foreach L $LLL R $RRR {
-        if {$L != $R} {return 0}
-    }
-    return 1
-}
-
-proc ::ip::normalize {ip {Ip4inIp6 0}} {
-    foreach {ip mask} [SplitIp $ip] break
-    set version [version $ip]
-    set s [ToString [Normalize $ip $version] $Ip4inIp6]
-    if {($version == 6 && $mask != 128) || ($version == 4 && $mask != 32)} {
-        append s /$mask
-    }
-    return $s
-}
-
-proc ::ip::contract {ip} {
-    foreach {ip mask} [SplitIp $ip] break
-    set version [version $ip]
-    set s [ToString [Normalize $ip $version]]
-    if {$version == 6} {
-        set r ""
-        foreach o [split $s :] { 
-            append r [format %x: 0x$o] 
-        }
-        set r [string trimright $r :]
-        regsub {(?:^|:)0(?::0)+(?::|$)} $r {::} r
-    } else {
-        set r [string trimright $s .0]
-    }
-    return $r
-}
-
-# Returns an IP address prefix.
-# For instance: 
-#  prefix 192.168.1.4/16 => 192.168.0.0
-#  prefix fec0::4/16     => fec0:0:0:0:0:0:0:0
-#  prefix fec0::4/ffff:: => fec0:0:0:0:0:0:0:0
-#
-proc ::ip::prefix {ip} {
-    foreach {addr mask} [SplitIp $ip] break
-    set version [version $addr]
-    set addr [Normalize $addr $version]
-    return [ToString [Mask$version $addr $mask]]
-}
-
-# Return the address type. For IPv4 this is one of private, reserved 
-# or normal
-# For IPv6 it is one of site local, link local, multicast, unicast,
-# unspecified or loopback.
-proc ::ip::type {ip} {
-    set version [version $ip]
-    upvar [namespace current]::IPv${version}Ranges types
-    set ip [prefix $ip]
-    foreach prefix [array names types] {
-        set mask [mask $prefix]
-        if {[equal $ip/$mask $prefix]} {
-            return $types($prefix)
-        }
-    }
-    if {$version == 4} {
-        return "normal"
-    } else {
-        return "unicast"
-    }
-}
-
-proc ::ip::mask {ip} {
-    foreach {addr mask} [split $ip /] break
-    return $mask
-}
-
-# -------------------------------------------------------------------------
-
-# Returns true is the argument can be converted into an IPv4 address.
-#
-proc ::ip::IPv4? {ip} {
-    if {[catch {Normalize4 $ip}]} {
-        return 0
-    }
-    return 1
-}
-
-proc ::ip::IPv6? {ip} {
-    set octets [split $ip :]
-    if {[llength $octets] < 3 || [llength $octets] > 8} {
-        return 0
-    }
-    set ndx 0
-    foreach octet $octets {
-        incr ndx
-        if {[string length $octet] < 1} continue
-        if {[regexp {^[a-fA-F\d]{1,4}$} $octet]} continue
-        if {$ndx >= [llength $octets] && [IPv4? $octet]} continue
-        if {$ndx == 2 && [lindex $octets 0] == 2002 && [IPv4? $octet]} continue
-        #"Invalid IPv6 address \"$ip\""
-        return 0
-    }
-    if {[regexp {^:[^:]} $ip]} {
-        #"Invalid ipv6 address \"$ip\" (starts with :)"
-        return 0
-    }
-    if {[regexp {[^:]:$} $ip]} {
-        # "Invalid IPv6 address \"$ip\" (ends with :)"
-        return 0
-    }
-    if {[regsub -all :: $ip "|" junk] > 1} {
-        # "Invalid IPv6 address \"$ip\" (more than one :: pattern)"
-        return 0
-    }
-    return 1
-}
-
-proc ::ip::Mask4 {ip {bits {}}} {
-    if {[string length $bits] < 1} { set bits 32 }
-    binary scan $ip I ipx
-    if {[string is integer $bits]} {
-        set mask [expr {(0xFFFFFFFF << (32 - $bits)) & 0xFFFFFFFF}]
-    } else {
-        binary scan [Normalize4 $bits] I mask
-    }
-    return [binary format I [expr {$ipx & $mask}]]
-}
-
-proc ::ip::Mask6 {ip {bits {}}} {
-    if {[string length $bits] < 1} { set bits 128 }
-    if {[string is integer $bits]} {
-        set mask [binary format B128 [string repeat 1 $bits]]
-    } else {
-        binary scan [Normalize6 $bits] I4 mask
-    }
-    binary scan $ip I4 Addr
-    binary scan $mask I4 Mask
-    foreach A $Addr M $Mask {
-        lappend r [expr {$A & $M}]
-    }
-    return [binary format I4 $r]
-}
-
-        
-
-# A network address specification is an IPv4 address with an optional bitmask
-# Split an address specification into a IPv4 address and a network bitmask.
-# This doesn't validate the address portion.
-# If a spec with no mask is provided then the mask will be 32
-# (all bits significant).
-# Masks may be either integer number of significant bits or dotted-quad
-# notation.
-#
-proc ::ip::SplitIp {spec} {
-    set slash [string last / $spec]
-    if {$slash != -1} {
-        incr slash -1
-        set ip [string range $spec 0 $slash]
-        incr slash 2
-        set bits [string range $spec $slash end]
-    } else {
-        set ip $spec
-        if {[string length $ip] > 0 && [version $ip] == 6} {
-            set bits 128
-        } else {
-            set bits 32
-        }
-    }
-    return [list $ip $bits]
-}
-
-# Given an IP string from the user, convert to a normalized internal rep.
-# For IPv4 this is currently a hex string (0xHHHHHHHH).
-# For IPv6 this is a binary string or 16 chars.
-proc ::ip::Normalize {ip {version 0}} {
-    if {$version < 0} {
-        set version [version $ip]
-        if {$version < 0} {
-            return -code error "invalid address \"$ip\":\
-                value must be a valid IPv4 or IPv6 address"
-        }
-    }
-    return [Normalize$version $ip]
-}
-
-proc ::ip::Normalize4 {ip} {
-    set octets [split $ip .]
-    if {[llength $octets] > 4} {
-        return -code error "invalid ip address \"$ip\""
-    } elseif {[llength $octets] < 4} {
-        set octets [lrange [concat $octets 0 0 0] 0 3]
-    }
-    foreach oct $octets {
-        if {$oct < 0 || $oct > 255} {
-            return -code error "invalid ip address"
-        }
-    }
-    return [binary format c4 $octets]
-}
-
-proc ::ip::Normalize6 {ip} {
-    set octets [split $ip :]
-    set ip4embed [string first . $ip]
-    set len [llength $octets]
-    if {$len < 0 || $len > 8} {
-        return -code error "invalid address: this is not an IPv6 address"
-    }
-    set result ""
-    for {set n 0} {$n < $len} {incr n} {
-        set octet [lindex $octets $n]
-        if {$octet == {}} {
-            if {$n == 0 || $n == ($len - 1)} {
-                set octet \0\0
-            } else {
-                set missing [expr {9 - $len}]
-                if {$ip4embed != -1} {incr missing -1}
-                set octet [string repeat \0\0 $missing]
-            }
-        } elseif {[string first . $octet] != -1} {
-            set octet [Normalize4 $octet]
-        } else {
-            set m [expr {4 - [string length $octet]}]
-            if {$m != 0} {
-                set octet [string repeat 0 $m]$octet
-            }
-            set octet [binary format H4 $octet]
-        }
-        append result $octet
-    }
-    if {[string length $result] != 16} {
-        return -code error "invalid address: \"$ip\" is not an IPv6 address"
-    }
-    return $result
-}
-
-
-# This will convert a full ipv4/ipv6 in binary format into a normal
-# expanded string rep.
-proc ::ip::ToString {bin {Ip4inIp6 0}} {
-    set len [string length $bin]
-    set r ""
-    if {$len == 4} {
-        binary scan $bin c4 octets
-        foreach octet $octets {
-            lappend r [expr {$octet & 0xff}]
-        }
-        return [join $r .]
-    } elseif {$len == 16} {
-        if {$Ip4inIp6 == 0} {
-            binary scan $bin H32 hex
-            for {set n 0} {$n < 32} {incr n} {
-                append r [string range $hex $n [incr n 3]]:
-            }
-            return [string trimright $r :]
-        } else {
-            binary scan $bin H24c4 hex octets
-            for {set n 0} {$n < 24} {incr n} {
-                append r [string range $hex $n [incr n 3]]:
-            }
-            foreach octet $octets {
-                append r [expr {$octet & 0xff}].
-            }
-            return [string trimright $r .]
-        }
-    } else {
-        return -code error "invalid binary address:\
-            argument is neither an IPv4 nor an IPv6 address"
-    }
-}
-
-# -------------------------------------------------------------------------
-# Load extended command set.
-
-source [file join [file dirname [info script]] ipMore.tcl]
-
-# -------------------------------------------------------------------------
-
-package provide ip $::ip::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/ipMore.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/ipMore.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1217 +1,0 @@
-#temporary home until this gets cleaned up for export to tcllib ip module
-# $Id: ipMore.tcl,v 1.4 2006/01/22 00:27:22 andreas_kupries Exp $
-
-
-##Library Header
-#
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#       ipMore
-#
-# Purpose:
-#       Additional commands for the tcllib ip package.
-#
-# Author:
-#        Aamer Akhter / aakhter@cisco.com
-#
-# Support Alias:
-#       aakhter@cisco.com
-#
-# Usage:
-#       package require ip
-#       (The command are loaded from the regular package).
-#
-# Description:
-#       A detailed description of the functionality provided by the library.
-#      
-# Requirements:
-#
-# Variables:
-#       namespace   ::ip
-#
-# Notes:
-#       1.
-#
-# Keywords:
-#
-#
-# Category: 
-#       
-#
-# End of Header
-
-package require msgcat
-
-# Try to load various C based accelerato packages for two of the
-# commands.
-
-if {[catch {package require ipMorec}]} {
-    catch {package require tcllibc}
-}
-
-if {[llength [info commands ::ip::prefixToNativec]]} {
-    # An accelerator is present, providing the C variants
-    interp alias {} ::ip::prefixToNative  {} ::ip::prefixToNativec
-    interp alias {} ::ip::isOverlapNative {} ::ip::isOverlapNativec
-} else {
-    # Link API to the Tcl variants, no accelerators are available.
-    interp alias {} ::ip::prefixToNative  {} ::ip::prefixToNativeTcl
-    interp alias {} ::ip::isOverlapNative {} ::ip::isOverlapNativeTcl
-}
-
-namespace eval ::ip {
-    ::msgcat::mcload [file join [file dirname [info script]] msgs]
-}
-
-if {![llength [info commands lassign]]} {
-    # Either an older tcl version, or tclx not loaded; have to use our
-    # internal lassign from http://wiki.tcl.tk/1530 by Schelte Bron
-
-    proc ::ip::lassign {values args} {
-        uplevel 1 [list foreach $args $values break]
-        lrange $values [llength $args] end
-    }
-}
-if {![llength [info commands lvarpop]]} {
-    # Define an emulation of Tclx's lvarpop if the command
-    # is not present already.
-
-    proc ::ip::lvarpop {upVar {index 0}} {
-	upvar $upVar list;
-	set top [lindex $list $index];
-	set list [concat [lrange $list 0 [expr $index - 1]] \
-		      [lrange $list [expr $index +1] end]];
-	return $top;
-    }
-}
-
-# Some additional aliases for backward compatability. Not
-# documented. The old names ar from previous versions while at Cisco.
-#
-#               Old command name -->      Documented command name
-interp alias {} ::ip::ToInteger           {} ::ip::toInteger
-interp alias {} ::ip::ToHex               {} ::ip::toHex
-interp alias {} ::ip::MaskToInt           {} ::ip::maskToInt
-interp alias {} ::ip::MaskToLength        {} ::ip::maskToLength
-interp alias {} ::ip::LengthToMask        {} ::ip::lengthToMask
-interp alias {} ::ip::IpToLayer2Multicast {} ::ip::ipToLayer2Multicast
-interp alias {} ::ip::IpHostFromPrefix    {} ::ip::ipHostFromPrefix
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::prefixToNative
-#
-# Purpose:
-#        convert from dotted from to native (hex) form
-#
-# Synopsis:
-#       prefixToNative <prefix>
-#
-# Arguments:
-#        <prefix>
-#            string in the <ipaddr>/<mask> format
-#
-# Return Values:
-#        <prefix> in native format {<hexip> <hexmask>}
-#
-# Description:
-#       
-# Examples:
-#   % ip::prefixToNative 1.1.1.0/24
-#   0x01010100 0xffffff00
-#
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#   fixed bug in C extension that modified 
-#    calling context variable
-# See Also:
-#
-# End of Header
-
-proc ip::prefixToNativeTcl {prefix} {
-    set plist {}
-    foreach p $prefix {
-	set newPrefix [ip::toHex [ip::prefix $p]]
-	if {[string equal [set mask [ip::mask $p]] ""]} {
-	    set newMask 0xffffffff
-	} else {
-	    set newMask [format "0x%08x" [ip::maskToInt $mask]]
-	}
-	lappend plist [list $newPrefix $newMask]
-    }
-    if {[llength $plist]==1} {return [lindex $plist 0]}
-    return $plist
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::nativeToPrefix
-#
-# Purpose:
-#        convert from native (hex) form to dotted form
-#
-# Synopsis:
-#       nativeToPrefix <nativeList>|<native> [-ipv4]
-#
-# Arguments:
-#        <nativeList> 
-#            list of native form ip addresses native form is:
-#        <native>
-#            tcllist in format {<hexip> <hexmask>}
-#        -ipv4
-#            the provided native format addresses are in ipv4 format (default)
-#
-# Return Values:
-#        if nativeToPrefix is called with <native> a single (non-listified) address
-#            is returned
-#        if nativeToPrefix is called with a <nativeList> address list, then 
-#            a list of addresses is returned
-#
-#        return form is: <ipaddr>/<mask>
-#
-# Description:
-#       
-# Examples:
-#   % ip::nativeToPrefix {0x01010100 0xffffff00} -ipv4
-#   1.1.1.0/24
-#
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::nativeToPrefix {nativeList args} {
-    set pList 1
-    set ipv4 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-
-    # if a single native element is passed eg {0x01010100 0xffffff00}
-    # instead of {{0x01010100 0xffffff00} {0x01010100 0xffffff00}...}
-    # then return a (non-list) single entry
-    if {[llength [lindex $nativeList 0]]==1} {set pList 0; set nativeList [list $nativeList]}
-    foreach native $nativeList {
-	lassign $native ip mask
-	if {[string equal $mask ""]} {set mask 32}
-	set pString ""
-	append pString [ip::ToString [binary format I [expr {$ip}]]]
-	append pString  "/"
-	append pString [ip::maskToLength $mask]
-	lappend rList $pString
-    }
-    # a multi (listified) entry was given
-    # return the listified entry
-    if {$pList} { return $rList }
-    return $pString
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::intToString
-#
-# Purpose:
-#        convert from an integer/hex to dotted form
-#
-# Synopsis:
-#       intToString <integer/hex> [-ipv4]
-#
-# Arguments:
-#        <integer>
-#            ip address in integer form
-#        -ipv4
-#            the provided integer addresses is ipv4 (default)
-#
-# Return Values:
-#        ip address in dotted form
-#
-# Description:
-#       
-# Examples:
-#       ip::intToString 4294967295
-#       255.255.255.255
-#
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::intToString {int args} {
-    set ipv4 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-    return [ip::ToString [binary format I [expr {$int}]]]
-}
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::toInteger
-#
-# Purpose:
-#        convert dotted form ip to integer
-#
-# Synopsis:
-#       toInteger <ipaddr>
-#
-# Arguments:
-#        <ipaddr>
-#            decimal dotted from ip address
-#
-# Return Values:
-#        integer form of <ipaddr>
-#
-# Description:
-#       
-# Examples:
-#   % ::ip::toInteger 1.1.1.0
-#   16843008
-#
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::toInteger {ip} {
-    binary scan [ip::Normalize4 $ip] I out
-    return $out
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::toHex
-#
-# Purpose:
-#        convert dotted form ip to hex
-#
-# Synopsis:
-#       toHex <ipaddr>
-#
-# Arguments:
-#        <ipaddr>
-#            decimal dotted from ip address
-#
-# Return Values:
-#        hex form of <ipaddr>
-#
-# Description:
-#       
-# Examples:
-#   % ::ip::toHex 1.1.1.0
-#   0x01010100
-#
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::toHex {ip} {
-    binary scan [ip::Normalize4 $ip] H8 out
-    return "0x$out"
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::maskToInt
-#
-# Purpose:
-#        convert mask to integer
-#
-# Synopsis:
-#       maskToInt <mask>
-#
-# Arguments:
-#        <mask>
-#            mask in either dotted form or mask length form (255.255.255.0 or 24)
-#
-# Return Values:
-#        integer form of mask
-#
-# Description:
-#       
-# Examples:
-#   ::ip::maskToInt 24
-#   4294967040
-#
-#   
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::maskToInt {mask} {
-    if {[string is integer -strict $mask]} {
-        set maskInt [expr {(0xFFFFFFFF << (32 - $mask))}]
-    } else {
-        binary scan [Normalize4 $mask] I maskInt
-    }
-    set maskInt [expr {$maskInt & 0xFFFFFFFF}]
-    return [format %u $maskInt]
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::broadcastAddress
-#
-# Purpose:
-#        return broadcast address given prefix
-#
-# Synopsis:
-#       broadcastAddress <prefix> [-ipv4]
-#
-# Arguments:
-#        <prefix>
-#            route in the form of <ipaddr>/<mask> or native form {<hexip> <hexmask>}
-#        -ipv4
-#            the provided native format addresses are in ipv4 format (default)
-#            note: broadcast addresses are not valid in ipv6
-#            
-#
-# Return Values:
-#        ipaddress of broadcast
-#
-# Description:
-#       
-# Examples:
-#   ::ip::broadcastAddress 1.1.1.0/24
-#   1.1.1.255
-#   
-#   ::ip::broadcastAddress {0x01010100 0xffffff00}
-#   0x010101ff
-#
-# Sample Input:
-#
-# Sample Output:
-
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::broadcastAddress {prefix args} {
-    set ipv4 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-    if {[llength $prefix] == 2} {
-	lassign $prefix net mask
-    } else {
-	set net [maskToInt [ip::prefix $prefix]]
-	set mask [maskToInt [ip::mask $prefix]]
-    }
-    set ba [expr {$net  | ((~$mask)&0xffffffff)}]
-    
-    if {[llength $prefix]==2} {
-	return [format "0x%08x" $ba]
-    }
-    return [ToString [binary format I $ba]]
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::maskToLength
-#
-# Purpose:
-#        converts dotted or integer form of mask to length
-#
-# Synopsis:
-#       maskToLength <dottedMask>|<integerMask>|<hexMask> [-ipv4]
-#
-# Arguments:
-#        <dottedMask>
-#        <integerMask>
-#        <hexMask>
-#            mask to convert to prefix length format (eg /24)
-#         -ipv4
-#            the provided integer/hex format masks are ipv4 (default)
-#
-# Return Values:
-#        prefix length
-#
-# Description:
-#       
-# Examples:
-#   ::ip::maskToLength 0xffffff00 -ipv4
-#   24
-#
-#   % ::ip::maskToLength 255.255.255.0
-#   24
-#
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::maskToLength {mask args} {
-    set ipv4 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-    #pick the fastest method for either format
-    if {[string is integer -strict $mask]} {
-	binary scan [binary format I [expr {$mask}]] B32 maskB
-	if {[regexp -all {^1+} $maskB ones]} {
-	    return [string length $ones]
-	} else {
-	    return 0
-	}
-    } else {
-	regexp {\/(.+)} $mask dumb mask
-	set prefix 0
-	foreach ipByte [split $mask {.}] {
-	    switch $ipByte {
-		255 {incr prefix 8; continue}
-		254 {incr prefix 7}
-		252 {incr prefix 6}
-		248 {incr prefix 5}
-		240 {incr prefix 4}
-		224 {incr prefix 3}
-		192 {incr prefix 2}
-		128 {incr prefix 1}
-		0   {}
-		default { 
-		    return -code error [msgcat::mc "not an ip mask: %s" $mask]
-		}
-	    }
-	    break
-	}
-	return $prefix
-    }
-}
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::lengthToMask
-#
-# Purpose:
-#        converts mask length to dotted mask form
-#
-# Synopsis:
-#       lengthToMask <maskLength> [-ipv4]
-#
-# Arguments:
-#        <maskLength>
-#            mask length   
-#        -ipv4
-#            the provided mask length is ipv4 (default)  
-#
-# Return Values:
-#        mask in dotted form
-#
-# Description:
-#       
-# Examples:
-#   ::ip::lengthToMask 24
-#   255.255.255.0
-#
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::lengthToMask {masklen args} {
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-    # the fastest method is just to look
-    # thru an array
-    return $::ip::maskLenToDotted($masklen)
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::nextNet
-#
-# Purpose:
-#        returns next an ipaddress in same position in next network
-#
-# Synopsis:
-#       nextNet <ipaddr> <mask> [<count>] [-ipv4]
-#
-# Arguments:
-#        <ipaddress>
-#            in hex/integer/dotted format
-#        <mask>
-#            mask in hex/integer/dotted/maskLen format
-#        <count>
-#            number of nets to skip over (default is 1)
-#        -ipv4
-#            the provided hex/integer addresses are in ipv4 format (default)
-#
-# Return Values:
-#        ipaddress in same position in next network in hex
-#
-# Description:
-#       
-# Examples:
-#
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::nextNet {prefix mask args} {
-    set count 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		set count [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	}
-    }
-    if {![string is integer -strict $prefix]} { 
-	set prefix [toInteger $prefix]
-    }
-    if {![string is integer -strict $mask] || ($mask < 33 && $mask > 0)} {
-	set mask [maskToInt $mask]
-    } 
-    
-    set prefix [expr $prefix + ($mask ^ 0xFFffFFff) + $count ]
-    return [format "0x%08x" $prefix]
-}
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::isOverlap
-#
-# Purpose:
-#        checks to see if prefixes overlap
-#
-# Synopsis:
-#       isOverlap <prefix> <prefix1> <prefix2>...
-#
-# Arguments:
-#        <prefix>
-#            in form <ipaddr>/<mask> prefix to compare <prefixN> against
-#        <prefixN>
-#            in form <ipaddr>/<mask> prefixes to compare against
-#
-# Return Values:
-#        1 if there is an overlap
-#
-# Description:
-#       
-# Examples:
-#        % ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32
-#        0
-#
-#        ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32 1.1.1.1/32
-#        1
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::isOverlap {ip args} {
-    lassign [SplitIp $ip] ip1 mask1
-    set ip1int [toInteger $ip1]
-    set mask1int [maskToInt $mask1]
-
-    set overLap 0
-    foreach prefix $args {
-	lassign [SplitIp $prefix] ip2 mask2
-	set ip2int [toInteger $ip2]
-	set mask2int [maskToInt $mask2]
-	set mask1mask2 [expr {$mask1int & $mask2int}]
-	if {[expr {$ip1int & $mask1mask2}] ==  [expr {$ip2int & $mask1mask2}]} {
-	    set overLap 1
-	    break
-	}
-    }
-    return $overLap
-}
-
-
-#optimized overlap, that accepts native format
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::isOverlapNative
-#
-# Purpose:
-#        checks to see if prefixes overlap (optimized native form)
-#
-# Synopsis:
-#       isOverlap <hexipaddr> <hexmask> {{<hexipaddr1> <hexmask1>} {<hexipaddr2> <hexmask2>...}
-#
-# Arguments:
-#        -all
-#            return all overlaps rather than the first one
-#        -inline
-#            rather than returning index values, return the actual overlap prefixes
-#        <hexipaddr>
-#            ipaddress in hex/integer form
-#        <hexMask>
-#            mask in hex/integer form
-#        -ipv4
-#            the provided native format addresses are in ipv4 format (default)
-#
-# Return Values:
-#        non-zero if there is an overlap, value is element # in list with overlap
-#
-# Description:
-#        isOverlapNative is avaliabel both as a C extension and in a native tcl form
-#        if the extension is loaded (tried automatically), isOverlapNative will be
-#        linked to isOverlapNativeC. If an extension is not loaded, then isOverlapNative
-#        will be linked to the native tcl proc: ipOverlapNativeTcl.
-#
-# Examples:
-#        % ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff}}
-#        0
-#
-#        %::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff} {0x01010101 0xffffffff}}
-#        2
-#
-# Sample Input:
-#
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::isOverlapNativeTcl {args} {
-    set all 0
-    set inline 0
-    set notOverlap 0
-    set ipv4 1
-    foreach sw [lrange $args 0 end-3] {
-	switch -exact -- $sw {
-	    -all {
-		set all 1
-		set allList [list]
-	    }
-	    -inline {set inline 1}
-	    -ipv4 {}
-	}
-    }
-    set args [lassign [lrange $args end-2 end] ip1int mask1int prefixList]
-    if {$inline} { 
-	set overLap [list]
-    } else {
-	set overLap 0
-    }
-    set count 0
-    foreach prefix $prefixList {
-	incr count
-	lassign $prefix ip2int mask2int
-	set mask1mask2 [expr {$mask1int & $mask2int}]
-	if {[expr {$ip1int & $mask1mask2}] ==  [expr {$ip2int & $mask1mask2}]} {
-	    if {$inline} {
-		set overLap [list $prefix]
-	    } else {
-		set overLap $count
-	    }
-	    if {$all} {
-		if {$inline} {
-		    lappend allList $prefix
-		} else {
-		    lappend allList $count
-		}
-	    } else {
-		break
-	    }
-	}
-    }
-    if {$all} {return $allList}
-    return $overLap
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::ipToLayer2Multicast
-#
-# Purpose:
-#        converts ipv4 address to a layer 2 multicast address
-#
-# Synopsis:
-#       ipToLayer2Multicast <ipaddr>
-#
-# Arguments:
-#        <ipaddr>
-#            ipaddress in dotted form
-#
-# Return Values:
-#        mac address in xx.xx.xx.xx.xx.xx form
-#
-# Description:
-#
-# Examples:
-#        % ::ip::ipToLayer2Multicast 224.0.0.2
-#        01.00.5e.00.00.02
-# Sample Input:
-#        
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::ipToLayer2Multicast { ipaddr } {
-    regexp "\[0-9\]+\.(\[0-9\]+)\.(\[0-9\]+)\.(\[0-9\]+)" $ipaddr junk ip2 ip3 ip4
-    #remove MSB of 2nd octet of IP address for mcast L2 addr
-    set mac2 [expr {$ip2 & 127}]
-    return [format "01.00.5e.%02x.%02x.%02x" $mac2 $ip3 $ip4]
-}
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::ipHostFromPrefix
-#
-# Purpose:
-#        gives back a host address from a prefix
-#
-# Synopsis:
-#       ::ip::ipHostFromPrefix <prefix> [-exclude <list of prefixes>]
-#
-# Arguments:
-#        <prefix>
-#            prefix is <ipaddr>/<masklen>
-#        -exclude <list of prefixes>
-#            list if ipprefixes that host should not be in
-# Return Values:
-#        ip address 
-#
-# Description:
-#
-# Examples:
-# %::ip::ipHostFromPrefix  1.1.1.5/24
-# 1.1.1.1
-#
-# %::ip::ipHostFromPrefix  1.1.1.1/32
-# 1.1.1.1
-#
-#
-# Sample Input:
-#        
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::ipHostFromPrefix { prefix args } {
-    set mask [mask $prefix]
-    set ipaddr [prefix $prefix]
-    if {[llength $args]} {
-	array set opts $args
-    } else {
-	if {$mask==32} {
-	    return $ipaddr
-	} else {
-	    return [intToString [expr {[toHex $ipaddr] + 1} ]]
-	}
-    }
-    set format {-ipv4}
-    # if we got here, then options were set
-    if {[info exists opts(-exclude)]} {
-	#basic algo is:
-	# 1. throw away prefixes that are less specific that $prefix
-	# 2. of remaining pfx, throw away prefixes that do not overlap
-	# 3. run reducetoAggregates on specific nets
-	# 4. 
-	
-	# 1. convert to hex format
-	set currHex [prefixToNative $prefix ]
-	set exclHex [prefixToNative $opts(-exclude) ]
-	# sort the prefixes by their mask, include the $prefix as a marker
-	#  so we know from where to throw away prefixes
-	set sortedPfx [lsort -integer -index 1 [concat [list $currHex]  $exclHex]]
-	# throw away prefixes that are less specific than $prefix
-	set specPfx [lrange $sortedPfx [expr {[lsearch -exact $sortedPfx $currHex] +1} ] end]
-	
-	#2. throw away non-overlapping prefixes
-	set specPfx [isOverlapNative -all -inline \
-			 [lindex $currHex 0 ] \
-			 [lindex $currHex 1 ] \
-			 $specPfx ]
-	#3. run reduce aggregates 
-	set specPfx [reduceToAggregates $specPfx]
-
-	#4 now have to pick an address that overlaps with $currHex but not with
-	#   $specPfx
-	# 4.1 find the largest prefix w/ most specific mask and go to the next net
-	
-
-	# current ats tcl does not allow this in one command, so 
-	#  for now just going to grab the last prefix (list is already sorted)
-	set sPfx [lindex $specPfx end]
-	set startPfx $sPfx
-	# add currHex to specPfx
-	set oChkPfx [concat $specPfx [list $currHex]]
-
-
-	set notcomplete 1
-	set overflow 0
-	while {$notcomplete} {
-	    #::ipMore::log::debug "doing nextnet on $sPfx"
-	    set nextNet [nextNet [lindex $sPfx 0] [lindex $sPfx 1]]
-	    #::ipMore::log::debug "trying $nextNet"
-	    if {$overflow && ($nextNet > $startPfx)} {
-		#we've gone thru the entire net and didn't find anything.
-		return -code error [msgcat::mc "ip host could not be found in %s" $prefix]
-		break
-	    }
-	    set oPfx [isOverlapNative -all -inline \
-			  $nextNet -1 \
-			  $oChkPfx
-		     ]
-	    switch -exact [llength $oPfx] {
-		0 {
-		    # no overlap at all. meaning we have gone beyond the bounds of
-		    # $currHex. need to overlap and try again
-		    #::ipMore::log::debug {ipHostFromPrefix: overlap done}
-		    set overflow 1
-		}
-		1 {
-		    #we've found what we're looking for. pick this address and exit
-		    return [intToString $nextNet]
-		}
-		default {
-		    # 2 or more overlaps, need to increment again
-		    set sPfx [lindex $oPfx 0]
-		}
-	    }
-	}
-    }
-}
-
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::reduceToAggregates
-#
-# Purpose:
-#        finds nets that overlap and filters out the more specifc nets
-#
-# Synopsis:
-#       ::ip::reduceToAggregates <prefixList>
-#
-# Arguments:
-#        <prefixList>
-#            prefixList a list in the from of
-#            is <ipaddr>/<masklen> or native format
-#
-# Return Values:
-#        non-overlapping ip prefixes
-#
-# Description:
-#
-# Examples:
-#
-#  % ::ip::reduceToAggregates {1.1.1.0/24 1.1.0.0/8  2.1.1.0/24 1.1.1.1/32 }
-#  1.0.0.0/8 2.1.1.0/24
-#
-# Sample Input:
-#        
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::reduceToAggregates { prefixList } {
-    #find out format of $prefixeList
-    set dotConv 0
-    if {[llength [lindex $prefixList 0]]==1} {
-	#format is dotted form convert all prefixes to native form
-	set prefixList [ip::prefixToNative $prefixList]
-	set dotConv 1
-    }
-    
-    set nonOverLapping $prefixList
-    while {1==1} {
-	set overlapFound 0
-	set remaining $nonOverLapping
-	set nonOverLapping {}
-	while {[llength $remaining]} {
-	    set current [lvarpop remaining]
-	    set overLap [ip::isOverlapNative [lindex $current 0] [lindex $current 1] $remaining]
-	    if {$overLap} {
-		#there was a overlap find out which prefix has a the smaller mask, and keep that one
-		if {[lindex $current 1] > [lindex [lindex $remaining [expr {$overLap -1}]] 1]} {
-		    #current has more restrictive mask, throw that prefix away
-		    # keep other prefix
-		    lappend nonOverLapping [lindex $remaining [expr {$overLap -1}]]
-		} else {
-		    lappend nonOverLapping $current
-		}
-		lvarpop remaining [expr {$overLap -1}]
-		set overlapFound 1
-	    } else {
-		#no overlap, keep all prefixes, don't touch the stuff in 
-		# remaining, it is needed for other overlap checking
-		lappend nonOverLapping $current
-	    }
-	}
-	if {$overlapFound==0} {break}
-    }
-    if {$dotConv} {return [nativeToPrefix $nonOverLapping]}
-    return $nonOverLapping
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::longestPrefixMatch
-#
-# Purpose:
-#        given host IP finds longest prefix match from set of prefixes
-#
-# Synopsis:
-#       ::ip::longestPrefixMatch <ipaddr> <prefixList> [-ipv4]
-#
-# Arguments:
-#        <prefixList>
-#            is list of <ipaddr> in native or dotted form
-#        <ipaddr>
-#            ip address in <ipprefix> format, dotted form, or integer form
-#        -ipv4
-#            the provided integer format addresses are in ipv4 format (default)
-#
-# Return Values:
-#        <ipprefix> that is the most specific match to <ipaddr>
-#
-# Description:
-#
-# Examples:
-#        % ::ip::longestPrefixMatch 1.1.1.1 {1.1.1.0/24 1.0.0.0/8  2.1.1.0/24 1.1.1.0/28 }
-#        1.1.1.0/28
-#
-# Sample Input:
-#        
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-
-proc ::ip::longestPrefixMatch { ipaddr prefixList args} {
-    set ipv4 1
-    while {[llength $args]} {
-	switch -- [lindex $args 0] {
-	    -ipv4 {set args [lrange $args 1 end]}
-	    default {
-		return -code error [msgcat::mc "option %s not supported" [lindex $args 0]]
-	    }
-	}
-    }
-    #find out format of prefixes
-    set dotConv 0
-    if {[llength [lindex $prefixList 0]]==1} {
-	#format is dotted form convert all prefixes to native form
-	set prefixList [ip::prefixToNative $prefixList]
-	set dotConv 1
-    }
-    #sort so that most specific prefix is in the front
-    if {[llength [lindex [lindex $prefixList 0] 1]]} {
-	set prefixList [lsort -decreasing -integer -index 1 $prefixList]
-    } else {
-	set prefixList [list $prefixList]
-    }
-    if {![string is integer -strict $ipaddr]} {
-	set ipaddr [prefixToNative $ipaddr]
-    }
-    set best [ip::isOverlapNative -inline \
-		  [lindex $ipaddr 0] [lindex $ipaddr 1] $prefixList]
-    if {$dotConv && [llength $best]} {
-	return [nativeToPrefix $best]
-    }
-    return $best
-}
-
-##Procedure Header
-# Copyright (c) 2004 Cisco Systems, Inc.
-#
-# Name:
-#       ::ip::cmpDotIP
-#
-# Purpose:
-#        helper function for dotted ip address for use in lsort
-#
-# Synopsis:
-#       ::ip::cmpDotIP <ipaddr1> <ipaddr2>
-#
-# Arguments:
-#        <ipaddr1> <ipaddr2>
-#            prefix is in dotted ip address format
-#
-# Return Values:
-#        -1 if ipaddr1 is less that ipaddr2
-#         1 if ipaddr1 is more that ipaddr2
-#         0 if ipaddr1 and ipaddr2 are equal
-#
-# Description:
-#
-# Examples:
-#        % lsort -command ip::cmpDotIP {1.0.0.0 2.2.0.0 128.0.0.0 3.3.3.3}
-#        1.0.0.0 2.2.0.0 3.3.3.3 128.0.0.0
-#
-# Sample Input:
-#        
-# Sample Output:
-# Notes:
-#
-# See Also:
-#
-# End of Header
-#            ip address in <ipprefix> format, dotted form, or integer form
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {
-    # 8.3+
-    proc ip::cmpDotIP {ipaddr1 ipaddr2} {
-	# convert dotted to list of integers
-	set ipaddr1 [split $ipaddr1 .]
-	set ipaddr2 [split $ipaddr2 .]
-	foreach a $ipaddr1 b $ipaddr2 {
-	    #ipMore::log::debug "$ipInt1 $ipInt2"
-	    if { $a < $b}  {
-		return -1
-	    } elseif {$a >$b} {
-		return 1
-	    }
-	}
-	return 0
-    }
-} else {
-    # 8.4+
-    proc ip::cmpDotIP {ipaddr1 ipaddr2} {
-	# convert dotted to decimal
-	set ipInt1 [::ip::toHex $ipaddr1]
-	set ipInt2 [::ip::toHex $ipaddr2]
-	#ipMore::log::debug "$ipInt1 $ipInt2"
-	if { $ipInt1 < $ipInt2}  {
-	    return -1
-	} elseif {$ipInt1 >$ipInt2 } {
-	    return 1
-	} else {
-	    return 0
-	}
-    }
-}
-
-# Populate the array "maskLenToDotted" for fast lookups of mask to
-# dotted form.
-
-namespace eval ::ip {
-    variable maskLenToDotted
-    variable x
-
-    for {set x 0} {$x <33} {incr x} {
-	set maskLenToDotted($x) [intToString [maskToInt $x]]
-    }
-    unset x
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/ipMoreC.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/ipMoreC.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,241 +1,0 @@
-# Skip this for window and a specific version of Solaris
-# 
-# This could do with an explanation -- why are we avoiding these platforms
-# and perhaps using critcl's platform::platform command might be better?
-#
-if {[string equal $::tcl_platform(platform) windows] ||
-    ([string equal $::tcl_platform(os)      SunOS] &&
-     [string equal $::tcl_platform(osVersion) 5.6])
-} {
-    # avoid warnings about nothing to compile
-    critcl::ccode {
-        /* nothing to do */
-    }
-    return
-}
-
-package require critcl;
-
-namespace eval ::ip {
-
-critcl::ccode {
-#include <stdlib.h>
-#include <stdio.h>
-#include <tcl.h>
-#include <inttypes.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <sys/socket.h>
-}
-
-critcl::ccommand prefixToNativec {clientData interp objc objv} { 
-    int elemLen, maskLen, ipLen, mask;
-	int rval,convertListc,i;
-	Tcl_Obj **convertListv;
-	Tcl_Obj *listPtr,*returnPtr, *addrList;
-	char *stringIP, *slashPos, *stringMask;
-	char v4HEX[11];
-	
-	uint32_t inaddr;
-	listPtr = NULL;
-
-	/* printf ("\n in prefixToNativeC"); */
-	/* printf ("\n objc = %d",objc); */
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "<ipaddress>/<mask>");
-		return TCL_ERROR;
-	}
-
-
-	if (Tcl_ListObjGetElements (interp, objv[1], 
-								&convertListc, &convertListv) != TCL_OK) {
-		return TCL_ERROR;
-	}
-	returnPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
-	for (i = 0; i < convertListc; i++) {
-		/*  need to create a duplicate here because when we modify */
-		/*  the stringIP it'll mess up the original in the calling */
-		/*  context */
-		addrList = Tcl_DuplicateObj(convertListv[i]);
-		stringIP = Tcl_GetStringFromObj(addrList, &elemLen);
-		listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
-		/* printf ("\n  ### %s ### string \n", stringIP); */
-		/*  split the ip address and mask */
-		slashPos = strchr(stringIP, (int) '/');
-		if (slashPos == NULL) {
-			/*  straight ip address without mask */
-			mask = 0xffffffff;
-			ipLen = strlen(stringIP);
-		} else {
-			/* ipaddress has the mask, handle the mask and seperate out the  */
-			/*  ip address */
-			/* printf ("\n ** %d ",(uintptr_t)slashPos); */
-			stringMask = slashPos +1;
-			maskLen =strlen(stringMask);
-			/* put mask in hex form */
-			if (maskLen < 3) {
-				mask = atoi(stringMask);
-				mask = (0xFFFFFFFF << (32 - mask)) & 0xFFFFFFFF;
-			} else {
-				/* mask is in dotted form */
-				if ((rval = inet_pton(AF_INET,stringMask,&mask)) < 1 ) {
-					Tcl_AddErrorInfo(interp, "\n    bad format encountered in mask conversion");
-					return TCL_ERROR;	
-				}
-				mask = htonl(mask);
-			}
-			ipLen = (uintptr_t)slashPos  - (uintptr_t)stringIP;
-			/* divide the string into ip and mask portion */
-			*slashPos = '\0';
-			/* printf("\n %d %d %d %d", (uintptr_t)stringMask, maskLen, (uintptr_t)stringIP, ipLen); */
-		}
-		if ( (rval = inet_pton(AF_INET,stringIP,&inaddr)) < 1) {
-			Tcl_AddErrorInfo(interp, 
-							 "\n    bad format encountered in ip conversion");
-			return TCL_ERROR;
-		};
-		inaddr = htonl(inaddr);
-		/* apply the mask the to the ip portion, just to make sure  */
-		/*  what we return is cleaned up */
-		inaddr = inaddr & mask;
-		sprintf(v4HEX,"0x%08X",inaddr);
-		/* printf ("\n\n ### %s",v4HEX); */
-		Tcl_ListObjAppendElement(interp, listPtr,
-								 Tcl_NewStringObj(v4HEX,-1));
-		sprintf(v4HEX,"0x%08X",mask);
-		Tcl_ListObjAppendElement(interp, listPtr,
-								 Tcl_NewStringObj(v4HEX,-1));
-		Tcl_ListObjAppendElement(interp, returnPtr, listPtr);
-		Tcl_DecrRefCount(addrList);
-	}
-	
-	if (convertListc==1) {
-		Tcl_SetObjResult(interp,listPtr);
-	} else {
-		Tcl_SetObjResult(interp,returnPtr);
-	}
-	
-	return TCL_OK;
-}
-
-critcl::ccommand isOverlapNativec {clientData interp objc objv} {
-        int i; 
-        unsigned int ipaddr,ipMask, mask1mask2;
-        unsigned int ipaddr2,ipMask2;
-        int compareListc,comparePrefixMaskc;
-        int allSet,inlineSet,index;
-        Tcl_Obj **compareListv,**comparePrefixMaskv, *listPtr;
-        Tcl_Obj *result;
-    static CONST char *options[] = {
-                "-all",     "-inline", "-ipv4", NULL
-    };
-    enum options {
-		OVERLAP_ALL, OVERLAP_INLINE, OVERLAP_IPV4
-    };
-
-        allSet = 0;
-        inlineSet = 0;
-        listPtr = NULL;
-
-        /* printf ("\n objc = %d",objc); */
-        if (objc < 3) {
-                Tcl_WrongNumArgs(interp, 1, objv, "?options? <hexIP> <hexMask> <hexList>");
-                return TCL_ERROR;
-        }
-        for (i = 1; i < objc-3; i++) {
-           if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index)
-                   != TCL_OK) {
-                   return TCL_ERROR;
-           }
-           switch (index) {
-           case OVERLAP_ALL:
-                   allSet = 1;
-                   /* printf ("\n all selected"); */
-                   break;
-           case OVERLAP_INLINE:
-                   inlineSet = 1;
-                   /* printf ("\n inline selected"); */
-                   break;
-		   case OVERLAP_IPV4:
-			   break;
-           }
-        }
-        /* options are parsed */
-
-        /* create return obj */
-        result = Tcl_GetObjResult (interp);
-
-        /* set ipaddr and ipmask */
-        Tcl_GetIntFromObj(interp,objv[objc-3],&ipaddr);
-        Tcl_GetIntFromObj(interp,objv[objc-2],&ipMask);
-
-        /* split the 3rd argument into <ipaddr> <mask> pairs */
-        if (Tcl_ListObjGetElements (interp, objv[objc-1], &compareListc, &compareListv) != TCL_OK) {
-                return TCL_ERROR;
-        }
-/*       printf("comparing %x/%x \n",ipaddr,ipMask); */
-
-        if (allSet || inlineSet) {
-                listPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
-        }
-
-        for (i = 0; i < compareListc; i++) {
-					    /* split the ipaddr2 and ipmask2  */
-                if (Tcl_ListObjGetElements (interp, 
-					    compareListv[i], 
-					    &comparePrefixMaskc, 
-					    &comparePrefixMaskv) != TCL_OK) {
-		    return TCL_ERROR;
-                }
-                if (comparePrefixMaskc != 2) {
-		    Tcl_AddErrorInfo(interp,"need format {{<ipaddr> <mask>} {<ipad..}}");
-                        return TCL_ERROR;
-                }
-                Tcl_GetIntFromObj(interp,comparePrefixMaskv[0],&ipaddr2);
-                Tcl_GetIntFromObj(interp,comparePrefixMaskv[1],&ipMask2);
-/*               printf(" with %x/%x \n",ipaddr2,ipMask2); */
-                mask1mask2 = ipMask & ipMask2;
-/*               printf("  mask1mask2 %x \n",mask1mask2); */
-/*               printf("  ipaddr & mask1mask2  %x\n",ipaddr & mask1mask2); */
-/*               printf("  ipaddr2 & mask1mask2 %x\n",ipaddr2 & mask1mask2); */
-                if ((ipaddr & mask1mask2) == (ipaddr2 & mask1mask2)) {
-		    if (allSet) {
-			if (inlineSet) {
-			    Tcl_ListObjAppendElement(interp, listPtr,
-						     compareListv[i]);
-			} else {
-			    /* printf("\n appending %d",i+1); */
-			    Tcl_ListObjAppendElement(interp, listPtr,
-						     Tcl_NewIntObj(i+1));
-			};
-		    } else {
-			if (inlineSet) {
-			    Tcl_ListObjAppendElement(interp, listPtr,
-						     compareListv[i]);
-			    Tcl_SetObjResult(interp,listPtr);
-			} else {
-			    Tcl_SetIntObj (result, i+1);
-			}
-			return TCL_OK;
-		    };
-                };
-					};
-
-        if (allSet || inlineSet) {
-                Tcl_SetObjResult(interp, listPtr);
-                return TCL_OK;
-        } else {
-                Tcl_SetIntObj (result, 0);
-                return TCL_OK;
-        }
-        return TCL_OK;
-
-
-
-}
-
-
-}
-
-package provide ipMorec 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/msgs/en.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/msgs/en.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,8 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset en "option %s not supported"          "option %s not supported"	   
-mcset en "option %s not supported"	    "option %s not supported"	   
-mcset en "not an ip mask: %s"		    "not an ip mask: %s"		   
-mcset en "ip host could not be found in %s" "ip host could not be found in %s"
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,9 +1,0 @@
-# pkgIndex.tcl -
-#
-# $Id: pkgIndex.tcl,v 1.17 2007/08/26 00:44:34 patthoyts Exp $
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded dns    1.3.2 [list source [file join $dir dns.tcl]]
-package ifneeded resolv 1.0.3 [list source [file join $dir resolv.tcl]]
-package ifneeded ip     1.1.2 [list source [file join $dir ip.tcl]]
-package ifneeded spf    1.1.0 [list source [file join $dir spf.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/resolv.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/resolv.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,254 +1,0 @@
-# resolv.tcl - Copyright (c) 2002 Emmanuel Frecon <emmanuel@sics.se>
-#
-# Original Author --  Emmanuel Frecon - emmanuel@sics.se
-# Modified by Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-#  A super module on top of the dns module for host name resolution.
-#  There are two services provided on top of the regular Tcl library:
-#  Firstly, this module attempts to automatically discover the default
-#  DNS server that is setup on the machine that it is run on.  This
-#  server will be used in all further host resolutions.  Secondly, this
-#  module offers a rudimentary cache.  The cache is rudimentary since it
-#  has no expiration on host name resolutions, but this is probably
-#  enough for short lived applications.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: resolv.tcl,v 1.9 2004/01/25 07:29:39 andreas_kupries Exp $
-
-package require dns 1.0;                # tcllib 1.3
-
-namespace eval ::resolv {
-    variable version 1.0.3
-    variable rcsid {$Id: resolv.tcl,v 1.9 2004/01/25 07:29:39 andreas_kupries Exp $}
-
-    namespace export resolve init ignore hostname
-
-    variable R
-    if {![info exists R]} {
-        array set R {
-            initdone   0
-            dns        ""
-            dnsdefault ""
-            ourhost    ""
-            search     {}
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Command Name     --  ignore
-# Original Author  --  Emmanuel Frecon - emmanuel@sics.se
-#
-# Remove a host name resolution from the cache, if present, so that the
-# next resolution will query the DNS server again.
-#
-# Arguments:
-#    hostname	- Name of host to remove from the cache.
-#
-proc ::resolv::ignore { hostname } {
-    variable Cache
-    catch {unset Cache($hostname)}
-    return
-}
-
-# -------------------------------------------------------------------------
-# Command Name     --  init
-# Original Author  --  Emmanuel Frecon - emmanuel@sics.se
-#
-# Initialise this module with a known host name.  This host (not mandatory)
-# will become the default if the library was not able to find a DNS server.
-# This command can be called several times, its effect is double: actively
-# looking for the default DNS server setup on the running machine; and
-# emptying the host name resolution cache.
-#
-# Arguments:
-#    defaultdns	- Default DNS server
-#
-proc ::resolv::init { {defaultdns ""} {search {}}} {
-    variable R
-    variable Cache
-
-    # Clean the resolver cache
-    catch {unset Cache}
-
-    # Record the default DNS server and search list.
-    set R(dnsdefault) $defaultdns
-    set R(search) $search
-
-    # Now do some intelligent lookup.  We do this on the current
-    # hostname to get a chance to get back some (full) information on
-    # ourselves.  A previous version was using 127.0.0.1, not sure
-    # what is best.
-    set res [catch [list exec nslookup [info hostname]] lkup]
-    if { $res == 0 } {
-	set l [split $lkup]
-	set nl ""
-	foreach e $l {
-	    if { [string length $e] > 0 } {
-		lappend nl $e
-	    }
-	}
-
-        # Now, a lot of mixture to arrange so that hostname points at the
-        # DNS server that we should use for any further request.  This
-        # code is complex, but was actually tested behind a firewall
-        # during the SITI Winter Conference 2003.  There, strangly,
-        # nslookup returned an error but a DNS server was actually setup
-        # correctly...
-        set hostname ""
-	set len [llength $nl]
-	for { set i 0 } { $i < $len } { incr i } {
-	    set e [lindex $nl $i]
-	    if { [string match -nocase "*server*" $e] } {
-		set hostname [lindex $nl [expr {$i + 1}]]
-                if { [string match -nocase "UnKnown" $hostname] } {
-                    set hostname ""
-                }
-		break
-	    }
-	}
-
-	if { $hostname != "" } {
-	    set R(dns) $hostname
-	} else {
-            for { set i 0 } { $i < $len } { incr i } {
-                set e [lindex $nl $i]
-                if { [string match -nocase "*address*" $e] } {
-                    set hostname [lindex $nl [expr {$i + 1}]]
-                    break
-                }
-            }
-            if { $hostname != "" } {
-                set R(dns) $hostname
-            }
-	}
-    }
-
-    if {$R(dns) == ""} {
-        set R(dns) $R(dnsdefault)
-    }
-
-
-    # Start again to find our full name
-    set ourhost ""
-    if {$res == 0} {
-        set dot [string first "." [info hostname]]
-        if { $dot < 0 } {
-            for { set i 0 } { $i < $len } { incr i } {
-                set e [lindex $nl $i]
-                if { [string match -nocase "*name*" $e] } {
-                    set ourhost [lindex $nl [expr {$i + 1}]]
-                    break
-                }
-            }
-            if { $ourhost == "" } {
-                if { ! [regexp {\d+\.\d+\.\d+\.\d+} $hostname] } {
-                    set dot [string first "." $hostname]
-                    set ourhost [format "%s%s" [info hostname] \
-                                     [string range $hostname $dot end]]
-                }
-            }
-        } else {
-            set ourhost [info hostname]
-        }
-    }
-
-    if {$ourhost == ""} {
-        set R(ourhost) [info hostname]
-    } else {
-        set R(ourhost) $ourhost
-    }
-
-
-    set R(initdone) 1
-
-    return $R(dns)
-}
-
-# -------------------------------------------------------------------------
-# Command Name     --  resolve
-# Original Author  --  Emmanuel Frecon - emmanuel@sics.se
-#
-# Resolve a host name to an IP address.  This is a wrapping procedure around
-# the basic services of the dns library.
-#
-# Arguments:
-#    hostname	- Name of host
-#
-proc ::resolv::resolve { hostname } {
-    variable R
-    variable Cache
-
-    # Initialise if not already done. Auto initialisation cannot take
-    # any known DNS server (known to the caller)
-    if { ! $R(initdone) } { init }
-
-    # Check whether this is not simply a raw IP address. What about
-    # IPv6 ??
-    # - We don't have sockets in Tcl for IPv6 protocols - [PT]
-    #
-    if { [regexp {\d+\.\d+\.\d+\.\d+} $hostname] } {
-	return $hostname
-    }
-
-    # Look for hostname in the cache, if found return.
-    if { [array names ::resolv::Cache $hostname] != "" } {
-	return $::resolv::Cache($hostname)
-    }
-
-    # Scream if we don't have any DNS server setup, since we cannot do
-    # anything in that case.
-    if { $R(dns) == "" } {
-	return -code error "No dns server provided"
-    }
-
-    set R(retries) 0
-    set ip [Resolve $hostname]
-
-    # And store the result of resolution in our cache for further use.
-    set Cache($hostname) $ip
-
-    return $ip
-}
-
-# Description:
-#  Attempt to resolve hostname via DNS. If the name cannot be resolved then
-#  iterate through the search list appending each domain in turn until we
-#  get one that succeeds.
-#
-proc ::resolv::Resolve {hostname} {
-    variable R
-    set t [::dns::resolve $hostname -server $R(dns)]
-    ::dns::wait $t;                       # wait with event processing
-    set status [dns::status $t]
-    if {$status == "ok"} {
-        set ip [lindex [::dns::address $t] 0]
-        ::dns::cleanup $t
-    } elseif {$status == "error"
-              && [::dns::errorcode $t] == 3 
-              && $R(retries) < [llength $R(search)]} {
-        ::dns::cleanup $t
-        set suffix [lindex $R(search) $R(retries)]
-        incr R(retries)
-        set new [lindex [split $hostname .] 0].[string trim $suffix .]
-        set ip [Resolve $new]
-    } else {
-        set err [dns::error $t]
-        ::dns::cleanup $t
-        return -code error "dns error: $err"
-    }
-    return $ip
-}
-
-# -------------------------------------------------------------------------
-
-package provide resolv $::resolv::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/dns/spf.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/dns/spf.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,533 +1,0 @@
-# spf.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-#                         Sender Policy Framework
-#
-#    http://www.ietf.org/internet-drafts/draft-ietf-marid-protocol-00.txt
-#    http://spf.pobox.com/
-#
-# Some domains using SPF:
-#   pobox.org       - mx, a, ptr
-#   oxford.ac.uk    - include
-#   gnu.org         - ip4
-#   aol.com         - ip4, ptr
-#   sourceforge.net - mx, a
-#   altavista.com   - exists,  multiple TXT replies.
-#   oreilly.com     - mx, ptr, include
-#   motleyfool.com  - include (looping includes)
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: spf.tcl,v 1.4 2004/07/30 23:58:06 patthoyts Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-package require dns;                    # tcllib 1.3
-package require logger;                 # tcllib 1.3
-package require ip;                     # tcllib 1.7
-package require struct::list;           # tcllib 1.7
-package require uri::urn;               # tcllib 1.3
-
-namespace eval spf {
-    variable version 1.1.0
-    variable rcsid {$Id: spf.tcl,v 1.4 2004/07/30 23:58:06 patthoyts Exp $}
-
-    namespace export spf
-
-    variable uid
-    if {![info exists uid]} {set uid 0}
-
-    variable log
-    if {![info exists log]} { 
-        set log [logger::init spf]
-        ${log}::setlevel warn
-        proc ${log}::stdoutcmd {level text} {
-            variable service
-            puts "\[[clock format [clock seconds] -format {%H:%M:%S}]\
-                $service $level\] $text"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# ip     : ip address of the connecting host
-# domain : the domain to match
-# sender : full sender email address
-#
-proc ::spf::spf {ip domain sender} {
-    variable log
-
-    # 3.3: Initial processing
-    # If the sender address has no local part, set it to postmaster
-    set addr [split $sender @]
-    if {[set len [llength $addr]] == 0} {
-        return -code error -errorcode permanent "invalid sender address"
-    } elseif {$len == 1} {
-        set sender "postmaster@$sender"
-    }
-
-    # 3.4: Record lookup
-    set spf [SPF $domain]
-    if {[string equal $spf none]} {
-        return $spf
-    }
-
-    return [Spf $ip $domain $sender $spf]
-}
-
-proc ::spf::Spf {ip domain sender spf} {
-    variable log
-
-    # 3.4.1: Matching Version
-    if {![regexp {^v=spf(\d)\s+} $spf -> version]} {
-        return none
-    }
-
-    ${log}::debug "$spf"
-
-    if {$version != 1} {
-        return -code error -errorcode permanent \
-            "version mismatch: we only understand SPF 1\
-            this domain has provided version \"$version\""
-    }
-
-    set result ?
-    set seen_domains $domain
-    set explanation {denied}
-
-    set directives [lrange [split $spf { }] 1 end]
-    foreach directive $directives {
-        set prefix [string range $directive 0 0]
-        if {[string equal $prefix "+"] || [string equal $prefix "-"]
-            || [string equal $prefix "?"] || [string equal $prefix "~"]} {
-            set directive [string range $directive 1 end]
-        } else {
-            set prefix "+"
-        }
-
-        set cmd [string tolower [lindex [split $directive {:/=}] 0]]
-        set param [string range $directive [string length $cmd] end]
-
-        if {[info command ::spf::_$cmd] == {}} {
-            # 6.1 Unrecognised directives terminate processing
-            #     but unknown modifiers are ignored.
-            if {[string match "=*" $param]} {
-                continue
-            } else {
-                set result unknown
-                break
-            }
-        } else {
-            set r [catch {::spf::_$cmd $ip $domain $sender $param} res]
-            if {$r} {
-                if {$r == 2} {return $res};# deal with return -code return
-                if {[string equal $res "none"] 
-                    || [string equal $res "error"]
-                    || [string equal $res "unknown"]} {
-                    return $res
-                }
-                return -code error "error in \"$cmd\": $res"
-            }            
-            if {$res} { set result $prefix }
-        }
-        
-        ${log}::debug "$prefix $cmd\($param) -> $result"
-        if {[string equal $result "+"]} break
-    }
-    
-    return $result
-}
-
-proc ::spf::loglevel {level} {
-    variable log
-    ${log}::setlevel $level
-}
-
-# get a guaranteed unique and non-present token id.
-proc ::spf::create_token {} {
-    variable uid
-    set id [incr uid]
-    while {[info exists [set token [namespace current]::$id]]} {
-        set id [incr uid]
-    }
-    return $token
-}
-
-# -------------------------------------------------------------------------
-#
-#                      SPF MECHANISM HANDLERS
-#
-# -------------------------------------------------------------------------
-
-# 4.1:	The "all" mechanism is a test that always matches.  It is used as the
-#	rightmost mechanism in an SPF record to provide an explicit default
-#
-proc ::spf::_all {ip domain sender param} {
-    return 1
-}
-
-# 4.2:	The "include" mechanism triggers a recursive SPF query.
-#	The domain-spec is expanded as per section 8.
-proc ::spf::_include {ip domain sender param} {
-    variable log
-    upvar seen_domains Seen
-
-    if {![string equal [string range $param 0 0] ":"]} {
-        return -code error "dubious parameters for \"include\""
-    }
-    set r ?
-    set new_domain [Expand [string range $param 1 end] $ip $domain $sender]
-    if {[lsearch $Seen $new_domain] == -1} {
-        lappend Seen $new_domain
-        set spf [SPF $new_domain]
-        if {[string equal $spf none]} {
-            return $spf
-        } 
-        set r [Spf $ip $new_domain $sender $spf]
-    }
-    return [string equal $r "+"]
-}
-
-# 4.4:	This mechanism matches if <ip> is one of the target's
-#	IP addresses.
-#	e.g: a:smtp.example.com a:mail.%{d} a
-#
-proc ::spf::_a {ip domain sender param} {
-    variable log
-    foreach {testdomain bits} [ip::SplitIp [string trimleft $param :]] {}
-    if {[string length $testdomain] < 1} {
-        set testdomain $domain
-    } else {
-        set testdomain [Expand $testdomain $ip $domain $sender]
-    }
-    ${log}::debug "  fetching A for $testdomain"
-    set dips [A $testdomain];           # get the IPs for the testdomain
-    foreach dip $dips {
-        ${log}::debug "  compare: ${ip}/${bits} with ${dip}/${bits}"
-        if {[ip::equal $ip/$bits $dip/$bits]} {
-            return 1
-        }
-    }
-    return 0
-}
-
-# 4.5: This mechanism matches if the <sending-host> is one of the MX hosts
-#      for a domain name.
-#
-proc ::spf::_mx {ip domain sender param} {
-    variable log
-    foreach {testdomain bits} [ip::SplitIp [string trimleft $param :]] {}
-    if {[string length $testdomain] < 1} {
-        set testdomain $domain
-    } else {
-        set testdomain [Expand $testdomain $ip $domain $sender]
-    }
-    ${log}::debug "  fetching MX for $testdomain"
-    set mxs [MX $testdomain]
-
-    foreach mx $mxs {
-        set mx [lindex $mx 1]
-        set mxips [A $mx]
-        foreach mxip $mxips {
-            ${log}::debug "  compare: ${ip}/${bits} with ${mxip}/${bits}"
-            if {[ip::equal $ip/$bits $mxip/$bits]} {
-                return 1
-            }
-        }
-    }
-    return 0
-}
-
-# 4.6: This mechanism tests if the <sending-host>'s name is within a
-#      particular domain.
-#
-proc ::spf::_ptr {ip domain sender param} {
-    variable log
-    set validnames {}
-    if {[catch { set names [PTR $ip] } msg]} {
-        ${log}::debug "  \"$ip\" $msg"
-        return 0
-    }
-    foreach name $names {
-        set addrs [A $name]
-        foreach addr $addrs {
-            if {[ip::equal $ip $addr]} {
-                lappend validnames $name
-                continue
-            }
-        }
-    }
-
-    ${log}::debug "  validnames: $validnames"
-    set testdomain [Expand [string trimleft $param :] $ip $domain $sender]
-    if {$testdomain == {}} {
-        set testdomain $domain
-    }
-    foreach name $validnames {
-        if {[string match "*$testdomain" $name]} {
-            return 1
-        }
-    }
-
-    return 0
-}
-
-# 4.7: These mechanisms test if the <sending-host> falls into a given IP
-#      network.
-#
-proc ::spf::_ip4 {ip domain sender param} {
-    variable log
-    foreach {network bits} [ip::SplitIp [string range $param 1 end]] {}
-    ${log}::debug "  compare ${ip}/${bits} to ${network}/${bits}"
-    if {[ip::equal $ip/$bits $network/$bits]} {
-        return 1
-    }
-    return 0
-}
-
-# 4.6: These mechanisms test if the <sending-host> falls into a given IP
-#      network.
-#
-proc ::spf::_ip6 {ip domain sender param} {
-    variable log
-    foreach {network bits} [ip::SplitIp [string range $param 1 end]] {}
-    ${log}::debug "  compare ${ip}/${bits} to ${network}/${bits}"
-    if {[ip::equal $ip/$bits $network/$bits]} {
-        return 1
-    }
-    return 0
-}
-
-# 4.7: This mechanism is used to construct an arbitrary host name that is
-#      used for a DNS A record query.  It allows for complicated schemes
-#      involving arbitrary parts of the mail envelope to determine what is
-#      legal.
-#
-proc ::spf::_exists {ip domain sender param} {
-    variable log
-    set testdomain [Expand [string range $param 1 end] $ip $domain $sender]
-    ${log}::debug "   checking existence of '$testdomain'"
-    if {[catch {A $testdomain}]} {
-        return 0
-    }
-    return return 1
-}
-
-# 5.1: Redirected query
-#
-proc ::spf::_redirect {ip domain sender param} {
-    variable log
-    set new_domain [Expand [string range $param 1 end] $ip $domain $sender]
-    ${log}::debug ">> redirect to '$new_domain'"
-    set spf [SPF $new_domain]
-    if {![string equal $spf none]} {
-        set spf [Spf $ip $new_domain $sender $spf]
-    }
-    ${log}::debug "<< redirect returning '$spf'"
-    return -code return $spf
-}
-
-# 5.2: Explanation
-#
-proc ::spf::_exp {ip domain sender param} {
-    variable log
-    set new_domain [string range $param 1 end]
-    set exp [TXT $new_domain]
-    set exp [Expand $exp $ip $domain $sender]
-    ${log}::debug "exp expanded to \"$exp\""
-    # FIX ME: need to store this somehow.
-}
-
-# 5.3: Sender accreditation
-#
-proc ::spf::_accredit {ip domain sender param} {
-    variable log
-    set accredit [Expand [string range $param 1 end] $ip $domain $sender]
-    ${log}::debug "  accreditation '$accredit'"
-    # We are not using this at the moment.
-    return 0
-}
-
-
-# 7: Macro expansion
-#
-proc ::spf::Expand {txt ip domain sender} {
-    variable log
-    set re {%\{[[:alpha:]](?:\d+)?r?[\+\-\.,/_=]*\}}
-    set txt [string map {\[ \\\[ \] \\\]} $txt]
-    regsub -all $re $txt {[ExpandMacro & $ip $domain $sender]} cmd
-    set cmd [string map {%% % %_ \  %- %20} $cmd]
-    return [subst -novariables $cmd]
-}
-
-proc ::spf::ExpandMacro {macro ip domain sender} {
-    variable log
-    set re {%\{([[:alpha:]])(\d+)?(r)?([\+\-\.,/_=]*)\}}
-    set C {} ; set T {} ; set R {}; set D {}
-    set r [regexp $re $macro -> C T R D]
-    if {$R == {}} {set R 0} else {set R 1}
-    set res $macro
-    if {$r} {
-        set enc [string is upper $C]
-        switch -exact -- [string tolower $C] {
-            s { set res $sender }
-            l {
-                set addr [split $sender @]
-                if {[llength $addr] < 2} {
-                    set res postmaster
-                } else {
-                    set res [lindex $addr 0]
-                }
-            }
-            o {
-                set addr [split $sender @]
-                if {[llength $addr] < 2} {
-                    set res $sender
-                } else {
-                    set res [lindex $addr 1]
-                }
-            }
-            h - d { set res $domain }
-            i { 
-                set res [ip::normalize $ip]
-                if {[ip::is ipv6 $res]} {
-                    # Convert 0000:0001 to 0.1
-                    set t {}
-                    binary scan [ip::Normalize $ip 6] c* octets
-                    foreach octet $octets {
-                        set hi [expr {($octet & 0xF0) >> 4}]
-                        set lo [expr {$octet & 0x0F}]
-                        lappend t [format %x $hi] [format %x $lo]
-                    }
-                    set res [join $t .]
-                }
-            }
-            v { 
-                if {[ip::is ipv6 $ip]} {
-                    set res ip6
-                } else {
-                    set res "in-addr"
-                }
-            }
-            c { 
-                set res [ip::normalize $ip]
-                if {[ip::is ipv6 $res]} {
-                    set res [ip::contract $res]
-                }
-            }
-            r { 
-                set s [socket -server {} -myaddr [info host] 0]
-                set res [lindex [fconfigure $s -sockname] 1]
-                close $s
-            }
-            t { set res [clock seconds] }
-        }
-        if {$T != {} || $R || $D != {}} {
-            if {$D == {}} {set D .}
-            set res [split $res $D]
-            if {$R} {
-                set res [struct::list::Lreverse $res]
-            }
-            if {$T != {}} {
-                incr T -1
-                set res [join [lrange $res end-$T end] $D]
-            }
-            set res [join $res .]
-        }
-        if {$enc} {
-            # URI encode the result.
-            set res [uri::urn::quote $res]
-        }
-    }
-    return $res
-}
-
-# -------------------------------------------------------------------------
-#
-# DNS helper procedures.
-#
-# -------------------------------------------------------------------------
-
-proc ::spf::Resolve {domain type resultproc} {
-    if {[info command $resultproc] == {}} {
-        return -code error "invalid arg: \"$resultproc\" must be a command"
-    }
-    set tok [dns::resolve $domain -type $type]
-    dns::wait $tok
-    set errorcode NONE
-    if {[string equal [dns::status $tok] "ok"]} {
-        set result [$resultproc $tok]
-        set code   ok
-    } else {
-        set result    [dns::error $tok]
-        set errorcode [dns::errorcode $tok]
-        set code      error
-    }
-    dns::cleanup $tok
-    return -code $code -errorcode $errorcode $result
-}
-
-# 3.4: Record lookup
-proc ::spf::SPF {domain} {
-    set txt ""
-    if {[catch {Resolve $domain SPF ::dns::result} spf]} {
-        set code $::errorCode
-        ${log}::debug "error fetching SPF record: $r"
-        switch -exact -- $code {
-            3 { return -code return [list - "Domain Does Not Exist"] }
-            2 { return -code error -errorcode temporary $spf }
-        }
-        set txt none
-    } else {
-        foreach res $spf {
-            set ndx [lsearch $res rdata]
-            incr ndx
-            if {$ndx != 0} {
-                append txt [string range [lindex $res $ndx] 1 end]
-            }
-        }
-    }
-    return $txt
-}
-
-proc ::spf::TXT {domain} {
-    set r [Resolve $domain TXT ::dns::result]
-    set txt ""
-    foreach res $r {
-        set ndx [lsearch $res rdata]
-        incr ndx
-        if {$ndx != 0} {
-            append txt [string range [lindex $res $ndx] 1 end]
-        }
-    }
-    return $txt
-}
-
-proc ::spf::A {name} {
-    return [Resolve $name A ::dns::address]
-}
-
-
-proc ::spf::AAAA {name} {
-    return [Resolve $name AAAA ::dns::address]
-}
-
-proc ::spf::PTR {addr} {
-    return [Resolve $addr A ::dns::name]
-}
-
-proc ::spf::MX {domain} {
-    set r [Resolve $domain MX ::dns::name]
-    return [lsort -index 0 $r]
-}
-
-    
-# -------------------------------------------------------------------------
-
-package provide spf $::spf::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/docstrip.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/docstrip.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,163 +1,0 @@
-## 
-## This is the file `docstrip.tcl',
-## generated with the SAK utility
-## (sak docstrip/regen).
-## 
-## The original source files were:
-## 
-## tcldocstrip.dtx  (with options: `pkg')
-## 
-## In other words:
-## **************************************
-## * This Source is not the True Source *
-## **************************************
-## the true source is the file from which this one was generated.
-##
-package require Tcl 8.4
-package provide docstrip 1.2
-namespace eval docstrip {
-   namespace export extract sourcefrom
-}
-proc docstrip::extract {text terminals args} {
-   array set O {
-      -annotate 0
-      -metaprefix %%
-      -onerror throw
-      -trimlines 1
-   }
-   array set O $args
-   foreach t $terminals {set T($t) ""}
-   set stripped ""
-   set block_stack [list]
-   set offlevel 0
-   set verbatim 0
-   set lineno 0
-   foreach line [split $text \n] {
-      incr lineno
-      if {$O(-trimlines)} then {
-         set line [string trimright $line " "]
-      }
-      if {$verbatim} then {
-         if {$line eq $endverbline} then {
-            set verbatim 0
-            continue
-         } elseif {$offlevel} then {
-            continue
-         }
-         append stripped $line \n
-         if {$O(-annotate)>=1} then {append stripped {V "" ""} \n}
-      } else {
-         switch -glob -- $line %%* {
-            if {!$offlevel} then {
-               append stripped $O(-metaprefix)\
-                 [string range $line 2 end] \n
-               if {$O(-annotate)>=1} then {
-                  append stripped [list M %% $O(-metaprefix)] \n
-               }
-            }
-         } %<<* {
-            set endverbline "%[string range $line 3 end]"
-            set verbatim 1
-            continue
-         } %<* {
-            if {![
-               regexp -- {^%<([*/+-]?)([^>]*)>(.*)$} $line ""\
-                 modifier expression line
-            ]} then {
-               extract,error BADGUARD\
-                 "Malformed guard \"\n$line\n\""
-                 "Malformed guard on line $lineno"
-               continue
-            }
-            regsub -all -- {\\|\{|\}|\$|\[|\]| |;} $expression\
-              {\\&} E
-            regsub -all -- {,} $E {|} E
-            regsub -all -- {[^()|&!]+} $E {[info exists T(&)]} E
-            if {[catch {expr $E} val]} then {
-               extract,error EXPRERR\
-                 "Error in expression <$expression> ignored"\
-                 "docstrip: $val"
-               set val -1
-            }
-            switch -exact -- $modifier * {
-               lappend block_stack $expression
-               if {$offlevel || !$val} then {incr offlevel}
-               continue
-            } / {
-               if {![llength $block_stack]} then {
-                  extract,error SPURIOUS\
-                    "Spurious end block </$expression> ignored"\
-                    "Spurious end block </$expression>"
-               } else {
-                  if {[string compare $expression\
-                    [lindex $block_stack end]]} then {
-                     extract,error MISMATCH\
-                       "Found </$expression> instead of\
-                       </[lindex $block_stack end]>"
-                  }
-                  if {$offlevel} then {incr offlevel -1}
-                  set block_stack [lreplace $block_stack end end]
-               }
-               continue
-            } - {
-               if {$offlevel || $val} then {continue}
-               append stripped $line \n
-               if {$O(-annotate)>=1} then {
-                  append stripped [list - %<-${expression}> ""] \n
-               }
-            } default {
-               if {$offlevel || !$val} then {continue}
-               append stripped $line \n
-               if {$O(-annotate)>=1} then {
-                  append stripped\
-                    [list + %<${modifier}${expression}> ""] \n
-               }
-            }
-         } %* {continue}\
-         {\\endinput} {
-           break
-         } default {
-            if {$offlevel} then {continue}
-            append stripped $line \n
-            if {$O(-annotate)>=1} then {append stripped {. "" ""} \n}
-         }
-      }
-      if {$O(-annotate)>=2} then {append stripped $lineno \n}
-      if {$O(-annotate)>=3} then {append stripped $block_stack \n}
-   }
-   return $stripped
-}
-proc docstrip::extract,error {situation message {errmessage ""}} {
-   upvar 1 O(-onerror) onerror lineno lineno
-   switch -- [string tolower $onerror] "puts" {
-      puts stderr "docstrip: $message on line $lineno."
-   } "ignore" {} default {
-      if {$errmessage ne ""} then {
-         error $errmessage "" [list DOCSTRIP $situation $lineno]
-      } else {
-         error $message "" [list DOCSTRIP $situation $lineno]
-      }
-   }
-}
-proc docstrip::sourcefrom {name terminals args} {
-   set F [open $name r]
-   if {[llength $args]} then {
-      eval [linsert $args 0 fconfigure $F]
-   }
-   set text [read $F]
-   close $F
-   set oldscr [info script]
-   info script $name
-   set code [catch {
-      uplevel 1 [extract $text $terminals -metaprefix #]
-   } res]
-   info script $oldscr
-   if {$code == 1} then {
-      error $res $::errorInfo $::errorCode
-   } else {
-      return $res
-   }
-}
-## 
-## 
-## End of file `docstrip.tcl'.
Index: tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/docstrip_util.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/docstrip_util.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,353 +1,0 @@
-## 
-## This is the file `docstrip_util.tcl',
-## generated with the SAK utility
-## (sak docstrip/regen).
-## 
-## The original source files were:
-## 
-## tcldocstrip.dtx  (with options: `utilpkg')
-## 
-## In other words:
-## **************************************
-## * This Source is not the True Source *
-## **************************************
-## the true source is the file from which this one was generated.
-##
-package require Tcl 8.4
-package require docstrip 1.2
-package provide docstrip::util 1.2
-namespace eval docstrip::util {
-   namespace import [namespace parent]::extract
-   namespace export ddt2man guard patch thefile
-}
-proc docstrip::util::ddt2man {text} {
-   set wascode 0
-   set verbatim 0
-   set res ""
-   foreach line [split $text \n] {
-      if {$verbatim} then {
-         if {$line eq $endverbline} then {
-            set verbatim 0
-         } else {
-            append res [string map {[ [lb] ] [rb]} $line] \n
-         }
-      } else {
-         switch -glob -- $line %%* {
-            if {$wacode} then {
-               append res {[example_end]} \n
-               set wascode 0
-            }
-            append res [string range $line 2 end] \n
-         } %<<* {
-            if {!$wascode} then {
-               append res {[example_begin]} \n
-               set wascode 1
-            }
-            set endverbline "%[string range $line 3 end]"
-            set verbatim 1
-         } %<* {
-            if {!$wascode} then {
-               append res {[example_begin]} \n
-               set wascode 1
-            }
-            set guard ""
-            regexp -- {(^%<[^>]*>)(.*)$} $line "" guard line
-            append res \[ [list emph $guard] \]\
-              [string map {[ [lb] ] [rb]} $line] \n
-         } %* {
-            if {$wascode} then {
-               append res {[example_end]} \n
-               set wascode 0
-            }
-            append res [string range $line 1 end] \n
-         } {\\endinput} {
-           break
-         } "" {
-            append res \n
-         } default {
-            if {!$wascode} then {
-               append res {[example_begin]} \n
-               set wascode 1
-            }
-            append res [string map {[ [lb] ] [rb]} $line] \n
-         }
-      }
-   }
-   if {$wascode} then {append res {[example_end]} \n}
-   return $res
-}
-proc docstrip::util::guards {subcmd text} {
-   set verbatim 0
-   set lineno 1
-   set badL {}
-   foreach line [split $text \n] {
-      if {$verbatim} then {
-         if {$line eq $endverbline} then {set verbatim 0}
-      } else {
-         switch -glob -- $line %<<* {
-            set endverbline "%[string range $line 3 end]"
-            set verbatim 1
-         } %<* {
-            if {![
-               regexp -- {^%<([*/+-]?)([^>]*)>(.*)$} $line ""\
-                 modifier expression line
-            ]} then {
-               lappend badL $lineno $line
-            } else {
-               if {$modifier eq ""} then {set modifier " "}
-               append E($expression) $modifier
-            }
-         }
-      }
-      incr lineno
-   }
-   if {$subcmd eq "rotten"} then {return $badL}
-   switch -- $subcmd "exprmods" {
-      return [array get E]
-   } "expressions" {
-      return [array names E]
-   } "exprerr" {
-      set res {}
-      foreach expr [array names E] {
-         regsub -all {[^()!,|&]+} $expr 0 e
-         regsub -all {,} $e {|} e
-         if {[catch {expr $e}]} then {lappend res $expr}
-      }
-      return $res
-   }
-   foreach name [array names E] {
-      set E($name) [string length $E($name)]
-   }
-   if {$subcmd eq "exprcounts"} then {return [array get E]}
-   foreach expr [array names E] {
-      foreach term [split $expr "()!,|&"] {
-         if {$term eq ""} then {continue}
-         if {![info exists T($term)]} then {set T($term) 0}
-         incr T($term) $E($expr)
-      }
-   }
-   switch -- $subcmd "counts" {
-      return [array get T]
-   } "names" {
-      return [array names T]
-   } default {
-      error "Unknown subcommand '$subcmd', must be one of:\
-        counts, exprcounts, expressions, exprmods, names, rotten"
-   }
-}
-proc docstrip::util::patch {sourcevar termL fromtext diff args} {
-   upvar 1 $sourcevar SL
-   array set O {-trimlines 1 -matching exact}
-   array set O $args
-   set cmd [list extract [join $SL \n]  $termL -annotate 2]
-   foreach opt {-metaprefix -trimlines} {
-      if {[info exists O($opt)]} then {lappend cmd $opt $O($opt)}
-   }
-   set EL [split [eval $cmd] \n]
-   lset EL end \n
-   set ptr 0
-   set lineno 1
-   set FL [list {}]
-   foreach line [split $fromtext \n] {
-      lappend FL $line
-      if {$O(-trimlines)} then {set line [string trimright $line " "]}
-      if {$line eq [lindex $EL $ptr]} then {
-         set lift($lineno) [lindex $EL [incr ptr]]
-         lset lift($lineno) 0 [expr { [lindex $EL [incr ptr]] - 1 }]
-         incr ptr
-      }
-      incr lineno
-   }
-   if {![array size lift]} then {
-      return -code error "The extract did not match any part of the\
-        fromtext. Check the list of terminals and the options"
-   }
-   set RL [list]
-   set log [list]
-   foreach hunk [lsort -decreasing -integer -index 0 $diff] {
-      set replL [list]
-      set l1 [lindex $hunk 0]
-      set repl {0 -1}
-      set matches 1
-      foreach {type line} [lindex $hunk 4] {
-         switch -glob -- $type {[0-]} {
-            switch -- $O(-matching) "exact" {
-               if {[lindex $FL $l1] ne $line} then {set matches 0}
-            } "nonspace" {
-               if {[regsub -all -- {\s} $line {}] ne\
-                 [regsub -all -- {\s} [lindex $FL $l1] {}]} then {
-                  set matches 0
-               }
-            } "anyspace" {
-               if {[regsub -all -- {\s+} $line { }] ne\
-                 [regsub -all -- {\s+} [lindex $FL $l1] { }]} then {
-                  set matches 0
-               }
-            }
-         }
-         switch -- $type synch {
-            if {[llength $repl]>2 ||\
-              [lindex $repl 1]-[lindex $repl 0]>=0} then {
-               lappend replL $repl
-            }
-            set repl [list $l1 [expr {$l1-1}]]
-         } + {
-            lappend repl $line
-         } - {
-            lset repl 1 $l1
-            incr l1
-         } 0 {
-            if {[llength $repl]>2 ||\
-              [lindex $repl 1]-[lindex $repl 0]>=0} then {
-               lappend replL $repl
-               set repl {0 -1}
-            }
-            lset repl 1 $l1
-            incr l1
-            lset repl 0 $l1
-         }
-      }
-      if {[llength $repl]>2 || [lindex $repl 1]-[lindex $repl 0]>=0}\
-      then {lappend replL $repl}
-      if {$matches} then {
-         lappend hunk [lsort -decreasing -integer -index 0 $replL]
-         lappend RL $hunk
-      } else {
-         lappend hunk "(-- did not match fromtext --)"
-         lappend log $hunk
-      }
-   }
-   foreach hunk $RL {
-      set applied 0
-      set misapplied 0
-      foreach repl [lindex $hunk 5] {
-         unset -nocomplain from to
-         for {set n [lindex $repl 1]} {$n>=[lindex $repl 0]}\
-           {incr n -1} {
-            if {![info exists lift($n)]} then {
-               incr misapplied
-               continue
-            } elseif {![info exists from]} then {
-               set to [lindex $lift($n) 0]
-               set from $to
-            } elseif {[lindex $lift($n) 0] == $from-1} then {
-               set from [lindex $lift($n) 0]
-            } else {
-               set SL [lreplace $SL $from $to]
-               set to [lindex $lift($n) 0]
-               set from $to
-            }
-            incr applied
-            set n0 $n
-         }
-         if {[info exists from]} then {
-            set sprefix [lindex $lift($n0) 1]
-            set eprefix [lindex $lift($n0) 2]
-         } elseif {[info exists lift([lindex $repl 0])]} then {
-            foreach {from sprefix eprefix} $lift([lindex $repl 0])\
-              break
-            set to [expr {$from-1}]
-         } else {
-            incr misapplied [llength [lrange $repl 2 end]]
-            continue
-         }
-         set eplen [string length $eprefix]
-         set epend [expr {$eplen-1}]
-         set cmd [list lreplace $SL $from $to]
-         foreach line [lrange $repl 2 end] {
-            if {$eprefix eq [string range $line 0 $epend]} then {
-               lappend cmd "$sprefix[string range $line $eplen end]"
-            } else {
-               lappend cmd $line
-            }
-            incr applied
-         }
-         set SL [eval $cmd]
-      }
-      if {$misapplied>0} then {
-         if {$applied>0} then {
-            lset hunk 5 "(-- was partially applied --)"
-         } else {
-            lset hunk 5 "(not applied)"
-         }
-         lappend log $hunk
-      }
-   }
-   set res ""
-   foreach hunk [lsort -index 0 -integer $log] {
-      foreach {start1 end1 start2 end2 lines msg} $hunk break
-      append res [format "@@ -%d,%d +%d,%d @@ %s\n"\
-        $start1 [expr {$end1-$start1+1}]\
-        $start2 [expr {$end2-$start2+1}] $msg]
-      foreach {type line} $lines {
-         switch -- $type 0 {
-            append res " " $line \n
-         } - - + {
-            append res $type $line \n
-         }
-      }
-   }
-   return $res
-}
-proc docstrip::util::thefile {fname args} {
-   set F [open $fname r]
-   if {[llength $args]} then {
-      if {[set code [
-         catch {eval [linsert $args 0 fconfigure $F]} res
-      ]]} then {
-         close $F
-         return -code $code -errorinfo $::errorInfo -errorcode\
-           $::errorCode
-      }
-   }
-   catch {read $F} res
-   close $F
-   return $res
-}
-proc docstrip::util::import_unidiff {text {warnvar ""}} {
-   if {$warnvar ne ""} then {upvar 1 $warnvar warning}
-   set inheader 1
-   set res [list]
-   set lines [list]
-   set end2 "not an integer"
-   foreach line [split $text \n] {
-      if {$inheader && [regexp {^(---|\+\+\+)} $line]}\
-      then {continue}
-      switch -glob -- $line { *} {
-         lappend lines 0 [string range $line 1 end]
-      } {+*} {
-         lappend lines + [string range $line 1 end]
-      } {-*} {
-         lappend lines - [string range $line 1 end]
-      } @@* {
-         if {[string is integer $end2]} then {
-            lappend res [list $start1 $end1 $start2 $end2 $lines]
-         }
-         set len2 [set len1 ,1]
-         if {[
-            regexp {^@@ -([0-9]+)(,[0-9]+)? \+([0-9]+)(,[0-9]+)? @@}\
-              $line -> start1 len1 start2 len2
-         ] && [scan "$start1 $len1,1" {%d ,%d} start1 len1]==2 &&\
-              [scan "$start2 $len2,1" {%d ,%d} start2 len2]==2
-         } then {
-            set end1 [expr {$start1+$len1-1}]
-            set end2 [expr {$start2+$len2-1}]
-            set inheader 0
-         } else {
-            set end2 "not an integer"
-            append warning "Could not parse hunk header:  " $line \n
-         }
-         set lines [list]
-      } "" {
-      } default {
-         append warning "Could not parse line:  " $line \n
-      }
-   }
-   if {[string is integer $end2]} then {
-      lappend res [list $start1 $end1 $start2 $end2 $lines]
-   }
-   return $res
-}
-## 
-## 
-## End of file `docstrip_util.tcl'.
Index: tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/docstrip/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded docstrip       1.2 [list source [file join $dir docstrip.tcl]]
-package ifneeded docstrip::util 1.2 [list source [file join $dir docstrip_util.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# -*- tcl -*-
-# api.tcl -- API placeholders
-#
-# Copyright (c) 2001 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Copyright (c) 2002 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# This file defines all commands expected from a formatter by the
-# doctools library. It is loaded into the formatter interpreter before
-# the code for a particular format is loaded. All commands defined
-# here return an error. This ensures the generation of errors if a
-# format forgets to define commands in the API.
-
-################################################################
-# Here it comes
-
-foreach __cmd {
-    initialize shutdown setup numpasses listvariables varset
-
-    manpage_begin moddesc titledesc manpage_end require description
-    section para list_begin list_end lst_item call bullet enum see_also
-    keywords example example_begin example_end nl arg cmd opt emph strong
-    comment sectref syscmd method option widget fun type package class var
-    file uri term const copyright
-} {
-    proc fmt_$__cmd {args} [list return  "return -code error \"Unimplemented API command $__cmd\""]
-}
-unset __cmd
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api_idx.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api_idx.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,26 +1,0 @@
-# -*- tcl -*-
-# api_idx.tcl -- API placeholders
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# This file defines all commands expected from a docidx formatter by the
-# doctools library. It is loaded into the formatter interpreter before
-# the code for a particular docidx format is loaded. All commands defined
-# here return an error. This ensures the generation of errors if a
-# format forgets to define commands in the API.
-
-################################################################
-# Here it comes
-
-foreach __cmd {
-    idx_initialize idx_shutdown idx_setup idx_numpasses
-    idx_listvariables idx_varset
-    fmt_index_begin fmt_index_end fmt_key fmt_manpage fmt_url
-    fmt_comment fmt_plain_text
-} {
-    proc $__cmd {args} [list return  "return -code error \"Unimplemented API command $__cmd\""]
-}
-unset __cmd
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api_toc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/api_toc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,26 +1,0 @@
-# -*- tcl -*-
-# api_toc.tcl -- API placeholders
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# This file defines all commands expected from a doctoc formatter by the
-# doctools library. It is loaded into the formatter interpreter before
-# the code for a particular doctoc format is loaded. All commands defined
-# here return an error. This ensures the generation of errors if a
-# format forgets to define commands in the API.
-
-################################################################
-# Here it comes
-
-foreach __cmd {
-    toc_initialize toc_shutdown toc_setup toc_numpasses
-    toc_listvariables toc_varset
-    fmt_toc_begin fmt_toc_end fmt_division_start fmt_division_end
-    fmt_item fmt_comment fmt_plain_text
-} {
-    proc $__cmd {args} [list return  "return -code error \"Unimplemented API command $__cmd\""]
-}
-unset __cmd
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/changelog.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/changelog.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,260 +1,0 @@
-# changelog.tcl --
-#
-#	Handling of ChangeLog's.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: changelog.tcl,v 1.5 2005/09/28 04:51:19 andreas_kupries Exp $
-
-
-# FUTURE -- Expand pre-parsed log (nested lists) into flat structures
-# FUTURE --  => date/author/file/cref + cref/text
-# FUTURE -- I.e. relational/tabular structure, useable in table displays,
-# FUTURE -- sort by date, author, file to see aggregated changes
-# FUTURE --  => Connectivity to 'struct::matrix', Reports!
-
-
-package require Tcl 8.2
-package require textutil
-
-namespace eval ::doctools {}
-namespace eval ::doctools::changelog {
-    namespace export scan toDoctools
-}
-
-# ::doctools::changelog::scan --
-#
-#	Scan a ChangeLog generated by 'emacs' and extract the relevant information.
-#
-# Result
-#	List of entries. Each entry is a list of three elements. These
-#	are date, author, and commentary. The commentary is a list of
-#	sections. Each section is a list of two elements, a list of
-#	files, and the associated text.
-
-
-proc ::doctools::changelog::scan {text} {
-    set text [split $text \n]
-    set n    [llength $text]
-
-    set entries [list]
-    set clist [list]
-    set files [list]
-    set comment ""
-    set first 1
-
-    for {set i 0} {$i < $n} {incr i} {
-	set line [lindex $text $i]
-
-	if {[regexp "^\[^ \t\]" $line]} {
-	    # No whitespace at the front, start a new entry
-
-	    closeEntry
-
-	    # For the upcoming entry. Quick extraction first, string
-	    # based in case of failure.
-
-	    if {[catch {
-		set date    [string trim [lindex $line 0]]
-		set author  [string trim [lrange $line 1 end]]
-	    }]} {
-		set pos    [string first " " $line]
-		set date   [string trim [string range $line 0   $pos]]
-		set author [string trim [string range $line $pos end]]
-	    }
-	    continue
-	}
-
-	# Inside of an entry.
-
-	set line [string trim $line]
-
-	if {[string length $line] == 0} {
-	    # Next comment section
-	    closeSection
-	    continue
-	}
-
-	# Line is not empty. Split into file and comment parts,
-	# remember the data.
-
-	if {[string first "* " $line] == 0} {
-	    if {[regexp {^\* (.*):[ 	]} $line full fname]} {
-		set line [string range $line [string length $full] end]
-	    } elseif {[regexp {^\* (.*):$} $line full fname]} {
-		set line ""
-	    } else {
-		# There is no filename
-		set fname ""
-		set line [string range $line 2 end] ; # Get rid of "* ".
-	    }
-
-	    set detail ""
-	    while {[string first "(" $fname] >= 0} {
-		if {[regexp {\([^)]*\)} $fname detailx]} {
-		    regsub {\([^)]*\)} $fname {} fnameNew
-		} elseif {[regexp {\([^)]*} $fname detailx]} {
-		    regsub {\([^)]*} $fname {} fnameNew
-		} else {
-		    break
-		}
-		append detail " " $detailx
-		set fname [string trim $fnameNew]
-	    }
-	    if {$detail != {}} {set line "$detail $line"}
-	    if {$fname  != {}} {lappend files $fname}
-	}
-
-	append comment $line\n
-    }
-
-    closeEntry
-    return $entries
-}
-
-
-proc ::doctools::changelog::closeSection {} {
-    upvar clist clist comment comment files files
-
-    if {
-	([string length $comment] > 0) ||
-	([llength $files] > 0)
-    } {
-	lappend clist   [list $files [string trim $comment]]
-	set     files   [list]
-	set     comment ""	
-    }
-    return
-}
-
-proc ::doctools::changelog::closeEntry {} {
-    upvar clist clist comment comment files files first first
-    upvar date date author author entries entries
-
-    if {!$first} {
-	closeSection
-	lappend entries [list $date $author $clist]
-    }
-    set first 0
-    set clist [list]
-    set files [list]
-    set comment ""
-    return
-}
-
-# ::doctools::changelog::merge --
-#
-#	Merge several preprocessed changelogs (see scan) into one structure.
-
-
-proc ::doctools::changelog::merge {args} {
-
-    if {[llength $args] == 0} {return {}}
-    if {[llength $args] == 1} {return [lindex $args 0]}
-
-    set res [list]
-    array set tmp {}
-
-    # Merge up ...
-
-    foreach entries $args {
-	foreach e $entries {
-	    foreach {date author comments} $e break
-	    if {![info exists tmp($date,$author)]} {
-		lappend res [list $date $author]
-		set tmp($date,$author) $comments
-	    } else {
-		foreach section $comments {
-		    lappend tmp($date,$author) $section
-		}
-	    }
-	}
-    }
-
-    # ... And construct the final result
-
-    set args $res
-    set res [list]
-    foreach key [lsort -decreasing $args] {
-	foreach {date author} $key break
-	lappend res [list $date $author $tmp($date,$author)]
-    }
-    return $res
-}
-
-
-# ::doctools::changelog::toDoctools --
-#
-#	Convert a preprocessed changelog log (see scan) into a doctools page.
-#
-# Arguments:
-#	evar, cvar, fvar: Name of the variables containing the preprocessed log.
-#
-# Results:
-#	A string containing a properly formatted ChangeLog.
-#
-
-proc ::doctools::changelog::q {text} {return "\[$text\]"}
-
-proc ::doctools::changelog::toDoctools {title module version entries} {
-
-    set     linebuffer [list]
-    lappend linebuffer [q "manpage_begin [list ${title}-changelog n $version]"]
-    lappend linebuffer [q "titledesc [list "$title ChangeLog"]"]
-    lappend linebuffer [q "moddesc [list $module]"]
-    lappend linebuffer [q description]
-    lappend linebuffer [q "list_begin definitions compact"]
-
-    foreach entry $entries {
-	foreach {date author commentary} $entry break
-
-	lappend linebuffer [q "lst_item \"[q "emph [list $date]"] -- [string map {{"} {\"} {\"} {\\\"}} $author]\""]
-
-	if {[llength $commentary] > 0} {
-	    lappend linebuffer [q nl]
-	}
-
-	foreach section $commentary {
-	    foreach {files text} $section break
-	    if {$text != {}} {
-		set text [string map {[ [lb] ] [rb]} [textutil::adjust $text]]
-	    }
-
-	    if {[llength $files] > 0} {
-		lappend linebuffer [q "list_begin definitions"]
-
-		foreach f $files {
-		    lappend linebuffer [q "lst_item [q "file [list $f]"]"]
-		}
-		if {$text != {}} {
-		    lappend linebuffer ""
-		    lappend linebuffer $text
-		    lappend linebuffer ""
-		}
-
-		lappend linebuffer [q list_end]
-	    } elseif {$text != {}} {
-		# No files
-		lappend linebuffer [q "list_begin bullet"]
-		lappend linebuffer [q bullet]
-		lappend linebuffer ""
-		lappend linebuffer $text
-		lappend linebuffer ""
-		lappend linebuffer [q list_end]
-	    }
-	}
-	lappend linebuffer [q nl]
-    }
-
-    lappend linebuffer [q list_end]
-    lappend linebuffer [q manpage_end]
-    return [join $linebuffer \n]
-}
-
-#------------------------------------
-# Module initialization
-
-package provide doctools::changelog 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,580 +1,0 @@
-# -*- tcl -*-
-# checker.tcl
-#
-# Code used inside of a checker interpreter to ensure correct usage of
-# doctools formatting commands.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# L10N
-
-package require msgcat
-
-proc ::msgcat::mcunknown {locale code} {
-    return "unknown error code \"$code\" (for locale $locale)"
-}
-
-if {0} {
-    puts stderr "Locale [::msgcat::mcpreferences]"
-    foreach path [dt_search] {
-	puts stderr "Catalogs: [::msgcat::mcload $path] - $path"
-    }
-} else {
-    foreach path [dt_search] {
-	::msgcat::mcload $path
-    }
-}
-
-# State, and checker commands.
-# -------------------------------------------------------------
-#
-# Note that the code below assumes that a command XXX provided by the
-# formatter engine is accessible under the name 'fmt_XXX'.
-#
-# -------------------------------------------------------------
-
-global state lstctx lstitem
-
-# --------------+-----------------------+----------------------
-# state		| allowed commands	| new state (if any)
-# --------------+-----------------------+----------------------
-# all except	| arg cmd opt comment	|
-#  for "done"	| syscmd method option	|
-#		| widget fun type class	|
-#		| package var file uri	|
-#		| strong emph namespace	|
-# --------------+-----------------------+----------------------
-# manpage_begin	| manpage_begin		| header
-# --------------+-----------------------+----------------------
-# header	| moddesc titledesc	| header
-#		| copyright keywords	|
-#		| require see_also	|
-#		+-----------------------+-----------
-#		| description		| body
-# --------------+-----------------------+----------------------
-# body		| section para list_end	| body
-#		| list_begin lst_item	|
-#		| call bullet usage nl	|
-#		| example see_also	|
-#		| keywords sectref enum	|
-#		| arg_def cmd_def	|
-#		| opt_def tkoption_def	|
-#		| subsection		|
-#		+-----------------------+-----------
-#		| example_begin		| example
-#		+-----------------------+-----------
-#		| manpage_end		| done
-# --------------+-----------------------+----------------------
-# example	| example_end		| body
-# --------------+-----------------------+----------------------
-# done		|			|
-# --------------+-----------------------+----------------------
-#
-# Additional checks
-# --------------------------------------+----------------------
-# list_begin/list_end			| Are allowed to nest.
-# --------------------------------------+----------------------
-#	section				| Not allowed in list context
-#
-#	arg_def				| Only in 'argument list'.
-#	cmd_def				| Only in 'command list'.
-#	nl para				| Only in list item context.
-#	opt_def				| Only in 'option list'.
-#	tkoption_def			| Only in 'tkoption list'.
-# 	def/call			| Only in 'definition list'.
-# 	enum				| Only in 'enum list'.
-# 	item/bullet			| Only in 'bullet list'.
-# --------------------------------------+----------------------
-
-# -------------------------------------------------------------
-# Helpers
-proc Error {code {text {}}} {
-    global state lstctx lstitem
-
-    # Problematic command with all arguments (we strip the "ck_" prefix!)
-    # -*- future -*- count lines of input, maintain history buffer, use
-    # -*- future -*- that to provide some context here.
-
-    set cmd  [lindex [info level 1] 0]
-    set args [lrange [info level 1] 1 end]
-    if {$args != {}} {append cmd " [join $args]"}
-
-    # Use a message catalog to map the error code into a legible message.
-    set msg [::msgcat::mc $code]
-
-    if {$text != {}} {
-	set msg [string map [list @ $text] $msg]
-    }
-    dt_error "Manpage error ($code), \"$cmd\" : ${msg}."
-    return
-}
-proc Warn {code args} {
-    set msg [::msgcat::mc $code]
-    foreach {off line col} [dt_where] break
-    set msg [eval [linsert $args 0 format $msg]]
-    set msg "In macro at line $line, column $col:\n$msg"
-    set msg [split $msg \n]
-    set prefix "DocTools Warning ($code): "
-    dt_warning "$prefix[join $msg "\n$prefix"]"
-    return
-}
-
-proc Is    {s} {global state ; return [string equal $state $s]}
-proc IsNot {s} {global state ; return [expr {![string equal $state $s]}]}
-proc Go    {s} {Log " >>\[$s\]" ; global state ; set state $s; return}
-proc LPush {l} {
-    global lstctx lstitem
-    set    lstctx [linsert $lstctx 0 $l $lstitem]
-    return
-}
-proc LPop {} {
-    global lstctx lstitem
-    set    lstitem [lindex $lstctx 1]
-    set    lstctx  [lrange $lstctx 2 end]
-    return
-}
-proc LSItem {} {global lstitem ; set lstitem 1}
-proc LIs  {l} {global lstctx ; string equal $l [lindex $lstctx 0]}
-proc LItem {} {global lstitem ; return $lstitem}
-proc LNest {} {
-    global lstctx
-    expr {[llength $lstctx] / 2}
-}
-proc LOpen {} {
-    global lstctx
-    expr {$lstctx != {}}
-}
-global    lmap ldmap
-array set lmap {
-    bullet   itemized    item     itemized
-    arg      arguments   args     arguments
-    opt      options     opts     options
-    cmd      commands    cmds     commands
-    enum     enumerated  tkoption tkoptions
-}
-array set ldmap {
-    bullet   . arg . cmd . tkoption . opt .
-}
-proc LMap {what} {
-    global lmap ldmap
-    if {![info exists lmap($what)]} {
-	return $what
-    }
-    if {[dt_deprecated] && [info exists ldmap($what)]} {
-	Warn depr_ltype $what $lmap($what)
-    }
-    return $lmap($what)
-}
-proc LValid {what} {
-    switch -exact -- $what {
-	arguments   -
-	commands    -
-	definitions -
-	enumerated  -
-	itemized    -
-	options     -
-	tkoptions   {return 1}
-	default     {return 0}
-    }
-}
-
-proc State {} {global state ; return $state}
-proc Enter {cmd} {Log "\[[State]\] $cmd"}
-
-#proc Log* {text} {puts -nonewline $text}
-#proc Log  {text} {puts            $text}
-proc Log* {text} {}
-proc Log  {text} {}
-
-
-# -------------------------------------------------------------
-# Framing
-proc ck_initialize {} {
-    global state   ; set state manpage_begin
-    global lstctx  ; set lstctx [list]
-    global lstitem ; set lstitem 0
-    global sect    ; catch {unset sect} ; set sect() . ; unset sect()
-    return
-}
-proc ck_complete {} {
-    if {[Is done]} {
-	if {![LOpen]} {
-	    return
-	} else {
-	    Error end/open/list
-	}
-    } elseif {[Is example]} {
-	Error end/open/example
-    } else {
-	Error end/open/mp
-    }
-    return
-}
-# -------------------------------------------------------------
-# Plain text
-proc plain_text {text} {
-    # Only in body, not between list_begin and first item.
-    # Ignore everything which is only whitespace ...
-
-    set redux [string map [list " " "" "\t" "" "\n" ""] $text]
-    if {$redux == {}} {return [fmt_plain_text $text]}
-    if {[IsNot body] && [IsNot example]} {Error body}
-    if {[LOpen] && ![LItem]} {Error nolisttxt}
-    return [fmt_plain_text $text]
-}
-
-# -------------------------------------------------------------
-# Variable handling ...
-
-proc vset {var args} {
-    switch -exact -- [llength $args] {
-	0 {
-	    # Retrieve contents of variable VAR
-	    upvar #0 __$var data
-	    return $data
-	}
-	1 {
-	    # Set contents of variable VAR
-	    global __$var
-	    set    __$var [lindex $args 0]
-	    return "" ; # Empty string ! Nothing for output.
-	}
-	default {
-	    return -code error "wrong#args: set var ?value?"
-	}
-    }
-}
-
-# -------------------------------------------------------------
-# Formatting commands
-proc manpage_begin {title section version} {
-    Enter manpage_begin
-    if {[IsNot manpage_begin]} {Error mpbegin}
-    Go header
-    fmt_manpage_begin $title $section $version
-}
-proc moddesc {desc} {
-    Enter moddesc
-    if {[IsNot header]} {Error hdrcmd}
-    fmt_moddesc $desc
-}
-proc titledesc {desc} {
-    Enter titledesc
-    if {[IsNot header]} {Error hdrcmd}
-    fmt_titledesc $desc
-}
-proc copyright {text} {
-    Enter copyright
-    if {[IsNot header]} {Error hdrcmd}
-    fmt_copyright $text
-}
-proc manpage_end {} {
-    Enter manpage_end
-    if {[IsNot body]} {Error bodycmd}
-    Go done
-    fmt_manpage_end
-}
-proc require {pkg {version {}}} {
-    Enter require
-    if {[IsNot header]} {Error reqcmd}
-    fmt_require $pkg $version
-}
-proc description {} {
-    Enter description
-    if {[IsNot header]} {Error reqcmd}
-    Go body
-    fmt_description
-}
-
-global sect
-proc __sid {name} {
-    # Identical to 'c_sectionId' in mpformats/_common.tcl
-    regsub -all {[ 	]+} [string tolower [string trim $name]] _ id
-    regsub -all {"} $id _ id ; # "
-    return $id
-}
-
-proc section {name} {
-    global sect
-
-    Enter section
-    if {[IsNot body]} {Error bodycmd}
-    if {[LOpen]}      {Error nolistcmd}
-
-    set sid [__sid $name]
-    if {[info exists sect($sid)]} {
-	Warn sectambig $name
-    }
-    set sect($sid) .
-
-    fmt_section $name
-}
-proc subsection {name} {
-    global sect
-
-    Enter subsection
-    if {[IsNot body]} {Error bodycmd}
-    if {[LOpen]}      {Error nolistcmd}
-
-    set sid [__sid $name]
-    if {[info exists sect($sid)]} {
-	Warn sectambig $name
-    }
-    set sect($sid) .
-
-    fmt_subsection $name
-}
-proc para {} {
-    Enter para
-    if {[IsNot body]} {Error bodycmd}
-    if {[LOpen]}      {
-	if {![LItem]} {Error nolisthdr}
-	fmt_nl
-    } else {
-	fmt_para
-    }
-}
-proc list_begin {what {hint {}}} {
-    Enter "list_begin $what $hint"
-    if {[IsNot body]}        {Error bodycmd}
-    if {[LOpen] && ![LItem]} {Error nolisthdr}
-    set what [LMap $what]
-    if {![LValid $what]}     {Error invalidlist $what}
-    LPush        $what
-    fmt_list_begin $what $hint
-}
-proc list_end {} {
-    Enter list_end
-    if {[IsNot body]} {Error bodycmd}
-    if {![LOpen]}     {Error listcmd}
-    LPop
-    fmt_list_end
-}
-
-# Deprecated command, and its common misspellings. Canon is 'def'.
-proc lst_item {{text {}}} {
-    if {[dt_deprecated]} {Warn depr_lstitem "\[lst_item\]"}
-    def $text
-}
-proc list_item {{text {}}} {
-    if {[dt_deprecated]} {Warn depr_lstitem "\[list_item\]"}
-    def $text
-}
-proc listitem  {{text {}}} {
-    if {[dt_deprecated]} {Warn depr_lstitem "\[listitem\]"}
-    def $text
-}
-proc lstitem   {{text {}}} {
-    if {[dt_deprecated]} {Warn depr_lstitem "\[lstitem\]"}
-    def $text
-}
-proc def {{text {}}} {
-    Enter def
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs definitions]} {Error deflist}
-    LSItem
-    fmt_lst_item $text
-}
-proc arg_def {type name {mode {}}} {
-    Enter arg_def
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs arguments]}   {Error arg_list}
-    LSItem
-    fmt_arg_def $type $name $mode
-}
-proc cmd_def {command} {
-    Enter cmd_def
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs commands]}    {Error cmd_list}
-    LSItem
-    fmt_cmd_def $command
-}
-proc opt_def {name {arg {}}} {
-    Enter opt_def
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs options]}     {Error opt_list}
-    LSItem
-    fmt_opt_def $name $arg
-}
-proc tkoption_def {name dbname dbclass} {
-    Enter tkoption_def
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs tkoptions]}   {Error tkoption_list}
-    LSItem
-    fmt_tkoption_def $name $dbname $dbclass
-}
-proc call {cmd args} {
-    Enter call
-    if {[IsNot body]}       {Error bodycmd}
-    if {![LOpen]}           {Error listcmd}
-    if {![LIs definitions]} {Error deflist}
-    LSItem
-    eval [linsert $args 0 fmt_call $cmd]
-}
-# Deprecated. Use 'item'
-proc bullet {} {
-    if {[dt_deprecated]} {Warn depr_bullet "\[bullet\]"}
-    item
-}
-proc item {} {
-    Enter item
-    if {[IsNot body]}    {Error bodycmd}
-    if {![LOpen]}        {Error listcmd}
-    if {![LIs itemized]} {Error bulletlist}
-    LSItem
-    fmt_bullet
-}
-proc enum {} {
-    Enter enum
-    if {[IsNot body]}      {Error bodycmd}
-    if {![LOpen]}          {Error listcmd}
-    if {![LIs enumerated]} {Error enumlist}
-    LSItem
-    fmt_enum
-}
-proc example {code} {
-    Enter example
-    return [example_begin][plain_text ${code}][example_end]
-}
-proc example_begin {} {
-    Enter example_begin
-    if {[IsNot body]}        {Error bodycmd}
-    if {[LOpen] && ![LItem]} {Error nolisthdr}
-    Go example
-    fmt_example_begin
-}
-proc example_end {} {
-    Enter example_end
-    if {[IsNot example]} {Error examplecmd}
-    Go body
-    fmt_example_end
-}
-proc see_also {args} {
-    Enter see_also
-    if {[Is done]} {Error nodonecmd}
-    # if {[IsNot body]} {Error bodycmd}
-    # if {[LOpen]}      {Error nolistcmd}
-    eval [linsert $args 0 fmt_see_also]
-}
-proc keywords {args} {
-    Enter keywords
-    if {[Is done]} {Error nodonecmd}
-    # if {[IsNot body]} {Error bodycmd}
-    # if {[LOpen]}      {Error nolistcmd}
-    eval [linsert $args 0 fmt_keywords]
-}
-# nl - Deprecated
-proc nl {} {
-    if {[dt_deprecated]} {Warn depr_nl "\[nl\]"}
-    para
-}
-proc emph {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_emph $text
-}
-# strong - Deprecated
-proc strong {text} {
-    if {[dt_deprecated]} {Warn depr_strong "\[strong\]"}
-    emph $text
-}
-proc arg {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_arg $text
-}
-proc cmd {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_cmd $text
-}
-proc opt {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_opt $text
-}
-proc comment {text} {
-    if {[Is done]} {Error nodonecmd}
-    return ; #fmt_comment $text
-}
-proc sectref {name {label {}}} {
-    if {[IsNot body]}        {Error bodycmd}
-    if {[LOpen] && ![LItem]} {Error nolisthdr}
-    if {![string length $label]} {set label $name}
-    fmt_sectref $name $label
-}
-proc syscmd {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_syscmd $text
-}
-proc method {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_method $text
-}
-proc option {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_option $text
-}
-proc widget {text} {
-    if {[Is done]} {Error nodonecmd}
-    widget $text
-}
-proc fun {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_fun $text
-}
-proc type {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_type $text
-}
-proc package {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_package $text
-}
-proc class {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_class $text
-}
-proc var {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_var $text
-}
-proc file {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_file $text
-}
-
-# Special case: We must not overwrite the builtin namespace command,
-# as it is required by the package "msgcat".
-proc _namespace {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_namespace $text
-}
-proc uri {text {label {}}} {
-    if {[Is done]} {Error nodonecmd}
-    # The label argument is left out when undefined so that we can
-    # control old formatters as well, if the input is not using uri
-    # labels.
-
-    if {$label == {}} {
-	fmt_uri $text
-    } else {
-	fmt_uri $text $label
-    }
-}
-proc usage {args} {
-    if {[Is done]} {Error nodonecmd}
-    eval fmt_usage $args
-}
-proc const {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_const $text
-}
-proc term {text} {
-    if {[Is done]} {Error nodonecmd}
-    fmt_term $text
-}
-
-# -------------------------------------------------------------
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker_idx.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker_idx.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,207 +1,0 @@
-# -*- tcl -*-
-# checker_idx.tcl
-#
-# Code used inside of a checker interpreter to ensure correct usage of
-# docidx formatting commands.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# L10N
-
-package require msgcat
-
-proc ::msgcat::mcunknown {locale code} {
-    return "unknown error code \"$code\" (for locale $locale)"
-}
-
-if {0} {
-    puts stderr "Locale [::msgcat::mcpreferences]"
-    foreach path [dt_search] {
-	puts stderr "Catalogs: [::msgcat::mcload $path] - $path"
-    }
-} else {
-    foreach path [dt_search] {
-	::msgcat::mcload $path
-    }
-}
-
-# State, and checker commands.
-# -------------------------------------------------------------
-#
-# Note that the code below assumes that a command XXX provided by the
-# formatter engine is accessible under the name 'fmt_XXX'.
-#
-# -------------------------------------------------------------
-
-global state
-
-# State machine ... State centered
-# --------------+-----------------------+----------------------
-# state		| allowed commands	| new state (if any)
-# --------------+-----------------------+----------------------
-# all except	| include vset		|
-# ==============+=======================+======================
-# idx_begin	| idx_begin		| -> contents
-# --------------+-----------------------+----------------------
-# contents	| key			| -> ref_series
-# --------------+-----------------------+----------------------
-# ref_series	| manpage		| -> refkey_series
-#		| url			|
-# --------------+-----------------------+----------------------
-# refkey_series	| manpage		| -> refkey_series
-#		| url			|
-#		+-----------------------+-----------
-#		| key			| -> ref_series
-#		+-----------------------+-----------
-#		| idx_end		| -> done
-# --------------+-----------------------+----------------------
-
-# State machine, as above ... Command centered
-# --------------+-----------------------+----------------------
-# state		| allowed commands	| new state (if any)
-# --------------+-----------------------+----------------------
-# all except	| include vset		|
-# ==============+=======================+======================
-# idx_begin	| idx_begin		| -> contents
-# --------------+-----------------------+----------------------
-# contents	| key			| -> ref_series
-# refkey_series	|			|
-# --------------+-----------------------+----------------------
-# ref_series	| manpage		| -> refkey_series
-# refkey_series	|			|
-# --------------+-----------------------+----------------------
-# ref_series	| url			| -> refkey_series
-# refkey_series	|			|
-# --------------+-----------------------+----------------------
-# refkey_series	| idx_end		| -> done
-# --------------+-----------------------+----------------------
-
-# -------------------------------------------------------------
-# Helpers
-proc Error {code {text {}}} {
-    global state
-
-    # Problematic command with all arguments (we strip the "ck_" prefix!)
-    # -*- future -*- count lines of input, maintain history buffer, use
-    # -*- future -*- that to provide some context here.
-
-    set cmd  [lindex [info level 1] 0]
-    set args [lrange [info level 1] 1 end]
-    if {$args != {}} {append cmd " [join $args]"}
-
-    # Use a message catalog to map the error code into a legible message.
-    set msg [::msgcat::mc $code]
-
-    if {$text != {}} {
-	set msg [string map [list @ $text] $msg]
-    }
-
-    dt_error "IDX error ($code), \"$cmd\" : ${msg}."
-    return
-}
-proc Warn {code text} {
-    set msg [::msgcat::mc $code]
-    dt_warning "IDX warning ($code): [join [split [format $msg $text] \n] "\nIDX warning ($code): "]"
-    return
-}
-
-proc Is    {s} {global state ; return [string equal $state $s]}
-proc IsNot {s} {global state ; return [expr {![string equal $state $s]}]}
-proc Go    {s} {Log " >>\[$s\]" ; global state ; set state $s; return}
-proc Push  {s} {Log " //\[$s\]" ; global state stack ; lappend stack $state ; set state $s; return}
-proc Pop   {}  {Log* " pop" ;  global state stack ; set state [lindex $stack end] ; set stack [lrange $stack 0 end-1] ; Log " \\\\\[$state\]" ; return}
-proc State {} {global state ; return $state}
-
-proc Enter {cmd} {Log* "\[[State]\] $cmd"}
-
-#proc Log* {text} {puts -nonewline $text}
-#proc Log  {text} {puts            $text}
-proc Log* {text} {}
-proc Log  {text} {}
-
-# -------------------------------------------------------------
-# Framing
-proc ck_initialize {} {
-    global state   ; set state idx_begin
-    global stack   ; set stack [list]
-}
-proc ck_complete {} {
-    if {[Is done]} {
-	return
-    } else {
-	Error end/open/idx
-    }
-    return
-}
-# -------------------------------------------------------------
-# Plain text
-proc plain_text {text} {
-    # Ignore everything which is only whitespace ...
-    # Beyond that plain text is not allowed.
-
-    set redux [string map [list " " "" "\t" "" "\n" ""] $text]
-    if {$redux == {}} {return [fmt_plain_text $text]}
-    Error idx/plaintext
-    return ""
-}
-
-# -------------------------------------------------------------
-# Variable handling ...
-
-proc vset {var args} {
-    switch -exact -- [llength $args] {
-	0 {
-	    # Retrieve contents of variable VAR
-	    upvar #0 __$var data
-	    return $data
-	}
-	1 {
-	    # Set contents of variable VAR
-	    global __$var
-	    set    __$var [lindex $args 0]
-	    return "" ; # Empty string ! Nothing for output.
-	}
-	default {
-	    return -code error "wrong#args: set var ?value?"
-	}
-    }
-}
-
-# -------------------------------------------------------------
-# Formatting commands
-proc index_begin {label title} {
-    Enter index_begin
-    if {[IsNot idx_begin]} {Error idx/begincmd}
-    Go contents
-    fmt_index_begin $label $title
-}
-proc index_end {} {
-    Enter index_end
-    if {[IsNot refkey_series]} {Error idx/endcmd}
-    Go done
-    fmt_index_end
-}
-proc key {text} {
-    Enter key
-    if {[IsNot contents] && [IsNot refkey_series]} {Error idx/keycmd}
-    Go ref_series
-    fmt_key $text
-}
-proc manpage {file label} {
-    Enter manpage
-    if {[IsNot ref_series] && [IsNot refkey_series]} {Error idx/manpagecmd}
-    Go refkey_series
-    fmt_manpage $file $label
-}
-proc url {url label} {
-    Enter url
-    if {[IsNot ref_series] && [IsNot refkey_series]} {Error idx/urlcmd}
-    Go refkey_series
-    fmt_url $url $label
-}
-proc comment {text} {
-    if {[Is done]} {Error idx/nodonecmd}
-    return ; #fmt_comment $text
-}
-
-# -------------------------------------------------------------
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker_toc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/checker_toc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,228 +1,0 @@
-# -*- tcl -*-
-# checker_toc.tcl
-#
-# Code used inside of a checker interpreter to ensure correct usage of
-# doctoc formatting commands.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# L10N
-
-package require msgcat
-
-proc ::msgcat::mcunknown {locale code} {
-    return "unknown error code \"$code\" (for locale $locale)"
-}
-
-if {0} {
-    puts stderr "Locale [::msgcat::mcpreferences]"
-    foreach path [dt_search] {
-	puts stderr "Catalogs: [::msgcat::mcload $path] - $path"
-    }
-} else {
-    foreach path [dt_search] {
-	::msgcat::mcload $path
-    }
-}
-
-# State, and checker commands.
-# -------------------------------------------------------------
-#
-# Note that the code below assumes that a command XXX provided by the
-# formatter engine is accessible under the name 'fmt_XXX'.
-#
-# -------------------------------------------------------------
-
-global state
-
-# State machine ... State centered
-# --------------+-----------------------+----------------------
-# state		| allowed commands	| new state (if any)
-# --------------+-----------------------+----------------------
-# all except	| include vset		|
-# ==============+=======================+======================
-# toc_begin	| toc_begin		| -> contents
-# --------------+-----------------------+----------------------
-# contents	| item			| -> item_series
-#		+-----------------------+-----------
-#		| division_start	| -> end, PUSH division
-# --------------+-----------------------+----------------------
-# item_series	| item			| -> item_series
-#		+-----------------------+-----------
-#		| toc_end		| -> done
-# --------------+-----------------------+----------------------
-# division	| item			| -> div_items
-#		+-----------------------+-----------
-#		| division_start	| -> div_series, PUSH division
-# --------------+-----------------------+----------------------
-# div_series	| division_start	| -> div_series, PUSH division
-# --------------+-----------------------+----------------------
-# div_items	| item			| -> div_items
-#		+-----------------------+-----------
-#		| division_end		| POP (-> div_series / -> end)
-# --------------+-----------------------+----------------------
-# end		| toc_end		| -> done
-#		+-----------------------+-----------
-#		| division_start	| PUSH division
-# --------------+-----------------------+----------------------
-
-# State machine, as above ... Command centered
-# --------------+-----------------------+----------------------
-# state		| allowed commands	| new state (if any)
-# --------------+-----------------------+----------------------
-# all except	| include vset		|
-# ==============+=======================+======================
-# toc_begin	| toc_begin		| -> contents
-# --------------+-----------------------+----------------------
-# contents	| item			| -> item_series
-# item_series	|			| -> item_series
-# div_items	|			| -> div_items
-# division      |                       | -> div_items
-# --------------+-----------------------+----------------------
-# contents	| division_start	| -> end, PUSH division
-# div_series	|			| -> div_series, PUSH division
-# end		|			| PUSH division
-# division      |                       | PUSH division
-# --------------+-----------------------+----------------------
-# div_items	| division_end		| POP (-> div_series / -> end)
-# --------------+-----------------------+----------------------
-# item_series	| toc_end		| -> done
-# end		|			| -> done
-# --------------+-----------------------+----------------------
-
-# -------------------------------------------------------------
-# Helpers
-proc Error {code {text {}}} {
-    global state
-
-    # Problematic command with all arguments (we strip the "ck_" prefix!)
-    # -*- future -*- count lines of input, maintain history buffer, use
-    # -*- future -*- that to provide some context here.
-
-    set cmd  [lindex [info level 1] 0]
-    set args [lrange [info level 1] 1 end]
-    if {$args != {}} {append cmd " [join $args]"}
-
-    # Use a message catalog to map the error code into a legible message.
-    set msg [::msgcat::mc $code]
-
-    if {$text != {}} {
-	set msg [string map [list @ $text] $msg]
-    }
-
-    dt_error "TOC error ($code), \"$cmd\" : ${msg}."
-    return
-}
-proc Warn {code text} {
-    set msg [::msgcat::mc $code]
-    dt_warning "TOC warning ($code): [join [split [format $msg $text] \n] "\nTOC warning ($code): "]"
-    return
-}
-
-proc Is    {s} {global state ; return [string equal $state $s]}
-proc IsNot {s} {global state ; return [expr {![string equal $state $s]}]}
-proc Go    {s} {Log " >>\[$s\]" ; global state ; set state $s; return}
-proc Push  {s} {Log " //\[$s\]" ; global state stack ; lappend stack $state ; set state $s; return}
-proc Pop   {}  {Log* " pop" ;  global state stack ; set state [lindex $stack end] ; set stack [lrange $stack 0 end-1] ; Log " \\\\\[$state\]" ; return}
-proc State {} {global state stack ; return "$stack || $state"}
-
-proc Enter {cmd} {Log* "\[[State]\] $cmd"}
-
-#proc Log* {text} {puts -nonewline $text}
-#proc Log  {text} {puts            $text}
-proc Log* {text} {}
-proc Log  {text} {}
-
-# -------------------------------------------------------------
-# Framing
-proc ck_initialize {} {
-    global state   ; set state toc_begin
-    global stack   ; set stack [list]
-}
-proc ck_complete {} {
-    if {[Is done]} {
-	return
-    } else {
-	Error end/open/toc
-    }
-    return
-}
-# -------------------------------------------------------------
-# Plain text
-proc plain_text {text} {
-    # Ignore everything which is only whitespace ...
-    # Beyond that plain text is not allowed.
-
-    set redux [string map [list " " "" "\t" "" "\n" ""] $text]
-    if {$redux == {}} {return [fmt_plain_text $text]}
-    Error toc/plaintext
-    return ""
-}
-
-# -------------------------------------------------------------
-# Variable handling ...
-
-proc vset {var args} {
-    switch -exact -- [llength $args] {
-	0 {
-	    # Retrieve contents of variable VAR
-	    upvar #0 __$var data
-	    return $data
-	}
-	1 {
-	    # Set contents of variable VAR
-	    global __$var
-	    set    __$var [lindex $args 0]
-	    return "" ; # Empty string ! Nothing for output.
-	}
-	default {
-	    return -code error "wrong#args: set var ?value?"
-	}
-    }
-}
-
-# -------------------------------------------------------------
-# Formatting commands
-proc toc_begin {label title} {
-    Enter toc_begin
-    if {[IsNot toc_begin]} {Error toc/begincmd}
-    Go contents
-    fmt_toc_begin $label $title
-}
-proc toc_end {} {
-    Enter toc_end
-    if {[IsNot end] && [IsNot item_series]} {Error toc/endcmd}
-    Go done
-    fmt_toc_end
-}
-proc division_start {title {symfile {}}} {
-    Enter division_start
-    if {
-	[IsNot contents] && [IsNot div_series] && [IsNot end] && [IsNot division]
-    } {Error toc/sectcmd}
-    if {[Is contents] || [Is end]} {Go end} else {Go div_series}
-    Push div_series
-    fmt_division_start $title $symfile
-}
-proc division_end {} {
-    Enter division_end
-    if {[IsNot div_items] && [IsNot div_series]} {Error toc/sectecmd [State]}
-    Pop
-    fmt_division_end
-}
-proc item {file label desc} {
-    Enter item
-    if {
-	[IsNot div_series] && [IsNot contents] && [IsNot item_series] && [IsNot div_items]
-    } {
-	Error toc/itemcmd
-    }
-    if {[Is div_items] || [Is div_series]} {Go div_items} else {Go item_series}
-    fmt_item $file $label $desc
-}
-proc comment {text} {
-    if {[Is done]} {Error toc/nodonecmd}
-    return ; #fmt_comment $text
-}
-
-# -------------------------------------------------------------
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/cvs.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/cvs.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,138 +1,0 @@
-# cvs.tcl --
-#
-#	Handling of various cvs output formats.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: cvs.tcl,v 1.7 2005/09/28 04:51:19 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require textutil
-
-namespace eval ::doctools {}
-namespace eval ::doctools::cvs {
-    namespace export scanLog toChangeLog
-}
-
-# ::doctools::cvs::scanLog --
-#
-#	Scan a log generated by 'cvs log' and extract the relevant information.
-#
-# Arguments:
-#	text	The text to scan
-#
-# Results:
-#	None.
-#
-# Sideeffects:
-#	None.
-#
-# Notes:
-#	Original location of code:	http://wiki.tcl.tk/3638
-#				aka	http://wiki.tcl.tk/log2changelog
-#	Original author unknown.
-#	Bugfix by TR / Torsten Reincke
-
-proc ::doctools::cvs::scanLog {text evar cvar fvar} {
-
-    set text [split $text \n]
-    set n    [llength $text]
-
-    upvar $evar entries  ;    #set       entries  [list]
-    upvar $cvar comments ;    #array set comments {}
-    upvar $fvar files    ;    #array set files    {}
-
-    for {set i 0} {$i < $n} {incr i} {
-	set line [lindex $text $i]
-	switch -glob -- $line {
-	    "*Working file:*" {
-		regexp {Working file: (.*)} $line -> filename
-	    }
-	    "date:*" {
-		scan $line "date: %s %s author: %s" date time author
-		set author [string trim $author ";"]
-
-		# read the comment lines following date
-		set comment ""
-		incr i
-		set line [lindex $text $i]
-		# [TR]: use regexp here to see if log ends:
-		while {(![regexp "(-----*)|(=====*)" $line]) && ($i < $n)} {
-		    append comment $line "\n"
-		    incr i
-		    set line [lindex $text $i]
-		}
-
-		#  Store this date/author/comment
-		lappend entries [list $date $author]
-		lappend comments($date,$author) $comment
-		lappend files($date,$author,$comment) $filename
-	    }
-	}
-    }
-
-    return
-}
-
-
-# ::doctools::cvs::toChangeLog --
-
-#	Convert a preprocessed cvs log (see scanLog) into a Changelog
-#	suitable for emacs.
-#
-# Arguments:
-#	evar, cvar, fvar: Name of the variables containing the preprocessed log.
-#
-# Results:
-#	A string containing a properly formatted ChangeLog.
-#
-# Sideeffects:
-#	None.
-#
-# Notes:
-#	Original location of code:	http://wiki.tcl.tk/3638
-#				aka	http://wiki.tcl.tk/log2changelog
-#	Original author unknown.
-
-proc ::doctools::cvs::toChangeLog {evar cvar fvar} {
-    upvar $evar entries
-    upvar $cvar comments
-    upvar $fvar files
-
-    set linebuffer [list]
-
-    foreach e [lsort -unique -decreasing $entries] {
-
-	#  print the date/author
-	foreach {date author} $e {break}
-	lappend linebuffer "$date $author"
-	lappend linebuffer ""
-
-	#  Find all the comments submitted this date/author
-
-	set clist [lsort -unique $comments($date,$author)]
-
-	foreach c $clist {
-	    #  Print all files for a given comment
-	    foreach f [lsort -unique $files($date,$author,$c)] {
-		lappend linebuffer "\t* $f:"
-	    }
-
-	    #  Format and print the comment
-
-	    lappend linebuffer [textutil::indent [textutil::undent $c] "\t  "]
-	    lappend linebuffer ""
-	    continue
-	}
-    }
-
-    return [join $linebuffer \n]
-}
-
-#------------------------------------
-# Module initialization
-
-package provide doctools::cvs 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/docidx.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/docidx.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,905 +1,0 @@
-# docidx.tcl --
-#
-#	Implementation of docidx objects for Tcl.
-#
-# Copyright (c) 2003-2007 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: docidx.tcl,v 1.14 2007/08/20 20:11:59 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require textutil::expander
-
-# @mdgen OWNER: api_idx.tcl
-# @mdgen OWNER: checker_idx.tcl
-# @mdgen OWNER: mpformats/*.tcl
-# @mdgen OWNER: mpformats/*.msg
-# @mdgen OWNER: mpformats/idx.*
-
-namespace eval ::doctools {}
-namespace eval ::doctools::idx {
-    # Data storage in the doctools::idx module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #  1) A list of additional search paths for format definition files.
-    #     This list extends the list of standard paths known to the module.
-    #     The paths in the list are searched before the standard paths.
-    #  2) Configuration information
-    #     a) string:  The format to use when converting the input.
-    #  4) Name of the interpreter used to perform the syntax check of the
-    #     input (= allowed order of formatting commands).
-    #  5) Name of the interpreter containing the code coming from the format
-    #     definition file.
-    #  6) Name of the expander object used to interpret the input to convert.
-
-    # commands is the list of subcommands recognized by the docidx objects
-    variable commands [list		\
-	    "cget"			\
-	    "configure"			\
-	    "destroy"			\
-	    "format"			\
-	    "map"			\
-	    "search"			\
-	    "warnings"                  \
-	    "parameters"                \
-	    "setparam"                  \
-	    ]
-
-    # Only export the toplevel commands
-    namespace export new search help
-
-    # Global data
-
-    #  1) List of standard paths to look at when searching for a format
-    #     definition. Extensible.
-    #  2) Location of this file in the filesystem
-
-    variable paths [list]
-    variable here [file dirname [info script]]
-}
-
-# ::doctools::idx::search --
-#
-#	Extend the list of paths used when searching for format definition files.
-#
-# Arguments:
-#	path	Path to add to the list. The path has to exist, has to be a
-#               directory, and has to be readable.
-#
-# Results:
-#	None.
-#
-# Sideeffects:
-#	The specified path is added to the front of the list of search
-#	paths. This means that the new path is search before the
-#	standard paths set at module initialization time.
-
-proc ::doctools::idx::search {path} {
-    variable paths
-
-    if {![file exists      $path]} {return -code error "doctools::idx::search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "doctools::idx::search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "doctools::idx::search: path cannot be read"}
-
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::idx::help --
-#
-#	Return a string containing short help
-#	regarding the existing formatting commands.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A string.
-
-proc ::doctools::idx::help {} {
-    return "formatting commands\n\
-	    * index_begin      - begin of index\n\
-	    * index_end        - end of index\n\
-	    * key              - begin of references for key\n\
-	    * manpage          - index reference to manpage\n\
-	    * url              - index reference to url\n\
-	    * vset             - set/get variable values\n\
-	    * include          - insert external file\n\
-	    * lb, rb           - left/right brackets\n\
-	    "
-}
-
-# ::doctools::idx::new --
-#
-#	Create a new docidx object with a given name. May configure the object.
-#
-# Arguments:
-#	name	Name of the docidx object.
-#	args	Options configuring the new object.
-#
-# Results:
-#	name	Name of the doctools created
-
-proc ::doctools::idx::new {name args} {
-        if { [llength [info commands ::$name]] } {
-	return -code error "command \"$name\" already exists, unable to create docidx object"
-    }
-    if {[llength $args] % 2 == 1} {
-	return -code error "wrong # args: doctools::new name ?opt val...??"
-    }
-
-    # The arguments seem to be ok, setup the namespace for the object
-
-    namespace eval ::doctools::idx::docidx$name {
-	variable paths      [list]
-	variable file       ""
-	variable format     ""
-	variable formatfile ""
-	variable format_ip  ""
-	variable chk_ip     ""
-	variable expander   "[namespace current]::ex"
-	variable ex_ok      0
-	variable msg        [list]
-	variable map ;      array set map {}
-	variable param      [list]
-    }
-
-    # Create the command to manipulate the object
-    #                 $name -> ::doctools::idx::DocIdxProc $name
-    interp alias {} ::$name {} ::doctools::idx::DocIdxProc $name
-
-    # If the name was followed by arguments use them to configure the
-    # object before returning its handle to the caller.
-
-    if {[llength $args] > 1} {
-	# Use linsert trick to make the command a pure list.
-	eval [linsert $args 0 _configure $name]
-    }
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::doctools::idx::DocIdxProc --
-#
-#	Command that processes all docidx object commands.
-#	Dispatches any object command to the appropriate internal
-#	command implementing its functionality.
-#
-# Arguments:
-#	name	Name of the docidx object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::doctools::idx::DocIdxProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-
-    if { [llength [info commands ::doctools::idx::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    return [eval [list ::doctools::idx::_$cmd $name] $args]
-}
-
-##########################
-# Method implementations follow (these are also private commands)
-
-# ::doctools::idx::_cget --
-#
-#	Retrieve the current value of a particular option
-#
-# Arguments:
-#	name	Name of the docidx object to query
-#	option	Name of the option whose value we are asking for.
-#
-# Results:
-#	The value of the option
-
-proc ::doctools::idx::_cget {name option} {
-    _configure $name $option
-}
-
-# ::doctools::idx::_configure --
-#
-#	Configure a docidx object, or query its configuration.
-#
-# Arguments:
-#	name	Name of the docidx object to configure
-#	args	Options and their values.
-#
-# Results:
-#	None if configuring the object.
-#	A list of all options and their values if called without arguments.
-#	The value of one particular option if called with a single argument.
-
-proc ::doctools::idx::_configure {name args} {
-    if {[llength $args] == 0} {
-	# Retrieve the current configuration.
-
-	upvar ::doctools::idx::docidx${name}::file    file
-	upvar ::doctools::idx::docidx${name}::format     format
-
-	set     res [list]
-	lappend res -file       $file
-	lappend res -format     $format
-	return $res
-
-    } elseif {[llength $args] == 1} {
-	# Query the value of one particular option.
-
-	switch -exact -- [lindex $args 0] {
-	    -file {
-		upvar ::doctools::idx::docidx${name}::file file
-		return $file
-	    }
-	    -format {
-		upvar ::doctools::idx::docidx${name}::format format
-		return $format
-	    }
-	    default {
-		return -code error \
-			"doctools::idx::_configure: Unknown option \"[lindex $args 0]\", expected\
-			-file, or -format"
-	    }
-	}
-    } else {
-	# Reconfigure the object.
-
-	if {[llength $args] % 2 == 1} {
-	    return -code error "wrong # args: doctools::idx::_configure name ?opt val...??"
-	}
-
-	foreach {option value} $args {
-	    switch -exact -- $option {
-		-file {
-		    upvar ::doctools::idx::docidx${name}::file file
-		    set file $value
-		}
-		-format {
-		    if {[catch {
-			set fmtfile [LookupFormat $name $value]
-			SetupFormatter $name $fmtfile
-			upvar ::doctools::idx::docidx${name}::format format
-			set format $value
-		    } msg]} {
-			return -code error "doctools::idx::_configure: -format: $msg"
-		    }
-		}
-		default {
-		    return -code error \
-			    "doctools::idx::_configure: Unknown option \"$option\", expected\
-			    -file, or -format"
-		}
-	    }
-	}
-    }
-    return ""
-}
-
-# ::doctools::idx::_destroy --
-#
-#	Destroy a docidx object, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the docidx object to destroy.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::_destroy {name} {
-    # Check the object for sub objects which have to destroyed before
-    # the namespace is torn down.
-    namespace eval ::doctools::idx::docidx$name {
-	if {$format_ip != ""} {interp delete $format_ip}
-	if {$chk_ip    != ""} {interp delete $chk_ip}
-
-	# Expander objects have no delete/destroy method. This would
-	# be a leak if not for the fact that an expander object is a
-	# namespace, and we have arranged to make it a sub namespace of
-	# the docidx object. Therefore tearing down our object namespace
-	# also cleans up the expander object.
-	# if {$expander != ""} {$expander destroy}
-
-    }
-    namespace delete ::doctools::idx::docidx$name
-    interp alias {} ::$name {}
-    return
-}
-
-# ::doctools::idx::_map --
-#
-#	Add a mapping from symbolic to actual filename to the object.
-#
-# Arguments:
-#	name	Name of the docidx object to use
-#	sfname	Symbolic filename to map
-#	afname	Actual filename
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::_map {name sfname afname} {
-    upvar ::doctools::idx::docidx${name}::map map
-    set map($sfname) $afname
-    return
-}
-
-# ::doctools::idx::_format --
-#
-#	Convert some text in doctools format
-#	according to the configuration in the object.
-#
-# Arguments:
-#	name	Name of the docidx object to use
-#	text	Text to convert.
-#
-# Results:
-#	The conversion result.
-
-proc ::doctools::idx::_format {name text} {
-    upvar ::doctools::idx::docidx${name}::format format
-    if {$format == ""} {
-	return -code error "$name: No format was specified"
-    }
-
-    upvar ::doctools::idx::docidx${name}::format_ip format_ip
-    upvar ::doctools::idx::docidx${name}::chk_ip    chk_ip
-    upvar ::doctools::idx::docidx${name}::ex_ok     ex_ok
-    upvar ::doctools::idx::docidx${name}::expander  expander
-    upvar ::doctools::idx::docidx${name}::passes    passes
-    upvar ::doctools::idx::docidx${name}::msg       warnings
-
-    if {!$ex_ok}       {SetupExpander  $name}
-    if {$chk_ip == ""} {SetupChecker   $name}
-    # assert (format_ip != "")
-
-    set warnings [list]
-    if {[catch {$format_ip eval idx_initialize}]} {
-	return -code error "Could not initialize engine"
-    }
-    set result ""
-
-    for {
-	set p $passes ; set n 1
-    } {
-	$p > 0
-    } {
-	incr p -1 ; incr n
-    } {
-	if {[catch {$format_ip eval [list idx_setup $n]}]} {
-	    catch {$format_ip eval idx_shutdown}
-	    return -code error "Could not initialize pass $n of engine"
-	}
-	$chk_ip eval ck_initialize
-
-	if {[catch {set result [$expander expand $text]} msg]} {
-	    catch {$format_ip eval idx_shutdown}
-	    # Filter for checker errors and reduce them to the essential message.
-
-	    if {![regexp {^Error in} $msg]}          {return -code error $msg}
-	    #set msg [join [lrange [split $msg \n] 2 end]]
-
-	    if {![regexp {^--> \(FmtError\) } $msg]} {return -code error "Docidx $msg"}
-	    set msg [lindex [split $msg \n] 0]
-	    regsub {^--> \(FmtError\) } $msg {} msg
-
-	    return -code error $msg
-	}
-
-	$chk_ip eval ck_complete
-    }
-
-    if {[catch {set result [$format_ip eval [list idx_postprocess $result]]}]} {
-	return -code error "Unable to post process final result"
-    }
-    if {[catch {$format_ip eval idx_shutdown}]} {
-	return -code error "Could not shut engine down"
-    }
-    return $result
-
-}
-
-# ::doctools::idx::_search --
-#
-#	Add a search path to the object.
-#
-# Arguments:
-#	name	Name of the docidx object to extend
-#	path	Search path to add.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::_search {name path} {
-    if {![file exists      $path]} {return -code error "$name search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "$name search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "$name search: path cannot be read"}
-
-    upvar ::doctools::idx::docidx${name}::paths paths
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::idx::_warnings --
-#
-#	Return the warning accumulated during the last invocation of 'format'.
-#
-# Arguments:
-#	name	Name of the docidx object to query
-#
-# Results:
-#	A list of warnings.
-
-proc ::doctools::idx::_warnings {name} {
-    upvar ::doctools::idx::docidx${name}::msg msg
-    return $msg
-}
-
-# ::doctools::_parameters --
-#
-#	Returns a list containing the parameters provided
-#	by the selected formatting engine.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#
-# Results:
-#	A list of parameter names
-
-proc ::doctools::idx::_parameters {name} {
-    upvar ::doctools::idx::docidx${name}::param param
-    return $param
-}
-
-# ::doctools::_setparam --
-#
-#	Set a named engine parameter to a value.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#	param	Name of the parameter to set.
-#	value	Value to set the parameter to.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::_setparam {name param value} {
-    upvar ::doctools::idx::docidx${name}::format_ip format_ip
-
-    if {$format_ip == {}} {
-	return -code error \
-		"Unable to set parameters without a valid format"
-    }
-
-    $format_ip eval [list idx_varset $param $value]
-    return
-}
-
-##########################
-# Support commands
-
-# ::doctools::idx::LookupFormat --
-#
-#	Search a format definition file based upon its name
-#
-# Arguments:
-#	name	Name of the docidx object to use
-#	format	Name of the format to look for.
-#
-# Results:
-#	The file containing the format definition
-
-proc ::doctools::idx::LookupFormat {name format} {
-    # Order of searching
-    # 1) Is the name of the format an existing file ?
-    #    If yes, take this file.
-    # 2) Look for the file in the directories given to the object itself..
-    # 3) Look for the file in the standard directories of this package.
-
-    if {[file exists $format]} {
-	return $format
-    }
-
-    upvar ::doctools::idx::docidx${name}::paths opaths
-    foreach path $opaths {
-	set f [file join $path idx.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    variable paths
-    foreach path $paths {
-	set f [file join $path idx.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    return -code error "Unknown format \"$format\""
-}
-
-# ::doctools::idx::SetupFormatter --
-#
-#	Create and initializes an interpreter containing a
-#	formatting engine
-#
-# Arguments:
-#	name	Name of the docidx object to manipulate
-#	format	Name of file containing the code of the engine
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::SetupFormatter {name format} {
-
-    # Create and initialize the interpreter first.
-    # Use a transient variable. Interrogate the
-    # engine and check its response. Bail out in
-    # case of errors. Only if we pass the checks
-    # we tear down the old engine and make the new
-    # one official.
-
-    variable here
-    set mpip [interp create -safe] ; # interpreter for the formatting engine
-    #set mpip [interp create] ; # interpreter for the formatting engine
-
-    $mpip invokehidden source [file join $here api_idx.tcl]
-    #$mpip eval [list source [file join $here api_idx.tcl]]
-    interp alias $mpip dt_source   {} ::doctools::idx::Source $mpip [file dirname $format]
-    interp alias $mpip dt_package  {} ::doctools::Package $mpip
-    interp alias $mpip file        {} ::doctools::FileOp  $mpip
-    interp alias $mpip puts_stderr {} ::puts stderr
-    $mpip invokehidden source $format
-    #$mpip eval [list source $format]
-
-    # Check the engine for useability in doctools.
-
-    foreach api {
-	idx_numpasses
-	idx_initialize
-	idx_setup
-	idx_postprocess
-	idx_shutdown
-	idx_listvariables
-	idx_varset
-    } {
-	if {[$mpip eval [list info commands $api]] == {}} {
-	    interp delete $mpip
-	    error "$format error: API incomplete, cannot use this engine"
-	}
-    }
-    if {[catch {
-	set passes [$mpip eval idx_numpasses]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for number of passes"
-    }
-    if {![string is integer $passes] || ($passes < 1)} {
-	interp delete $mpip
-	error "$format error: illegal number of passes \"$passes\""
-    }
-    if {[catch {
-	set parameters [$mpip eval idx_listvariables]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for list of parameters"
-    }
-
-    # Passed the tests. Tear down existing engine,
-    # and checker. The latter is destroyed because
-    # of its aliases into the formatter, which are
-    # now invalid. It will be recreated during the
-    # next call of 'format'.
-
-    upvar ::doctools::idx::docidx${name}::formatfile formatfile
-    upvar ::doctools::idx::docidx${name}::format_ip  format_ip
-    upvar ::doctools::idx::docidx${name}::chk_ip     chk_ip
-    upvar ::doctools::idx::docidx${name}::expander   expander
-    upvar ::doctools::idx::docidx${name}::passes     xpasses
-    upvar ::doctools::idx::docidx${name}::param      xparam
-
-    if {$chk_ip != {}}    {interp delete $chk_ip}
-    if {$format_ip != {}} {interp delete $format_ip}
-
-    set chk_ip    ""
-    set format_ip ""
-
-    # Now link engine API into it.
-
-    interp alias $mpip dt_format    {} ::doctools::idx::GetFormat    $name
-    interp alias $mpip dt_user      {} ::doctools::idx::GetUser      $name
-    interp alias $mpip dt_fmap      {} ::doctools::idx::MapFile      $name
-
-    foreach cmd {cappend cget cis cname cpop cpush cset lb rb} {
-	interp alias $mpip ex_$cmd {} $expander $cmd
-    }
-
-    set format_ip  $mpip
-    set formatfile $format
-    set xpasses    $passes
-    set xparam     $parameters
-    return
-}
-
-# ::doctools::idx::SetupChecker --
-#
-#	Create and initializes an interpreter for checking the usage of
-#	docidx formatting commands
-#
-# Arguments:
-#	name	Name of the docidx object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::SetupChecker {name} {
-    # Create an interpreter for checking the usage of docidx formatting commands
-    # and initialize it: Link it to the interpreter doing the formatting, the
-    # expander object and the configuration information. All of which
-    # is accessible through the token/handle (name of state/object array).
-
-    variable here
-
-    upvar ::doctools::idx::docidx${name}::chk_ip    chk_ip
-    if {$chk_ip != ""} {return}
-
-    upvar ::doctools::idx::docidx${name}::expander  expander
-    upvar ::doctools::idx::docidx${name}::format_ip format_ip
-
-    set chk_ip [interp create] ; # interpreter hosting the formal format checker
-
-    # Make configuration available through command, then load the code base.
-
-    foreach {cmd ckcmd} {
-	dt_search     SearchPaths
-	dt_error      FmtError
-	dt_warning    FmtWarning
-    } {
-	interp alias $chk_ip $cmd {} ::doctools::idx::$ckcmd $name
-    }
-    $chk_ip eval [list source [file join $here checker_idx.tcl]]
-
-    # Simple expander commands are directly routed back into it, no
-    # checking required.
-
-    foreach cmd {cappend cget cis cname cpop cpush cset lb rb} {
-	interp alias $chk_ip $cmd {} $expander $cmd
-    }
-
-    # Link the formatter commands into the checker. We use the prefix
-    # 'fmt_' to distinguish them from the checking commands.
-
-    foreach cmd {
-	index_begin index_end key manpage url comment plain_text
-    } {
-	interp alias $chk_ip fmt_$cmd $format_ip fmt_$cmd
-    }
-    return
-}
-
-# ::doctools::idx::SetupExpander --
-#
-#	Create and initializes the expander for input
-#
-# Arguments:
-#	name	Name of the docidx object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::SetupExpander {name} {
-    upvar ::doctools::idx::docidx${name}::ex_ok    ex_ok
-    if {$ex_ok} {return}
-
-    upvar ::doctools::idx::docidx${name}::expander expander
-    ::textutil::expander $expander
-    $expander evalcmd [list ::doctools::idx::Eval $name]
-    $expander textcmd plain_text
-    set ex_ok 1
-    return
-}
-
-# ::doctools::idx::SearchPaths --
-#
-#	API for checker. Returns list of search paths for format
-#	definitions. Used to look for message catalogs as well.
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::SearchPaths {name} {
-    upvar ::doctools::idx::docidx${name}::paths opaths
-    variable paths
-
-    set p $opaths
-    foreach s $paths {lappend p $s}
-    return $p
-}
-
-# ::doctools::idx::FmtError --
-#
-#	API for checker. Called when an error occurred.
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#	text	Error message
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::FmtError {name text} {
-    return -code error "(FmtError) $text"
-}
-
-# ::doctools::idx::FmtWarning --
-#
-#	API for checker. Called when a warning was generated
-#
-# Arguments:
-#	name	Name of the docidx object
-#	text	Warning message
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::FmtWarning {name text} {
-    upvar ::doctools::idx::docidx${name}::msg msg
-    lappend msg $text
-    return
-}
-
-# ::doctools::idx::Eval --
-#
-#	API for expander. Routes the macro invocations
-#	into the checker interpreter
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::Eval {name macro} {
-    upvar ::doctools::idx::docidx${name}::chk_ip chk_ip
-
-    # Handle the [include] command directly
-    if {[string match include* $macro]} {
-	foreach {cmd filename} $macro break
-	return [ExpandInclude $name $filename]
-    }
-
-    return [$chk_ip eval $macro]
-}
-
-# ::doctools::idx::ExpandInclude --
-#
-#	Handle inclusion of files.
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#	path	Name of file to include and expand.
-#
-# Results:
-#	None.
-
-proc ::doctools::idx::ExpandInclude {name path} {
-    upvar ::doctools::idx::docidx${name}::file file
-
-    set ipath [file join [file dirname $file] $path]
-    if {![file exists $ipath]} {
-	set ipath $path
-	if {![file exists $ipath]} {
-	    return -code error "Unable to fine include file \"$path\""
-	}
-    }
-
-    set    chan [open $ipath r]
-    set    text [read $chan]
-    close $chan
-
-    upvar ::doctools::idx::docidx${name}::expander  expander
-
-    return [$expander expand $text]
-}
-
-# ::doctools::idx::GetUser --
-#
-#	API for formatter. Returns name of current user
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#
-# Results:
-#	String, name of current user.
-
-proc ::doctools::idx::GetUser {name} {
-    global  tcl_platform
-    return $tcl_platform(user)
-}
-
-# ::doctools::idx::GetFormat --
-#
-#	API for formatter. Returns format information
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#
-# Results:
-#	Format information
-
-proc ::doctools::idx::GetFormat {name} {
-    upvar ::doctools::idx::docidx${name}::format format
-    return $format
-}
-
-# ::doctools::idx::MapFile --
-#
-#	API for formatter. Maps symbolic to actual filename in an
-#	index element. If no mapping is found it is assumed that
-#	the symbolic name is also the actual name.
-#
-# Arguments:
-#	name	Name of the docidx object to query.
-#	fname	Symbolic name of the file.
-#
-# Results:
-#	Actual name of the file.
-
-proc ::doctools::idx::MapFile {name fname} {
-    upvar ::doctools::idx::docidx${name}::map map
-    if {[info exists map($fname)]} {
-	return $map($fname)
-    }
-    return $fname
-}
-
-# ::doctools::idx::Source --
-#
-#	API for formatter. Used by engine to ask for
-#	additional script files support it.
-#
-# Arguments:
-#	name	Name of the docidx object to change.
-#
-# Results:
-#	Boolean flag.
-
-proc ::doctools::idx::Source {ip path file} {
-    $ip invokehidden source [file join $path [file tail $file]]
-    #$ip eval [list source [file join $path [file tail $file]]]
-    return
-}
-
-#------------------------------------
-# Module initialization
-
-namespace eval ::doctools::idx {
-    # Reverse order of searching. First to search is specified last.
-
-    # FOO/docidx.tcl
-    # => FOO/mpformats
-
-    #catch {search [file join $here                lib doctools mpformats]}
-    #catch {search [file join [file dirname $here] lib doctools mpformats]}
-    catch {search [file join $here                             mpformats]}
-}
-
-package provide doctools::idx 0.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/doctoc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/doctoc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,911 +1,0 @@
-# doctoc.tcl --
-#
-#	Implementation of doctoc objects for Tcl.
-#
-# Copyright (c) 2003-2007 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: doctoc.tcl,v 1.14 2007/08/20 20:11:59 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require textutil::expander
-
-# @mdgen OWNER: api_toc.tcl
-# @mdgen OWNER: checker_toc.tcl
-# @mdgen OWNER: mpformats/*.tcl
-# @mdgen OWNER: mpformats/*.msg
-# @mdgen OWNER: mpformats/toc.*
-
-namespace eval ::doctools {}
-namespace eval ::doctools::toc {
-    # Data storage in the doctools::toc module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #  1) A list of additional search paths for format definition files.
-    #     This list extends the list of standard paths known to the module.
-    #     The paths in the list are searched before the standard paths.
-    #  2) Configuration information
-    #     a) string:  The format to use when converting the input.
-    #  4) Name of the interpreter used to perform the syntax check of the
-    #     input (= allowed order of formatting commands).
-    #  5) Name of the interpreter containing the code coming from the format
-    #     definition file.
-    #  6) Name of the expander object used to interpret the input to convert.
-
-    # commands is the list of subcommands recognized by the doctoc objects
-    variable commands [list		\
-	    "cget"			\
-	    "configure"			\
-	    "destroy"			\
-	    "format"			\
-	    "map"			\
-	    "search"			\
-	    "warnings"                  \
-	    "parameters"                \
-	    "setparam"                  \
-	    ]
-
-    # Only export the toplevel commands
-    namespace export new search help
-
-    # Global data
-
-    #  1) List of standard paths to look at when searching for a format
-    #     definition. Extensible.
-    #  2) Location of this file in the filesystem
-
-    variable paths [list]
-    variable here [file dirname [info script]]
-}
-
-# ::doctools::toc::search --
-#
-#	Extend the list of paths used when searching for format definition files.
-#
-# Arguments:
-#	path	Path to add to the list. The path has to exist, has to be a
-#               directory, and has to be readable.
-#
-# Results:
-#	None.
-#
-# Sideeffects:
-#	The specified path is added to the front of the list of search
-#	paths. This means that the new path is search before the
-#	standard paths set at module initialization time.
-
-proc ::doctools::toc::search {path} {
-    variable paths
-
-    if {![file exists      $path]} {return -code error "doctools::toc::search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "doctools::toc::search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "doctools::toc::search: path cannot be read"}
-
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::toc::help --
-#
-#	Return a string containing short help
-#	regarding the existing formatting commands.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A string.
-
-proc ::doctools::toc::help {} {
-    return "formatting commands\n\
-	    * toc_begin      - begin of table of contents\n\
-	    * toc_end        - end of toc\n\
-	    * division_start - begin of toc division\n\
-	    * division_end   - end of toc division\n\
-	    * item           - toc element\n\
-	    * vset           - set/get variable values\n\
-	    * include        - insert external file\n\
-	    * lb, rb         - left/right brackets\n\
-	    "
-}
-
-# ::doctools::toc::new --
-#
-#	Create a new doctoc object with a given name. May configure the object.
-#
-# Arguments:
-#	name	Name of the doctoc object.
-#	args	Options configuring the new object.
-#
-# Results:
-#	name	Name of the doctools created
-
-proc ::doctools::toc::new {name args} {
-        if { [llength [info commands ::$name]] } {
-	return -code error "command \"$name\" already exists, unable to create doctoc object"
-    }
-    if {[llength $args] % 2 == 1} {
-	return -code error "wrong # args: doctools::new name ?opt val...??"
-    }
-
-    # The arguments seem to be ok, setup the namespace for the object
-
-    namespace eval ::doctools::toc::doctoc$name {
-	variable paths      [list]
-	variable file       ""
-	variable format     ""
-	variable formatfile ""
-	variable format_ip  ""
-	variable chk_ip     ""
-	variable expander   "[namespace current]::ex"
-	variable ex_ok      0
-	variable msg        [list]
-	variable map ;      array set map {}
-	variable param      [list]
-    }
-
-    # Create the command to manipulate the object
-    #                 $name -> ::doctools::toc::DocTocProc $name
-    interp alias {} ::$name {} ::doctools::toc::DocTocProc $name
-
-    # If the name was followed by arguments use them to configure the
-    # object before returning its handle to the caller.
-
-    if {[llength $args] > 1} {
-	# Use linsert trick to make the command a pure list.
-	eval [linsert $args 0 _configure $name]
-    }
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::doctools::toc::DocTocProc --
-#
-#	Command that processes all doctoc object commands.
-#	Dispatches any object command to the appropriate internal
-#	command implementing its functionality.
-#
-# Arguments:
-#	name	Name of the doctoc object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::doctools::toc::DocTocProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-
-    if { [llength [info commands ::doctools::toc::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    return [eval [list ::doctools::toc::_$cmd $name] $args]
-}
-
-##########################
-# Method implementations follow (these are also private commands)
-
-# ::doctools::toc::_cget --
-#
-#	Retrieve the current value of a particular option
-#
-# Arguments:
-#	name	Name of the doctoc object to query
-#	option	Name of the option whose value we are asking for.
-#
-# Results:
-#	The value of the option
-
-proc ::doctools::toc::_cget {name option} {
-    _configure $name $option
-}
-
-# ::doctools::toc::_configure --
-#
-#	Configure a doctoc object, or query its configuration.
-#
-# Arguments:
-#	name	Name of the doctoc object to configure
-#	args	Options and their values.
-#
-# Results:
-#	None if configuring the object.
-#	A list of all options and their values if called without arguments.
-#	The value of one particular option if called with a single argument.
-
-proc ::doctools::toc::_configure {name args} {
-    if {[llength $args] == 0} {
-	# Retrieve the current configuration.
-
-	upvar ::doctools::toc::doctoc${name}::file    file
-	upvar ::doctools::toc::doctoc${name}::format  format
-
-	set     res [list]
-	lappend res -file       $file
-	lappend res -format     $format
-	return $res
-
-    } elseif {[llength $args] == 1} {
-	# Query the value of one particular option.
-
-	switch -exact -- [lindex $args 0] {
-	    -file {
-		upvar ::doctools::toc::doctoc${name}::file file
-		return $file
-	    }
-	    -format {
-		upvar ::doctools::toc::doctoc${name}::format format
-		return $format
-	    }
-	    default {
-		return -code error \
-			"doctools::toc::_configure: Unknown option \"[lindex $args 0]\", expected\
-			-file, or -format"
-	    }
-	}
-    } else {
-	# Reconfigure the object.
-
-	if {[llength $args] % 2 == 1} {
-	    return -code error "wrong # args: doctools::toc::_configure name ?opt val...??"
-	}
-
-	foreach {option value} $args {
-	    switch -exact -- $option {
-		-file {
-		    upvar ::doctools::toc::doctoc${name}::file file
-		    set file $value
-		}
-		-format {
-		    if {[catch {
-			set fmtfile [LookupFormat $name $value]
-			SetupFormatter $name $fmtfile
-			upvar ::doctools::toc::doctoc${name}::format format
-			set format $value
-		    } msg]} {
-			return -code error "doctools::toc::_configure: -format: $msg"
-		    }
-		}
-		default {
-		    return -code error \
-			    "doctools::toc::_configure: Unknown option \"$option\", expected\
-			    -file, or -format"
-		}
-	    }
-	}
-    }
-    return ""
-}
-
-# ::doctools::toc::_destroy --
-#
-#	Destroy a doctoc object, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the doctoc object to destroy.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::_destroy {name} {
-    # Check the object for sub objects which have to destroyed before
-    # the namespace is torn down.
-    namespace eval ::doctools::toc::doctoc$name {
-	if {$format_ip != ""} {interp delete $format_ip}
-	if {$chk_ip    != ""} {interp delete $chk_ip}
-
-	# Expander objects have no delete/destroy method. This would
-	# be a leak if not for the fact that an expander object is a
-	# namespace, and we have arranged to make it a sub namespace of
-	# the doctoc object. Therefore tearing down our object namespace
-	# also cleans up the expander object.
-	# if {$expander != ""} {$expander destroy}
-
-    }
-    namespace delete ::doctools::toc::doctoc$name
-    interp alias {} ::$name {}
-    return
-}
-
-# ::doctools::toc::_map --
-#
-#	Add a mapping from symbolic to actual filename to the object.
-#
-# Arguments:
-#	name	Name of the doctoc object to use
-#	sfname	Symbolic filename to map
-#	afname	Actual filename
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::_map {name sfname afname} {
-    upvar ::doctools::toc::doctoc${name}::map map
-    set map($sfname) $afname
-    return
-}
-
-# ::doctools::toc::_format --
-#
-#	Convert some text in doctools format
-#	according to the configuration in the object.
-#
-# Arguments:
-#	name	Name of the doctoc object to use
-#	text	Text to convert.
-#
-# Results:
-#	The conversion result.
-
-proc ::doctools::toc::_format {name text} {
-    upvar ::doctools::toc::doctoc${name}::format format
-    if {$format == ""} {
-	return -code error "$name: No format was specified"
-    }
-
-    upvar ::doctools::toc::doctoc${name}::format_ip format_ip
-    upvar ::doctools::toc::doctoc${name}::chk_ip    chk_ip
-    upvar ::doctools::toc::doctoc${name}::ex_ok     ex_ok
-    upvar ::doctools::toc::doctoc${name}::expander  expander
-    upvar ::doctools::toc::doctoc${name}::passes    passes
-    upvar ::doctools::toc::doctoc${name}::msg       warnings
-
-    if {!$ex_ok}       {SetupExpander  $name}
-    if {$chk_ip == ""} {SetupChecker   $name}
-    # assert (format_ip != "")
-
-    set warnings [list]
-    if {[catch {$format_ip eval toc_initialize}]} {
-	return -code error "Could not initialize engine"
-    }
-    set result ""
-
-    for {
-	set p $passes ; set n 1
-    } {
-	$p > 0
-    } {
-	incr p -1 ; incr n
-    } {
-	if {[catch {$format_ip eval [list toc_setup $n]}]} {
-	    catch {$format_ip eval toc_shutdown}
-	    return -code error "Could not initialize pass $n of engine"
-	}
-	$chk_ip eval ck_initialize
-
-	if {[catch {set result [$expander expand $text]} msg]} {
-	    catch {$format_ip eval toc_shutdown}
-	    # Filter for checker errors and reduce them to the essential message.
-
-	    if {![regexp {^Error in} $msg]}          {return -code error $msg}
-	    #set msg [join [lrange [split $msg \n] 2 end]]
-
-	    if {![regexp {^--> \(FmtError\) } $msg]} {return -code error "Doctoc $msg"}
-	    set msg [lindex [split $msg \n] 0]
-	    regsub {^--> \(FmtError\) } $msg {} msg
-
-	    return -code error $msg
-	}
-
-	$chk_ip eval ck_complete
-    }
-
-    if {[catch {set result [$format_ip eval [list toc_postprocess $result]]}]} {
-	return -code error "Unable to post process final result"
-    }
-    if {[catch {$format_ip eval toc_shutdown}]} {
-	return -code error "Could not shut engine down"
-    }
-    return $result
-
-}
-
-# ::doctools::toc::_search --
-#
-#	Add a search path to the object.
-#
-# Arguments:
-#	name	Name of the doctoc object to extend
-#	path	Search path to add.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::_search {name path} {
-    if {![file exists      $path]} {return -code error "$name search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "$name search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "$name search: path cannot be read"}
-
-    upvar ::doctools::toc::doctoc${name}::paths paths
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::toc::_warnings --
-#
-#	Return the warning accumulated during the last invocation of 'format'.
-#
-# Arguments:
-#	name	Name of the doctoc object to query
-#
-# Results:
-#	A list of warnings.
-
-proc ::doctools::toc::_warnings {name} {
-    upvar ::doctools::toc::doctoc${name}::msg msg
-    return $msg
-}
-
-# ::doctools::_parameters --
-#
-#	Returns a list containing the parameters provided
-#	by the selected formatting engine.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#
-# Results:
-#	A list of parameter names
-
-proc ::doctools::toc::_parameters {name} {
-    upvar ::doctools::toc::doctoc${name}::param param
-    return $param
-}
-
-# ::doctools::_setparam --
-#
-#	Set a named engine parameter to a value.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#	param	Name of the parameter to set.
-#	value	Value to set the parameter to.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::_setparam {name param value} {
-    upvar ::doctools::toc::doctoc${name}::format_ip format_ip
-
-    if {$format_ip == {}} {
-	return -code error \
-		"Unable to set parameters without a valid format"
-    }
-
-    $format_ip eval [list toc_varset $param $value]
-    return
-}
-
-##########################
-# Support commands
-
-# ::doctools::toc::LookupFormat --
-#
-#	Search a format definition file based upon its name
-#
-# Arguments:
-#	name	Name of the doctoc object to use
-#	format	Name of the format to look for.
-#
-# Results:
-#	The file containing the format definition
-
-proc ::doctools::toc::LookupFormat {name format} {
-    # Order of searching
-    # 1) Is the name of the format an existing file ?
-    #    If yes, take this file.
-    # 2) Look for the file in the directories given to the object itself..
-    # 3) Look for the file in the standard directories of this package.
-
-    if {[file exists $format]} {
-	return $format
-    }
-
-    upvar ::doctools::toc::doctoc${name}::paths opaths
-    foreach path $opaths {
-	set f [file join $path toc.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    variable paths
-    foreach path $paths {
-	set f [file join $path toc.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    return -code error "Unknown format \"$format\""
-}
-
-# ::doctools::toc::SetupFormatter --
-#
-#	Create and initializes an interpreter containing a
-#	formatting engine
-#
-# Arguments:
-#	name	Name of the doctoc object to manipulate
-#	format	Name of file containing the code of the engine
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::SetupFormatter {name format} {
-
-    # Create and initialize the interpreter first.
-    # Use a transient variable. Interrogate the
-    # engine and check its response. Bail out in
-    # case of errors. Only if we pass the checks
-    # we tear down the old engine and make the new
-    # one official.
-
-    variable here
-    set mpip [interp create -safe] ; # interpreter for the formatting engine
-    #set mpip [interp create] ; # interpreter for the formatting engine
-
-    $mpip invokehidden source [file join $here api_toc.tcl]
-    #$mpip eval [list source [file join $here api_toc.tcl]]
-    interp alias $mpip dt_source   {} ::doctools::toc::Source $mpip [file dirname $format]
-    interp alias $mpip dt_package  {} ::doctools::Package $mpip
-    interp alias $mpip file        {} ::doctools::FileOp  $mpip
-    interp alias $mpip puts_stderr {} ::puts stderr
-    $mpip invokehidden source $format
-    #$mpip eval [list source $format]
-
-    # Check the engine for useability in doctools.
-
-    foreach api {
-	toc_numpasses
-	toc_initialize
-	toc_setup
-	toc_postprocess
-	toc_shutdown
-	toc_listvariables
-	toc_varset
-    } {
-	if {[$mpip eval [list info commands $api]] == {}} {
-	    interp delete $mpip
-	    error "$format error: API incomplete, cannot use this engine"
-	}
-    }
-    if {[catch {
-	set passes [$mpip eval toc_numpasses]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for number of passes"
-    }
-    if {![string is integer $passes] || ($passes < 1)} {
-	interp delete $mpip
-	error "$format error: illegal number of passes \"$passes\""
-    }
-    if {[catch {
-	set parameters [$mpip eval toc_listvariables]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for list of parameters"
-    }
-
-    # Passed the tests. Tear down existing engine,
-    # and checker. The latter is destroyed because
-    # of its aliases into the formatter, which are
-    # now invalid. It will be recreated during the
-    # next call of 'format'.
-
-    upvar ::doctools::toc::doctoc${name}::formatfile formatfile
-    upvar ::doctools::toc::doctoc${name}::format_ip  format_ip
-    upvar ::doctools::toc::doctoc${name}::chk_ip     chk_ip
-    upvar ::doctools::toc::doctoc${name}::expander   expander
-    upvar ::doctools::toc::doctoc${name}::passes     xpasses
-    upvar ::doctools::toc::doctoc${name}::param      xparam
-
-    if {$chk_ip != {}}    {interp delete $chk_ip}
-    if {$format_ip != {}} {interp delete $format_ip}
-
-    set chk_ip    ""
-    set format_ip ""
-
-    # Now link engine API into it.
-
-    interp alias $mpip dt_format    {} ::doctools::toc::GetFormat    $name
-    interp alias $mpip dt_user      {} ::doctools::toc::GetUser      $name
-    interp alias $mpip dt_fmap      {} ::doctools::toc::MapFile      $name
-
-    foreach cmd {cappend cget cis cname cpop cpush cset lb rb} {
-	interp alias $mpip ex_$cmd {} $expander $cmd
-    }
-
-    set format_ip  $mpip
-    set formatfile $format
-    set xpasses    $passes
-    set xparam     $parameters
-    return
-}
-
-# ::doctools::toc::SetupChecker --
-#
-#	Create and initializes an interpreter for checking the usage of
-#	doctoc formatting commands
-#
-# Arguments:
-#	name	Name of the doctoc object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::SetupChecker {name} {
-    # Create an interpreter for checking the usage of doctoc formatting commands
-    # and initialize it: Link it to the interpreter doing the formatting, the
-    # expander object and the configuration information. All of which
-    # is accessible through the token/handle (name of state/object array).
-
-    variable here
-
-    upvar ::doctools::toc::doctoc${name}::chk_ip    chk_ip
-    if {$chk_ip != ""} {return}
-
-    upvar ::doctools::toc::doctoc${name}::expander  expander
-    upvar ::doctools::toc::doctoc${name}::format_ip format_ip
-
-    set chk_ip [interp create] ; # interpreter hosting the formal format checker
-
-    # Make configuration available through command, then load the code base.
-
-    foreach {cmd ckcmd} {
-	dt_search     SearchPaths
-	dt_error      FmtError
-	dt_warning    FmtWarning
-    } {
-	interp alias $chk_ip $cmd {} ::doctools::toc::$ckcmd $name
-    }
-    $chk_ip eval [list source [file join $here checker_toc.tcl]]
-
-    # Simple expander commands are directly routed back into it, no
-    # checking required.
-
-    foreach cmd {cappend cget cis cname cpop cpush cset lb rb} {
-	interp alias $chk_ip $cmd {} $expander $cmd
-    }
-
-    # Link the formatter commands into the checker. We use the prefix
-    # 'fmt_' to distinguish them from the checking commands.
-
-    foreach cmd {
-	toc_begin toc_end division_start division_end item
-	comment plain_text
-    } {
-	interp alias $chk_ip fmt_$cmd $format_ip fmt_$cmd
-    }
-    return
-}
-
-# ::doctools::toc::SetupExpander --
-#
-#	Create and initializes the expander for input
-#
-# Arguments:
-#	name	Name of the doctoc object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::SetupExpander {name} {
-    upvar ::doctools::toc::doctoc${name}::ex_ok    ex_ok
-    if {$ex_ok} {return}
-
-    upvar ::doctools::toc::doctoc${name}::expander expander
-    ::textutil::expander $expander
-    $expander evalcmd [list ::doctools::toc::Eval $name]
-    $expander textcmd plain_text
-    set ex_ok 1
-    return
-}
-
-# ::doctools::toc::SearchPaths --
-#
-#	API for checker. Returns list of search paths for format
-#	definitions. Used to look for message catalogs as well.
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::SearchPaths {name} {
-    upvar ::doctools::toc::doctoc${name}::paths opaths
-    variable paths
-
-    set p $opaths
-    foreach s $paths {lappend p $s}
-    return $p
-}
-
-# ::doctools::toc::FmtError --
-#
-#	API for checker. Called when an error occurred.
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#	text	Error message
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::FmtError {name text} {
-    return -code error "(FmtError) $text"
-}
-
-# ::doctools::toc::FmtWarning --
-#
-#	API for checker. Called when a warning was generated
-#
-# Arguments:
-#	name	Name of the doctoc object
-#	text	Warning message
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::FmtWarning {name text} {
-    upvar ::doctools::toc::doctoc${name}::msg msg
-    lappend msg $text
-    return
-}
-
-# ::doctools::toc::Eval --
-#
-#	API for expander. Routes the macro invocations
-#	into the checker interpreter
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::Eval {name macro} {
-    upvar ::doctools::toc::doctoc${name}::chk_ip chk_ip
-
-    # Handle the [include] command directly
-    if {[string match include* $macro]} {
-	foreach {cmd filename} $macro break
-	return [ExpandInclude $name $filename]
-    }
-
-    return [$chk_ip eval $macro]
-}
-
-# ::doctools::toc::ExpandInclude --
-#
-#	Handle inclusion of files.
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#	path	Name of file to include and expand.
-#
-# Results:
-#	None.
-
-proc ::doctools::toc::ExpandInclude {name path} {
-    # Look for the file relative to the directory of the
-    # main file we are converting. If that fails try to
-    # use the current working directory. Throw an error
-    # if the file couldn't be found.
-
-    upvar ::doctools::toc::doctoc${name}::file file
-
-    set ipath [file join [file dirname $file] $path]
-    if {![file exists $ipath]} {
-	set ipath $path
-	if {![file exists $ipath]} {
-	    return -code error "Unable to fine include file \"$path\""
-	}
-    }
-
-    set    chan [open $ipath r]
-    set    text [read $chan]
-    close $chan
-
-    upvar ::doctools::toc::doctoc${name}::expander  expander
-
-    return [$expander expand $text]
-}
-
-# ::doctools::toc::GetUser --
-#
-#	API for formatter. Returns name of current user
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#
-# Results:
-#	String, name of current user.
-
-proc ::doctools::toc::GetUser {name} {
-    global  tcl_platform
-    return $tcl_platform(user)
-}
-
-# ::doctools::toc::GetFormat --
-#
-#	API for formatter. Returns format information
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#
-# Results:
-#	Format information
-
-proc ::doctools::toc::GetFormat {name} {
-    upvar ::doctools::toc::doctoc${name}::format format
-    return $format
-}
-
-# ::doctools::toc::MapFile --
-#
-#	API for formatter. Maps symbolic to actual filename in a toc
-#	item. If no mapping is found it is assumed that the symbolic
-#	name is also the actual name.
-#
-# Arguments:
-#	name	Name of the doctoc object to query.
-#	fname	Symbolic name of the file.
-#
-# Results:
-#	Actual name of the file.
-
-proc ::doctools::toc::MapFile {name fname} {
-    upvar ::doctools::toc::doctoc${name}::map map
-    if {[info exists map($fname)]} {
-	return $map($fname)
-    }
-    return $fname
-}
-
-# ::doctools::toc::Source --
-#
-#	API for formatter. Used by engine to ask for
-#	additional script files support it.
-#
-# Arguments:
-#	name	Name of the doctoc object to change.
-#
-# Results:
-#	Boolean flag.
-
-proc ::doctools::toc::Source {ip path file} {
-    $ip invokehidden source [file join $path [file tail $file]]
-    #$ip eval [list source [file join $path [file tail $file]]]
-    return
-}
-
-#------------------------------------
-# Module initialization
-
-namespace eval ::doctools::toc {
-    # Reverse order of searching. First to search is specified last.
-
-    # FOO/doctoc.tcl
-    # => FOO/mpformats
-
-    #catch {search [file join $here                lib doctools mpformats]}
-    #catch {search [file join [file dirname $here] lib doctools mpformats]}
-    catch {search [file join $here                             mpformats]}
-}
-
-package provide doctools::toc 0.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/doctools.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/doctools.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1194 +1,0 @@
-# doctools.tcl --
-#
-#	Implementation of doctools objects for Tcl.
-#
-# Copyright (c) 2003-2007 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: doctools.tcl,v 1.22 2007/08/20 20:11:59 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require textutil::expander
-
-# @mdgen OWNER: api.tcl
-# @mdgen OWNER: checker.tcl
-# @mdgen OWNER: mpformats/*.tcl
-# @mdgen OWNER: mpformats/*.msg
-# @mdgen OWNER: mpformats/fmt.*
-
-namespace eval ::doctools {
-    # Data storage in the doctools module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #  1) A list of additional search paths for format definition files.
-    #     This list extends the list of standard paths known to the module.
-    #     The paths in the list are searched before the standard paths.
-    #  2) Configuration information
-    #     a) string:  The format to use when converting the input.
-    #     b) boolean: A flag telling us whether to warn when visual markup
-    #        is used in the input, or not.
-    #     c) File information associated with the input, if any.
-    #     d) Module information associated with the input, if any.
-    #     e) Copyright information, if any
-    #  4) Name of the interpreter used to perform the syntax check of the
-    #     input (= allowed order of formatting commands).
-    #  5) Name of the interpreter containing the code coming from the format
-    #     definition file.
-    #  6) Name of the expander object used to interpret the input to convert.
-
-    # commands is the list of subcommands recognized by the doctools objects
-    variable commands [list		\
-	    "cget"			\
-	    "configure"			\
-	    "destroy"			\
-	    "format"			\
-	    "map"			\
-	    "search"			\
-	    "warnings"                  \
-	    "parameters"                \
-	    "setparam"                  \
-	    ]
-
-    # Only export the toplevel commands
-    namespace export new search help
-
-    # Global data
-
-    #  1) List of standard paths to look at when searching for a format
-    #     definition. Extensible.
-    #  2) Location of this file in the filesystem
-
-    variable paths [list]
-    variable here [file dirname [info script]]
-}
-
-# ::doctools::search --
-#
-#	Extend the list of paths used when searching for format definition files.
-#
-# Arguments:
-#	path	Path to add to the list. The path has to exist, has to be a
-#               directory, and has to be readable.
-#
-# Results:
-#	None.
-#
-# Sideeffects:
-#	The specified path is added to the front of the list of search
-#	paths. This means that the new path is search before the
-#	standard paths set at module initialization time.
-
-proc ::doctools::search {path} {
-    variable paths
-
-    if {![file exists      $path]} {return -code error "doctools::search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "doctools::search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "doctools::search: path cannot be read"}
-
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::help --
-#
-#	Return a string containing short help
-#	regarding the existing formatting commands.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A string.
-
-proc ::doctools::help {} {
-    return "formatting commands\n\
-	    * manpage_begin - begin of manpage\n\
-	    * moddesc       - module description\n\
-	    * titledesc     - manpage title\n\
-	    * copyright     - copyright assignment\n\
-	    * manpage_end   - end of manpage\n\
-	    * require       - package requirement\n\
-	    * description   - begin of manpage body\n\
-	    * section       - begin new section of body\n\
-	    * subsection    - begin new sub-section of body\n\
-	    * para          - begin new paragraph\n\
-	    * list_begin    - begin a list\n\
-	    * list_end      - end of a list\n\
-	    * lst_item      - begin item of definition list\n\
-	    * call          - command definition, adds to synopsis\n\
-	    * usage         - see above, without adding to synopsis\n\
-	    * bullet        - begin item in bulleted list\n\
-	    * enum          - begin item in enumerated list\n\
-	    * arg_def       - begin item in argument list\n\
-	    * cmd_def       - begin item in command list\n\
-	    * opt_def       - begin item in option list\n\
-	    * tkoption_def  - begin item in tkoption list\n\
-	    * example       - example block\n\
-	    * example_begin - begin example\n\
-	    * example_end   - end of example\n\
-	    * see_also      - cross reference declaration\n\
-	    * keywords      - keyword declaration\n\
-	    * nl            - paragraph break in list items\n\
-	    * arg           - semantic markup - argument\n\
-	    * cmd           - semantic markup - command\n\
-	    * opt           - semantic markup - optional data\n\
-	    * comment       - semantic markup - comment\n\
-	    * sectref       - semantic markup - section reference\n\
-	    * syscmd        - semantic markup - system command\n\
-	    * method        - semantic markup - object method\n\
-	    * namespace     - semantic markup - namespace name\n\
-	    * option        - semantic markup - option\n\
-	    * widget        - semantic markup - widget\n\
-	    * fun           - semantic markup - function\n\
-	    * type          - semantic markup - data type\n\
-	    * package       - semantic markup - package\n\
-	    * class         - semantic markup - class\n\
-	    * var           - semantic markup - variable\n\
-	    * file          - semantic markup - file \n\
-	    * uri           - semantic markup - uri (optional label)\n\
-	    * term          - semantic markup - unspecific terminology\n\
-	    * const         - semantic markup - constant value\n\
-	    * emph          - emphasis\n\
-	    * strong        - emphasis, deprecated, usage is discouraged\n\
-	    "
-}
-
-# ::doctools::new --
-#
-#	Create a new doctools object with a given name. May configure the object.
-#
-# Arguments:
-#	name	Name of the doctools object.
-#	args	Options configuring the new object.
-#
-# Results:
-#	name	Name of the doctools created
-
-proc ::doctools::new {name args} {
-    
-    if { [llength [info commands ::$name]] } {
-	return -code error "command \"$name\" already exists, unable to create doctools object"
-    }
-    if {[llength $args] % 2 == 1} {
-	return -code error "wrong # args: doctools::new name ?opt val...??"
-    }
-
-    # The arguments seem to be ok, setup the namespace for the object
-
-    namespace eval ::doctools::doctools$name {
-	variable paths      [list]
-	variable format     ""
-	variable formatfile ""
-	variable deprecated 0
-	variable file       ""
-	variable module     ""
-	variable copyright  ""
-	variable format_ip  ""
-	variable chk_ip     ""
-	variable expander   "[namespace current]::ex"
-	variable ex_ok      0
-	variable msg        [list]
-	variable param      [list]
-	variable map ;      array set map {}
-    }
-
-    # Create the command to manipulate the object
-    #                 $name -> ::doctools::DoctoolsProc $name
-    interp alias {} ::$name {} ::doctools::DoctoolsProc $name
-
-    # If the name was followed by arguments use them to configure the
-    # object before returning its handle to the caller.
-
-    if {[llength $args] > 1} {
-	# Use linsert trick to make the command a pure list.
-	eval [linsert $args 0 _configure $name]
-    }
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::doctools::DoctoolsProc --
-#
-#	Command that processes all doctools object commands.
-#	Dispatches any object command to the appropriate internal
-#	command implementing its functionality.
-#
-# Arguments:
-#	name	Name of the doctools object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::doctools::DoctoolsProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-
-    if { [llength [info commands ::doctools::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    return [eval [list ::doctools::_$cmd $name] $args]
-}
-
-##########################
-# Method implementations follow (these are also private commands)
-
-# ::doctools::_cget --
-#
-#	Retrieve the current value of a particular option
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#	option	Name of the option whose value we are asking for.
-#
-# Results:
-#	The value of the option
-
-proc ::doctools::_cget {name option} {
-    _configure $name $option
-}
-
-# ::doctools::_configure --
-#
-#	Configure a doctools object, or query its configuration.
-#
-# Arguments:
-#	name	Name of the doctools object to configure
-#	args	Options and their values.
-#
-# Results:
-#	None if configuring the object.
-#	A list of all options and their values if called without arguments.
-#	The value of one particular option if called with a single argument.
-
-proc ::doctools::_configure {name args} {
-    upvar ::doctools::doctools${name}::format_ip  format_ip
-    upvar ::doctools::doctools${name}::chk_ip     chk_ip
-    upvar ::doctools::doctools${name}::expander   expander
-    upvar ::doctools::doctools${name}::passes     passes
-
-    if {[llength $args] == 0} {
-	# Retrieve the current configuration.
-
-	upvar ::doctools::doctools${name}::file       file
-	upvar ::doctools::doctools${name}::module     module
-	upvar ::doctools::doctools${name}::format     format
-	upvar ::doctools::doctools${name}::copyright  copyright
-	upvar ::doctools::doctools${name}::deprecated deprecated
-
-	set     res [list]
-	lappend res -file       $file
-	lappend res -module     $module
-	lappend res -format     $format
-	lappend res -copyright  $copyright
-	lappend res -deprecated $deprecated
-	return $res
-
-    } elseif {[llength $args] == 1} {
-	# Query the value of one particular option.
-
-	switch -exact -- [lindex $args 0] {
-	    -file {
-		upvar ::doctools::doctools${name}::file file
-		return $file
-	    }
-	    -module {
-		upvar ::doctools::doctools${name}::module module
-		return $module
-	    }
-	    -copyright {
-		upvar ::doctools::doctools${name}::copyright copyright
-		return $copyright
-	    }
-	    -format {
-		upvar ::doctools::doctools${name}::format format
-		return $format
-	    }
-	    -deprecated {
-		upvar ::doctools::doctools${name}::deprecated deprecated
-		return $deprecated
-	    }
-	    default {
-		return -code error \
-			"doctools::_configure: Unknown option \"[lindex $args 0]\", expected\
-			-copyright, -file, -module, -format, or -deprecated"
-	    }
-	}
-    } else {
-	# Reconfigure the object.
-
-	if {[llength $args] % 2 == 1} {
-	    return -code error "wrong # args: doctools::_configure name ?opt val...??"
-	}
-
-	foreach {option value} $args {
-	    switch -exact -- $option {
-		-file {
-		    upvar ::doctools::doctools${name}::file file
-		    set file $value
-		}
-		-module {
-		    upvar ::doctools::doctools${name}::module module
-		    set module $value
-		}
-		-copyright {
-		    upvar ::doctools::doctools${name}::copyright copyright
-		    set copyright $value
-		}
-		-format {
-		    if {[catch {
-			set fmtfile [LookupFormat $name $value]
-			SetupFormatter $name $fmtfile
-			upvar ::doctools::doctools${name}::format format
-			set format $value
-		    } msg]} {
-			return -code error "doctools::_configure: -format: $msg"
-		    }
-		}
-		-deprecated {
-		    if {![string is boolean $value]} {
-			return -code error \
-				"doctools::_configure: -deprecated expected a boolean, got \"$value\""
-		    }
-		    upvar ::doctools::doctools${name}::deprecated deprecated
-		    set deprecated $value
-		}
-		default {
-		    return -code error \
-			    "doctools::_configure: Unknown option \"$option\", expected\
-			    -copyright, -file, -module, -format, or -deprecated"
-		}
-	    }
-	}
-    }
-    return ""
-}
-
-# ::doctools::_destroy --
-#
-#	Destroy a doctools object, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the doctools object to destroy.
-#
-# Results:
-#	None.
-
-proc ::doctools::_destroy {name} {
-    # Check the object for sub objects which have to destroyed before
-    # the namespace is torn down.
-    namespace eval ::doctools::doctools$name {
-	if {$format_ip != ""} {interp delete $format_ip}
-	if {$chk_ip    != ""} {interp delete $chk_ip}
-
-	# Expander objects have no delete/destroy method. This would
-	# be a leak if not for the fact that an expander object is a
-	# namespace, and we have arranged to make it a sub namespace of
-	# the doctools object. Therefore tearing down our object namespace
-	# also cleans up the expander object.
-	# if {$expander != ""} {$expander destroy}
-
-    }
-    namespace delete ::doctools::doctools$name
-    interp alias {} ::$name {}
-    return
-}
-
-# ::doctools::_map --
-#
-#	Add a mapping from symbolic to actual filename to the object.
-#
-# Arguments:
-#	name	Name of the doctools object to use
-#	sfname	Symbolic filename to map
-#	afname	Actual filename
-#
-# Results:
-#	None.
-
-proc ::doctools::_map {name sfname afname} {
-    upvar ::doctools::doctools${name}::map map
-    set map($sfname) $afname
-    return
-}
-
-# ::doctools::_format --
-#
-#	Convert some text in doctools format
-#	according to the configuration in the object.
-#
-# Arguments:
-#	name	Name of the doctools object to use
-#	text	Text to convert.
-#
-# Results:
-#	The conversion result.
-
-proc ::doctools::_format {name text} {
-    upvar ::doctools::doctools${name}::format format
-    if {$format == ""} {
-	return -code error "$name: No format was specified"
-    }
-
-    upvar ::doctools::doctools${name}::format_ip format_ip
-    upvar ::doctools::doctools${name}::chk_ip    chk_ip
-    upvar ::doctools::doctools${name}::ex_ok     ex_ok
-    upvar ::doctools::doctools${name}::expander  expander
-    upvar ::doctools::doctools${name}::passes    passes
-    upvar ::doctools::doctools${name}::msg       warnings
-
-    if {!$ex_ok}       {SetupExpander  $name}
-    if {$chk_ip == ""} {SetupChecker   $name}
-    # assert (format_ip != "")
-
-    set warnings [list]
-    if {[catch {$format_ip eval fmt_initialize}]} {
-	return -code error "Could not initialize engine"
-    }
-    set result ""
-
-    for {
-	set p $passes ; set n 1
-    } {
-	$p > 0
-    } {
-	incr p -1 ; incr n
-    } {
-	if {[catch {$format_ip eval [list fmt_setup $n]}]} {
-	    catch {$format_ip eval fmt_shutdown}
-	    return -code error "Could not initialize pass $n of engine"
-	}
-	$chk_ip eval ck_initialize
-
-	if {[catch {set result [$expander expand $text]} msg]} {
-	    catch {$format_ip eval fmt_shutdown}
-	    # Filter for checker errors and reduce them to the essential message.
-
-	    if {![regexp {^Error in} $msg]}          {return -code error $msg}
-	    #set msg [join [lrange [split $msg \n] 2 end]]
-
-	    if {![regexp {^--> \(FmtError\) } $msg]} {return -code error "Doctools $msg"}
-	    set msg [lindex [split $msg \n] 0]
-	    regsub {^--> \(FmtError\) } $msg {} msg
-
-	    return -code error $msg
-	}
-
-	$chk_ip eval ck_complete
-    }
-
-    if {[catch {set result [$format_ip eval [list fmt_postprocess $result]]}]} {
-	return -code error "Unable to post process final result"
-    }
-    if {[catch {$format_ip eval fmt_shutdown}]} {
-	return -code error "Could not shut engine down"
-    }
-    return $result
-
-}
-
-# ::doctools::_search --
-#
-#	Add a search path to the object.
-#
-# Arguments:
-#	name	Name of the doctools object to extend
-#	path	Search path to add.
-#
-# Results:
-#	None.
-
-proc ::doctools::_search {name path} {
-    if {![file exists      $path]} {return -code error "$name search: path does not exist"}
-    if {![file isdirectory $path]} {return -code error "$name search: path is not a directory"}
-    if {![file readable    $path]} {return -code error "$name search: path cannot be read"}
-
-    upvar ::doctools::doctools${name}::paths paths
-    set paths [linsert $paths 0 $path]
-    return
-}
-
-# ::doctools::_warnings --
-#
-#	Return the warning accumulated during the last invocation of 'format'.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#
-# Results:
-#	A list of warnings.
-
-proc ::doctools::_warnings {name} {
-    upvar ::doctools::doctools${name}::msg msg
-    return $msg
-}
-
-# ::doctools::_parameters --
-#
-#	Returns a list containing the parameters provided
-#	by the selected formatting engine.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#
-# Results:
-#	A list of parameter names
-
-proc ::doctools::_parameters {name} {
-    upvar ::doctools::doctools${name}::param param
-    return $param
-}
-
-# ::doctools::_setparam --
-#
-#	Set a named engine parameter to a value.
-#
-# Arguments:
-#	name	Name of the doctools object to query
-#	param	Name of the parameter to set.
-#	value	Value to set the parameter to.
-#
-# Results:
-#	None.
-
-proc ::doctools::_setparam {name param value} {
-    upvar ::doctools::doctools${name}::format_ip format_ip
-
-    if {$format_ip == {}} {
-	return -code error \
-		"Unable to set parameters without a valid format"
-    }
-
-    $format_ip eval [list fmt_varset $param $value]
-    return
-}
-
-##########################
-# Support commands
-
-# ::doctools::LookupFormat --
-#
-#	Search a format definition file based upon its name
-#
-# Arguments:
-#	name	Name of the doctools object to use
-#	format	Name of the format to look for.
-#
-# Results:
-#	The file containing the format definition
-
-proc ::doctools::LookupFormat {name format} {
-    # Order of searching
-    # 1) Is the name of the format an existing file ?
-    #    If yes, take this file.
-    # 2) Look for the file in the directories given to the object itself..
-    # 3) Look for the file in the standard directories of this package.
-
-    if {[file exists $format]} {
-	return $format
-    }
-
-    upvar ::doctools::doctools${name}::paths opaths
-    foreach path $opaths {
-	set f [file join $path fmt.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    variable paths
-    foreach path $paths {
-	set f [file join $path fmt.$format]
-	if {[file exists $f]} {
-	    return $f
-	}
-    }
-
-    return -code error "Unknown format \"$format\""
-}
-
-# ::doctools::SetupFormatter --
-#
-#	Create and initializes an interpreter containing a
-#	formatting engine
-#
-# Arguments:
-#	name	Name of the doctools object to manipulate
-#	format	Name of file containing the code of the engine
-#
-# Results:
-#	None.
-
-proc ::doctools::SetupFormatter {name format} {
-
-    # Create and initialize the interpreter first.
-    # Use a transient variable. Interrogate the
-    # engine and check its response. Bail out in
-    # case of errors. Only if we pass the checks
-    # we tear down the old engine and make the new
-    # one official.
-
-    variable here
-    set mpip [interp create -safe] ; # interpreter for the formatting engine
-    $mpip eval [list set auto_path $::auto_path]
-    #set mpip [interp create] ; # interpreter for the formatting engine
-
-    $mpip invokehidden source [file join $here api.tcl]
-    #$mpip eval [list source [file join $here api.tcl]]
-    interp alias $mpip dt_source   {} ::doctools::Source  $mpip [file dirname $format]
-    interp alias $mpip dt_package  {} ::doctools::Package $mpip
-    interp alias $mpip file        {} ::doctools::FileOp  $mpip
-    interp alias $mpip puts_stderr {} ::puts stderr
-    $mpip invokehidden source $format
-    #$mpip eval [list source $format]
-
-    # Check the engine for useability in doctools.
-
-    foreach api {
-	fmt_numpasses
-	fmt_initialize
-	fmt_setup
-	fmt_postprocess
-	fmt_shutdown
-	fmt_listvariables
-	fmt_varset
-    } {
-	if {[$mpip eval [list info commands $api]] == {}} {
-	    interp delete $mpip
-	    error "$format error: API incomplete, cannot use this engine"
-	}
-    }
-    if {[catch {
-	set passes [$mpip eval fmt_numpasses]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for number of passes"
-    }
-    if {![string is integer $passes] || ($passes < 1)} {
-	interp delete $mpip
-	error "$format error: illegal number of passes \"$passes\""
-    }
-    if {[catch {
-	set parameters [$mpip eval fmt_listvariables]
-    }]} {
-	interp delete $mpip
-	error "$format error: Unable to query for list of parameters"
-    }
-
-    # Passed the tests. Tear down existing engine,
-    # and checker. The latter is destroyed because
-    # of its aliases into the formatter, which are
-    # now invalid. It will be recreated during the
-    # next call of 'format'.
-
-    upvar ::doctools::doctools${name}::formatfile formatfile
-    upvar ::doctools::doctools${name}::format_ip  format_ip
-    upvar ::doctools::doctools${name}::chk_ip     chk_ip
-    upvar ::doctools::doctools${name}::expander   expander
-    upvar ::doctools::doctools${name}::passes     xpasses
-    upvar ::doctools::doctools${name}::param      xparam
-
-    if {$chk_ip != {}}    {interp delete $chk_ip}
-    if {$format_ip != {}} {interp delete $format_ip}
-
-    set chk_ip    ""
-    set format_ip ""
-
-    # Now link engine API into it.
-
-    interp alias $mpip dt_file      {} ::doctools::GetFile      $name
-    interp alias $mpip dt_fileid    {} ::doctools::GetFileId    $name
-    interp alias $mpip dt_module    {} ::doctools::GetModule    $name
-    interp alias $mpip dt_copyright {} ::doctools::GetCopyright $name
-    interp alias $mpip dt_format    {} ::doctools::GetFormat    $name
-    interp alias $mpip dt_user      {} ::doctools::GetUser      $name
-    interp alias $mpip dt_lnesting  {} ::doctools::ListLevel    $name
-    interp alias $mpip dt_fmap      {} ::doctools::MapFile      $name
-    interp alias $mpip file         {} ::doctools::FileCmd
-
-    foreach cmd {cappend cget cis cname cpop cpush ctopandclear cset lb rb} {
-	interp alias $mpip ex_$cmd {} $expander $cmd
-    }
-
-    set format_ip  $mpip
-    set formatfile $format
-    set xpasses    $passes
-    set xparam     $parameters
-    return
-}
-
-# ::doctools::SetupChecker --
-#
-#	Create and initializes an interpreter for checking the usage of
-#	doctools formatting commands
-#
-# Arguments:
-#	name	Name of the doctools object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::SetupChecker {name} {
-    # Create an interpreter for checking the usage of doctools formatting commands
-    # and initialize it: Link it to the interpreter doing the formatting, the
-    # expander object and the configuration information. All of which
-    # is accessible through the token/handle (name of state/object array).
-
-    variable here
-
-    upvar ::doctools::doctools${name}::chk_ip    chk_ip
-    if {$chk_ip != ""} {return}
-
-    upvar ::doctools::doctools${name}::expander  expander
-    upvar ::doctools::doctools${name}::format_ip format_ip
-
-    set chk_ip [interp create] ; # interpreter hosting the formal format checker
-
-    # Make configuration available through command, then load the code base.
-
-    foreach {cmd ckcmd} {
-	dt_search     SearchPaths
-	dt_deprecated Deprecated
-	dt_error      FmtError
-	dt_warning    FmtWarning
-	dt_where      Where
-    } {
-	interp alias $chk_ip $cmd {} ::doctools::$ckcmd $name
-    }
-    $chk_ip eval [list source [file join $here checker.tcl]]
-
-    # Simple expander commands are directly routed back into it, no
-    # checking required.
-
-    foreach cmd {cappend cget cis cname cpop cpush ctopandclear cset lb rb} {
-	interp alias $chk_ip $cmd {} $expander $cmd
-    }
-
-    # Link the formatter commands into the checker. We use the prefix
-    # 'fmt_' to distinguish them from the checking commands.
-
-    foreach cmd {
-	manpage_begin moddesc titledesc copyright manpage_end require
-	description section para list_begin list_end lst_item call
-	bullet enum example example_begin example_end see_also
-	keywords nl arg cmd opt comment sectref syscmd method option
-	widget fun type package class var file uri usage term const
-	arg_def cmd_def opt_def tkoption_def emph strong plain_text
-	namespace subsection
-    } {
-	interp alias $chk_ip fmt_$cmd $format_ip fmt_$cmd
-    }
-    return
-}
-
-# ::doctools::SetupExpander --
-#
-#	Create and initializes the expander for input
-#
-# Arguments:
-#	name	Name of the doctools object to manipulate
-#
-# Results:
-#	None.
-
-proc ::doctools::SetupExpander {name} {
-    upvar ::doctools::doctools${name}::ex_ok    ex_ok
-    if {$ex_ok} {return}
-
-    upvar ::doctools::doctools${name}::expander expander
-    ::textutil::expander $expander
-    $expander evalcmd [list ::doctools::Eval $name]
-    $expander textcmd plain_text
-    set ex_ok 1
-    return
-}
-
-# ::doctools::SearchPaths --
-#
-#	API for checker. Returns list of search paths for format
-#	definitions. Used to look for message catalogs as well.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::SearchPaths {name} {
-    upvar ::doctools::doctools${name}::paths opaths
-    variable paths
-
-    set p $opaths
-    foreach s $paths {lappend p $s}
-    return $p
-}
-
-# ::doctools::Deprecated --
-#
-#	API for checker. Returns flag determining
-#	whether visual markup is warned against, or not.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::Deprecated {name} {
-    upvar ::doctools::doctools${name}::deprecated deprecated
-    return $deprecated
-}
-
-# ::doctools::FmtError --
-#
-#	API for checker. Called when an error occurred.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#	text	Error message
-#
-# Results:
-#	None.
-
-proc ::doctools::FmtError {name text} {
-    return -code error "(FmtError) $text"
-}
-
-# ::doctools::FmtWarning --
-#
-#	API for checker. Called when a warning was generated
-#
-# Arguments:
-#	name	Name of the doctools object
-#	text	Warning message
-#
-# Results:
-#	None.
-
-proc ::doctools::FmtWarning {name text} {
-    upvar ::doctools::doctools${name}::msg msg
-    lappend msg $text
-    return
-}
-
-# ::doctools::Where --
-#
-#	API for checker. Called when the current location is needed
-#
-# Arguments:
-#	name	Name of the doctools object
-#
-# Results:
-#	List containing offset, line, column
-
-proc ::doctools::Where {name} {
-    upvar ::doctools::doctools${name}::expander expander
-    return [$expander where]
-}
-
-# ::doctools::Eval --
-#
-#	API for expander. Routes the macro invocations
-#	into the checker interpreter
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	None.
-
-proc ::doctools::Eval {name macro} {
-    upvar ::doctools::doctools${name}::chk_ip chk_ip
-
-    #puts stderr "\t\t$name [lindex [split $macro] 0]"
-
-    # Handle the [include] command directly
-    if {[string match include* $macro]} {
-	foreach {cmd filename} $macro break
-	return [ExpandInclude $name $filename]
-    }
-
-    # Rewrite the [namespace] command before passing it on.
-    # "namespace" is a special command. The interpreter the validator
-    # resides in uses the package "msgcat", which in turn uses the
-    # builtin namespace. So the builtin cannot be simply
-    # overwritten. We use a different name.
-
-    if {[string match namespace* $macro]} {
-	set macro _$macro
-    }
-    return [$chk_ip eval $macro]
-}
-
-# ::doctools::ExpandInclude --
-#
-#	Handle inclusion of files.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#	path	Name of file to include and expand.
-#
-# Results:
-#	None.
-
-proc ::doctools::ExpandInclude {name path} {
-    upvar ::doctools::doctools${name}::file file
-
-    set ipath [file join [file dirname $file] $path]
-    if {![file exists $ipath]} {
-	set ipath $path
-	if {![file exists $ipath]} {
-	    return -code error "Unable to find include file \"$path\""
-	}
-    }
-
-    set    chan [open $ipath r]
-    set    text [read $chan]
-    close $chan
-
-    upvar ::doctools::doctools${name}::expander  expander
-
-    return [$expander expand $text]
-}
-
-# ::doctools::GetUser --
-#
-#	API for formatter. Returns name of current user
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	String, name of current user.
-
-proc ::doctools::GetUser {name} {
-    global  tcl_platform
-    return $tcl_platform(user)
-}
-
-# ::doctools::GetFile --
-#
-#	API for formatter. Returns file information
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	File information
-
-proc ::doctools::GetFile {name} {
-
-    #puts stderr "GetFile $name"
-
-    upvar ::doctools::doctools${name}::file file
-
-    #puts stderr "ok $file"
-    return $file
-}
-
-# ::doctools::GetFileId --
-#
-#	API for formatter. Returns file information (truncated to stem of filename)
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	File information
-
-proc ::doctools::GetFileId {name} {
-    return [file rootname [file tail [GetFile $name]]]
-}
-
-# ::doctools::FileCmd --
-#
-#	API for formatter. Restricted implementation of file.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	Module information
-
-proc ::doctools::FileCmd {cmd args} {
-    switch -exact -- $cmd {
-	split {return [eval file split $args]}
-	join  {return [eval file join $args]}
-    }
-    return -code error "Illegal subcommand: $cmd $args"
-}
-
-# ::doctools::GetModule --
-#
-#	API for formatter. Returns module information
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	Module information
-
-proc ::doctools::GetModule {name} {
-    upvar ::doctools::doctools${name}::module module
-    return   $module
-}
-
-# ::doctools::GetCopyright --
-#
-#	API for formatter. Returns copyright information
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	Copyright information
-
-proc ::doctools::GetCopyright {name} {
-    upvar ::doctools::doctools${name}::copyright copyright
-    return   $copyright
-}
-
-# ::doctools::GetFormat --
-#
-#	API for formatter. Returns format information
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	Format information
-
-proc ::doctools::GetFormat {name} {
-    upvar ::doctools::doctools${name}::format format
-    return $format
-}
-
-# ::doctools::ListLevel --
-#
-#	API for formatter. Returns number of open lists
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#
-# Results:
-#	Boolean flag.
-
-proc ::doctools::ListLevel {name} {
-    upvar ::doctools::doctools${name}::chk_ip chk_ip
-    return [$chk_ip eval LNest]
-}
-
-# ::doctools::MapFile --
-#
-#	API for formatter. Maps symbolic to actual filename in a doctools
-#	item. If no mapping is found it is assumed that the symbolic name
-#	is also the actual name.
-#
-# Arguments:
-#	name	Name of the doctools object to query.
-#	fname	Symbolic name of the file.
-#
-# Results:
-#	Actual name of the file.
-
-proc ::doctools::MapFile {name fname} {
-    upvar ::doctools::doctools${name}::map map
-
-    #parray map
-
-    if {[info exists map($fname)]} {
-	return $map($fname)
-    }
-    return $fname
-}
-
-# ::doctools::Source --
-#
-#	API for formatter. Used by engine to ask for
-#	additional script files support it.
-#
-# Arguments:
-#	name	Name of the doctools object to change.
-#
-# Results:
-#	Boolean flag.
-
-proc ::doctools::Source {ip path file} {
-    #puts stderr "$ip (source $path $file)"
-
-    $ip invokehidden source [file join $path [file tail $file]]
-    #$ip eval [list source [file join $path [file tail $file]]]
-    return
-}
-
-
-proc ::doctools::Locate {p} {
-    # @mdgen NODEP: doctools::__undefined__
-    catch {package require doctools::__undefined__}
-
-    #puts stderr "auto_path = [join $::auto_path \n]"
-
-    # Check if requested package is in the list of loadable packages.
-    # Then get the highest possible version, and then the index script
-
-    if {[lsearch -exact [package names] $p] < 0} {
-	return -code error "Unknown package $p"
-    }
-
-    set v  [lindex [lsort -increasing [package versions $p]] end]
-
-    #puts stderr "Package $p = $v"
-
-    return [package ifneeded $p $v]
-}
-
-proc ::doctools::FileOp {ip args} {
-    #puts stderr "$ip (file $args)"
-    # -- FUTURE -- disallow unsafe operations --
-
-    return [eval [linsert $args 0 file]]
-}
-
-
-proc ::doctools::Package {ip pkg} {
-    #puts stderr "$ip package require $pkg"
-
-    set indexScript [Locate $pkg]
-
-    $ip expose source
-    $ip expose load
-    $ip eval		$indexScript
-    $ip hide   source
-    $ip hide   load
-    #$ip eval [list source [file join $path [file tail $file]]]
-    return
-}
-
-#------------------------------------
-# Module initialization
-
-namespace eval ::doctools {
-    # Reverse order of searching. First to search is specified last.
-
-    # FOO/doctools.tcl
-    # => FOO/mpformats
-
-    #catch {search [file join $here                lib doctools mpformats]}
-    #catch {search [file join [file dirname $here] lib doctools mpformats]}
-    catch {search [file join $here                             mpformats]}
-}
-
-package provide doctools 1.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_common.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_common.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,281 +1,0 @@
-# -*- tcl -*-
-#
-# _common.tcl
-#
-# (c) 2001 Andreas Kupries <andreas_kupries@sourceforge.net>
-# (c) 2002 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# The code here contains general definitions for API functions and
-# state information. They are used by several formatters to simplify
-# their own code.
-
-global    state
-array set state {}
-
-proc fmt_initialize {} {
-    global    state
-    unset     state
-
-    set state(pass)   unknown ; # Not relevant before a pass
-    set state(begun)  unknown ; # is active
-    set state(mdesc)  {}      ; # Text, module desciption
-    #set state(tdesc) {}      ; # Text, title of manpage
-    set state(copyright) {}   ; # Text, copyright assignment (list)
-    return
-}
-
-proc fmt_shutdown      {}             {return}
-proc fmt_numpasses     {}             {return 2}
-proc fmt_postprocess   {text}         {return $text}
-proc fmt_plain_text    {text}         {return $text}
-proc fmt_listvariables {}             {return {}}
-proc fmt_varset        {varname text} {return}
-
-proc fmt_setup {n} {
-    # Called to setup a pass through the input.
-
-    global state
-    set    state(pass)  $n  ; # We are in pass 'n' through the text.
-    set    state(begun) 0   ; # No manpage_begin yet
-
-    if {$n == 1} {c_xref_init}
-
-    SetPassProcs $n
-    return
-}
-
-################################################################
-# Functions made available to the formatter to access the common
-# state managed here.
-
-proc c_inpass {} {global state ; return $state(pass)}
-
-proc c_begin {} {global state ; set     state(begun) 1 ; return}
-proc c_begun {} {global state ; return $state(begun)}
-
-proc c_get_module {}     {global state ; return $state(mdesc)}
-proc c_set_module {text} {global state ; set     state(mdesc) $text ; return}
-
-proc c_set_title {text} {global state ; set state(tdesc) $text ; return}
-proc c_get_title {} {
-    global state
-    if {![info exists state(tdesc)]} {
-	return $state(mdesc)
-    }
-    return $state(tdesc)
-}
-
-proc c_copyrightsymbol {} {return "(c)"}
-proc c_set_copyright {text} {global state ; lappend state(copyright) $text ; return}
-proc c_get_copyright {}     {
-    global state
-
-    set cc $state(copyright)
-    if {$cc == {}} {set cc [dt_copyright]}
-    if {$cc == {}} {return {}}
-
-    return "Copyright [c_copyrightsymbol] [join $cc "\nCopyright [c_copyrightsymbol] "]"
-}
-
-proc c_provenance {} {
-    return "Generated from file '[dt_file]' by tcllib/doctools with format '[dt_format]'"
-}
-
-################################################################
-# Manage pass-dependent procedure definitions.
-
-global PassProcs
-
-# pass $passNo procName procArgs { body  } --
-#	Specifies procedure definition for pass $n.
-#
-proc c_pass {pass proc arguments body} {
-    global  PassProcs
-    lappend PassProcs($pass) $proc $arguments $body
-}
-proc SetPassProcs {pass} {
-    global PassProcs
-    foreach {proc args body} $PassProcs($pass) {
-	proc $proc $args $body
-    }
-}
-
-
-################################################################
-# Manage a set of buffers to hold information between passes.
-# Each buffer holds a list of lines.
-
-global Buffers
-
-# holdBuffers buffer ? buffer ...? --
-#	Declare a list of hold buffers,
-#	to collect data in one pass and output it later.
-#
-proc c_holdBuffers {args} {
-    global Buffers
-    foreach arg $args {
-	set Buffers($arg) [list]
-    }
-}
-
-proc c_holdRemove {args} {
-    global Buffers
-    foreach arg $args {
-	catch {unset Buffers($arg)}
-    }
-    return
-}
-
-# hold buffer text --
-#	Append text to named buffer
-#
-proc c_hold {buffer entry} {
-    global  Buffers
-    lappend Buffers($buffer) $entry
-
-    #puts "$buffer -- $entry"
-    return
-}
-
-proc c_holding {buffer} {
-    global  Buffers
-    set l 0
-    catch {set l [llength $Buffers($buffer)]}
-    return $l
-}
-
-# held buffer --
-#	Returns current contents of named buffer and empty the buffer.
-#
-proc c_held {buffer} {
-    global Buffers
-    set content [join $Buffers($buffer) "\n"]
-    set Buffers($buffer) [list]
-    return $content
-}
-
-######################################################################
-# Nested counter
-
-global counters cnt
-set    counters [list]
-set    cnt 0
-
-proc c_cnext {} {global cnt ; incr cnt}
-proc c_cinit {} {
-    global counters cnt
-    set counters [linsert $counters 0 $cnt]
-    set cnt      0
-    return
-}
-proc c_creset {} {
-    global counters cnt
-    set cnt      [lindex $counters 0]
-    set counters [lrange $counters 1 end]
-    return
-}
-
-
-######################################################################
-# Utilities.
-#
-
-proc NOP {args} { }		;# do nothing
-proc NYI {{message {}}} {
-    return -code error [append message " Not Yet Implemented"]
-}
-
-######################################################################
-# Cross-reference tracking (for a single file).
-#
-global SectionNames	;# array mapping 'section name' to 'reference id'
-global SectionList      ;# List of sections, their ids, and levels, in
-set    SectionList {}   ;# order of definition.
-
-# sectionId --
-#	Format section name as an XML ID.
-#
-proc c_sectionId {name} {
-    # Identical to '__sid' in checker.tcl
-    regsub -all {[ 	]+} [string tolower [string trim $name]] _ id
-    regsub -all {"} $id _ id
-    return $id
-}
-
-# possibleReference text gi --
-#	Check if $text is a potential cross-reference;
-#	if so, format as a reference;
-#	otherwise format as a $gi element.
-#
-proc c_possibleReference {text gi {label {}}} {
-    global SectionNames
-    if {![string length $label]} {set label $text}
-    set id [c_sectionId $text]
-    if {[info exists SectionNames($id)]} {
-    	return "[startTag ref refid $id]$label[endTag ref]"
-    } else {
-    	return [wrap $label $gi]
-    }
-}
-
-proc c_newSection {name level location} {
-    global SectionList SectionNames
-    set id          [c_sectionId $name]
-
-    set SectionNames($id) .
-    set SectionList [linsert $SectionList $location $name $id $level]
-    return
-}
-
-proc c_clrSections {} {
-    global SectionList SectionNames
-    set    SectionList {}
-    catch {unset SectionNames}
-}
-
-######################################################################
-# Conversion specification.
-#
-# Two-pass processing.  The first pass collects text for the
-# SYNOPSIS, SEE ALSO, and KEYWORDS sections, and the second pass
-# produces output.
-#
-
-c_holdBuffers synopsis see_also keywords precomments
-
-################################################################
-# Management of see-also and keyword cross-references
-
-proc c_xref_init {} {
-    global seealso  seealso__  ; set seealso  [list] ; catch {unset seealso__}  ; array set seealso__  {}
-    global keywords keywords__ ; set keywords [list] ; catch {unset keywords__} ; array set keywords__ {}
-}
-
-proc c_xref_seealso  {} {global seealso  ; return $seealso}
-proc c_xref_keywords {} {global keywords ; return $keywords}
-
-c_pass 1 fmt_see_also {args} {
-    global seealso seealso__
-    foreach ref $args {
-	if {[info exists seealso__($ref)]} continue
-	lappend seealso $ref
-	set     seealso__($ref) .
-    }
-    return
-}
-
-c_pass 1 fmt_keywords {args} {
-    global keywords keywords__
-    foreach ref $args {
-	if {[info exists keywords__($ref)]} continue
-	lappend keywords $ref
-	set     keywords__($ref) .
-    }
-    return
-}
-
-c_pass 2 fmt_see_also {args} NOP
-c_pass 2 fmt_keywords {args} NOP
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_html.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_html.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,133 +1,0 @@
-# -*- tcl -*-
-# Helper rules for the creation of the memchan website from the .exp files.
-# General formatting instructions ...
-
-# htmlEscape text --
-#	Replaces HTML markup characters in $text with the
-#	appropriate entity references.
-#
-
-global textMap;
-set    textMap {
-    &    &amp;    <    &lt;     >    &gt;       
-    \xa0 &nbsp;   \xb0 &deg;    \xc0 &Agrave; \xd0 &ETH;    \xe0 &agrave; \xf0 &eth;
-    \xa1 &iexcl;  \xb1 &plusmn; \xc1 &Aacute; \xd1 &Ntilde; \xe1 &aacute; \xf1 &ntilde;
-    \xa2 &cent;	  \xb2 &sup2;   \xc2 &Acirc;  \xd2 &Ograve; \xe2 &acirc;  \xf2 &ograve;
-    \xa3 &pound;  \xb3 &sup3;   \xc3 &Atilde; \xd3 &Oacute; \xe3 &atilde; \xf3 &oacute;
-    \xa4 &curren; \xb4 &acute;  \xc4 &Auml;   \xd4 &Ocirc;  \xe4 &auml;   \xf4 &ocirc;
-    \xa5 &yen;	  \xb5 &micro;  \xc5 &Aring;  \xd5 &Otilde; \xe5 &aring;  \xf5 &otilde;
-    \xa6 &brvbar; \xb6 &para;   \xc6 &AElig;  \xd6 &Ouml;   \xe6 &aelig;  \xf6 &ouml;
-    \xa7 &sect;	  \xb7 &middot; \xc7 &Ccedil; \xd7 &times;  \xe7 &ccedil; \xf7 &divide;
-    \xa8 &uml;	  \xb8 &cedil;  \xc8 &Egrave; \xd8 &Oslash; \xe8 &egrave; \xf8 &oslash;
-    \xa9 &copy;	  \xb9 &sup1;   \xc9 &Eacute; \xd9 &Ugrave; \xe9 &eacute; \xf9 &ugrave;
-    \xaa &ordf;	  \xba &ordm;   \xca &Ecirc;  \xda &Uacute; \xea &ecirc;  \xfa &uacute;
-    \xab &laquo;  \xbb &raquo;  \xcb &Euml;   \xdb &Ucirc;  \xeb &euml;   \xfb &ucirc;
-    \xac &not;	  \xbc &frac14; \xcc &Igrave; \xdc &Uuml;   \xec &igrave; \xfc &uuml;
-    \xad &shy;	  \xbd &frac12; \xcd &Iacute; \xdd &Yacute; \xed &iacute; \xfd &yacute;
-    \xae &reg;	  \xbe &frac34; \xce &Icirc;  \xde &THORN;  \xee &icirc;  \xfe &thorn;
-    \xaf &hibar;  \xbf &iquest; \xcf &Iuml;   \xdf &szlig;  \xef &iuml;   \xff &yuml;
-    {"} &quot;
-} ; # " make the emacs highlighting code happy.
-
-# Handling of HTML delimiters in content:
-#
-# Plain text is initially passed through unescaped;
-# internally-generated markup is protected by preceding it with \1.
-# The final PostProcess step strips the escape character from
-# real markup and replaces markup characters from content
-# with entity references.
-#
-
-global   markupMap
-set      markupMap { {&} {\1&}  {<} {\1<}  {>} {\1>} {"} {\1"} } 
-global   finalMap
-set      finalMap $textMap
-lappend  finalMap {\1&} {&}  {\1<} {<}  {\1>} {>} {\1"} {"}
-
-
-proc htmlEscape {text} {
-    global textMap
-    return [string map $textMap $text]
-}
-
-proc fmt_postprocess {text}	{
-    global finalMap
-    return [string map $finalMap $text]
-}
-
-# markup text --
-#	Protect markup characters in $text with \1.
-#	These will be stripped out in PostProcess.
-#
-proc markup {text} {
-    global markupMap
-    return [string map $markupMap $text]
-}
-
-proc use_bg {} {
-    set c [bgcolor]
-    #puts stderr "using $c"
-    if {$c == {}} {return ""}
-    return bgcolor=$c
-}
-
-
-proc nbsp   {}         {return [markup "&nbsp;"]}
-proc p      {}         {return [markup <p>]}
-proc ptop   {}         {return [markup "<p valign=top>"]}
-proc td     {}         {return [markup "<td [use_bg]>"]}
-proc trtop  {}         {return [markup "<tr valign=top [use_bg]>"]}
-proc tr     {}         {return [markup "<tr            [use_bg]>"]}
-proc sect   {s}        {return [markup "<b>$s</b><br><hr>"]}
-proc link   {text url} {return [markup "<a href=\"$url\">$text</a>"]}
-proc table  {}         {return [markup "<table [border] width=100% cellspacing=0 cellpadding=0>"]}
-proc btable {}         {return [markup "<table border=1 width=100% cellspacing=0 cellpadding=0>"]}
-proc stable {}         {return [markup "<table [border] cellspacing=0 cellpadding=0>"]}
-
-
-proc tcl_cmd {cmd} {return "[markup <b>]\[$cmd][markup </b>]"}
-proc wget    {url} {exec /usr/bin/wget -q -O - $url 2>/dev/null}
-
-proc url {tag text url} {
-    set body {
-	switch -exact -- $what {
-	    link {return {\1<a href="%url%"\1>%text%\1</a\1>}} ; ## TODO - markup
-	    text {return {%text%}}
-	    url  {return {%url%}}
-	}
-    }
-    proc $tag {{what link}} [string map [list %text% $text %url% $url] $body]
-}
-
-proc img {tag alt img} {
-    proc $tag {} [list return "\1<img alt=\"$alt\" src=\"$img\"\1>"]
-}
-
-proc protect {text} {return [string map [list & "&amp;" < "&lt;" > "&gt;"] $text]}
-
-
-proc tag  {t} {return [markup <$t>]}
-proc taga {t av} {
-    # av = attribute value ...
-    set avt [list]
-    foreach {a v} $av {lappend avt "$a=\"$v\""}
-    return [markup "<$t [join $avt]>"]
-}
-proc tag/ {t} {return [markup </$t>]}
-proc tag_ {t block args} {
-    # args = key value ...
-    if {$args == {}} {return "[tag $t]$block[tag/ $t]"}
-    return "[taga $t $args]$block[tag/ $t]"
-}
-
-
-proc ht_comment {text}   {return "[markup <]! -- [join [split $text \n] "   -- "]\n   --[markup >]"}
-
-# wrap content gi --
-#	Returns $content wrapped inside <$gi> ... </$gi> tags.
-#
-proc wrap {content gi} {
-    return "[tag $gi]${content}[tag/ $gi]"
-}
-proc startTag {x args} {if {[llength $args]} {taga $x $args} else {tag $x}}
-proc endTag   {x} {tag/ $x}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_idx_common.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_idx_common.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# -*- tcl -*-
-#
-# _idx_common.tcl
-#
-# (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# The code here contains general definitions for API functions and
-# state information. They are used by several formatters to simplify
-# their own code.
-
-proc idx_initialize    {}             {return}
-proc idx_shutdown      {}             {return}
-proc idx_numpasses     {}             {return 1}
-proc idx_postprocess   {text}         {return $text}
-proc idx_setup         {n}            {return}
-proc idx_listvariables {}             {return {}}
-proc idx_varset        {varname text} {return}
-
-
-proc fmt_plain_text  {text} {return $text}
-
-################################################################
-# Functions made available to the formatter to access the common
-# state managed here.
-
-proc c_provenance {} {
-    return "Generated by tcllib/doctools/idx with format '[dt_format]'"
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_nroff.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_nroff.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,152 +1,0 @@
-# -*- tcl -*-
-#
-# -- nroff commands
-#
-# Copyright (c) 2003-2005 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-
-################################################################
-# nroff specific commands
-#
-# All dot-commands (f.e. .PP) are returned with a leading \n,
-# enforcing that they are on a new line. Any empty line created
-# because of this is filtered out in the post-processing step.
-
-
-proc nr_lp      {}          {return \n.LP}
-proc nr_ta      {{text {}}} {return ".ta$text"}
-proc nr_bld     {}          {return \1\\fB}
-proc nr_ul      {}          {return \1\\fI}
-proc nr_rst     {}          {return \1\\fR}
-proc nr_p       {}          {return \n.PP\n}
-proc nr_comment {text}      {return "\1'\1\\\" [join [split $text \n] "\n\1'\1\\\" "]"} ; # "
-proc nr_enum    {num}       {nr_item " \[$num\]"}
-proc nr_item    {{text {}}} {return "\n.IP$text"}
-proc nr_vspace  {}          {return \n.sp}
-proc nr_blt     {text}      {return "\n.TP\n$text"}
-proc nr_bltn    {n text}    {return "\n.TP $n\n$text"}
-proc nr_in      {}          {return \n.RS}
-proc nr_out     {}          {return \n.RE}
-proc nr_nofill  {}          {return \n.nf}
-proc nr_fill    {}          {return \n.fi}
-proc nr_title   {text}      {return "\n.TH $text"}
-proc nr_include {file}      {return "\n.so $file"}
-proc nr_bolds   {}          {return \n.BS}
-proc nr_bolde   {}          {return \n.BE}
-
-proc nr_section {name} {
-    if {![regexp {[ 	]} $name]} {
-	return "\n.SH $name"
-    }
-    return "\n.SH \"$name\""
-}
-proc nr_subsection {name}   {
-    if {![regexp {[ 	]} $name]} {
-	return "\n.SS $name"
-    }
-    return "\n.SS \"$name\""
-}
-
-
-################################################################
-
-# Handling of nroff special characters in content:
-#
-# Plain text is initially passed through unescaped;
-# internally-generated markup is protected by preceding it with \1.
-# The final PostProcess step strips the escape character from
-# real markup and replaces unadorned special characters in content
-# with proper escapes.
-#
-
-global   markupMap
-set      markupMap [list "\\" "\1\\"]
-global   finalMap
-set      finalMap [list \
-	"\1\\" "\\" \
-        "\1'" "'" \
-	"\\"   "\\\\"]
-global   textMap
-set      textMap [list "\\" "\\\\"]
-
-
-proc nroffEscape {text} {
-    global textMap
-    return [string map $textMap $text]
-}
-
-# markup text --
-#	Protect markup characters in $text.
-#	These will be stripped out in PostProcess.
-#
-proc nroffMarkup {text} {
-    global markupMap
-    return [string map $markupMap $text]
-}
-
-proc nroff_postprocess {nroff} {
-    global finalMap
-
-    # Postprocessing final nroff text.
-    # - Strip empty lines out of the text
-    # - Remove leading and trailing whitespace from lines.
-    # - Exceptions to the above: Keep empty lines and leading
-    #   whitespace when in verbatim sections (no-fill-mode)
-
-    set nfMode   [list .nf .CS]	; # commands which start no-fill mode
-    set fiMode   [list .fi .CE]	; # commands which terminate no-fill mode
-    set lines    [list]         ; # Result buffer
-    set verbatim 0              ; # Automaton mode/state
-
-    foreach line [split $nroff "\n"] {
-	if {!$verbatim} {
-	    # Normal lines, not in no-fill mode.
-
-	    if {[lsearch -exact $nfMode [split $line]] >= 0} {
-		# no-fill mode starts after this line.
-		set verbatim 1
-	    }
-
-	    # Ensure that empty lines are not added.
-	    # This also removes leading and trailing whitespace.
-
-	    if {![string length $line]} {continue}
-	    set line [string trim $line]
-	    if {![string length $line]} {continue}
-
-	    if {[regexp {^\x1\\f[BI]\.} $line]} {
-		# We found confusing formatting at the beginning of
-		# the current line. We lift this line up and attach it
-		# at the end of the last line to remove this
-		# irregularity. Note that the regexp has to look for
-		# the special 0x01 character as well to be sure that
-		# the sequence in question truly is formatting.
-
-		set last  [lindex   $lines end]
-		set lines [lreplace $lines end end]
-		set line "$last $line"
-	    } elseif {[string match '* $line]} {
-		# Apostrophes at the beginning of a line have to
-		# quoted to prevent misinterpretation as comments.
-		# The apostrophes for true comments are quoted with \1
-		# already and will therefore not detected by the code
-		# here.
-
-		set line \1\\$line
-	    }
-	} else {
-	    # No-fill mode. We remove trailing whitespace, but keep
-	    # leading whitespace and empty lines.
-
-	    if {[lsearch -exact $fiMode [split $line]] >= 0} {
-		# Normal mode resumes after this line.
-		set verbatim 0
-	    }
-	    set line [string trimright $line]
-	}
-	lappend lines $line
-    }
-    # Return the modified result buffer
-    return [string map $finalMap [join $lines "\n"]]
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_text.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_text.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,430 +1,0 @@
-# -*- tcl -*-
-#
-# _text.tcl -- Core support for text engines.
-
-
-################################################################
-
-if {0} {
-    catch {rename proc proc__} msg ; puts_stderr >>$msg
-    proc__ proc {cmd argl body} {
-	puts_stderr "proc $cmd $argl ..."
-	uplevel [list proc__ $cmd $argl $body]
-    }
-}
-
-dt_package textutil::string ; # for adjust
-dt_package textutil::repeat
-dt_package textutil::adjust
-
-if {0} {
-    puts_stderr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    rename proc {}
-    rename proc__ proc
-    puts_stderr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-}
-
-
-################################################################
-# Formatting constants ... Might be engine variables in the future.
-
-global lmarginIncrement ; set lmarginIncrement 4
-global rmarginThreshold ; set rmarginThreshold 20
-global bulleting        ; set bulleting        {* - # @ ~ %}
-global enumeration      ; set enumeration      {[%] (%) <%>}
-
-proc Bullet {ivar} {
-    global bulleting ; upvar $ivar i
-    set res [lindex $bulleting $i]
-    set i [expr {($i + 1) % [llength $bulleting]}]
-    return $res
-}
-
-proc EnumBullet {ivar} {
-    global enumeration ; upvar $ivar i
-    set res [lindex $enumeration $i]
-    set i [expr {($i + 1) % [llength $enumeration]}]
-    return $res
-}
-
-################################################################
-
-#
-# The engine maintains several data structures per document and pass.
-# Most important is an internal representation of the text better
-# suited to perform the final layouting, the display list. Elements of
-# the display list are lists containing 2 elements, an operation, and
-# its arguments, in this order. The arguments are a list again, its
-# contents are specific to the operation.
-#
-# The operations are:
-#
-# - SECT	Section.    Title.
-# - SUBSECT     Subsection. Title.
-# - PARA	Paragraph.  Environment reference and text.
-#
-# The PARA operation is the workhorse of the engine, dooing all the
-# formatting, using the information in an "environment" as the guide
-# for doing so. The environments themselves are generated during the
-# second pass through the contents. They contain the information about
-# nesting (i.e. indentation), bulleting and the like.
-#
-
-global cmds ; set cmds [list]   ; # Display list
-global pEnv ; array set pEnv {} ; # Defined paragraph environments (bulleting, indentation, other).
-global para ; set para ""       ; # Text buffer for paragraphs.
-
-global nextId     ; set       nextId     0      ; # Counter for environment generation.
-global currentId  ; set       currentId  {}     ; # Id of current environment in 'pEnv'
-global currentEnv ; array set currentEnv {}     ; # Current environment, expanded form.
-global contexts   ; set       contexts   [list] ; # Stack of saved environments.
-global off        ; set off   1                 ; # Supression of plain text in some places.
-
-################################################################
-# Management of the current context.
-
-proc Text  {text}    {global para ; append para $text ; return}
-proc Store {op args} {global cmds ; lappend cmds [list $op $args] ; return}
-proc Off   {}        {global off ; set off 1 ; return}
-proc On    {}        {global off para ; set off 0 ; set para "" ; return}
-proc IsOff {}        {global off ; return [expr {$off == 1}]}
-
-# Debugging ...
-#proc Text  {text}    {puts_stderr "TXT \{$text\}"; global para; append para $text ; return}
-#proc Store {op args} {puts_stderr "STO $op $args"; global cmds; lappend cmds [list $op $args]; return}
-#proc Off   {}        {puts_stderr OFF ; global off ; set off 1 ; return}
-#proc On    {}        {puts_stderr ON_ ; global off para ; set off 0 ; set para "" ; return}
-
-
-proc NewEnv {name script} {
-    global currentId  nextId currentEnv
-
-    #puts_stderr "NewEnv ($name)"
-
-    set    parentId  $currentId
-    set    currentId $nextId
-    incr              nextId
-
-    append currentEnv(NAME) -$parentId-$name
-    set currentEnv(parent) $parentId
-    set currentEnv(id)     $currentId
-
-    # Always squash a verbatim environment inherited from the previous
-    # environment ...
-    catch {unset currentEnv(verbenv)}
-
-    uplevel $script
-    SaveEnv
-    return $currentId
-}
-
-################################################################
-
-proc TextInitialize {} {
-    global off  ; set off 1
-    global cmds ; set cmds [list]   ; # Display list
-    global pEnv ; array set pEnv {} ; # Defined paragraph environments (bulleting, indentation, other).
-    global para ; set para ""       ; # Text buffer for paragraphs.
-
-    global nextId     ; set       nextId     0      ; # Counter for environment generation.
-    global currentId  ; set       currentId  {}     ; # Id of current environment in 'pEnv'
-    global currentEnv ; array set currentEnv {}     ; # Current environment, expanded form.
-    global contexts   ; set       contexts   [list] ; # Stack of saved environments.
-
-    # lmargin  = location of left margin for text.
-    # prefix   = prefix string to use for all lines.
-    # wspfx    = whitespace prefix for all but the first line
-    # listtype = type of list, if any
-    # bullet   = bullet to use for unordered, bullet template for ordered.
-    # verbatim = flag if verbatim formatting requested.
-    # next     = if present the environment to use after closing the paragraph using this one.
-
-    NewEnv Base {
-	array set currentEnv {
-	    lmargin     0
-	    prefix      {}
-	    wspfx       {}
-	    listtype    {}
-	    bullet      {}
-	    verbatim    0
-	    bulleting   0
-	    enumeration 0
-	}
-    }
-    return
-}
-
-################################################################
-
-proc Section    {name} {Store SECT    $name ; return}
-proc Subsection {name} {Store SUBSECT $name ; return}
-
-proc CloseParagraph {{id {}}} {
-    global para currentId
-    if {$para != {}} {
-	if {$id == {}} {set id $currentId}
-	Store PARA $id $para
-	#puts_stderr "CloseParagraph $id"
-    }
-    set para ""
-    return
-} 
-
-proc SaveContext {} {
-    global  contexts  currentId
-    lappend contexts $currentId
-
-    #global currentEnv ; puts_stderr "Save>> $currentId ($currentEnv(NAME))"
-    return
-}
-
-proc RestoreContext {} {
-    global                contexts
-    SetContext   [lindex $contexts end]
-    set contexts [lrange $contexts 0 end-1]
-
-    #global currentId currentEnv ; puts_stderr "<<Restored $currentId ($currentEnv(NAME))"
-    return
-}
-
-proc SetContext {id} {
-    global    currentId currentEnv pEnv
-    set       currentId $id
-
-    # Ensure that array is clean before setting hte new block of
-    # information.
-    unset     currentEnv
-    array set currentEnv $pEnv($currentId)
-
-    #puts_stderr "--Set $currentId ($currentEnv(NAME))"
-    return
-}
-
-proc SaveEnv {} {
-    global pEnv  currentId             currentEnv
-    set    pEnv($currentId) [array get currentEnv]
-    return
-}
-
-################################################################
-
-proc NewVerbatim {} {
-    global currentEnv
-    return [NewEnv Verbatim {set currentEnv(verbatim) 1}]
-}
-
-proc Verbatim {} {
-    global currentEnv
-    if {![info exists currentEnv(verbenv)]} {
-	SaveContext
-	set verb [NewVerbatim]
-	RestoreContext
-
-	# Remember verbatim mode in the base environment
-	set currentEnv(verbenv) $verb
-	SaveEnv
-    }
-    return $currentEnv(verbenv)
-}
-
-################################################################
-
-proc text_plain_text {text} {
-    #puts_stderr "<<text_plain_text>>"
-
-    if  {[IsOff]} {return}
-
-    # Note: Whenever we get plain text it is possible that a macro for
-    # visual markup actually generated output before the expander got
-    # to the current text. This output was captured by the expander in
-    # its current context. Given the current organization of the
-    # engine we have to retrieve this formatted text from the expander
-    # or it will be lost. This is the purpose of the 'ctopandclear',
-    # which retrieves the data and also clears the capture buffer. The
-    # latter to prevent us from retrieving it again later, after the
-    # next macro added more data.
-
-    set text [ex_ctopandclear]$text
-
-    # ... TODO ... Handling of example => verbatim
-
-    if {[string length [string trim $text]] == 0} return
-
-    Text $text
-    return
-}
-
-################################################################
-
-proc text_postprocess {text} {
-
-    #puts_stderr XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-    #puts_stderr <<$text>>
-    #puts_stderr XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
-    global cmds
-    # The argument is not relevant. Access the display list, perform
-    # the final layouting and return its result.
-
-    set linebuffer [list]
-    array set state {lmargin 0 rmargin 0}
-    foreach cmd $cmds {
-	foreach {op arguments} $cmd break
-	$op $arguments
-    }
-
-    #puts_stderr XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
-    return [join $linebuffer \n]
-}
-
-
-proc SECT {text} {
-    upvar linebuffer linebuffer
-
-    # text is actually the list of arguments, having one element, the text.
-    set text [lindex $text 0]
-    #puts_stderr "SECT $text"
-    #puts_stderr ""
-
-    # Write section title, underline it
-
-    lappend linebuffer ""
-    lappend linebuffer $text
-    lappend linebuffer [textutil::repeat::strRepeat = [string length $text]]
-    return
-}
-
-proc SUBSECT {text} {
-    upvar linebuffer linebuffer
-
-    # text is actually the list of arguments, having one element, the text.
-    set text [lindex $text 0]
-    #puts_stderr "SUBSECT $text"
-    #puts_stderr ""
-
-    # Write subsection title, underline it (with less emphasis)
-
-    lappend linebuffer ""
-    lappend linebuffer $text
-    lappend linebuffer [textutil::repeat::strRepeat - [string length $text]]
-    return
-}
-
-proc PARA {arguments} {
-    global pEnv
-    upvar linebuffer linebuffer
-
-    foreach {env text} $arguments break
-    array set para $pEnv($env)
-
-    #puts_stderr "PARA $env"
-    #parray_stderr para
-    #puts_stderr "     \{$text\}"
-    #puts_stderr ""
-
-    # Use the information in the referenced environment to format the paragraph.
-
-    if {$para(verbatim)} {
-	set text [textutil::adjust::undent $text]
-    } else {
-	# The size is determined through the set left and right margins
-	# right margin is fixed at 80, left margin is variable. Size
-	# is at least 20. I.e. when left margin > 60 right margin is
-	# shifted out to the right.
-
-	set size [expr {80 - $para(lmargin)}]
-	if {$size < 20} {set size 20}
-
-	set text [textutil::adjust::adjust $text -length $size]
-    }
-
-    # Now apply prefixes, (ws prefixes bulleting), at last indentation.
-
-    if {[string length $para(prefix)] > 0} {
-	set text [textutil::adjust::indent $text $para(prefix)]
-    }
-
-    if {$para(listtype) != {}} {
-	switch -exact $para(listtype) {
-	    bullet {
-		# Indent for bullet, but not the first line. This is
-		# prefixed by the bullet itself.
-
-		set thebullet $para(bullet)
-	    }
-	    enum {
-		# Handling the enumeration counter. Special case: An
-		# example as first paragraph in an item has to use the
-		# counter in environment it is derived from to prevent
-		# miscounting.
-
-		if {[info exists para(example)]} {
-		    set parent $para(parent)
-		    array set __ $pEnv($parent)
-		    if {![info exists __(counter)]} {
-			set __(counter) 1
-		    } else {
-			incr __(counter)
-		    }
-		    set pEnv($parent) [array get __] ; # Save context change ...
-		    set n $__(counter)
-		} else {
-		    if {![info exists para(counter)]} {
-			set para(counter) 1
-		    } else {
-			incr para(counter)
-		    }
-		    set pEnv($env) [array get para] ; # Save context change ...
-		    set n $para(counter)
-		}
-
-		set thebullet [string map [list % $n] $para(bullet)]
-	    }
-	}
-
-	set blen [string length $thebullet]
-	if {$blen >= [string length $para(wspfx)]} {
-	    set text    "$thebullet\n[textutil::adjust::indent $text $para(wspfx)]"
-	} else {
-	    set fprefix $thebullet[string range $para(wspfx) $blen end]
-	    set text    "${fprefix}[textutil::adjust::indent $text $para(wspfx) 1]"
-	}
-    }
-
-    if {$para(lmargin) > 0} {
-	set text [textutil::adjust::indent $text \
-		      [textutil::repeat::strRepeat " " $para(lmargin)]]
-    }
-
-    lappend linebuffer ""
-    lappend linebuffer $text
-    return
-}
-
-################################################################
-
-proc strong      {text} {return *${text}*}
-proc em          {text} {return _${text}_}
-
-################################################################
-
-proc parray_stderr {a {pattern *}} {
-    upvar 1 $a array
-    if {![array exists array]} {
-        error "\"$a\" isn't an array"
-    }
-    set maxl 0
-    foreach name [lsort [array names array $pattern]] {
-        if {[string length $name] > $maxl} {
-            set maxl [string length $name]
-        }
-    }
-    set maxl [expr {$maxl + [string length $a] + 2}]
-    foreach name [lsort [array names array $pattern]] {
-        set nameString [format %s(%s) $a $name]
-        puts_stderr "    [format "%-*s = {%s}" $maxl $nameString $array($name)]"
-    }
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_toc_common.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_toc_common.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# -*- tcl -*-
-#
-# _toc_common.tcl
-#
-# (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-
-################################################################
-# The code here contains general definitions for API functions and
-# state information. They are used by several formatters to simplify
-# their own code.
-
-proc toc_initialize    {}             {return}
-proc toc_shutdown      {}             {return}
-proc toc_numpasses     {}             {return 1}
-proc toc_postprocess   {text}         {return $text}
-proc toc_setup         {n}            {return}
-proc toc_listvariables {}             {return {}}
-proc toc_varset        {varname text} {return}
-
-
-proc fmt_plain_text  {text} {return $text}
-
-################################################################
-# Functions made available to the formatter to access the common
-# state managed here.
-
-proc c_provenance {} {
-    return "Generated by tcllib/doctools/toc with format '[dt_format]'"
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_xml.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/_xml.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,236 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: _xml.tcl,v 1.9 2004/04/22 21:16:46 jenglish Exp $
-#
-# [expand] utilities for generating XML.
-#
-# Copyright (C) 2001 Joe English <jenglish@sourceforge.net>.
-# Freely redistributable.
-#
-######################################################################
-
-
-# Handling XML delimiters in content:
-#
-# Plain text is initially passed through unescaped;
-# internally-generated markup is protected by preceding it with \1.
-# The final PostProcess step strips the escape character from
-# real markup and replaces markup characters from content
-# with entity references.
-#
-
-variable attvalMap { {&} &amp;  {<} &lt;  {>} &gt; {"} &quot; {'} &apos; } ; # "
-variable markupMap { {&} {\1&}  {<} {\1<}  {>} {\1>} }
-variable finalMap  { {\1&} {&}  {\1<} {<}  {\1>} {>}
-		     {&} &amp;  {<} &lt;   {>} &gt; }
-
-proc fmt_postprocess {text}	{
-    variable finalMap
-    return [string map $finalMap $text]
-}
-
-# markup text --
-#	Protect markup characters in $text with \1.
-#	These will be stripped out in PostProcess.
-#
-proc markup {text} {
-    variable markupMap
-    return [string map $markupMap $text]
-}
-
-# attlist { n1 v1 n2 v2 ... } --
-#	Return XML-formatted attribute list.
-#	Does *not* escape markup -- the result must be passed through
-#	[markup] before returning it to the expander.
-#
-proc attlist {nvpairs} {
-    variable attvalMap
-    if {[llength $nvpairs] == 1} { set nvpairs [lindex $nvpairs 0] }
-    set attlist ""
-    foreach {name value} $nvpairs {
-    	append attlist " $name='[string map $attvalMap $value]'"
-    }
-    return $attlist
-}
-
-# startTag gi ?attname attval ... ? --
-#	Return start-tag for element $gi with specified attributes.
-#
-proc startTag {gi args} {
-    return [markup "<$gi[attlist $args]>"]
-}
-
-# endTag gi --
-#	Return end-tag for element $gi.
-#
-proc endTag {gi} {
-    return [markup "</$gi>"]
-}
-
-# emptyElement gi ?attribute  value ... ?
-#	Return empty-element tag.
-#
-proc emptyElement {gi args} {
-    return [markup "<$gi[attlist $args]/>"]
-}
-
-# xmlComment text --
-#	Return XML comment declaration containing $text.
-#	NB: if $text includes the sequence "--", it will be mangled.
-#
-proc xmlComment {text} {
-    return [markup "<!-- [string map {-- { - - }} $text] -->"]
-}
-
-# wrap content gi --
-#	Returns $content wrapped inside <$gi> ... </$gi> tags.
-#
-proc wrap {content gi} {
-    return "[startTag $gi]${content}[endTag $gi]"
-}
-
-# wrap? content gi --
-#	Same as [wrap], but returns an empty string if $content is empty.
-#
-proc wrap? {content gi} {
-    if {![string length [string trim $content]]} { return "" }
-    return "[startTag $gi]${content}[endTag $gi]"
-}
-
-# wrapLines? content gi ? gi... ?
-#	Same as [wrap?], but separates entries with newlines
-#       and supports multiple nesting levels.
-#
-proc wrapLines? {content args} {
-    if {![string length $content]} { return "" }
-    foreach gi $args {
-	set content [join [list [startTag $gi] $content [endTag $gi]] "\n"]
-    }
-    return $content
-}
-
-# sequence args --
-#	Handy combinator.
-#
-proc sequence {args} { join $args "\n" }
-
-######################################################################
-# XML context management.
-#
-
-variable elementStack [list]
-
-# start gi ?attribute value ... ? --
-#	Return start-tag for element $gi
-#	As a side-effect, pushes $gi onto the element stack.
-#
-proc start {gi args} {
-    if {[llength $args] == 1} { set args [lindex $args 0] }
-    variable elementStack
-    lappend elementStack $gi
-    return [startTag $gi $args]
-}
-
-# xmlContext {gi1 ... giN} ?default?  --
-#	Pops elements off the element stack until one of
-#	the specified element types is found.
-#
-#	Returns: sequence of end-tags for each element popped.
-#
-#	If none of the specified elements are found, returns
-# 	a start-tag for $default.
-#
-proc xmlContext {gis {default {}}} {
-    variable elementStack
-    set origStack $elementStack
-    set endTags [list]
-    while {[llength $elementStack]} {
-	set current [lindex $elementStack end]
-	if {[lsearch $gis $current] >= 0} {
-	    return [join $endTags \n]
-	}
-	lappend endTags [endTag $current]
-	set elementStack [lreplace $elementStack end end]
-    }
-    # Not found:
-    set elementStack $origStack
-    if {![string length $default]} {
-    	set where "[join $elementStack /] - [info level 1]"
-	puts_stderr "Warning: Cannot start context $gis ($where)"
-    	set default [lindex $gis 0] 
-    }
-    lappend elementStack $default
-    return [startTag $default]
-}
-
-# end ? gi ? --
-#	Generate markup to close element $gi, including end-tags
-#	for any elements above it on the element stack.
-#
-#	If element name is omitted, closes the current element.
-#
-proc end {{gi {}}} {
-    variable elementStack
-    if {![string length $gi]} {
-    	set gi [lindex $elementStack end]
-    }
-    set prefix [xmlContext $gi]
-    set elementStack [lreplace $elementStack end end]
-    return [join [list $prefix [endTag $gi]] "\n"]
-}
-
-######################################################################
-# Utilities for multi-pass processing.
-#
-# Not really XML-related, but I find them handy.
-#
-
-variable PassProcs
-variable Buffers
-
-# pass $passNo procName procArgs { body  } --
-#	Specifies procedure definition for pass $n.
-#
-proc pass {pass proc arguments body} {
-    variable PassProcs
-    lappend PassProcs($pass) $proc $arguments $body
-}
-
-proc setPassProcs {pass} {
-    variable PassProcs
-    foreach {proc args body} $PassProcs($pass) {
-	proc $proc $args $body
-    }
-}
-
-# holdBuffers buffer ? buffer ...? --
-#	Declare a list of hold buffers,
-#	to collect data in one pass and output it later.
-#
-proc holdBuffers {args} {
-    variable Buffers
-    foreach arg $args {
-	set Buffers($arg) [list]
-    }
-}
-
-# hold buffer text --
-#	Append text to named buffer
-#
-proc hold {buffer entry} {
-    variable Buffers
-    lappend Buffers($buffer) $entry
-    return
-}
-
-# held buffer --
-#	Returns current contents of named buffer and empty the buffer.
-#
-proc held {buffer} {
-    variable Buffers
-    set content [join $Buffers($buffer) "\n"]
-    set Buffers($buffer) [list]
-    return $content
-}
-
-#*EOF*
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/c.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/c.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,56 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset c end/open/list    "End of manpage reached, \[list_end\] missing"
-mcset c end/open/example "End of manpage reached, \[example_end\] missing"
-mcset c end/open/mp	  "End of manpage reached, \[manpage_end\] missing"
-mcset c mpbegin          "Command must be first of manpage"
-mcset c hdrcmd           "Command not allowed outside of the header section"
-mcset c bodycmd          "Command not allowed outside of the body of the manpage"
-mcset c body             "Plain text not allowed outside of the body of the manpage"
-mcset c reqcmd           "Command not allowed outside of header or requirement section"
-mcset c invalidlist      "Invalid list type \"@\""
-mcset c nolistcmd        "Command not allowed inside of a list"
-mcset c nolisthdr        "Command not allowed between beginning of a list and its first item"
-mcset c nolisttxt        "Plain text not allowed between beginning of a list and its first item"
-mcset c listcmd          "Command not allowed outside of a list"
-mcset c deflist          "Command restricted to usage in definition lists"
-mcset c bulletlist       "Command restricted to usage in itemized lists"
-mcset c enumlist         "Command restricted to usage in enumerated lists"
-mcset c examplecmd       "Command allowed only to close example section"
-mcset c listcmd          "Command not allowed outside of a list"
-mcset c nodonecmd        "Command not allowed after \[manpage_end\]"
-mcset c arg_list         "Command restricted to usage in argument lists"
-mcset c cmd_list         "Command restricted to usage in command lists"
-mcset c opt_list         "Command restricted to usage in option lists"
-mcset c tkoption_list    "Command restricted to usage in tkoption lists"
-mcset c depr_strong      "Deprecated command \"%s\".\n\tPlease consider appropriate semantic markup or \[emph\] instead."
-mcset c depr_lstitem     "Deprecated command \"%s\".\n\tPlease use \[def\] instead."
-mcset c depr_nl          "Deprecated command \"%s\".\n\tPlease use \[para\] instead."
-mcset c depr_bullet      "Deprecated command \"%s\".\n\tPlease use \[item\] instead."
-mcset c depr_ltype       "Deprecated list type \"%s\".\n\tPlease use \"%s\" instead."
-mcset c sectambig        "(Sub)Section title \"%s\" causes ambiguous section references."
-
-# TOC messages
-
-mcset c end/open/toc  "\[toc_end\] missing."
-mcset c toc/plaintext "Plain text beyond whitespace is not allowed."
-mcset c toc/begincmd  "Command not allowed here."
-mcset c toc/endcmd    "Command not allowed here."
-mcset c toc/titlecmd  "Command not allowed here."
-mcset c toc/sectcmd   "Command not allowed here."
-mcset c toc/sectecmd  "Command not allowed here."
-mcset c toc/itemcmd   "Command not allowed here."
-mcset c toc/nodonecmd "Command not allowed after \[toc_end\]"
-
-# IDX messages
-
-mcset c end/open/idx   "\[index_end\] missing."
-mcset c idx/plaintext  "Plain text beyond whitespace is not allowed."
-mcset c idx/begincmd   "Command not allowed here."
-mcset c idx/endcmd     "Command not allowed here."
-mcset c idx/keycmd     "Command not allowed here."
-mcset c idx/manpagecmd "Command not allowed here."
-mcset c idx/urlcmd     "Command not allowed here."
-mcset c idx/nodonecmd  "Command not allowed after \[index_end\]"
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/de.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/de.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,52 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset de end/open/list    "Dokument zu Ende, nicht alle Listen wurden geschlossen"
-mcset de end/open/example "Dokument zu Ende, das letzte Beispiel wurde nicht abgeschlossen"
-mcset de end/open/mp	  "Dokument zu Ende, es fehlt der Abschlussbefehl \[manpage_end\]"
-mcset de mpbegin          "Erwartete diesen Befehl als ersten in der Manpage"
-mcset de hdrcmd           "Dieser Befehl ist ausserhalb des Headers nicht erlaubt"
-mcset de bodycmd          "Dieser Befehl darf nicht ausserhalb des Hauptteils der Manpage auftreten"
-mcset de body             "Text darf nicht ausserhalb des Hauptteils der Manpage auftreten"
-mcset de reqcmd           "Dieser Befehl ist ausserhalb von Header/Requirements nicht erlaubt"
-mcset de invalidlist      "Die Listenart \"@\" ist dem System nicht bekannt"
-mcset de nolistcmd        "Dieser Befehl ist innerhalb einer Liste nicht erlaubt"
-mcset de nolisthdr        "Dieser Befehl darf nicht zwischen dem Beginn einer Liste und ihrem ersten Unterpunkt benutzt werden"
-mcset de nolisttxt        "Text darf nicht zwischen dem Beginn einer Liste und ihrem ersten Unterpunkt benutzt werden"
-mcset de listcmd          "Dieser Befehl ist ausserhalb einer Liste nicht erlaubt"
-mcset de deflist          "Dieser Befehl darf nur in Definitions-Listen benutzt werden"
-mcset de bulletlist       "Dieser Befehl darf nur in ungeordneten Listen benutzt werden"
-mcset de enumlist         "Dieser Befehl darf nur in Aufz\xE4hlungs-Listen benutzt werden"
-mcset de examplecmd       "Dieser Befehl kann nur zum Schliessen eines Beispieles benutzt werden"
-mcset de listcmd          "Dieser Befehl ist ausserhalb einer Liste nicht erlaubt"
-mcset de nodonecmd        "Dieser Befehl ist nach Ausf\xFChrung von \[manpage_end\] nicht mehr erlaubt"
-mcset de arg_list         "Dieser Befehl darf nur in Argument-Listen benutzt werden"
-mcset de cmd_list         "Dieser Befehl darf nur in Befehls-Listen benutzt werden"
-mcset de opt_list         "Dieser Befehl darf nur in Options-Listen benutzt werden"
-mcset de tkoption_list    "Dieser Befehl darf nur in TkOptions-Listen benutzt werden"
-mcset de depr_strong      "Misbilligter Befehl \"%s\".\n\tBitte verwenden sie \[emph\] oder eine passende semantische Auszeichnung."
-mcset de depr_lstitem     "Misbilligter Befehl \"%s\".\n\tBitte verwenden sie \[def\]."
-mcset de depr_nl          "Misbilligter Befehl \"%s\".\n\tBitte verwenden sie \[para\]."
-mcset de depr_bullet      "Misbilligter Befehl \"%s\".\n\tBitte verwenden sie \[item\]."
-mcset de depr_ltype       "Misbilligte Listen-Art \"%s\".\n\tBitte verwenden sie \"%s\"."
-mcset de sectambig        "Die Kapitel\xFCberschrift \"%s\" ist nicht eindeutig, Referenzen k\xF6nnen falsch sein."
-
-mcset de end/open/toc  "\[toc_end\] fehlt."
-mcset de toc/plaintext "Normaler Text ist (mit Ausnahme von reinem Leerraum) nicht erlaubt."
-mcset de toc/begincmd  "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/endcmd    "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/titlecmd  "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/sectcmd   "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/sectecmd  "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/itemcmd   "Dieser Befehl ist hier nicht erlaubt."
-mcset de toc/nodonecmd "Dieser Befehl ist nach \[toc_end\] nicht erlaubt."
-
-mcset de end/open/idx   "\[index_end\] fehlt."
-mcset de idx/plaintext  "Normaler Text ist (mit Ausnahme von reinem Leerraum) nicht erlaubt."
-mcset de idx/begincmd   "Dieser Befehl ist hier nicht erlaubt."
-mcset de idx/endcmd     "Dieser Befehl ist hier nicht erlaubt."
-mcset de idx/keycmd     "Dieser Befehl ist hier nicht erlaubt."
-mcset de idx/manpagecmd "Dieser Befehl ist hier nicht erlaubt."
-mcset de idx/urlcmd     "Dieser Befehl ist hier nicht erlaubt."
-mcset de idx/nodonecmd  "Dieser Befehl ist nach \[index_end\] nicht erlaubt."
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/en.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/en.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,52 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset en end/open/list    "End of manpage reached, \[list_end\] missing"
-mcset en end/open/example "End of manpage reached, \[example_end\] missing"
-mcset en end/open/mp	  "End of manpage reached, \[manpage_end\] missing"
-mcset en mpbegin          "Command must be first of manpage"
-mcset en hdrcmd           "Command not allowed outside of the header section"
-mcset en bodycmd          "Command not allowed outside of the body of the manpage"
-mcset en body             "Plain text not allowed outside of the body of the manpage"
-mcset en reqcmd           "Command not allowed outside of header or requirement section"
-mcset en invalidlist      "Invalid list type \"@\""
-mcset en nolistcmd        "Command not allowed inside of a list"
-mcset en nolisthdr        "Command not allowed between beginning of a list and its first item"
-mcset en nolisttxt        "Plain text not allowed between beginning of a list and its first item"
-mcset en listcmd          "Command not allowed outside of a list"
-mcset en deflist          "Command restricted to usage in definition lists"
-mcset en bulletlist       "Command restricted to usage in itemized lists"
-mcset en enumlist         "Command restricted to usage in enumerated lists"
-mcset en examplecmd       "Command allowed only to close example section"
-mcset en listcmd          "Command not allowed outside of a list"
-mcset en nodonecmd        "Command not allowed after \[manpage_end\]"
-mcset en arg_list         "Command restricted to usage in argument lists"
-mcset en cmd_list         "Command restricted to usage in command lists"
-mcset en opt_list         "Command restricted to usage in option lists"
-mcset en tkoption_list    "Command restricted to usage in tkoption lists"
-mcset en depr_strong      "Deprecated command \"%s\".\n\tPlease consider appropriate semantic markup or \[emph\] instead."
-mcset en depr_lstitem     "Deprecated command \"%s\".\n\tPlease use \[def\] instead."
-mcset en depr_nl          "Deprecated command \"%s\".\n\tPlease use \[para\] instead."
-mcset en depr_bullet      "Deprecated command \"%s\".\n\tPlease use \[item\] instead."
-mcset en depr_ltype       "Deprecated list type \"%s\".\n\tPlease use \"%s\" instead."
-mcset en sectambig        "(Sub)Section title \"%s\" causes ambiguous section references."
-
-mcset en end/open/toc  "\[toc_end\] missing."
-mcset en toc/plaintext "Plain text beyond whitespace is not allowed."
-mcset en toc/begincmd  "Command not allowed here."
-mcset en toc/endcmd    "Command not allowed here."
-mcset en toc/titlecmd  "Command not allowed here."
-mcset en toc/sectcmd   "Command not allowed here."
-mcset en toc/sectecmd  "Command not allowed here."
-mcset en toc/itemcmd   "Command not allowed here."
-mcset en toc/nodonecmd "Command not allowed after \[toc_end\]"
-
-mcset en end/open/idx   "\[index_end\] missing."
-mcset en idx/plaintext  "Plain text beyond whitespace is not allowed."
-mcset en idx/begincmd   "Command not allowed here."
-mcset en idx/endcmd     "Command not allowed here."
-mcset en idx/keycmd     "Command not allowed here."
-mcset en idx/manpagecmd "Command not allowed here."
-mcset en idx/urlcmd     "Command not allowed here."
-mcset en idx/nodonecmd  "Command not allowed after \[index_end\]"
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.desc
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.desc	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,49 +1,0 @@
-# -*- tcl -*-
-#
-# -- Extraction of meta information from a manpage (package
-#    description), and associating it with package names.
-#
-# Copyright (c) 2005 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-################################################################
-
-# Take the null format as a base and extend it a bit.
-dt_source fmt.null
-
-global    data
-array set data {}
-
-proc fmt_numpasses   {}     {return 1}
-proc fmt_postprocess {text} {
-    global data
-
-    # Title in required packages => This is the sole package.
-    # Otherwise dump everything required.
-
-    if {[lsearch -exact $data(require) $data(title)] >= 0} {
-	return [list $data(title) $data(shortdesc) $data(desc)]
-    } else {
-	set res {}
-	foreach p $data(require) {
-	    lappend res [list $p $data(shortdesc) $data(desc)]
-	}
-	return [join $res \n]
-    }
-}
-proc fmt_plain_text  {text} {return ""}
-proc fmt_setup       {n}    {return}
-
-proc fmt_manpage_begin {title section version} {
-    global data
-    set    data(title)     $title
-    set    data(require)   {}
-    set    data(desc)      ""
-    set    data(shortdesc) ""
-    return
-}
-
-proc fmt_moddesc   {desc} {global data ; set data(shortdesc) $desc}
-proc fmt_titledesc {desc} {global data ; set data(desc)      $desc}
-proc fmt_require   {p {v {}}} {global data ; lappend data(require) $p ; return}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.html
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.html	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,475 +1,0 @@
-# -*- tcl -*-
-#
-# fmt.html
-#
-# Copyright (c) 2001-2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# Definitions to convert a tcl based manpage definition into
-# a manpage based upon HTML markup.
-#
-################################################################
-################################################################
-
-dt_source _common.tcl   ; # Shared code
-dt_source _html.tcl     ; # HTML basic formatting
-
-proc c_copyrightsymbol {} {markup "&copy;"}
-
-proc bgcolor {} {return ""}
-proc border  {} {return 0}
-proc Year    {} {clock format [clock seconds] -format %Y}
-
-# possibleReference text gi --
-#	Check if $text is a potential cross-reference;
-#	if so, format as a reference;
-#	otherwise format as a $gi element.
-#
-proc c_possibleReference {text gi} {
-    global SectionNames
-    set id [c_sectionId $text]
-    if {[info exists SectionNames($id)]} {
-	return [taga a [list href #$id]]$text[tag/ a]
-    } else {
-	return [tag $gi]$text[tag/ $gi]
-    }
-}
-
-c_holdBuffers require
-
-################################################################
-## Backend for HTML markup
-
-# --------------------------------------------------------------
-# Handling of lists. Simplified, the global check of nesting and
-# legality of list commands allows us to throw away most of the
-# existing checks.
-
-global liststack ; # stack of list tags to use in list_end
-global hintstack ; # stack of hint information.
-global chint     ; # current hint settings
-global lmark     ; # boolean flag, 1 = list item command was last
-#                ; #               0 = something other than a list item command
-
-set    liststack [list]
-set    hintstack [list]
-set    chint     ""
-set    lmark     0
-
-proc llevel {} {global liststack ; return [llength $liststack]}
-
-proc lpush {t hint} {
-    global  liststack hintstack chint
-    lappend liststack [tag/ $t]
-    lappend hintstack $chint
-    set     chint $hint
-    return [tag $t]
-}
-
-proc lpop {} {
-    global liststack hintstack chint
-    set t         [lindex   $liststack end]
-    set liststack [lreplace $liststack end end]
-    set chint     [lindex   $hintstack end]
-    set hintstack [lreplace $hintstack end end]
-    return $t
-}
-
-proc lsmark {value} {
-    global lmark ; set lmark $value ; return
-}
-
-proc limark {} {
-    # hint and mark processing.
-    # hint: compact list, do not create additional whitespace
-    if {[lcompact]} {return ""}
-
-    # hint: wide list, create additional whitespace.
-    # mark: exception: two list items following each other have no whitespace.
-    global lmark ; if {$lmark} {return ""}
-    return [tag br][tag br]\n
-}
-
-proc lcompact {} {global chint ; string equal $chint compact}
-
-proc fmt_plain_text {text} {
-    # Control list state
-    set redux [string map [list " " "" "\t" "" "\n" ""] $text]
-    if {$redux != {}} {lsmark 0}
-    return $text
-}
-
-################################################################
-# Formatting commands.
-
-c_pass 1 fmt_manpage_begin {title section version} {c_cinit ; c_clrSections ; return}
-c_pass 2 fmt_manpage_begin {title section version} {
-    XrefInit
-    c_cinit
-    set module      [dt_module]
-    set shortdesc   [c_get_module]
-    set description [c_get_title]
-    set copyright   [c_get_copyright]
-
-    set     hdr ""
-    append  hdr "[markup <html><head>]\n"
-    append  hdr "[markup <title>]$title - $shortdesc [markup </title>]\n"
-
-    # Engine parameter - insert 'meta'
-    if {[set meta [Get meta]] != {}} {append hdr [markup $meta]\n}
-
-    append  hdr "[markup </head>]\n"
-    append  hdr [ht_comment [c_provenance]]\n
-    if {$copyright != {}} {
-	append  hdr [ht_comment $copyright]\n
-    }
-    append  hdr [ht_comment "CVS: \$Id\$ $title.$section"]\n
-    append  hdr \n
-    append  hdr [markup <body>]\n
-
-    # Engine parameter - insert 'header'
-    if {[set header [Get header]] != {}} {append hdr [markup $header]\n}
-
-    append  hdr "[markup <h1>] [string trimleft $title :]($section) $version $module \"$shortdesc\"[markup </h1>]\n"
-    append  hdr [fmt_section NAME]\n
-    append  hdr "[fmt_para] $title - $description"
-    return $hdr
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 2 fmt_moddesc   {desc} NOP
-
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 2 fmt_titledesc {desc} NOP
-
-c_pass 1 fmt_copyright {desc} {c_set_copyright $desc}
-c_pass 2 fmt_copyright {desc} NOP
-
-c_pass 1 fmt_manpage_end {} {c_creset ; return}
-c_pass 2 fmt_manpage_end {} {
-    c_creset
-    set res ""
-
-    set sa [c_xref_seealso]
-    set kw [c_xref_keywords]
-    set ct [c_get_copyright]
-
-    if {[llength $sa] > 0} {
-	append res [fmt_section {SEE ALSO}] \n
-	append res [join [XrefList [lsort $sa] sa] ", "] \n
-    }
-    if {[llength $kw] > 0} {
-	append res [fmt_section KEYWORDS] \n
-	append res [join [XrefList [lsort $kw] kw] ", "] \n
-    }
-    if {$ct != {}} {
-	append res [fmt_section COPYRIGHT] \n
-	append res [join [split $ct \n] [tag br]\n] [tag br]\n
-    }
-
-    # Engine parameter - insert 'footer'
-    if {[set footer [Get footer]] != {}} {append res [markup $footer]\n}
-
-    append res [markup </body></html>]
-    return $res
-}
-
-c_pass 1 fmt_section {name} {c_newSection $name 1 end}
-c_pass 2 fmt_section {name} {
-    set id [c_sectionId $name]
-    return "[markup <h2><]a name=[markup \"]$id[markup \">]$name[markup </a></h2>\n<p>]"
-}
-
-c_pass 1 fmt_subsection {name} {c_newSection $name 2 end}
-c_pass 2 fmt_subsection {name} {
-    set id [c_sectionId $name]
-    return "[markup <h3><]a name=[markup \"]$id[markup \">]$name[markup </a></h3>\n<p>]"
-}
-
-proc fmt_para {} {return [markup <p>]}
-
-c_pass 2 fmt_require {pkg {version {}}} NOP
-c_pass 1 fmt_require {pkg {version {}}} {
-    set result "package require [markup <b>]$pkg"
-    if {$version != {}} {
-	append result " $version"
-    }
-    append result [markup "</b><br>"]
-    c_hold require $result
-    return
-}
-
-c_pass 2 fmt_usage {cmd args} NOP
-c_pass 1 fmt_usage {cmd args} {c_hold synopsis "[trtop][td]$cmd [join $args " "][markup </td></tr>]"}
-
-c_pass 1 fmt_call {cmd args} {
-    c_hold synopsis "[trtop][td][markup "<a href=\"#[c_cnext]\">"]$cmd [join $args " "][markup </a></td></tr>]"
-}
-c_pass 2 fmt_call {cmd args} {
-    return "[fmt_lst_item "[markup "<a name=\"[c_cnext]\">"]$cmd [join $args " "][markup </a>]"]\n"
-}
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    set result ""
-    set syn [c_held synopsis]
-    set req [c_held require]
-
-    # Create the TOC.
-
-    # Pass 1: We have a number of special sections which were not
-    #         listed explicitly in the document sources. Add them
-    #         now. Note the inverse order for the section added
-    #         at the beginning.
-
-    c_newSection DESCRIPTION 1 0
-    if {$syn != {} || $req != {}} {c_newSection SYNOPSIS 1 0}
-    c_newSection {TABLE OF CONTENTS} 1 0
-
-    if {[llength [c_xref_seealso]] > 0}  {c_newSection {SEE ALSO} 1 end}
-    if {[llength [c_xref_keywords]] > 0} {c_newSection KEYWORDS   1 end}
-    if {[c_get_copyright]         != {}} {c_newSection COPYRIGHT  1 end}
-
-    set sections $::SectionList
-
-    # Pass 2: Generate the markup for the TOC, indenting the
-    #         links according to the level of the section.
-
-    append result [fmt_section {TABLE OF CONTENTS}]
-
-    foreach {name id level} $sections {
-	append result \
-		[markup [string repeat "&nbsp;&nbsp;&nbsp;&nbsp;" $level]] \
-		[taga a [list href #$id]] \
-		$name \
-		[tag/ a][tag br]\n
-    }
-
-    # Implicit sections coming after the TOC (Synopsis, then the
-    # description which starts the actual document). The other
-    # implict sections are added at the end of the document and
-    # are generated by 'fmt_manpage_end' in the second pass.
-
-    if {$syn != {} || $req != {}} {
-	append result [fmt_section SYNOPSIS]\n
-    }
-    if {$req != {}} {
-	append result $req \n
-	append result [markup <br>]
-    }
-    if {$syn != {}} {
-	proc bgcolor {} {return lightyellow}
-
-	append result [btable][tr][td][table]${syn}\n[markup </table></td></tr></table>]\n
-
-	proc bgcolor {} {return ""}
-    }
-    append result [fmt_section DESCRIPTION]
-    return $result
-}
-
-################################################################
-
-proc fmt_list_begin  {what {hint {}}} {
-    switch -exact -- $what {
-	enumerated  {set tag ol}
-	itemized    {set tag ul}
-	arguments -
-	commands  -
-	options   -
-	tkoptions -
-	definitions {set tag dl}
-    }
-    return [if {[llevel]} {limark} else {}][lpush $tag $hint][lsmark 1]
-}
-
-proc fmt_list_end {}        {return [lpop][lsmark 1]}
-proc fmt_lst_item {text}    {return [limark][tag dt]$text[tag dd][lsmark 1]}
-proc fmt_bullet   {}        {return [limark][tag li][lsmark 1]}
-proc fmt_enum     {}        {return [limark][tag li][lsmark 1]}
-proc fmt_cmd_def  {command} {fmt_lst_item [fmt_cmd $command]}
-
-proc fmt_arg_def {type name {mode {}}} {
-    set    text ""
-    append text "$type [fmt_arg $name]"
-    if {$mode != {}} {
-	append text " ($mode)"
-    }
-    fmt_lst_item $text
-}
-proc fmt_opt_def {name {arg {}}} {
-    set text [fmt_option $name]
-    if {$arg != {}} {append text " $arg"}
-    fmt_lst_item $text
-}
-proc fmt_tkoption_def {name dbname dbclass} {
-    set    text ""
-    append text "Command-Line Switch:\t[fmt_option $name][markup <br>]\n"
-    append text "Database Name:\t[strong $dbname][markup <br>]\n"
-    append text "Database Class:\t[strong $dbclass][markup <br>]\n"
-    fmt_lst_item $text
-}
-
-
-################################################################
-
-proc fmt_example_begin {} {
-    lsmark 0
-    return [markup "<p><table><tr><td bgcolor=black>&nbsp;</td><td><pre class='sample'>"]
-}
-proc fmt_example_end   {} {
-    return [markup "</pre></td></tr></table></p>"]
-}
-proc fmt_example {code} {
-    return "[fmt_example_begin][fmt_plain_text $code][fmt_example_end]"
-}
-
-proc fmt_nl {} {
-    if {[lcompact]} {return [tag br]}
-    return [tag br][tag br]
-}
-proc fmt_arg    {text} {return "[markup "<i class='arg'>"]$text[markup </i>]" }
-proc fmt_cmd    {text} {return "[markup "<b class='cmd'>"][XrefMatch $text sa][markup </b>]" }
-
-proc fmt_emph	{text}	{ em $text }
-
-proc strong {text} {return "[markup <strong>]$text[markup </strong>]"}
-proc em     {text} {return "[markup <em>]$text[markup </em>]"}
-
-
-proc fmt_opt     {text} {return "?$text?" }
-proc fmt_comment {text} {ht_comment $text}
-proc fmt_sectref {text {label {}}} {
-    global SectionNames
-    if {![string length $label]} {set label $text}
-    set id [c_sectionId $text]
-    if {[info exists SectionNames($id)]} {
-    	return "[markup <]a href=[markup \"]#$id[markup \">]$label[markup </a>]"
-    } else {
-    	return "[markup <b>]$label[markup </b>]"
-    }
-}
-proc fmt_syscmd  {text} {strong [XrefMatch $text sa]}
-proc fmt_method  {text} {strong $text}
-proc fmt_option  {text} {strong $text}
-proc fmt_widget  {text} {strong $text}
-proc fmt_fun     {text} {strong $text}
-proc fmt_type    {text} {strong $text}
-proc fmt_package {text} {strong [XrefMatch $text sa kw]}
-proc fmt_class   {text} {strong $text}
-proc fmt_var     {text} {strong $text}
-proc fmt_file    {text} {return "\"[strong $text]\""}
-proc fmt_namespace     {text} {strong $text}
-proc fmt_uri     {text {label {}}} {
-    if {$label == {}} {set label $text}
-    return "[markup <]a href=[markup \"]$text[markup \">]$label[markup </a>]"
-}
-proc fmt_term    {text} {em [XrefMatch $text kw sa]}
-proc fmt_const   {text} {strong $text}
-
-################################################################
-
-global xref ; array set xref {}
-
-global    __var
-array set __var {
-    meta   {}
-    header {}
-    footer {}
-    xref   {}
-}
-proc Get               {varname}      {global __var ; return $__var($varname)}
-proc fmt_listvariables {}             {global __var ; return [array names __var]}
-proc fmt_varset        {varname text} {
-    global __var
-    if {![info exists __var($varname)]} {return -code error "Unknown engine variable \"$varname\""}
-    set __var($varname) $text
-    return
-}
-
-################################################################
-
-proc XrefInit {} {
-    global xref __var
-    foreach item $__var(xref) {
-	foreach {pattern fname fragment} $item break
-	set fname_ref [dt_fmap $fname]
-	if {$fragment != {}} {append fname_ref #$fragment}
-	set xref($pattern) $fname_ref
-    }
-    proc XrefInit {} {}
-    return
-}
-
-proc XrefMatch {word args} {
-    global xref
-
-    foreach ext $args {
-	if {$ext != {}} {
-	    if {[info exists xref($ext,$word)]} {
-		return [XrefLink $xref($ext,$word) $word]
-	    }
-	}
-    }
-    if {[info exists xref($word)]} {
-	return [XrefLink $xref($word) $word]
-    }
-
-    # Convert the word to all-lower case and then try again.
-
-    set lword [string tolower $word]
-
-    foreach ext $args {
-	if {$ext != {}} {
-	    if {[info exists xref($ext,$lword)]} {
-		return [XrefLink $xref($ext,$lword) $word]
-	    }
-	}
-    }
-    if {[info exists xref($lword)]} {
-	return [XrefLink $xref($lword) $word]
-    }
-
-    return $word
-}
-
-proc XrefList {list {ext {}}} {
-    set res [list]
-    foreach w $list {lappend res [XrefMatch $w $ext]}
-    return $res
-}
-
-proc XrefLink {dest label} {
-    # Ensure that the link is properly done relative to this file!
-
-    set save $dest
-
-    #puts_stderr "XrefLink $dest $label"
-
-    set here [file split [dt_fmap [dt_file]]]
-    set dest [file split $dest]
-
-    #puts_stderr "XrefLink < $here"
-    #puts_stderr "XrefLink > $dest"
-
-    while {[string equal [lindex $dest 0] [lindex $here 0]]} {
-	set dest [lrange $dest 1 end]
-	set here [lrange $here 1 end]
-	if {[llength $dest] == 0} {break}
-    }
-    set ul [llength $dest]
-    set hl [llength $here]
-
-    if {$ul == 0} {
-	set dest [lindex [file split $save] end]
-    } else {
-	while {$hl > 1} {
-	    set dest [linsert $dest 0 ..]
-	    incr hl -1
-	}
-	set dest [eval file join $dest]
-    }
-
-    #puts_stderr "XrefLink --> $dest"
-
-    return "[markup "<a href=\"$dest\">"] $label [markup </a>]" ; # "
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.latex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.latex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,370 +1,0 @@
-# -*- tcl -*-
-#
-# fmt.latex
-#
-# (c) 2001 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# [mpexpand] definitions to convert a tcl based manpage definition into
-# a manpage based upon LaTeX markup.
-#
-################################################################
-
-##
-## This engine needs a rewrite for a better handling
-## of characters special to TeX / LaTeX.
-##
-
-dt_source _common.tcl   ; # Shared code
-
-global _in_example
-set    _in_example 0
-
-# Called to handle plain text from the input
-proc fmt_plain_text {text} {
-    global _in_example
-    if {$_in_example} {
-	return $text
-    }
-    return [texEscape $text]
-}
-
-proc Year {} {clock format [clock seconds] -format %Y}
-
-c_holdBuffers require
-
-proc fmt_postprocess {text} {
-    regsub -all -- "\n+" $text "\n" text
-    return [string map {\1\\ \\ \1$ $} $text]
-    #return $text
-}
-
-################################################################
-## Backend for LaTeX markup
-
-c_pass 1 fmt_manpage_begin {title section version} NOP
-c_pass 2 fmt_manpage_begin {title section version} {
-    set module      [dt_module]
-    set shortdesc   [c_get_module]
-    set description [c_get_title]
-    set copyright   [c_get_copyright]
-
-    set     hdr ""
-    append  hdr [Comment [c_provenance]] \n
-    if {$copyright != {}} {
-	append  hdr [Comment $copyright] \n
-    }
-    append  hdr [Comment "CVS: \$Id\$ $title.$section"] \n
-    append  hdr \n
-    append  hdr "\1\\documentclass\{article\}" \n
-    append  hdr "\1\\begin\{document\}" \n
-    append  hdr "\1\\author\{[dt_user]\}" \n
-
-    set    titletext ""
-    append titletext "$module / $title -- "
-    append titletext "$shortdesc : $description"
-
-    append  hdr "\1\\title\{[texEscape $titletext]\}" \n
-    append  hdr "\1\\maketitle" \n
-    return $hdr
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 2 fmt_moddesc   {desc} NOP
-
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 2 fmt_titledesc {desc} NOP
-
-c_pass 1 fmt_copyright {desc} {c_set_copyright [texEscape $desc]}
-c_pass 2 fmt_copyright {desc} NOP
-
-c_pass 1 fmt_manpage_end {} NOP
-c_pass 2 fmt_manpage_end {} {
-    set    res ""
-
-    set sa [c_xref_seealso]
-    set kw [c_xref_keywords]
-    set ct [c_get_copyright]
-
-    if {[llength $sa] > 0} {
-	set tmp {}
-	foreach x $sa {lappend tmp [texEscape $x]}
-	set sa $tmp
-
-	append res [fmt_section {SEE ALSO}] \n
-	append res [join [lsort $sa] ", "] \n
-    }
-    if {[llength $kw] > 0} {
-	set tmp {}
-	foreach x $kw {lappend tmp [texEscape $x]}
-	set kw $tmp
-
-	append res [fmt_section KEYWORDS] \n
-	append res [join [lsort $kw] ", "] \n
-    }
-    if {$ct != {}} {
-	append res [fmt_section COPYRIGHT] \n
-	append res \1\\begin\{flushleft\} \n
-	append res [join [split $ct \n] \1\\linebreak\n] \1\\linebreak\n
-	append res \1\\end\{flushleft\} \n
-    }
-    append  res "\1\\end\{document\}"
-    return $res
-}
-
-
-
-proc fmt_section    {name} {return "\1\\section\{[texEscape $name]\}"}
-proc fmt_subsection {name} {return "\1\\subsection\{[texEscape $name]\}"}
-proc fmt_para    {}        {return \n\n}
-
-c_pass 2 fmt_require {pkg {version {}}} NOP
-c_pass 1 fmt_require {pkg {version {}}} {
-    if {$version != {}} {
-	set res "package require [Bold "$pkg $version"]\n"
-    } else {
-	set res "package require [Bold $pkg]\n"
-    }
-    c_hold require $res
-    return
-}
-
-c_pass 2 fmt_usage {cmd args} NOP
-c_pass 1 fmt_usage {cmd args} {c_hold synopsis "\1\\item\[\] $cmd [join $args " "]"}
-
-c_pass 2 fmt_call {cmd args} {return "[fmt_lst_item "$cmd [join $args " "]"]"}
-c_pass 1 fmt_call {cmd args} {c_hold synopsis "\1\\item\[\] $cmd [join $args " "]"}
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    set res ""
-    set req [c_held require]
-    set syn [c_held synopsis]
-    if {$req != {} || $syn != {}} {
-	append res [fmt_section SYNOPSIS]\n
-	if {$req != {}} {
-	    append res \1\\begin\{flushleft\} \n
-	    append res $req \n
-	    append res \1\\end\{flushleft\} \n
-	}
-	if {$syn != {}} {
-	    append res "\1\\begin\{itemize\}" \n
-	    append res ${syn} \n\n
-	    append res "\1\\end\{itemize\}" \n
-	}
-    }
-    append res [fmt_section DESCRIPTION]
-    return $res
-}
-
-################################################################
-
-global    list_state
-array set list_state {level -1}
-
-proc fmt_list_begin  {what {hint {}}} {
-    # ignoring hints
-    global list_state
-    incr list_state(level)
-    set  list_state(l,$list_state(level)) $what
-    set  list_state(l,$list_state(level),item) 0
-
-    switch -exact -- $what {
-	enumerated {
-	    return \1\\begin\{enumerate\}
-	}
-	itemized -
-	arguments -
-	options -
-	commands -
-	tkoptions -
-	definitions {
-	    return \1\\begin\{itemize\}
-	}
-	default {
-	    return -code error "Must not happen"
-	}
-    }
-}
-
-proc fmt_list_end {} {
-    global list_state
-
-    set what $list_state(l,$list_state(level))
-    set item $list_state(l,$list_state(level),item)
-
-    catch {unset list_state(l,$list_state(level))}
-    catch {unset list_state(l,$list_state(level),item)}
-
-    incr list_state(level) -1
-
-    switch -exact -- $what {
-	enumerated {
-	    return \1\\end\{enumerate\}
-	}
-	itemized -
-	arguments -
-	options -
-	commands -
-	tkoptions -
-	definitions {
-	    return \1\\end\{itemize\}
-	}
-	default {
-	    return -code error "Must not happen"
-	}
-    }
-}
-
-proc fmt_bullet {} {return "\n%\n\1\\item\n%\n"}
-proc fmt_enum   {} {return "\n%\n\1\\item\n%\n"}
-
-proc fmt_lst_item {text} {
-    global list_state
-
-    set item $list_state(l,$list_state(level),item)
-    set list_state(l,$list_state(level),item) 1
-
-    set text [texEscape $text]
-    return "\n%\n\1\\item\[\] $text\n%\n"
-}
-
-proc fmt_arg_def {type name {mode {}}} {
-    global list_state
-
-    set item $list_state(l,$list_state(level),item)
-    set list_state(l,$list_state(level),item) 1
-
-    set    text ""
-    append text [fmt_arg $name]
-    append text " $type"
-    if {$mode != {}} {append text " ($mode)"}
-    return "\n%\n\1\\item\[\] $text\n%\n"
-}
-
-proc fmt_cmd_def {command} {
-    global list_state
-
-    set item $list_state(l,$list_state(level),item)
-    set list_state(l,$list_state(level),item) 1
-
-    set text [fmt_cmd $command]
-    return "\n%\n\1\\item\[\] $text\n%\n"
-}
-
-proc fmt_opt_def {name {arg {}}} {
-    global list_state
-
-    set item $list_state(l,$list_state(level),item)
-    set list_state(l,$list_state(level),item) 1
-
-    set text [fmt_option $name]
-    if {$arg != {}} {append text " $arg"}
-    return "\n%\n\1\\item\[\] $text\n%\n"
-}
-
-proc fmt_tkoption_def {name dbname dbclass} {
-    global list_state
-
-    set item $list_state(l,$list_state(level),item)
-    set list_state(l,$list_state(level),item) 1
-
-    set    text ""
-    append text "Command-Line Switch:	[Bold $name]\\\\\n"
-    append text "Database Name:	[Bold $dbname]\\\\\n"
-    append text "Database Class:	[Bold $dbclass]\\\\\n"
-    return "\n%\n\1\\item\[\] $text\n%\n"
-}
-
-################################################################
-
-proc fmt_example_begin {} {
-    global _in_example
-    set    _in_example 1
-    return {\begin{verbatim}}
-}
-proc fmt_example_end   {} {
-    global _in_example
-    set    _in_example 0
-    return {\end{verbatim}}
-}
-# No mapping of special characters
-proc fmt_example {code} { return "\1\\begin\{verbatim\}\n${code}\n\1\\end\{verbatim\}\n" }
-
-proc fmt_nl     {}     {return}
-proc fmt_arg    {text} {Underline $text}
-proc fmt_cmd    {text} {Bold      $text}
-proc fmt_emph   {text} {Italic    $text}
-proc fmt_opt    {text} {return   ?$text?}
-
-proc fmt_comment {text} {
-    set res [list]
-    foreach l [split $text \n] {
-	lappend res [Comment $l]
-    }
-    return [join $res \n]
-}
-proc fmt_sectref {text {label {}}} {
-    if {![string length $label]} {set label $text}
-    Bold $label
-}
-proc fmt_syscmd  {text} {Bold $text}
-proc fmt_method  {text} {Bold $text}
-proc fmt_option  {text} {Bold $text}
-proc fmt_widget  {text} {Bold $text}
-proc fmt_fun     {text} {Bold $text}
-proc fmt_type    {text} {Bold $text}
-proc fmt_package {text} {Bold $text}
-proc fmt_class   {text} {Bold $text}
-proc fmt_var     {text} {Bold $text}
-proc fmt_file    {text} {return "\"[Italic $text]\""}
-proc fmt_namespace     {text} {Bold $text]}
-proc fmt_uri     {text {label {}}} {
-    if {$label == {}} {
-	# Without label we use the link directly as part of the text.
-	return [Underline $text]
-    } else {
-	# Label is used in the text, refered link is delegated into a
-	# footnote.
-	return "[Underline $label] \1\\footnote\{[texEscape $text]\}"
-    }
-}
-proc fmt_term    {text} {Italic $text}
-proc fmt_const   {text} {Bold $text}
-
-
-################################################################
-# latex specific commands
-
-proc Comment   {text} {return "% [join [split $text \n] "\n% "]"}
-proc Bold      {text} {return "\{\1\\bf [texEscape $text]\}"}
-proc Italic    {text} {return "\{\1\\it [texEscape $text]\}"}
-proc Underline {text} {return "\1\\underline\{[texEscape $text]\}"}
-
-################################################################
-
-proc texEscape {text} {
-    set x 0
-    if {[string match *%* $text]} {
-	#puts_stderr '$text'
-	set x 1
-    }
-
-    # Important: \1 protected sequences are left unchanged, they are already escaped.
-    set text [string map {
-        \1$\\backslash$ \1$\\backslash$ \1$<$ \1$<$ \1$>$ \1$>$
-	\1\\_ \1\\_
-	\1\\% \1\\%
-	\1\\^ \1\\^
-	\1\\$ \1\\$
-	\1\\# \1\\#
-	\1\\& \1\\&
-	\1\\ \1\\
-	\\ \1$\\backslash$ _ \1\\_ % \1\\% ^ \1\\^ $ \1\\$ < \1$<$ > \1$>$ # \1\\# & \1\\&
-    } $text]
-    if {$x} {
-	#puts_stderr "==> '$text'"
-    }
-    return $text
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.list
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.list	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,50 +1,0 @@
-# -*- tcl -*-
-#
-# -- Extraction of basic meta information (title section version) from a manpage.
-#
-# Copyright (c) 2001-2002 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Copyright (c) 2003     Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-################################################################
-
-# Take the null format as a base and extend it a bit.
-dt_source fmt.null
-
-global    data
-array set data {}
-
-proc fmt_numpasses   {}     {return 1}
-proc fmt_postprocess {text} {
-    global data
-    foreach key {seealso keywords} {
-	array set _ {}
-	foreach ref $data($key) {set _($ref) .}
-	set data($key) [array names _]
-	unset _
-    }
-    return [list manpage [array get data]]\n
-}
-proc fmt_plain_text  {text} {return ""}
-proc fmt_setup       {n}    {return}
-
-proc fmt_manpage_begin {title section version} {
-    global data
-    set    data(title)     $title
-    set    data(section)   $section
-    set    data(version)   $version
-    set    data(file)      [dt_file]
-    set    data(fid)       [dt_fileid]
-    set    data(module)    [dt_module]
-    set    data(desc)      ""
-    set    data(shortdesc) ""
-    set    data(keywords)  [list]
-    set    data(seealso)   [list]
-    return
-}
-
-proc fmt_moddesc   {desc} {global data ; set data(shortdesc) $desc}
-proc fmt_titledesc {desc} {global data ; set data(desc)      $desc}
-proc fmt_keywords  {args} {global data ; foreach ref $args {lappend data(keywords) $ref} ; return}
-proc fmt_see_also  {args} {global data ; foreach ref $args {lappend data(seealso)  $ref} ; return}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.nroff
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.nroff	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,238 +1,0 @@
-# -*- tcl -*-
-#
-# -- doctools NROFF formatting engine.
-#
-# Copyright (c) 2001-2005 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# [expand] definitions to convert a tcl based manpage definition into
-# a manpage based upon *roff markup. Additional definition files allow
-# the conversion into HTML and TMML.
-
-
-################################################################
-# Load shared code, load nroff support.
-
-dt_source _common.tcl
-dt_source _nroff.tcl
-
-################################################################
-# Define the API commands.
-
-c_pass 1 fmt_manpage_begin {title section version} c_begin
-c_pass 2 fmt_manpage_begin {title section version} {
-    c_begin
-
-    set module      [dt_module]
-    set shortdesc   [c_get_module]
-    set description [c_get_title]
-    set copyright   [c_get_copyright]
-
-    c_holdBuffers hdr
-
-    c_hold hdr [nr_comment {}]
-    c_hold hdr [nr_comment [c_provenance]]
-    if {$copyright != {}} {
-	c_hold hdr [nr_comment $copyright]
-    }
-    c_hold hdr [nr_comment {}]
-
-    if {[set text [c_held precomments]] != {}} {
-	c_hold hdr $text
-    }
-
-    c_hold hdr [nr_include man.macros]
-    c_hold hdr [nr_title "\"[string trimleft $title :]\" $section $version $module \"$shortdesc\""]
-    c_hold hdr [nr_bolds]
-    c_hold hdr [fmt_section NAME]
-    c_hold hdr "$title \1\\- $description"
-
-    return [c_held hdr]
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 2 fmt_moddesc   {desc} NOP
-
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 2 fmt_titledesc {desc} NOP
-
-c_pass 1 fmt_copyright {desc} {c_set_copyright $desc}
-c_pass 2 fmt_copyright {desc} NOP
-
-c_pass 1 fmt_manpage_end {} NOP
-c_pass 2 fmt_manpage_end {} {
-
-    # Complete the generation with a copyright
-    # section, if such information is available.
-
-    set nroff ""
-
-    set sa [c_xref_seealso]
-    set kw [c_xref_keywords]
-    set ct [c_get_copyright]
-
-    if {[llength $sa] > 0} {
-	append nroff [fmt_section {SEE ALSO}] \n
-	append nroff [join [lsort $sa] ", "] \n
-    }
-    if {[llength $kw] > 0} {
-	append nroff [fmt_section KEYWORDS] \n
-	append nroff [join [lsort $kw] ", "] \n
-    }
-    if {$ct != {}} {
-	append nroff [fmt_section COPYRIGHT] \n
-	append nroff [nr_nofill] \n
-	append nroff $ct \n
-	append nroff [nr_fill]
-    }
-    return $nroff
-}
-
-proc fmt_postprocess {nroff} {return [nroff_postprocess $nroff]}
-
-proc fmt_section    {name} {return [nr_section $name]}
-proc fmt_subsection {name} {return [nr_subsection $name]}
-proc fmt_para {} {nr_p}
-
-c_pass 2 fmt_require {pkg {version {}}} NOP
-c_pass 1 fmt_require {pkg {version {}}} {
-    if {$version != {}} {set version " $version"}
-    c_hold synopsis "package require [nr_bld]$pkg $version[nr_rst]\n[fmt_nl]"
-}
-
-c_pass 1 fmt_usage {cmd args} {c_hold synopsis "$cmd [join $args " "]\n[fmt_nl]"}
-c_pass 2 fmt_usage {cmd args} NOP
-
-c_pass 1 fmt_call  {cmd args} {c_hold synopsis       "$cmd [join $args " "]\n[fmt_nl]"}
-c_pass 2 fmt_call  {cmd args} {return "[fmt_lst_item "$cmd [join $args " "]"]"}
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    set text ""
-    if {[set syn [c_held synopsis]] != {}} {
-	append text [fmt_section SYNOPSIS]\n
-	append text ${syn}\n
-	append text [nr_bolde]\n
-    }
-    append text [fmt_section DESCRIPTION]
-    return $text
-}
-
-################################################################
-
-global    list_state
-array set list_state {level -1}
-
-proc fmt_list_begin {what {hint {}}} {
-    c_cinit
-    if {[dt_lnesting] > 1} {
-	return [nr_in]
-    }
-    return {}
-}
-
-proc fmt_list_end {} {
-    c_creset
-    if {[dt_lnesting] > 0} {
-	return [nr_out]
-    } else {
-	return [nr_p]
-    }
-}
-
-proc fmt_enum     {}        {return [nr_item " \[[c_cnext]\]\n"]}
-proc fmt_bullet   {}        {return [nr_item " \1\\(bu\n"]}
-proc fmt_lst_item {text}    {return [nr_blt $text]\n}
-proc fmt_cmd_def  {command} {return [nr_blt [fmt_cmd $command]]\n}
-
-proc fmt_arg_def {type name {mode {}}} {
-    set    text [nr_blt ""]
-    append text [fmt_arg $name]
-    append text " $type"
-    if {$mode != {}} {append text " ($mode)"}
-    return $text
-}
-proc fmt_opt_def {name {arg {}}} {
-    #if {[string match -* $name]} {set name \1\\$name}
-    set name [fmt_option $name]
-    if {$arg != {}} {append name " $arg"}
-    return [nr_blt $name]
-}
-proc fmt_tkoption_def {name dbname dbclass} {
-    set    text ""
-    append text "[nr_lp]\n"
-    append text "[nr_nofill]\n"
-    append text "[nr_ta " 6c"]\n"
-    append text "Command-Line Switch:\t[bold $name]\n"
-    append text "Database Name:\t[bold $dbname]\n"
-    append text "Database Class:\t[bold $dbclass]\n"
-    append text "[nr_fill]\n"
-    append text "[nr_item]\n"
-    return $text
-}
-
-################################################################
-
-proc fmt_example_begin {} { return "\n[nr_nofill]\n" }
-proc fmt_example_end   {} { nr_fill }
-proc fmt_example {code} { 
-    set lines [list "" [nr_nofill]]
-    foreach line [split $code "\n"] {
-    	lappend lines [fmt_plain_text $line]
-    }
-    lappend lines [nr_fill] ""
-    return [join $lines "\n"]
-}
-
-proc fmt_nl     {}     {nr_vspace}
-proc fmt_arg    {text} {underline $text}
-proc fmt_cmd    {text} {bold      $text}
-proc fmt_emph   {text} {underline $text}
-proc fmt_opt    {text} {return   ?$text?}
-
-proc bold      {text} {return [nr_bld]$text[nr_rst]}
-proc underline {text} {return [nr_ul]$text[nr_rst]}
-
-proc fmt_comment {text} {
-    set res [list]
-    foreach l [split $text \n] {
-	lappend res [nr_comment $l]
-    }
-    if {[c_begun]} {
-	return [join $res \n]
-    } else {
-	if {[c_inpass] == 1} {
-	    c_hold precomments [join $res \n]
-	}
-	return ""
-    }
-}
-proc fmt_sectref {text {label {}}} {
-    if {![string length $label]} {set label $text}
-    bold $label
-}
-proc fmt_syscmd  {text} {bold $text}
-proc fmt_method  {text} {bold $text}
-proc fmt_option  {text} {bold $text}
-proc fmt_widget  {text} {bold $text}
-proc fmt_fun     {text} {bold $text}
-proc fmt_type    {text} {bold $text}
-proc fmt_package {text} {bold $text}
-proc fmt_class   {text} {bold $text}
-proc fmt_var     {text} {bold $text}
-proc fmt_file    {text} {return "\"[underline $text]\""}
-proc fmt_namespace     {text} {bold $text}
-proc fmt_uri     {text {label {}}} {
-    if {$label == {}} {
-	# Without label we use the link directly as part of the text.
-	return [underline $text]
-    } else {
-	# with label and link we use the label directly, and the
-	# link comes in parentheses after that.
-
-	return "[underline $label] \[$text\]"
-    }
-}
-proc fmt_term    {text} {underline $text}
-proc fmt_const   {text} {bold $text}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.null
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.null	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,30 +1,0 @@
-# -*- tcl -*-
-#
-# -- Null format
-#
-# Copyright (c) 2001-2002 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Copyright (c) 2003      Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# This is a null format which does return no output at all.
-
-################################################################
-
-proc fmt_initialize  {}     {return}
-proc fmt_shutdown    {}     {return}
-proc fmt_numpasses   {}     {return 1}
-proc fmt_postprocess {text} {return ""}
-proc fmt_plain_text  {text} {return ""}
-proc fmt_setup       {n}    {return}
-
-foreach p {
-    manpage_begin moddesc titledesc manpage_end require description
-    section para list_begin list_end lst_item call usage bullet enum
-    arg_def cmd_def opt_def tkoption_def see_also keywords example
-    example_begin example_end nl arg cmd opt emph comment
-    sectref syscmd method option widget fun type package class var
-    file uri term const copyright namespace subsection
-} {
-    proc fmt_$p {args} {return ""}
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.text
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.text	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,455 +1,0 @@
-# -*- tcl -*-
-#
-# fmt.text -- Engine to convert a doctools document into plain text.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-################################################################
-################################################################
-
-# Load shared code and modify it to our needs.
-
-dt_source _common.tcl
-dt_source _text.tcl
-proc c_copyrightsymbol {} {return "(c)"}
-
-rename fmt_initialize     BaseInitialize
-proc   fmt_initialize {} {BaseInitialize ; TextInitialize ; return}
-
-################################################################
-# Special manpage environments
-
-proc NewExample {} {
-    global currentEnv
-    return [NewEnv Example {
-	set    currentEnv(verbatim) 1
-	append currentEnv(prefix)   "| "
-	set    currentEnv(example) .
-    }] ; # {}
-}
-
-proc Example {} {
-    global currentEnv
-    if {![info exists currentEnv(exenv)]} {
-	SaveContext
-	set verb [NewExample]
-	RestoreContext
-
-	# Remember verbatim mode in the base environment
-	set currentEnv(exenv) $verb
-	SaveEnv
-    }
-    return $currentEnv(exenv)
-}
-
-proc NewList {what} {
-    # List environments
-    # Per list several environments are required.
-
-    switch -exact -- $what {
-	enumerated {NewOrderedList}
-	itemized   {NewUnorderedList}
-	arguments -
-	commands  -
-	options   -
-	tkoptions -
-	definitions {NewDefinitionList}
-    }
-}
-
-proc NewUnorderedList {} {
-    global currentEnv lmarginIncrement
-
-    # Itemized list - unordered list - bullet
-    # 1. Base environment provides indentation.
-    # 2. First paragraph in a list item.
-    # 3. All other paragraphs.
-
-    set base [NewEnv Itemized {
-	incr currentEnv(lmargin)   $lmarginIncrement
-
-	set bullet [Bullet currentEnv(bulleting)]
-    }] ; # {}
-    set first [NewEnv First {
-	set currentEnv(wspfx) [::textutil::repeat::blank $lmarginIncrement]
-	set currentEnv(listtype)  bullet
-	set currentEnv(bullet) $bullet
-    }] ; SetContext $base ; # {}
-
-    set next [NewEnv Next {
-	incr currentEnv(lmargin)   $lmarginIncrement
-    }] ; SetContext $base ; # {}
-
-    set currentEnv(_first) $first
-    set currentEnv(_next)  $next
-    set currentEnv(pcount) 0
-    SaveEnv
-    return
-}
-
-proc NewOrderedList {} {
-    global currentEnv lmarginIncrement
-
-    # Ordered list - enumeration - enum
-    # 1. Base environment provides indentation.
-    # 2. First paragraph in a list item.
-    # 3. All other paragraphs.
-
-    set base [NewEnv Enumerated {
-	incr currentEnv(lmargin)   $lmarginIncrement
-
-	set bullet [EnumBullet currentEnv(enumeration)]
-    }] ; # {}
-    set first [NewEnv First {
-	set currentEnv(wspfx)  [::textutil::repeat::blank $lmarginIncrement]
-	set currentEnv(listtype)  enum
-	set currentEnv(bullet) $bullet
-    }] ; SetContext $base ; # {}
-
-    set next [NewEnv Next {
-	incr currentEnv(lmargin)   $lmarginIncrement
-    }] ; SetContext $base ; # {}
-
-    set currentEnv(_first) $first
-    set currentEnv(_next)  $next
-    set currentEnv(pcount) 0
-    SaveEnv
-    return
-}
-
-proc NewDefinitionList {} {
-    global currentEnv lmarginIncrement
-
-    # Definition list - terms & definitions
-    # 1. Base environment provides indentation.
-    # 2. Term environment
-    # 3. Definition environment
-
-    set base [NewEnv DefL {
-	incr currentEnv(lmargin)   $lmarginIncrement
-    }] ; # {}
-    set term [NewEnv Term {
-	set currentEnv(verbatim) 1
-    }] ; SetContext $base ; # {}
-
-    set def [NewEnv Def {
-	incr currentEnv(lmargin) $lmarginIncrement
-    }] ; SetContext $base ; # {}
-
-    set currentEnv(_term)       $term
-    set currentEnv(_definition) $def
-    SaveEnv
-    return
-}
-
-################################################################
-# Final layouting.
-
-c_holdBuffers require
-
-proc fmt_postprocess {text} {text_postprocess $text}
-
-
-################################################################
-# Implementations of the formatting commands.
-
-c_pass 1 fmt_plain_text {text} NOP
-c_pass 2 fmt_plain_text {text} {text_plain_text $text}
-
-c_pass 1 fmt_manpage_begin {title section version} NOP
-c_pass 2 fmt_manpage_begin {title section version} {
-    Off
-    set module      [dt_module]
-    set shortdesc   [c_get_module]
-    set description [c_get_title]
-    set copyright   [c_get_copyright]
-
-    set     hdr [list]
-    lappend hdr "$title - $shortdesc"
-    lappend hdr [c_provenance]
-    lappend hdr "[string trimleft $title :]($section) $version $module \"$shortdesc\""
-    set     hdr [join $hdr \n]
-
-    Text $hdr
-    CloseParagraph [Verbatim]
-    Section NAME
-    Text "$title - $description"
-    CloseParagraph
-    return
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 2 fmt_moddesc   {desc} NOP
-
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 2 fmt_titledesc {desc} NOP
-
-c_pass 1 fmt_copyright {desc} {c_set_copyright $desc}
-c_pass 2 fmt_copyright {desc} NOP
-
-c_pass 1 fmt_manpage_end {} NOP
-c_pass 2 fmt_manpage_end {} {
-    set sa [c_xref_seealso]
-    set kw [c_xref_keywords]
-    set ct [c_get_copyright]
-
-    CloseParagraph
-    if {[llength $sa] > 0} {Section {SEE ALSO} ; Text [join [lsort $sa] ", "] ; CloseParagraph}
-    if {[llength $kw] > 0} {Section KEYWORDS   ; Text [join [lsort $kw] ", "] ; CloseParagraph}
-    if {$ct != {}}         {Section COPYRIGHT  ; Text $ct ; CloseParagraph [Verbatim]}
-    return
-}
-
-c_pass 1 fmt_section     {name} NOP
-c_pass 2 fmt_section     {name} {CloseParagraph ; Section $name ; return}
-
-c_pass 1 fmt_subsection  {name} NOP
-c_pass 2 fmt_subsection  {name} {CloseParagraph ; Subsection $name ; return}
-
-c_pass 1 fmt_para {} NOP
-c_pass 2 fmt_para {} {CloseParagraph ; return}
-
-c_pass 2 fmt_require {pkg {version {}}} NOP
-c_pass 1 fmt_require {pkg {version {}}} {
-    set result "package require $pkg"
-    if {$version != {}} {append result " $version"}
-    c_hold require $result
-    return
-}
-
-c_pass 1 fmt_usage {cmd args} {c_hold synopsis "$cmd [join $args " "]"}
-c_pass 2 fmt_usage {cmd args} NOP
-
-c_pass 1 fmt_call  {cmd args} {c_hold synopsis "$cmd [join $args " "]"}
-c_pass 2 fmt_call  {cmd args} {fmt_lst_item "$cmd [join $args " "]"}
-
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    On
-    set syn [c_held synopsis]
-    set req [c_held require]
-
-    if {$syn != {} || $req != {}} {
-	Section SYNOPSIS
-	if {($req != {}) && ($syn != {})} {
-	    Text $req\n\n$syn
-	} else {
-	    if {$req != {}} {Text $req}
-	    if {$syn != {}} {Text $syn}
-	}
-	CloseParagraph [Verbatim]
-    }
-
-    Section DESCRIPTION
-    return
-}
-
-################################################################
-
-c_pass 1 fmt_list_begin {what {hint {}}} NOP
-c_pass 2 fmt_list_begin {what {hint {}}} {
-    #puts_stderr "<<fmt_list_begin $what>>"
-
-    global currentEnv
-    if {[info exists currentEnv(_definition)]} {
-	CloseParagraph $currentEnv(_definition)
-    } elseif {[info exists currentEnv(pcount)]} {
-	if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-	if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-	incr currentEnv(pcount)
-    } else {
-	CloseParagraph
-    }
-    SaveContext
-    NewList $what
-    Off
-
-    #puts_stderr "<<fmt_list_begin _____>>"
-    return
-}
-
-c_pass 1 fmt_list_end {} NOP
-c_pass 2 fmt_list_end {} {
-    #puts_stderr "<<fmt_list_end>>"
-
-    global currentEnv
-    if {[info exists currentEnv(_definition)]} {
-	CloseParagraph $currentEnv(_definition)
-    } else {
-	if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-	if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-    }
-    RestoreContext
-
-    #puts_stderr "<<fmt_list_end ____>>"
-    return
-}
-
-c_pass 1 fmt_lst_item {text} NOP
-c_pass 2 fmt_lst_item {text} {
-    global currentEnv
-
-    #puts_stderr "<<fmt_lst_item \{$text\}>>"
-
-    if {[IsOff]} {
-	On
-    } else {
-	CloseParagraph $currentEnv(_definition)
-    }
-    Text $text
-    CloseParagraph $currentEnv(_term)
-
-    #puts_stderr "<<fmt_lst_item _____>>"
-    return
-}
-
-c_pass 1 fmt_bullet {} NOP
-c_pass 2 fmt_bullet {} {
-    global currentEnv
-    if {[IsOff]} {On ; return}
-    if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-    if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-    set  currentEnv(pcount) 0
-    return
-}
-
-c_pass 1 fmt_enum {} NOP
-c_pass 2 fmt_enum {} {
-    global currentEnv
-    if {[IsOff]} {On ; return}
-    if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-    if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-    set  currentEnv(pcount) 0
-    return
-}
-
-c_pass 1 fmt_cmd_def  {command} NOP
-c_pass 2 fmt_cmd_def  {command} {fmt_lst_item [fmt_cmd $command]}
-
-c_pass 1 fmt_arg_def {type name {mode {}}} NOP
-c_pass 2 fmt_arg_def {type name {mode {}}} {
-    set text "$type [fmt_arg $name]"
-    if {$mode != {}} {append text " ($mode)"}
-    fmt_lst_item $text
-    return
-}
-
-c_pass 1 fmt_opt_def {name {arg {}}} NOP
-c_pass 2 fmt_opt_def {name {arg {}}} {
-    set text [fmt_option $name]
-    if {$arg != {}} {append text " $arg"}
-    fmt_lst_item $text
-    return
-}
-
-c_pass 1 fmt_tkoption_def {name dbname dbclass} NOP
-c_pass 2 fmt_tkoption_def {name dbname dbclass} {
-    set    text ""
-    append text "Command-Line Switch:\t[fmt_option $name]\n"
-    append text "Database Name:\t[strong $dbname]\n"
-    append text "Database Class:\t[strong $dbclass]\n"
-    fmt_lst_item $text
-}
-
-################################################################
-
-c_pass 1 fmt_example_begin {} NOP
-c_pass 2 fmt_example_begin {} {
-    global currentEnv para
-    if {[info exists currentEnv(_definition)]} {
-	CloseParagraph $currentEnv(_definition)
-    } elseif {[info exists currentEnv(pcount)]} {
-	if {$para != {}} {
-	    if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-	    if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-	    incr currentEnv(pcount)
-	}
-    } else {
-	CloseParagraph
-    }
-    return
-}
-
-c_pass 1 fmt_example_end {} NOP
-c_pass 2 fmt_example_end {} {
-    global currentEnv para
-    set penv {}
-    if {[info exists currentEnv(_definition)]} {
-	set penv $currentEnv(_definition)
-    } elseif {[info exists currentEnv(pcount)]} {
-	if {$currentEnv(pcount) == 0} {set penv $currentEnv(_first)}
-	if {$currentEnv(pcount) >  0} {set penv $currentEnv(_next)}
-	incr currentEnv(pcount)
-    }
-    if {$penv != {}} {
-	# Save current list context, get chosen paragraph context and
-	# then create an example context form this. After closing the
-	# paragraph we get back our main list context.
-
-	SaveContext
-	SetContext $penv
-	CloseParagraph [Example]
-	RestoreContext
-    } else {
-	CloseParagraph [Example]
-    }
-    return
-}
-
-c_pass 1 fmt_example {code} NOP
-c_pass 2 fmt_example {code} {
-    fmt_example_begin
-    fmt_plain_text $code
-    fmt_example_end
-    return
-}
-
-c_pass 1 fmt_nl {} NOP
-c_pass 2 fmt_nl {} {
-    global currentEnv
-    if {[info exists currentEnv(_definition)]} {
-	CloseParagraph $currentEnv(_definition)
-    } else {
-	if {$currentEnv(pcount) == 0} {CloseParagraph $currentEnv(_first)}
-	if {$currentEnv(pcount) >  0} {CloseParagraph $currentEnv(_next)}
-	incr currentEnv(pcount)
-    }
-    return
-}
-
-################################################################
-# Visual markup of words and phrases.
-
-proc fmt_arg     {text} {return $text}
-proc fmt_cmd     {text} {return $text}
-proc fmt_emph	 {text} {em     $text }
-proc fmt_opt     {text} {return "?$text?" }
-proc fmt_comment {text} {return}
-proc fmt_sectref {text {label {}}} {
-    if {![string length $label]} {set label $text}
-    return "-> $label"
-}
-proc fmt_syscmd  {text} {strong $text}
-proc fmt_method  {text} {return $text}
-proc fmt_option  {text} {return $text}
-proc fmt_widget  {text} {strong $text}
-proc fmt_fun     {text} {strong $text}
-proc fmt_type    {text} {strong $text}
-proc fmt_package {text} {strong $text}
-proc fmt_class   {text} {strong $text}
-proc fmt_var     {text} {strong $text}
-proc fmt_file    {text} {return "\"$text\""}
-proc fmt_namespace     {text} {strong $text}
-proc fmt_uri     {text {label {}}} {
-    if {$label == {}} {
-	# Without label we use the link directly as part of the text.
-	return "<URL:$text>"
-    } else {
-	return "[em $label] <URL:$text>"
-    }
-}
-proc fmt_term    {text} {em     $text}
-proc fmt_const   {text} {strong $text}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.tmml
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.tmml	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,269 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: fmt.tmml,v 1.24 2007/08/02 19:01:14 andreas_kupries Exp $
-#
-# [expand] definitions to convert a tcl based manpage definition
-# into TMML.
-#
-# Copyright (C) 2001 Joe English <jenglish@sourceforge.net>.
-# Freely redistributable.
-#
-# See also <URL: http://tmml.sourceforge.net>
-#
-# BUGS:
-#	+ Text must be preceded by [para] or one of the
-#	  list item macros, or else the output will be invalid.
-#
-######################################################################
-
-dt_source _common.tcl
-dt_source _xml.tcl
-
-######################################################################
-# Conversion specification.
-#
-# Two-pass processing.  The first pass collects text for the
-# SYNOPSIS, SEE ALSO, and KEYWORDS sections, and the second pass
-# produces output.
-#
-
-c_holdBuffers synopsis see_also keywords
-
-variable block {section dd li desc}	;# block context elements
-
-proc fmt_nl  	{}	{ emptyElement br }
-proc fmt_arg 	{text}	{ wrap $text m }
-proc fmt_cmd	{text}	{ wrap $text cmd }
-proc fmt_emph	{text}	{ c_possibleReference $text emph }
-proc fmt_opt 	{text}	{ wrap $text o }
-
-c_pass 1 fmt_example_begin {}	NOP
-c_pass 1 fmt_example_end {} 	NOP
-c_pass 1 fmt_example {code}	NOP
-c_pass 2 fmt_example_begin {}	{ sequence [xmlContext $::block] [start example] }
-c_pass 2 fmt_example_end   {}	{ end example }
-c_pass 2 fmt_example {code} 	{ sequence [xmlContext $::block] [wrap $code example] }
-
-proc fmt_comment {text} {xmlComment $text}
-proc fmt_sectref {text {label {}}} {c_possibleReference $text emph $label}
-proc fmt_syscmd  {text} {wrap $text syscmd}
-proc fmt_method  {text} {wrap $text method}
-proc fmt_option  {text} {wrap $text option}
-proc fmt_widget  {text} {wrap $text widget}
-proc fmt_fun     {text} {wrap $text fun}
-proc fmt_type    {text} {wrap $text type}
-proc fmt_package {text} {wrap $text package}
-proc fmt_class   {text} {wrap $text class}
-proc fmt_var     {text} {wrap $text variable}
-proc fmt_file    {text} {wrap $text file}
-proc fmt_namespace     {text} {wrap $text term}
-proc fmt_uri     {text {label {}}} {
-    # TMML ignores the label
-    wrap $text url
-}
-proc fmt_term    {text} {wrap $text term}
-proc fmt_const   {text} {wrap $text l}
-
-
-c_pass 1 fmt_manpage_begin {args} NOP
-c_pass 2 fmt_manpage_begin {title section version} {
-    set headInfo [list]
-    foreach copyrightLine [split [c_get_copyright] "\n"] {
-    	lappend headInfo [emptyElement info key copyright value $copyrightLine] 
-    }
-    # ... other metadata here if needed ...
-
-    sequence \
-	[xmlComment [c_provenance]] \
-	[start manpage \
-	    id  	[dt_fileid] \
-	    cat 	cmd \
-	    title	$title \
-	    version	$version \
-	    package	[dt_module]] \
-	[wrapLines? [join $headInfo \n] head] \
-	[start namesection] \
-	[wrap $title name] \
-	[wrap [c_get_title] desc] \
-	[end namesection] \
-	;
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 1 fmt_copyright {desc} {c_set_copyright $desc}
-
-c_pass 2 fmt_moddesc     {args} NOP
-c_pass 2 fmt_titledesc   {args} NOP
-c_pass 2 fmt_copyright   {desc} NOP
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    sequence \
-	[xmlContext manpage] \
-	[wrapLines? [c_held synopsis] syntax synopsis] \
-	[start section] \
-	[wrap "DESCRIPTION" title] \
-	;
-}
-
-c_pass 1 fmt_section {name} {c_newSection $name 1 end}
-c_pass 2 fmt_section {name} {
-    sequence \
-	[xmlContext manpage] \
-    	[start section id [c_sectionId $name]] \
-	[wrap [string toupper $name] title] \
-	;
-}
-
-c_pass 1 fmt_subsection {name} {c_newSection $name 2 end}
-c_pass 2 fmt_subsection {name} {
-    sequence \
-	[xmlContext section] \
-    	[start subsection id [c_sectionId $name]] \
-	[wrap [string toupper $name] title] \
-	;
-}
-
-c_pass 1 fmt_para {} NOP
-c_pass 2 fmt_para {} { sequence [xmlContext section] [start p] }
-
-foreach {type gi} {
-    itemized	ul
-    enumerated	ol
-    definitions	dl
-    arguments	arglist
-    commands	commandlist
-    options	optlist
-    tkoptions	optionlist
-} {
-    set listTypes($type) $gi
-    lappend listGIs $gi
-}
-
-c_pass 1 fmt_list_begin {what {hint {}}} NOP
-c_pass 1 fmt_list_end {} NOP
-c_pass 2 fmt_list_begin {what {hint {}}} {
-    variable listTypes
-    sequence \
-    	[xmlContext $::block] \
-	[start $listTypes($what)] \
-	;
-}
-c_pass 2 fmt_list_end {} {
-    variable listGIs
-    sequence \
-	[xmlContext $listGIs] \
-	[end] \
-	;
-}
-
-c_pass 1 fmt_bullet {}	NOP
-c_pass 1 fmt_enum {} 		NOP
-c_pass 2 fmt_bullet {} 	{ sequence [xmlContext {ul ol}] [start li] }
-c_pass 2 fmt_enum {} 		{ sequence [xmlContext {ul ol}] [start li] }
-
-c_pass 1 fmt_lst_item {text} NOP
-c_pass 2 fmt_lst_item {text} {
-    sequence \
-    	[xmlContext dl] \
-	[start dle] \
-	[wrap $text dt] \
-	[start dd] \
-	;
-}
-
-c_pass 1 fmt_arg_def {type name {mode {}}} NOP
-c_pass 2 fmt_arg_def {type name {mode {}}} {
-    sequence \
-    	[xmlContext arglist] \
-	[start argdef] \
-	[wrap $type argtype] \
-	[wrap $name name] \
-	[wrap? $mode argmode] \
-	[start desc] \
-	;
-}
-
-c_pass 1 fmt_cmd_def {command} NOP
-c_pass 2 fmt_cmd_def {command} {
-    sequence \
-    	[xmlContext commandlist] \
-	[start commanddef] \
-	[wrap $command command] \
-	[start desc] \
-	;
-}
-
-c_pass 1 fmt_opt_def {name {arg {}}} NOP
-c_pass 2 fmt_opt_def {name {arg {}}} {
-    sequence \
-    	[xmlContext optlist] \
-	[start optdef] \
-	[wrap $name optname] \
-	[wrap? $arg optarg] \
-	[start desc] \
-	;
-}
-
-c_pass 1 fmt_tkoption_def {name dbname dbclass}  NOP
-c_pass 2 fmt_tkoption_def {name dbname dbclass} {
-    sequence \
-    	[xmlContext optionlist] \
-	[start optiondef] \
-	[wrap $name name] \
-	[wrap $dbname dbname] \
-	[wrap $dbclass dbclass] \
-	[start desc] \
-	;
-}
-
-c_pass 1 fmt_usage {cmd args} { c_hold synopsis [formatCall $cmd $args] }
-c_pass 2 fmt_usage {cmd args} NOP
-
-c_pass 1 fmt_call {cmd args} { c_hold synopsis [formatCall $cmd $args] }
-c_pass 2 fmt_call {cmd args} {
-    sequence \
-    	[xmlContext dl] \
-	[start dle] \
-	[wrap [formatCall $cmd $args] dt] \
-	[start dd] \
-	;
-}
-proc formatCall {cmd arglist} {
-    return "$cmd [join $arglist { }]"	;# OR: wrap "..." command
-}
-
-c_pass 1 fmt_require {pkg {version {}}} {
-    c_hold synopsis [formatRequire $pkg $version]
-}
-c_pass 2 fmt_require {pkg {version {}}} NOP
-proc formatRequire {pkg version} {
-    return "package require [wrap $pkg package] $version"
-}
-
-c_pass 1 fmt_see_also	{args} { holdWrapped see_also $args ref }
-c_pass 1 fmt_keywords   {args} { holdWrapped keywords $args keyword }
-c_pass 2 fmt_see_also	{args} NOP
-c_pass 2 fmt_keywords	{args} NOP
-
-# holdWrapped --
-#	Common factor of [see_also] and [keywords].
-#
-proc holdWrapped {buffer arglist gi} {
-    foreach arg $arglist { c_hold $buffer [wrap $arg $gi] }
-    return
-}
-
-c_pass 1 fmt_manpage_end {} NOP
-c_pass 2 fmt_manpage_end {} {
-    sequence \
-	[xmlContext manpage] \
-	[wrapLines? [c_held see_also] seealso] \
-	[wrapLines? [c_held keywords] keywords] \
-	[end manpage] \
-	;
-}
-
-#*EOF*
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.wiki
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fmt.wiki	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,252 +1,0 @@
-# -*- tcl -*-
-#
-# fmt.nroff
-#
-# (c) 2002 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# [expand] definitions to convert a tcl based manpage definition into
-# Wiki markup.
-#
-################################################################
-
-dt_source _common.tcl   ; # Shared code
-
-proc fmt_postprocess {wiki} {
-    # Strip empty lines out of the generated wiki source
-    # and trim leading blanks, except in code samples.
-    #
-    set lines [list]
-    foreach line [split $wiki \n] {
-	if {[string match " |*" $line]} {
-	    # Verbatim / example
-	    lappend lines [string trimright $line]
-	} elseif {[string match ". *" $line]} {
-	    # Verbatim / regular
-	    lappend lines [string range [string trimright $line] 1 end]
-	} elseif {[string match "   \* *" $line]} {
-	    # Itemized lists.
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match "   1. *" $line]} {
-	    # Enumerated lists
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[regexp "^   (\[^:\]): " $line]} {
-	    # Definition list
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match " *" $line]} {
-	    # Unwanted indentation
-	    lappend lines [string map {[ [[ ] ]]} [string trim $line]]
-	} else {
-	    # Everything else
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	}
-    }
-    set wiki [join $lines \n]\n
-
-    regsub {^[ ]+} $wiki {} wiki
-    return $wiki
-}
-
-
-################################################################
-## Backend for *roff markup
-
-c_pass 1 fmt_manpage_begin {title section version} NOP
-c_pass 2 fmt_manpage_begin {title section version} {
-    set module      [dt_module]
-    set shortdesc   [c_get_module]
-    set description [c_get_title]
-
-    set     hdr ""
-    append  hdr "$title $version '''$module''' ''$shortdesc''" \n
-    append  hdr \n
-    append  hdr "$description"
-    append  hdr \n
-    return $hdr
-}
-
-c_pass 1 fmt_moddesc   {desc} {c_set_module $desc}
-c_pass 2 fmt_moddesc   {desc} NOP
-
-c_pass 1 fmt_titledesc {desc} {c_set_title $desc}
-c_pass 2 fmt_titledesc {desc} NOP
-
-c_pass 1 fmt_copyright {desc} {c_set_copyright $desc}
-c_pass 2 fmt_copyright {desc} NOP
-
-c_pass 1 fmt_manpage_end {} NOP
-c_pass 2 fmt_manpage_end {} {
-    # Complete the generation with a copyright
-    # section, if such information is available.
-
-    set wiki ""
-
-    set sa [c_xref_seealso]
-    set kw [c_xref_keywords]
-    set ct [c_get_copyright]
-
-    if {[llength $sa] > 0} {
-	append wiki [fmt_section {SEE ALSO}] \n
-	append wiki [join [lsort $sa] ", "] \n
-    }
-    if {[llength $kw] > 0} {
-	append wiki [fmt_section KEYWORDS] \n
-	append wiki [join [lsort $kw] ", "] \n
-    }
-    if {$ct != {}} {
-	append wiki [fmt_section COPYRIGHT]
-	append wiki ". " [join [split $ct \n] "\n. "] \n
-    }
-    return $wiki
-}
-
-proc fmt_section    {name} {return "\n\n----\n'''$name'''\n\n"}
-proc fmt_subsection {name} {return "\n\n''$name''\n\n"}
-
-proc fmt_para    {}     {return \n}
-
-c_pass 2 fmt_require {pkg {version {}}} NOP
-c_pass 1 fmt_require {pkg {version {}}} {
-    if {$version != {}} {set version " $version"}
-    # @mdgen NODEP: '''
-    c_hold synopsis "package require '''$pkg$version'''\n"
-}
-
-c_pass 2 fmt_usage {cmd args} NOP
-c_pass 1 fmt_usage {cmd args} {c_hold synopsis "   * $cmd [join $args " "]\n"}
-
-c_pass 2 fmt_call {cmd args} {return "[fmt_lst_item "$cmd [join $args " "]"]"}
-c_pass 1 fmt_call {cmd args} {c_hold synopsis "   * $cmd [join $args " "]\n"}
-
-c_pass 1 fmt_description {} NOP
-c_pass 2 fmt_description {} {
-    set result ""
-    if {[set syn [c_held synopsis]] != {}} {
-	append result [fmt_section SYNOPSIS] \n
-	append result $syn \n\n
-    }
-    append result [fmt_section DESCRIPTION]
-    return $result
-}
-
-################################################################
-
-proc fmt_list_begin {what {hint {}}} {return {}}
-proc fmt_list_end   {}               {return {}}
-
-proc fmt_bullet   {}        {return "\n\n   * "}
-proc fmt_enum     {}        {return "\n\n   1. "}
-proc fmt_lst_item {text}    {return "\n\n   $text:  "}
-proc fmt_cmd_def  {command} {return "\n\n   [fmt_cmd $command]:  "}
-
-proc fmt_arg_def {type name {mode {}}} {
-    set text "\n\n   "
-    append text [fmt_arg $name]
-    append text " $type"
-    if {$mode != {}} {append text " ($mode)"}
-    return "${text}: "
-}
-proc fmt_opt_def {name {arg {}}} {
-    if {[string match -* $name]} {set    name \\-$name}
-    set name [fmt_option $name]
-    if {$arg != {}}              {append name " $arg"}
-    return "\n\n   ${name}:  "
-}
-proc fmt_tkoption_def {name dbname dbclass} {
-    set    text "\n\n"
-    append text "   Command-Line Switch:\t'''$name'''\n"
-    append text "   Database Name:\t'''$dbname'''\n"
-    append text "   Database Class:\t'''$dbclass'''\n"
-    append text "   * "
-    return $text
-}
-
-################################################################
-
-global textmode
-set    textmode ""
-
-proc fmt_example_begin {} {
-    global  mode_save textmode
-    lappend mode_save $textmode
-    set     textmode example
-    return ""
-}
-proc fmt_example_end   {} {
-    global  mode_save textmode
-    set textmode  [lindex $mode_save end]
-    set mode_save [lrange $mode_save 0 end-1]
-    return ""
-}
-proc fmt_example {code} {
-    set lines [list ""]
-    foreach line [split $code "\n"] {
-	set linex [string trim $line]
-	if {$linex == {}} {lappend lines {} ; continue}
-    	lappend lines " | $line"
-    }
-    lappend lines ""
-    return [join $lines "\n"]
-}
-
-proc emph    {text} {return ''$text''}
-proc strong  {text} {return '''$text'''}
-
-proc fmt_nl      {}     {return ""}
-proc fmt_arg     {text} {return ''$text''}
-proc fmt_cmd     {text} {return '''$text'''}
-proc fmt_emph    {text} {return ''$text''}
-proc fmt_opt     {text} {return ?$text?}
-proc fmt_comment {text} {return {}}
-proc fmt_sectref {text {label {}}} {
-    if {![string length $label]} {set label $text}
-    strong $label
-}
-proc fmt_syscmd  {text} {strong $text}
-proc fmt_method  {text} {strong $text}
-proc fmt_option  {text} {strong $text}
-proc fmt_widget  {text} {strong $text}
-proc fmt_fun     {text} {strong $text}
-proc fmt_type    {text} {strong $text}
-proc fmt_package {text} {strong $text}
-proc fmt_class   {text} {strong $text}
-proc fmt_var     {text} {strong $text}
-proc fmt_file    {text} {return "\"[emph $text]\""}
-proc fmt_namespace     {text} {strong $text}
-proc fmt_uri     {text {label {}}} {
-    if {$label == {}} {
-	# No label is an inlined emphasized link.
-	return [emph $text]
-    } else {
-	# Label in the text, link for it is hidden in an annotation.
-	return "[emph $label] \[$text\]"
-    }
-}
-proc fmt_term    {text} {emph $text}
-proc fmt_const   {text} {strong $text}
-
-################################################################
-# wiki specific commands
-
-proc fmt_plain_text {text} {
-    # For the wiki we have to force certain text into a single line.
-    # We also have to make sure that the text is on the same line as
-    # the initiator (i.e. list bullet).
-
-    global textmode
-
-    if {"$textmode" == "example"} {
-	set lines [list ""] 
-	foreach line [split $text "\n"] {
-	    set linex [string trim $line]
-	    if {$linex == {}} {lappend lines {} ; continue}
-	    lappend lines " | $line"
-	}
-	lappend lines ""
-	return [join $lines "\n"]
-    }
-
-    regsub -all "\[ \t\n\]+" $text { } text
-    return $text
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fr.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/fr.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,32 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset fr end/open/list    "Fin de la page de manuel atteinte, \[list_end\] manquant"
-mcset fr end/open/example "Fin de la page de manuel atteinte, \[example_end\] manquant"
-mcset fr end/open/mp	  "Fin de la page de manuel atteinte, \[manpage_end\] manquant"
-mcset fr mpbegin          "Cette commande doit \xEAtre la premi\xE8re de la page de manuel"
-mcset fr hdrcmd           "Commande interdite \xE0 l'ext\xE9rieur de l'en-t\xEAte"
-mcset fr bodycmd          "Commande interdite \xE0 l'ext\xE9rieur du corps de la page de manuel"
-mcset fr body             "Le texte est interdit \xE0 l'ext\xE9rieur du corps de la page de manuel"
-mcset fr reqcmd           "Commande interdite \xE0 l'ext\xE9rieur de l'en-t\xEAte ou de la section de condition"
-mcset fr invalidlist      "Type de liste non valide \"@\""
-mcset fr nolistcmd        "Commande interdite \xE0 l'int\xE9rieur d'une liste"
-mcset fr nolisthdr        "Commande interdite entre le d\xE9but d'une liste et son premier \xE9l\xE9ment"
-mcset fr nolisttxt        "Le texte est interdit entre le d\xE9but d'une liste et son premier \xE9l\xE9ment"
-mcset fr listcmd          "Commande interdite \xE0 l'ext\xE9rieur d'une liste"
-mcset fr deflist          "Commande restreinte \xE0 l'utilisation dans les listes de d\xE9finition"
-mcset fr bulletlist       "Commande restreinte \xE0 l'utilisation dans les listes d'\xE9l\xE9ments"
-mcset fr enumlist         "Commande restreinte \xE0 l'utilisation dans les listes num\xE9rot\xE9es"
-mcset fr examplecmd       "Commande autoris\xE9e uniquement pour fermer une section d'exemple"
-mcset fr nodonecmd        "Commande interdite apr\xE8s  \[manpage_end\]"
-mcset fr arg_list         "Commande restreinte \xE0 l'utilisation dans les listes d'arguments"
-mcset fr cmd_list         "Commande restreinte \xE0 l'utilisation dans les listes de commandes"
-mcset fr opt_list         "Commande restreinte \xE0 l'utilisation dans les listes d'options"
-mcset fr tkoption_list    "Commande restreinte \xE0 l'utilisation dans les listes de tkoption"
-mcset fr depr_strong      "Commande obsol\xE8te \"%s\".\n\tConsultez l'aide s\xE9mantique correspondante ou \[emph\] \xE0 la place."
-mcset fr depr_lstitem     "Commande obsol\xE8te \"%s\".\n\tConsultez \[def\] \xE0 la place."
-mcset fr depr_nl          "Commande obsol\xE8te \"%s\".\n\tConsultez \[para\] \xE0 la place."
-mcset fr depr_bullet      "Commande obsol\xE8te \"%s\".\n\tConsultez \[item\] \xE0 la place."
-mcset fr depr_ltype       "<List type> obsol\xE8te \"%s\".\n\tConsultez \"%s\" \xE0 la place."
-mcset fr sectambig        "@@@ Translate @@@ (Sub)Section title \"%s\" causes ambiguous section references."
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.html
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.html	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,296 +1,0 @@
-## -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-# $Id$
-#
-# Index Formatting Engine : docidx --> HTML.
-# Single-pass
-#
-# Copyright (c) 2003-2007 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-dt_source _idx_common.tcl
-dt_source _html.tcl
-
-# ### ### ### ######### ######### #########
-## API implementation
-
-rename idx_postprocess {}
-rename fmt_postprocess idx_postprocess
-
-proc fmt_plain_text {text} {return {}}
-
-proc fmt_index_begin {l t} {
-    global la ti
-    set la $l
-    set ti $t
-    return {}
-}
-
-proc fmt_key {text} {
-    global key lk ch
-    set lk $text
-    set key($lk) {}
-    set ch([F $lk]) .
-    return {}
-}
-
-proc fmt_manpage {f l} {Ref [dt_fmap $f] $l}
-proc fmt_url     {u l} {Ref $u           $l}
-
-proc fmt_index_end {} {
-    LoadKwid
-    set lines {}
-    BeginHeader ; Meta  ; EndHeader
-    BeginBody   ; Title ; Navbar
-    BeginIndex  ; Keys  ; EndIndex
-    EndBody
-    return [join $lines \n]
-}
-
-# ### ### ### ######### ######### #########
-## Helper commands
-
-proc Ref {r l} {
-    global  key  lk
-    lappend key($lk) $r $l
-    return {}
-}
-
-proc F {text} {
-    return [string toupper [string index $text 0]]
-}
-
-proc LoadKwid {} {
-    global kwid
-    # Engine parameter - load predefined keyword anchors.
-    set             ki [Get kwid]
-    if {![llength  $ki]} return
-    array set kwid $ki
-    return
-}
-
-proc BeginHeader {} {
-    global la ti
-    upvar 1 lines lines
-    lappend lines [markup <html>]
-    lappend lines [ht_comment [c_provenance]]
-    lappend lines [ht_comment "CVS: \$Id\$ $la"]
-    lappend lines [markup <head>]
-    lappend lines "[markup <title>] $la [markup </title>]"
-    return
-}
-
-proc Meta {} {
-    # Engine parameter - insert 'meta'
-    set meta [Get meta]
-    if {$meta == {}} return
-    upvar 1 lines lines
-    lappend lines [markup $meta]
-    return
-}
-
-proc EndHeader {} {
-    upvar 1 lines lines
-    lappend lines [markup </head>]
-    return
-}
-
-proc BeginBody {} {
-    upvar 1 lines lines
-    lappend lines [markup <body>]
-    # Engine parameter - insert 'meta'
-    set header [Get header]
-    if {$header == {}} return
-    lappend lines [markup $header]
-    return
-}
-
-proc Title {} {
-    global la ti
-    upvar 1 lines lines
-    if {($la != {}) && ($ti != {})} {
-	set title "$la -- $ti"
-    } elseif {$la != {}} {
-	set title $la
-    } elseif {$ti != {}} {
-	set title $ti
-    }
-    lappend lines "[markup <h3>] $title [markup </h3>]"
-    return
-}
-
-proc Navbar {} {
-    global ch cnt dot
-    upvar 1 lines lines
-
-    set nav {}
-    foreach c [lsort -dict [array names ch]] {
-	set ref c[incr cnt]
-	set ch($c) $ref
-	lappend nav [ALink $ref $c]
-    }
-
-    lappend lines [markup "<hr><div class=\"#idxnav\">"]
-    lappend lines [join $nav $dot]
-    lappend lines [markup </div>]
-    return
-}
-
-proc BeginIndex {} {
-    upvar 1 lines lines
-    lappend lines [markup "<hr><table class=\"#idx\" width=\"100%\">"]
-    return
-}
-
-proc Keys {} {
-    global key
-    upvar 1 lines lines
-    set lc {}
-    foreach k [lsort -dict [array names key]] {
-	set c [F $k] ; if {$lc != $c} { Section $c ; set lc $c }
-	BeginKey   $k
-	References $k
-	EndKey
-    }
-    return
-}
-
-proc Section {c} {
-    global ch
-    upvar 1 lines lines
-    lappend lines [markup {<tr class="#idxheader"><th colspan="2">}]
-    lappend lines [markup "<a name=\"$ch($c)\">Keywords: $c</a>"]
-    lappend lines [markup </th></tr>]
-    return
-}
-
-proc BeginKey {k} {
-    upvar 1 lines lines
-    lappend lines [markup "<tr class=\"[Row]\" valign=top>"]
-    lappend lines [BeginColLeft][SetAnchor $k][markup </td>]
-    lappend lines [BeginColRight]
-    return
-}
-
-proc EndKey {} {
-    upvar 1 lines lines
-    lappend lines [markup </td></tr>]
-    return
-}
-
-proc References {k} {
-    global key dot
-    upvar 1 lines lines
-    set refs {}
-    foreach {ref label} $key($k) {
-	lappend refs [markup "<a href=\"$ref\"> $label </a>"]
-    }
-    lappend lines [join $refs $dot]
-    return
-}
-
-proc EndIndex {} {
-    upvar 1 lines lines
-    lappend lines [markup </table>]
-    # Engine parameter - insert 'footer'
-    set  footer [Get footer]
-    if {$footer == {}} return
-    lappend lines [markup "<hr>"]
-    lappend lines [markup $footer]
-    return
-}
-
-proc EndBody {} {
-    upvar 1 lines lines
-    lappend lines [markup "</body></html>"]
-    return
-}
-
-proc ALink {dst label} {
-    markup "<a href=\"#$dst\"> $label </a>"
-}
-
-proc BeginColLeft {} {
-    return [markup {<td class="#idxleft" width="35%">}]
-}
-
-proc BeginColRight {} {
-    return [markup {<td class="#idxright" width="65%">}]
-}
-
-proc SetAnchor {text} {
-    return [markup "<a name=[Anchor $text]> $text </a>"]
-}
-
-proc Anchor {text} {
-    global kwid cnt
-    if {[info exists kwid($text)]} {
-	return "\"$kwid($text)\""
-    }
-    set anchor key$cnt
-    incr cnt
-    return "\"$anchor\""
-}
-
-proc Row {} {
-    global even
-    set res [expr {$even
-    ? "\#idxeven"
-    : "\#idxodd"}]
-    Flip
-    return $res
-}
-
-proc Flip {} {
-    global even
-    set    even [expr {1-$even}]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Engine state
-
-# key  : string -> dict(ref -> label) "key formatting"
-# ch   : string -> '.'                "key starting characters"
-# lk   : string                       "last key"
-# la   : string "index label"
-# ti   : string "index title"
-# cnt  : int
-# kwid : string -> ...
-# even : bool
-
-global key  ; array set key  {}
-global ch   ; array set ch   {}
-global lk   ; set       lk   {}
-global la   ; set       la   {}
-global ti   ; set       ti   {}
-global cnt  ; set       cnt  0
-global kwid ; array set kwid {}
-global even ; set       even 1
-global dot  ; set dot   [markup { &#183; }]
-
-# ### ### ### ######### ######### #########
-## Engine parameters
-
-global    __var
-array set __var {
-    meta   {}
-    header {}
-    footer {}
-    kwid   {}
-}
-proc Get               {varname}      {global __var ; return $__var($varname)}
-proc idx_listvariables {}             {global __var ; return [array names __var]}
-proc idx_varset        {varname text} {
-    global __var
-    if {![info exists __var($varname)]} {return -code error "Unknown engine variable \"$varname\""}
-    set __var($varname) $text
-    return
-}
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.nroff
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.nroff	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,81 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: idx.nroff,v 1.6 2005/09/28 04:51:19 andreas_kupries Exp $
-#
-# Engine to convert a docidx document into nroff.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _idx_common.tcl
-dt_source _nroff.tcl
-
-######################################################################
-# Conversion specification.
-#
-# One-pass processing.
-
-proc idx_postprocess {nroff} {
-    # Postprocessing after generation ...
-    # Strip empty lines out of the generated nroff source
-    # and trim leading blanks, except in code samples.
-
-    set lines [list]
-    foreach line [split $nroff "\n"] {
-	set line [string trim $line]
-	if {0 == [string length $line]} {
-	    continue
-	}
-	lappend lines $line
-    } 
-    return [nroff_postprocess [join $lines \n]]
-}
-
-#proc fmt_plain_text {text} {if {$text != {}} {return \n} else {return {}}}
-proc fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for NROFF markup
-
-global prec ok haskey
-set    prec   ""
-set    ok     0
-set    haskey 0
-
-proc fmt_index_begin     {label title}      {
-    global prec ok
-    set ok 1
-    set     hdr [nr_comment {}]\n
-    if {$prec != {}} {
-	set hdr [nr_comment $prec]\n
-    }
-    append  hdr [nr_comment [c_provenance]]\n
-    append  hdr [nr_include man.macros]\n
-    append  hdr [nr_title "\"[string trimleft $label :]\" n"]\n
-    append  hdr [nr_bolds]\n
-    append  hdr [nr_section INDEX]\n
-    append  hdr $title[nr_in]\n
-    return $hdr
-}
-proc fmt_index_end {}          {return [nr_out]}
-proc fmt_key       {text}      {
-    global haskey
-    set res ""
-    if {$haskey} {append res [nr_out]\n}
-    append res $text[nr_in]\n
-    set haskey 1
-    return $res
-}
-proc fmt_manpage   {file label} {return [nr_blt [nr_bld]$file[nr_rst]]\n$label\n}
-proc fmt_url       {url label}  {return [nr_blt [nr_bld]$url[nr_rst]]\n$label\n}
-
-proc fmt_comment {text} {
-    global prec ok
-    if {$ok} {return [nr_comment $text]}
-    append prec $text \n
-    return {}
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.null
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.null	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,23 +1,0 @@
-# -*- tcl -*-
-#
-# -- Null format (docidx)
-#
-# Copyright (c) 2003      Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# This is a null format which does return no output at all.
-
-################################################################
-
-proc idx_initialize  {}     {return}
-proc idx_shutdown    {}     {return}
-proc idx_numpasses   {}     {return 1}
-proc idx_postprocess {text} {return ""}
-proc idx_setup       {n}    {return}
-
-foreach p {
-    index_begin index_end key manpage url comment plain_text
-} {
-    proc fmt_$p {args} {return ""}
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.text
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.text	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,79 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: idx.text,v 1.3 2004/01/15 06:36:12 andreas_kupries Exp $
-#
-# Engine to convert a docidx document into plain text.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _idx_common.tcl
-dt_source _text.tcl
-proc c_copyrightsymbol {} {return "(c)"}
-
-######################################################################
-# Conversion specification.
-# One-pass processing.
-
-rename idx_postprocess {}
-rename text_postprocess idx_postprocess
-proc   fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for plain text markup
-
-global map ; array set map {}
-global key ; set key {}
-global max ; set max 0
-
-proc fmt_index_begin {label title} {
-    TextInitialize
-
-    global map ; unset map ; array set map {}
-    global key ; set key {}
-    global max ; set max 0
-
-    set hdr ""
-    append hdr "Index [textutil::uncap [c_provenance]]\n\n"
-
-    if {($label != {}) && ($title != {})} {
-	set title "$label -- $title"
-    } elseif {$label != {}} {
-	set title $label
-    } elseif {$title != {}} {
-	 # title is set
-    }
-    append hdr $title \n
-    append hdr [textutil::strRepeat = [string length $title]]
-    Text  $hdr
-    CloseParagraph [Verbatim]
-    return
-}
-proc fmt_index_end {} {
-    global map max
-
-    set break 0
-    set rmargin [expr {80 - $max}]
-    if {$rmargin < 20} {set rmargin 20}
-    incr max
-    set pfx [textutil::blank $max]
-
-    foreach key [lsort [array names map]] {
-	set   opfx $key[string range $pfx [string length $key] end]
-	Text $opfx[textutil::indent [textutil::adjust [join $map($key) ", "] -length $rmargin] $pfx 1]
-	CloseParagraph [Verbatim]
-    }
-    return
-}
-proc fmt_key {text} {
-    global key max ; set key $text
-    if {[string length $text] > $max} {set max [string length $text]}
-    return
-}
-proc fmt_manpage {file label} {global map key ; lappend map($key) $file ; return}
-proc fmt_url     {url label}  {global map key ; lappend map($key) $url ; return}
-proc fmt_comment {text}       {return}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.wiki
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.wiki	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,63 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: idx.wiki,v 1.2 2004/01/15 06:36:12 andreas_kupries Exp $
-#
-# Engine to convert a docidx document into Wiki markup.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _idx_common.tcl   ; # Shared code
-
-######################################################################
-
-proc idx_postprocess {wiki} {
-    # Strip empty lines out of the generated wiki source
-    # and trim leading blanks, except in code samples.
-    #
-    set lines [list]
-    foreach line [split $wiki \n] {
-	if {[string match " |*" $line]} {
-	    # Verbatim / example
-	    lappend lines [string trimright $line]
-	} elseif {[string match ". *" $line]} {
-	    # Verbatim / regular
-	    lappend lines [string range [string trimright $line] 1 end]
-	} elseif {[string match "   \* *" $line]} {
-	    # Itemized lists.
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match "   1. *" $line]} {
-	    # Enumerated lists
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[regexp "^   (\[^:\]): " $line]} {
-	    # Definition list
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match " *" $line]} {
-	    # Unwanted indentation
-	    lappend lines [string map {[ [[ ] ]]} [string trim $line]]
-	} else {
-	    # Everything else
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	}
-    }
-    set wiki [join $lines \n]\n
-
-    regsub {^[ ]+} $wiki {} wiki
-    return $wiki
-}
-
-proc fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for wiki markup
-
-proc fmt_index_begin      {label title} {return "Index '''$label'''\n'''[string trim $title]'''\n"}
-proc fmt_index_end        {}            {return {}}
-proc fmt_key              {text}        {return "\n   '''[string trim $text]''':   "}
-proc fmt_manpage          {file label}  {return "$file "}
-proc fmt_url              {url label}   {return "$url "}
-proc fmt_comment          {text}        {return {}}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.html
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.html	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,117 +1,0 @@
-# -*- tcl -*-
-#
-# $Id$
-#
-# Engine to convert a doctoc document into HTML.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _toc_common.tcl
-dt_source _html.tcl
-
-######################################################################
-# Conversion specification.
-#
-# One-pass processing.
-
-rename toc_postprocess {}
-rename fmt_postprocess toc_postprocess
-
-proc fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for TMML markup
-
-global firstitem   ; set firstitem   1
-global maintable   ; set maintable   1
-global even        ; set even        1
-
-proc fmt_toc_begin     {label title}      {
-    set     hdr ""
-    append  hdr "[markup <html><head>]\n"
-    append  hdr "[markup <title>] $label [markup </title>]\n"
-
-    # Engine parameter - insert 'meta'
-    if {[set meta [Get meta]] != {}} {append hdr [markup $meta]\n}
-
-    append  hdr "[markup </head>]\n"
-    append  hdr [ht_comment [c_provenance]]\n
-    append  hdr [ht_comment "CVS: \$Id\$ $label"]\n
-    append  hdr \n
-    append  hdr [markup <body>]\n
-
-    # Engine parameter - insert 'header'
-    if {[set header [Get header]] != {}} {append hdr [markup $header]\n}
-
-    append  hdr "[markup <h3>] $label [markup </h3>]\n"
-    append  hdr "[markup <hr><dl><dt><h2>] $title [markup </h2><dd>]\n"
-    return $hdr
-}
-proc fmt_toc_end       {}           {
-    global maintable
-    set text "\n"
-    if {$maintable} {append text [tag/ table]\n}
-
-    # Engine parameter - insert 'footer'
-    set footer [Get footer]
-    if {$footer != {}} {set footer \n[markup ${footer}]\n}
-
-    return $text[tag /dl][tag hr]${footer}[tag/ body][tag/ html]\n
-}
-proc fmt_division_start {title symfile} {
-    global maintable ; set maintable 0
-
-    if {$symfile == ""} {
-	return \n[markup <dl><dt>]$title[markup <dd>]
-    } else {
-	return \n[markup <dl><dt>][markup "<a href=\"[dt_fmap $symfile]\">"]$title[markup </a><dd>]
-    }
-}
-proc fmt_division_end   {}           {
-    global firstitem ; set firstitem 1
-    global even      ; set even 1
-    return [markup </table></dl>]
-}
-proc fmt_item          {file label desc} {
-    global firstitem even
-    set text ""
-
-    if {$firstitem} {
-	set firstitem 0
-	append text \n[markup "<table class=\"#toc\">"]\n
-    }
-
-    if {$even} {
-	append text [markup "<tr class=\"#toceven\" >"]\n
-    } else {
-	append text [markup "<tr class=\"#tocodd\"  >"]\n
-    }
-    set even [expr {1-$even}]
-    append text [markup "<td class=\"#tocleft\" >"][markup "<a href=\"[dt_fmap $file]\">"]$label[tag/ a][tag/ td]\n
-    append text [markup "<td class=\"#tocright\">"]${desc}[tag /td]\n
-    append text [tag/ tr]\n
-    return $text
-}
-proc fmt_comment       {text}       {ht_comment $text}
-
-################################################################
-
-global    __var
-array set __var {
-    meta   {}
-    header {}
-    footer {}
-}
-proc Get               {varname}      {global __var ; return $__var($varname)}
-proc toc_listvariables {}             {global __var ; return [array names __var]}
-proc toc_varset        {varname text} {
-    global __var
-    if {![info exists __var($varname)]} {return -code error "Unknown engine variable \"$varname\""}
-    set __var($varname) $text
-    return
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.nroff
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.nroff	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,73 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: toc.nroff,v 1.6 2005/09/28 04:51:19 andreas_kupries Exp $
-#
-# Engine to convert a doctoc document into nroff.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _toc_common.tcl
-dt_source _nroff.tcl
-
-######################################################################
-# Conversion specification.
-#
-# One-pass processing.
-
-proc toc_postprocess {nroff} {
-    # Postprocessing after generation ...
-    # Strip empty lines out of the generated nroff source
-    # and trim leading blanks, except in code samples.
-
-    set lines [list]
-    foreach line [split $nroff "\n"] {
-	set line [string trim $line]
-	if {0 == [string length $line]} {
-	    continue
-	}
-	lappend lines $line
-    } 
-    return [nroff_postprocess [join $lines \n]]
-}
-
-#proc fmt_plain_text {text} {if {$text != {}} {return \n} else {return {}}}
-proc fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for TMML markup
-
-global prec ok
-set    prec ""
-set    ok   0
-
-proc fmt_toc_begin     {label title}      {
-    global prec ok
-    set ok 1
-    set     hdr [nr_comment {}]\n
-    if {$prec != {}} {
-	set hdr [nr_comment $prec]\n
-    }
-    append  hdr [nr_comment [c_provenance]]\n
-    append  hdr [nr_include man.macros]\n
-    append  hdr [nr_title "\"[string trimleft $label :]\" n"]\n
-    append  hdr [nr_bolds]\n
-    append  hdr [nr_section CONTENTS]\n
-    append  hdr $title[nr_in]\n
-    return $hdr
-}
-proc fmt_toc_end        {}           {}
-proc fmt_division_start {title symfile} {return $title[nr_in]\n}
-proc fmt_division_end   {}              {return [nr_out]\n}
-proc fmt_item           {file label desc} {return "[nr_blt [nr_bld]$label[nr_rst]]\n[nr_ul]$file[nr_rst]: $desc\n"}
-
-proc fmt_comment {text} {
-    global prec ok
-    if {$ok} {return [nr_comment $text]}
-    append prec $text \n
-    return {}
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.null
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.null	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,23 +1,0 @@
-# -*- tcl -*-
-#
-# -- Null format (doctoc)
-#
-# Copyright (c) 2003      Andreas Kupries <andreas_kupries@sourceforge.net>
-
-# This is a null format which does return no output at all.
-
-################################################################
-
-proc toc_initialize  {}     {return}
-proc toc_shutdown    {}     {return}
-proc toc_numpasses   {}     {return 1}
-proc toc_postprocess {text} {return ""}
-proc toc_setup       {n}    {return}
-
-foreach p {
-    toc_begin toc_end item division_start division_end comment plain_text
-} {
-    proc fmt_$p {args} {return ""}
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.text
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.text	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,88 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: toc.text,v 1.7 2005/09/28 04:51:19 andreas_kupries Exp $
-#
-# Engine to convert a doctoc document into plain text.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _toc_common.tcl
-dt_source _text.tcl
-
-######################################################################
-# Conversion specification.
-# One-pass processing.
-
-rename toc_postprocess {}
-rename text_postprocess toc_postprocess
-
-proc fmt_plain_text {text} {return {}}
-
-################################################################
-## Backend for TMML markup
-
-global seclist ; set seclist {}
-global max     ; set max 0
-
-proc fmt_comment       {text}        {return}
-proc fmt_toc_end       {}            {return}
-proc fmt_toc_begin     {label title} {
-    TextInitialize
-
-    set     title "$label -- $title"
-    set     hdr ""
-    append  hdr "Table of contents [textutil::uncap [c_provenance]]\n"
-    append  hdr \n
-    append  hdr $title \n
-    append  hdr [textutil::strRepeat = [string length $title]]
-    Text   $hdr
-    CloseParagraph [Verbatim]
-}
-proc fmt_division_start {title symfile} {
-    global lmarginIncrement currentEnv
-    global seclist ; set seclist {}
-    global max     ; set max 0
-
-    Text $title\n
-    Text [textutil::strRepeat - [string length $title]]
-    CloseParagraph [Verbatim]
-    SaveContext
-    NewEnv Division {
-	incr currentEnv(lmargin) $lmarginIncrement
-    }
-    return
-}
-proc fmt_division_end   {}      {
-    global seclist max
-
-    if {[llength $seclist] > 0} {
-	set break 0
-	incr max 2
-	set  rmargin [expr {80 - $max}]
-	if {$rmargin < 20} {set rmargin 20}
-	set pfx [textutil::blank $max]
-	incr max -1
-	set fpfx "[textutil::strRepeat . $max] "
-
-	foreach {file desc} $seclist {
-	    set   opfx "$file [string range $fpfx [string length $file] end]"
-	    Text $opfx[textutil::indent [textutil::adjust $desc -length $rmargin] $pfx 1]
-	    CloseParagraph [Verbatim]
-	}
-	set seclist {}
-    }
-
-    RestoreContext
-    return
-}
-proc fmt_item {file label desc} {
-    global seclist max
-    lappend seclist $file $desc
-    if {[string length $file] > $max} {set max [string length $file]}
-    return
-}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.tmml
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.tmml	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,37 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: toc.tmml,v 1.6 2005/09/28 04:51:19 andreas_kupries Exp $
-#
-# Engine to convert a doctoc document into TMML.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-# See also <URL: http://tmml.sourceforge.net>
-#
-######################################################################
-
-dt_source _toc_common.tcl
-dt_source _xml.tcl
-
-######################################################################
-# Conversion specification.
-#
-# One-pass processing.
-
-rename toc_postprocess {}
-rename fmt_postprocess toc_postprocess
-
-proc fmt_plain_text {text} {if {$text != {}} {return \n} else {return {}}}
-
-################################################################
-## Backend for TMML markup
-
-proc fmt_toc_begin      {label title}     {sequence [start manual package $label] [wrap $title title]}
-proc fmt_toc_end        {}                {end manual}
-proc fmt_division_start {title symfile}   {sequence [start division] [wrap $text title]}
-proc fmt_division_end   {}                {end   division}
-proc fmt_item           {file label desc} {emptyElement subdoc href [dt_fmap $file]}
-proc fmt_comment        {text}            {xmlComment $text}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.wiki
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/toc.wiki	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,63 +1,0 @@
-# -*- tcl -*-
-#
-# $Id: toc.wiki,v 1.6 2005/09/28 04:51:19 andreas_kupries Exp $
-#
-# Engine to convert a doctoc document into Wiki markup.
-#
-# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
-# Freely redistributable.
-#
-######################################################################
-
-dt_source _toc_common.tcl   ; # Shared code
-
-######################################################################
-
-proc toc_postprocess {wiki} {
-    # Strip empty lines out of the generated wiki source
-    # and trim leading blanks, except in code samples.
-    #
-    set lines [list]
-    foreach line [split $wiki \n] {
-	if {[string match " |*" $line]} {
-	    # Verbatim / example
-	    lappend lines [string trimright $line]
-	} elseif {[string match ". *" $line]} {
-	    # Verbatim / regular
-	    lappend lines [string range [string trimright $line] 1 end]
-	} elseif {[string match "   \* *" $line]} {
-	    # Itemized lists.
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match "   1. *" $line]} {
-	    # Enumerated lists
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[regexp "^   (\[^:\]): " $line]} {
-	    # Definition list
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	} elseif {[string match " *" $line]} {
-	    # Unwanted indentation
-	    lappend lines [string map {[ [[ ] ]]} [string trim $line]]
-	} else {
-	    # Everything else
-	    lappend lines [string map {[ [[ ] ]]} [string trimright $line]]
-	}
-    }
-    set wiki [join $lines \n]\n
-
-    regsub {^[ ]+} $wiki {} wiki
-    return $wiki
-}
-
-proc fmt_plain_text {text} {if {$text != {}} {return \n} else {return {}}}
-
-################################################################
-## Backend for wiki markup
-
-proc fmt_toc_begin      {label title} {return "Table of Contents '''$label'''\n'''[string trim $title]'''"}
-proc fmt_toc_end        {}                {return {}}
-proc fmt_division_start {title symfile}   {return '''[string trim $title]'''}
-proc fmt_division_end   {}                {return {}}
-proc fmt_item           {file label desc} {return "   \[$label\]:   $file -- $desc"}
-proc fmt_comment        {text}            {return {}}
-
-################################################################
Index: tolsh/tolsh.vfs/lib/tcllib1.10/doctools/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/doctools/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,6 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded doctools            1.3   [list source [file join $dir doctools.tcl]]
-package ifneeded doctools::toc       0.3   [list source [file join $dir doctoc.tcl]]
-package ifneeded doctools::idx       0.3   [list source [file join $dir docidx.tcl]]
-package ifneeded doctools::cvs       0.1.1 [list source [file join $dir cvs.tcl]]
-package ifneeded doctools::changelog 0.1.1 [list source [file join $dir changelog.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/exif/exif.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/exif/exif.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,937 +1,0 @@
-# EXIF parser in Tcl
-# Author: Darren New <dnew@san.rr.com>
-# Translated directly from the Perl version
-# by Chris Breeze <chris@breezesys.com>
-# http://www.breezesys.com
-# See the original comment block, reproduced
-# at the bottom.
-# Most of the inline comments about the meanings of fields
-# are copied verbatim and without understanding from the
-# original, unless "DNew" is there.
-# Much of the structure is preserved, except in
-# makerNote, where I got tired of typing as verbosely
-# as the original Perl. But thanks for making it so
-# readable that even someone who doesn't know Perl
-# could translate it, Chris! ;-)
-# PLEASE read and understand exif::fieldnames
-# BEFORE making any changes here! Thanks!
-
-# Usage of this version:
-#     exif::analyze $stream ?$thumbnail?
-# Stream should be an open file handle
-# rewound to the start. It gets set to
-# binary mode and is left at EOF or 
-# possibly pointing at image data.
-# You have to open and close the
-# stream yourself.
-# The return is a serialized array
-# (a la [array get]) with informative
-# english text about what was found.
-# Errors in parsing or I/O or whatever
-# throw errors.
-#     exif::allfields
-# returns a list of all possible field names.
-# Added by DNew. Funky implementation.
-#
-# New
-#     exif::analyzeFile $filename ?$thumbnail?
-#
-# If you find any mistakes here, feel free to correct them
-# and/or send them to me. I just cribbed this - I don't even
-# have a camera that puts this kind of info into the file.
-
-# LICENSE: Standard BSD License.
-
-# There's probably something here I'm using without knowing it.
-package require Tcl 8.3
-
-package provide exif 1.1.2 ; # first release
-
-namespace eval ::exif {
-    namespace export analyze analyzeFile fieldnames
-    variable debug 0 ; # set to 1 for puts of debug trace
-    variable cameraModel ; # used internally to understand options
-    variable jpeg_markers ; # so we only have to do it once
-    variable intel ; # byte order - so we don't have to pass to every read
-    variable cached_fieldnames ; # just what it says
-    array set jpeg_markers {
-        SOF0  \xC0
-        DHT   \xC4
-        SOI   \xD8
-        EOI   \xD9
-        SOS   \xDA
-        DQT   \xDB
-        DRI   \xDD
-        APP1  \xE1
-    }
-}
-
-proc ::exif::debug {str} {
-    variable debug
-    if {$debug} {puts $str}
-}
-
-proc ::exif::streq {s1 s2} {
-    return [string equal $s1 $s2]
-}
-
-proc ::exif::analyzeFile {file {thumbnail {}}} {
-    set stream [open $file]
-    set res [analyze $stream $thumbnail]
-    close $stream
-    return $res
-}
-
-proc ::exif::analyze {stream {thumbnail {}}} {
-    variable jpeg_markers
-    array set result {}
-    fconfigure $stream -translation binary -encoding binary
-    while {![eof $stream]} {
-        set ch [read $stream 1]
-        if {1 != [string length $ch]} {error "End of file reached @1"}
-        if {![streq "\xFF" $ch]} {break} ; # skip image data
-        set marker [read $stream 1]
-        if {1 != [string length $marker]} {error "End of file reached @2"}
-        if {[streq $marker $jpeg_markers(SOI)]} {
-            debug "SOI"
-        } elseif {[streq $marker $jpeg_markers(EOI)]} {
-            debug "EOI"
-        } else {
-            set msb [read $stream 1]
-            set lsb [read $stream 1]
-            if {1 != [string length $msb] || 1 != [string length $lsb]} {
-                error "File truncated @1"
-            }
-            scan $msb %c msb ; scan $lsb %c lsb
-            set size [expr {256 * $msb + $lsb}]
-            set data [read $stream [expr {$size-2}]]
-	    debug "read [expr {$size - 2}] bytes of data"
-            if {[expr {$size-2}] != [string length $data]} {
-                error "File truncated @2"
-            }
-            if {[streq $marker $jpeg_markers(APP1)]} {
-                debug "APP1\t$size"
-                array set result [app1 $data $thumbnail]
-            } elseif {[streq $marker $jpeg_markers(DQT)]} {
-                debug "DQT\t$size"
-            } elseif {[streq $marker $jpeg_markers(SOF0)]} {
-                debug "SOF0\t$size"
-            } elseif {[streq $marker $jpeg_markers(DHT)]} {
-                debug "DHT\t$size"
-            } elseif {[streq $marker $jpeg_markers(SOS)]} {
-                debug "SOS\t$size"
-            } else {
-                binary scan $marker H* x
-                debug "UNKNOWN MARKER $x"
-            }
-        }
-    }
-    return [array get result]
-}
-
-proc ::exif::app1 {data thumbnail} {
-    variable intel
-    variable cameraModel
-    array set result {}
-    if {![string equal [string range $data 0 5] "Exif\0\0"]} {
-        error "APP1 does not contain EXIF"
-    }
-    debug "Reading EXIF data"
-    set data [string range $data 6 end]
-    set t [string range $data 0 1]
-    if {[streq $t "II"]} {
-        set intel 1
-        debug "Intel byte alignment"
-    } elseif {[streq $t "MM"]} {
-        set intel 0
-        debug "Motorola byte alignment"
-    } else {
-        error "Invalid byte alignment: $t"
-    }
-    if {[readShort $data 2]!=0x002A} {error "Invalid tag mark"}
-    set curoffset [readLong $data 4] ; # just called "offset" in the Perl - DNew
-    debug "Offset to first IFD: $curoffset"
-    set numEntries [readShort $data $curoffset]
-    incr curoffset 2
-    debug "Number of directory entries: $numEntries"
-    for {set i 0} {$i < $numEntries} {incr i} {
-        set head [expr {$curoffset + 12 * $i}]
-        set entry [string range $data $head [expr {$head+11}]]
-        set tag [readShort $entry 0]
-        set format [readShort $entry 2]
-        set components [readLong $entry 4]
-        set offset [readLong $entry 8]
-        set value [readIFDEntry $data $format $components $offset]
-        if {$tag==0x010e} {
-            set result(ImageDescription) $value
-        } elseif {$tag==0x010f} {
-            set result(CameraMake) $value
-        } elseif {$tag==0x0110} {
-            set result(CameraModel) $value
-            set cameraModel $value
-        } elseif {$tag==0x0112} {
-            set result(Orientation) $value
-        } elseif {$tag == 0x011A} {
-            set result(XResolution) $value
-        } elseif {$tag == 0x011B} {
-            set result(YResolution) $value
-        } elseif {$tag == 0x0128} {
-            set result(ResolutionUnit) "unknown"
-            if {$value==2} {set result(ResolutionUnit) "inch"}
-            if {$value==3} {set result(ResolutionUnit) "centimeter"}
-        } elseif {$tag==0x0131} {
-            set result(Software) $value
-        } elseif {$tag==0x0132} {
-            set result(DateTime) $value
-        } elseif {$tag==0x0213} {
-            set result(YCbCrPositioning) "unknown"
-            if {$value==1} {set result(YCbCrPositioning) "Center of pixel array"}
-            if {$value==2} {set result(YCbCrPositioning) "Datum point"}
-        } elseif {$tag==0x8769} {
-            # EXIF sub IFD
-	    debug "==CALLING exifSubIFD=="
-            array set result [exifSubIFD $data $offset]
-        } else {
-            debug "Unrecognized entry: Tag=$tag, value=$value"
-        }
-    }
-    set offset [readLong $data [expr {$curoffset + 12 * $numEntries}]]
-    debug "Offset to next IFD: $offset"
-    array set thumb_result [exifSubIFD $data $offset]
-
-    if {$thumbnail != {}} {
-	set jpg [string range $data \
-		$thumb_result(JpegIFOffset) \
-		[expr {$thumb_result(JpegIFOffset) + $thumb_result(JpegIFByteCount) - 1}]]
-
-        set         to [open $thumbnail w]
-        fconfigure $to -translation binary -encoding binary
-	puts       $to $jpg
-        close      $to
-
-        #can be used (with a JPG-aware TK) to add the image to the result array
-	#set result(THUMB) [image create photo -file $thumbnail]
-    }
-
-    return [array get result]
-}
-
-# Extract EXIF sub IFD info
-proc ::exif::exifSubIFD {data curoffset} {
-    debug "EXIF: offset=$curoffset"
-    set numEntries [readShort $data $curoffset]
-    incr curoffset 2
-    debug "Number of directory entries: $numEntries"
-    for {set i 0} {$i < $numEntries} {incr i} {
-        set head [expr {$curoffset + 12 * $i}]
-        set entry [string range $data $head [expr {$head+11}]]
-        set tag [readShort $entry 0]
-        set format [readShort $entry 2]
-        set components [readLong $entry 4]
-        set offset [readLong $entry 8]
-        if {$tag==0x9000} {
-            set result(ExifVersion) [string range $entry 8 11]
-        } elseif {$tag==0x9101} {
-            set result(ComponentsConfigured) [format 0x%08x $offset]
-        } elseif {$tag == 0x927C} {
-            array set result [makerNote $data $offset]
-        } elseif {$tag == 0x9286} {
-            # Apparently, this doesn't usually work.
-            set result(UserComment) "$offset - [string range $data $offset [expr {$offset+8}]]"
-            set result(UserComment) [string trim $result(UserComment) "\0"]
-        } elseif {$tag==0xA000} {
-            set result(FlashPixVersion) [string range $entry 8 11]
-        } elseif {$tag==0xA300} {
-            # 3 means digital camera
-            if {$offset == 3} {
-                set result(FileSource) "3 - Digital camera"
-            } else {
-                set result(FileSource) $offset
-            }
-        } else {
-            set value [readIFDEntry $data $format $components $offset]
-            if {$tag==0x829A} {
-                if {0.3 <= $value} {
-                    # In seconds...
-                    set result(ExposureTime) "$value seconds"
-                } else {
-                    set result(ExposureTime) "1/[expr {1.0/$value}] seconds"
-                }
-            } elseif {$tag == 0x829D} {
-                set result(FNumber) $value
-            } elseif {$tag == 0x8827} {
-                # D30 stores ISO here, G1 uses MakerNote Tag 1 field 16
-                set result(ISOSpeedRatings) $value
-            } elseif {$tag == 0x9003} {
-                set result(DateTimeOriginal) $value
-            } elseif {$tag == 0x9004} {
-                set result(DateTimeDigitized) $value
-            } elseif {$tag == 0x9102} {
-                if {$value == 5} {
-                    set result(ImageQuality) "super fine"
-                } elseif {$value == 3} {
-                    set result(ImageQuality) "fine"
-                } elseif {$value == 2} {
-                    set result(ImageQuality) "normal"
-                } else {
-                    set result(CompressedBitsPerPixel) $value
-                }
-            } elseif {$tag == 0x9201} {
-                # Not very accurate, use Exposure time instead.
-                #  (That's Chris' comment. I don't know what it means.)
-                set value [expr {pow(2,$value)}]
-                if {$value < 4} {
-                    set value [expr {1.0 / $value}]
-                    set value [expr {int($value * 10 + 0.5) / 10.0}]
-                } else {
-                    set value [expr {int($value + 0.49)}]
-                }
-                set result(ShutterSpeedValue) "$value Hz"
-            } elseif {$tag == 0x9202} {
-                set value [expr {int(pow(sqrt(2.0), $value) * 10 + 0.5) / 10.0}]
-                set result(AperatureValue) $value
-            } elseif {$tag == 0x9204} {
-                set value [compensationFraction $value]
-                set result(ExposureBiasValue) $value
-            } elseif {$tag == 0x9205} {
-                set value [expr {int(pow(sqrt(2.0), $value) * 10 + 0.5) / 10.0}]
-            } elseif {$tag == 0x9206} {
-                # May need calibration
-                set result(SubjectDistance) "$value m"
-            } elseif {$tag == 0x9207} {
-                set result(MeteringMode) "other"
-                if {$value == 0} {set result(MeteringMode) "unknown"} 
-                if {$value == 1} {set result(MeteringMode) "average"} 
-                if {$value == 2} {set result(MeteringMode) "center weighted average"} 
-                if {$value == 3} {set result(MeteringMode) "spot"} 
-                if {$value == 4} {set result(MeteringMode) "multi-spot"} 
-                if {$value == 5} {set result(MeteringMode) "multi-segment"} 
-                if {$value == 6} {set result(MeteringMode) "partial"} 
-            } elseif {$tag == 0x9209} {
-                if {$value == 0} {
-                    set result(Flash) no
-                } elseif {$value == 1} {
-                    set result(Flash) yes
-                } else {
-                    set result(Flash) "unknown: $value"
-                }
-            } elseif {$tag == 0x920a} {
-                set result(FocalLength) "$value mm"
-            } elseif {$tag == 0xA001} {
-                set result(ColorSpace) $value
-            } elseif {$tag == 0xA002} {
-                set result(ExifImageWidth) $value
-            } elseif {$tag == 0xA003} {
-                set result(ExifImageHeight) $value
-            } elseif {$tag == 0xA005} {
-                set result(ExifInteroperabilityOffset) $value
-            } elseif {$tag == 0xA20E} {
-                set result(FocalPlaneXResolution) $value
-            } elseif {$tag == 0xA20F} {
-                set result(FocalPlaneYResolution) $value
-            } elseif {$tag == 0xA210} {
-                set result(FocalPlaneResolutionUnit) "none"
-                if {$value == 2} {set result(FocalPlaneResolutionUnit) "inch"}
-                if {$value == 3} {set result(FocalPlaneResolutionUnit) "centimeter"} 
-            } elseif {$tag == 0xA217} {
-                # 2 = 1 chip color area sensor
-                set result(SensingMethod) $value
-            } elseif {$tag == 0xA401} {
-		#TJE
-		set result(SensingMethod) "normal"
-                if {$value == 1} {set result(SensingMethod) "custom"}
-            } elseif {$tag == 0xA402} {
-		#TJE
-                set result(ExposureMode) "auto"
-                if {$value == 1} {set result(ExposureMode) "manual"}
-                if {$value == 2} {set result(ExposureMode) "auto bracket"}
-            } elseif {$tag == 0xA403} {
-		#TJE
-                set result(WhiteBalance) "auto"
-                if {$value == 1} {set result(WhiteBalance) "manual"}
-            } elseif {$tag == 0xA404} {
-                # digital zoom not used if number is zero
-		set result(DigitalZoomRatio) "not used"
-                if {$value != 0} {set result(DigitalZoomRatio) $value}
-            } elseif {$tag == 0xA405} {
-		set result(FocalLengthIn35mmFilm) "unknown"
-                if {$value != 0} {set result(FocalLengthIn35mmFilm) $value}
-            } elseif {$tag == 0xA406} {
-                set result(SceneCaptureType) "Standard"
-                if {$value == 1} {set result(SceneCaptureType) "Landscape"} 
-                if {$value == 2} {set result(SceneCaptureType) "Portrait"}
-                if {$value == 3} {set result(SceneCaptureType) "Night scene"}
-            } elseif {$tag == 0xA407} {
-                set result(GainControl) "none"
-                if {$value == 1} {set result(GainControl) "Low gain up"} 
-                if {$value == 2} {set result(GainControl) "High gain up"}
-                if {$value == 3} {set result(GainControl) "Low gain down"}
-                if {$value == 4} {set result(GainControl) "High gain down"}
-            } elseif {$tag == 0x0103} {
-		#TJE
-		set result(Compression) "unknown"
-		if {$value == 1} {set result(Compression) "none"}
-		if {$value == 6} {set result(Compression) "JPEG"}
-            } elseif {$tag == 0x011A} {
-		#TJE
-		set result(XResolution) $value
-            } elseif {$tag == 0x011B} {
-		#TJE
-		set result(YResolution) $value
-            } elseif {$tag == 0x0128} {
-		#TJE
-		set result(ResolutionUnit) "unknown"
-		if {$value == 1} {set result(ResolutionUnit) "inch"}
-		if {$value == 6} {set result(ResolutionUnit) "cm"}
-            } elseif {$tag == 0x0201} {
-		#TJE
-		set result(JpegIFOffset) $value
-		debug "offset = $value"
-            } elseif {$tag == 0x0202} {
-		#TJE
-		set result(JpegIFByteCount) $value
-		debug "bytecount = $value"
-            } else {
-                error "Unrecognized EXIF Tag: $tag (0x[string toupper [format %x $tag]])"
-            }
-        }
-    }
-    return [array get result]
-}
-
-# Canon proprietary data that I didn't feel like translating to Tcl yet.
-proc ::exif::makerNote {data curoffset} {
-    variable cameraModel
-    debug "MakerNote: offset=$curoffset"
-
-    array set result {}
-    set numEntries [readShort $data $curoffset]
-    incr curoffset 2
-    debug "Number of directory entries: $numEntries"
-    for {set i 0} {$i < $numEntries} {incr i} {
-        set head [expr {$curoffset + 12 * $i}]
-        set entry [string range $data $head [expr {$head+11}]]
-        set tag [readShort $entry 0]
-        set format [readShort $entry 2]
-        set components [readLong $entry 4]
-        set offset [readLong $entry 8]
-        debug "$i)\tTag: $tag, format: $format, components: $components"
-
-        if {$tag==6} {
-            set value [readIFDEntry $data $format $components $offset]
-            set result(ImageFormat) $value
-        } elseif {$tag==7} {
-            set value [readIFDEntry $data $format $components $offset]
-            set result(FirmwareVersion) $value
-        } elseif {$tag==8} {
-            set value [string range $offset 0 2]-[string range $offset 3 end]
-            set result(ImageNumber) $value
-        } elseif {$tag==9} {
-            set value [readIFDEntry $data $format $components $offset]
-            set result(Owner) $value
-        } elseif {$tag==0x0C} {
-            # camera serial number
-            set msw [expr {($offset >> 16) & 0xFFFF}]
-            set lsw [expr {$offset & 0xFFFF}]
-            set result(CameraSerialNumber) [format %04X%05d $msw $lsw]
-        } elseif {$tag==0x10} {
-            set result(UnknownTag-0x10) $offset
-        } else {
-            if {$format == 3 && 1 < $components} {
-                debug "MakerNote $i: TAG=$tag"
-                catch {unset field}
-                array set field {}
-                for {set j 0} {$j < $components} {incr j} {
-                    set field($j) [readShort $data [expr {$offset+2*$j}]]
-                    debug "$j : $field($j)"
-                }
-                if {$tag == 1} {
-                    if {![string match -nocase "*Pro90*" $cameraModel]} {
-                        if {$field(1)==1} {
-                            set result(MacroMode) macro
-                        } else {
-                            set result(MacroMode) normal
-                        }
-                    }
-                    if {0 < $field(2)} {
-                        set result(SelfTimer) "[expr {$field(2)/10.0}] seconds"
-                    }
-                    set result(ImageQuality) [switch $field(3) {
-                        2 {format Normal}
-                        3 {format Fine}
-                        4 {format "CCD Raw"}
-                        5 {format "Super fine"}
-                        default {format ""}
-                    }]
-                    set result(FlashMode) [switch $field(4) {
-                        0 {format off}
-                        1 {format auto}
-                        2 {format on}
-                        3 {format "red eye reduction"}
-                        4 {format "slow synchro"}
-                        5 {format "auto + red eye reduction"}
-                        6 {format "on + red eye reduction"}
-                        default {format ""}
-                    }]
-                    if {$field(5)} {
-                        set result(ShootingMode) "Continuous"
-                    } else {
-                        set result(ShootingMode) "Single frame"
-                    }
-                    # Field 6 - don't know what it is.
-                    set result(AutoFocusMode) [switch $field(7) {
-                        0 {format "One-shot"}
-                        1 {format "AI servo"}
-                        2 {format "AI focus"}
-                        3 - 6 {format "MF"}
-                        5 {format "Continuous"}
-                        4 {
-                            # G1: uses field 32 to store single/continuous,
-                            # and always sets 7 to 4.
-                            if {[info exists field(32)] && $field(32)} {
-                                format "Continuous"
-                            } else {
-                                format "Single"
-                            }
-                        }
-                        default {format unknown}
-                    }]
-                    # Field 8 and 9 are unknown
-                    set result(ImageSize) [switch $field(10) {
-                        0 {format "large"}
-                        1 {format "medium"}
-                        2 {format "small"}
-                        default {format "unknown"}
-                    }]
-                    # Field 11 - easy shooting - see field 20
-                    # Field 12 - unknown
-                    set NHL {
-                        0 {format "Normal"}
-                        1 {format "High"}
-                        65536 {format "Low"}
-                        default {format "Unknown"}
-                    }
-                    set result(Contrast) [switch $field(13) $NHL]
-                    set result(Saturation) [switch $field(14) $NHL]
-		    set result(Sharpness) [switch $field(15) $NHL]
-                    set result(ISO) [switch $field(16) {
-                        15 {format Auto}
-                        16 {format 50}
-                        17 {format 100}
-                        18 {format 200}
-                        19 {format 400}
-                        default {format "unknown"}
-                    }]
-                    set result(MeteringMode) [switch $field(17) {
-                        3 {format evaluative}
-                        4 {format partial}
-                        5 {format center-weighted}
-                        default {format unknown}
-                    }]
-                    # Field 18 - unknown
-		    if {[info exists field(19)]} {
-			set result(AFPoint) [switch -- [expr {$field(19)-0x3000}] {
-			    0 {format none}
-			    1 {format auto-selected}
-			    2 {format right}
-			    3 {format center}
-			    4 {format left}
-			    default {format unknown}
-			}] ; # {}
-		    }
-		    if {[info exists field(20)]} {
-			if {$field(20) == 0} {
-			    set result(ExposureMode) [switch $field(11) {
-				0 {format auto}
-				1 {format manual}
-				2 {format landscape}
-				3 {format "fast shutter"}
-				4 {format "slow shutter"}
-				5 {format "night scene"}
-				6 {format "black and white"}
-				7 {format sepia}
-				8 {format portrait}
-				9 {format sports}
-				10 {format close-up}
-				11 {format "pan focus"}
-				default {format unknown}
-			    }] ; # {}
-			} elseif {$field(20) == 1} {
-			    set result(ExposureMode) program
-			} elseif {$field(20) == 2} {
-			    set result(ExposureMode) Tv
-			} elseif {$field(20) == 3} {
-			    set result(ExposureMode) Av
-			} elseif {$field(20) == 4} {
-			    set result(ExposureMode) manual
-			} elseif {$field(20) == 5} {
-			    set result(ExposureMode) A-DEP
-			} else {
-			    set result(ExposureMode) unknown
-			}
-		    }
-                    # Field 21 and 22 are unknown
-                    # Field 23: max focal len, 24 min focal len, 25 units per mm
-		    if {[info exists field(23)] && [info exists field(25)]} {
-			set result(MaxFocalLength) \
-				"[expr {1.0 * $field(23) / $field(25)}] mm"
-		    }
-                    if {[info exists field(24)] && [info exists field(25)]} {
-			set result(MinFocalLength) \
-				"[expr {1.0 * $field(24) / $field(25)}] mm"
-		    }
-                    # Field 26-28 are unknown.
-		    if {[info exists field(29)]} {
-			if {$field(29) & 0x0010} {
-			    lappend result(FlashMode) "FP_sync_enabled"
-			}
-			if {$field(29) & 0x0800} {
-			    lappend result(FlashMode) "FP_sync_used"
-			}
-			if {$field(29) & 0x2000} {
-			    lappend result(FlashMode) "internal_flash"
-			}
-			if {$field(29) & 0x4000} {
-			    lappend result(FlashMode) "external_E-TTL"
-			}
-		    }
-                    if {[info exists field(34)] && \
-			    [string match -nocase "*pro90*" $cameraModel]} {
-                        if {$field(34)} {
-                            set result(ImageStabilisation) on
-                        } else {
-                            set result(ImageStabilisation) off
-                        }
-                    }
-                } elseif {$tag == 4} {
-                    set result(WhiteBalance) [switch $field(7) {
-                        0 {format Auto}
-                        1 {format Daylight}
-                        2 {format Cloudy}
-                        3 {format Tungsten}
-                        4 {format Fluorescent}
-                        5 {format Flash}
-                        6 {format Custom}
-                        default {format Unknown}
-                    }]
-                    if {$field(14) & 0x07} {
-                        set result(AFPointsUsed) \
-                            [expr {($field(14)>>12) & 0x0F}]
-                        if {$field(14)&0x04} {
-                            append result(AFPointsUsed) " left"
-                        }
-                        if {$field(14)&0x02} {
-                            append result(AFPointsUsed) " center"
-                        }
-                        if {$field(14)&0x01} {
-                            append result(AFPointsUsed) " right"
-                        }
-                    }
-		    if {[info exists field(15)]} {
-			set v $field(15)
-			if {32768 < $v} {incr v -65536}
-			set v [compensationFraction [expr {$v / 32.0}]]
-			set result(FlashExposureCompensation) $v
-		    }
-		    if {[info exists field(19)]} {
-			set result(SubjectDistance) "$field(19) m"
-		    }
-                } elseif {$tag == 15} {
-                    foreach k [array names field] {
-                        set func [expr {($field($k) >> 8) & 0xFF}]
-                        set v [expr {$field($k) & 0xFF}]
-                        if {$func==1 && $v} {
-                            set result(LongExposureNoiseReduction) on
-                        } elseif {$func==1 && !$v} {
-                            set result(LongExposureNoiseReduction) off
-                        } elseif {$func==2} {
-                            set result(Shutter/AE-Lock) [switch $v {
-                                0 {format "AF/AE lock"}
-                                1 {format "AE lock/AF"}
-                                2 {format "AF/AF lock"}
-                                3 {format "AE+release/AE+AF"}
-                                default {format "Unknown"}
-                            }]
-                        } elseif {$func==3} {
-                            if {$v} {
-                                set result(MirrorLockup) enable
-                            } else {
-                                set result(MirrorLockup) disable
-                            }
-                        } elseif {$func==4} {
-                            if {$v} {
-                                set result(Tv/AvExposureLevel) "1/3 stop"
-                            } else {
-                                set result(Tv/AvExposureLevel) "1/2 stop"
-                            }
-                        } elseif {$func==5} {
-                            if {$v} {
-                                set result(AFAssistLight) off
-                            } else {
-                                set result(AFAssistLight) on
-                            }
-                        } elseif {$func==6} {
-                            if {$v} {
-                                set result(ShutterSpeedInAVMode) "Fixed 1/200"
-                            } else {
-                                set result(ShutterSpeedInAVMode) "Auto"
-                            }
-                        } elseif {$func==7} {
-                            set result(AEBSeq/AutoCancel) [switch $v {
-                                0 {format "0, -, + enabled"}
-                                1 {format "0, -, + disabled"}
-                                2 {format "-, 0, + enabled"}
-                                3 {format "-, 0, + disabled"}
-                                default {format unknown}
-                            }]
-                        } elseif {$func==8} {
-                            if {$v} {
-                                set result(ShutterCurtainSync) "2nd curtain sync"
-                            } else {
-                                set result(ShutterCurtainSync) "1st curtain sync"
-                            }
-                        } elseif {$func==9} {
-                            set result(LensAFStopButtonFnSwitch) [switch $v {
-                                0 {format "AF stop"}
-                                1 {format "operate AF"}
-                                2 {format "lock AE and start timer"}
-                                default {format unknown}
-                            }]
-                        } elseif {$func==10} {
-                            if {$v} {
-                                set result(AutoReductionOfFillFlash) disable
-                            } else {
-                                set result(AutoReductionOfFillFlash) enable
-                            }
-                        } elseif {$func==11} {
-                            if {$v} {
-                                set result(MenuButtonReturnPosition) previous
-                            } else {
-                                set result(MenuButtonReturnPosition) top
-                            }
-                        } elseif {$func==12} {
-                            set result(SetButtonFuncWhenShooting) [switch $v {
-                                0 {format "not assigned"}
-                                1 {format "change quality"}
-                                2 {format "change ISO speed"}
-                                3 {format "select parameters"}
-                                default {format unknown}
-                            }]
-                        } elseif {$func==13} {
-                            if {$v} {
-                                set result(SensorCleaning) enable
-                            } else {
-                                set result(SensorCleaning) disable
-                            }
-                        } elseif {$func==0} {
-                            # Discovered by DNew?
-                            set result(CameraOwner) $v
-                        } else {
-                            append result(UnknownCustomFunc) "$func=$v "
-                        }
-                    }
-                }
-            } else {
-                debug [format "makerNote: Unrecognized TAG: 0x%x" $tag]
-            }
-        }
-    }
-    return [array get result]
-}
-
-proc ::exif::readShort {data offset} {
-    variable intel
-    if {[string length $data] < [expr {$offset+2}]} {
-        error "readShort: end of string reached"
-    }
-    set ch1 [string index $data $offset]
-    set ch2 [string index $data [expr {$offset+1}]]
-    scan $ch1 %c ch1 ; scan $ch2 %c ch2
-    if {$intel} {
-        return [expr {$ch1 + 256 * $ch2}]
-    } else {
-        return [expr {$ch2 + 256 * $ch1}]
-    }
-}
-
-proc ::exif::readLong {data offset} {
-    variable intel
-    if {[string length $data] < [expr {$offset+4}]} {
-        error "readLong: end of string reached"
-    }
-    set ch1 [string index $data $offset]
-    set ch2 [string index $data [expr {$offset+1}]]
-    set ch3 [string index $data [expr {$offset+2}]]
-    set ch4 [string index $data [expr {$offset+3}]]
-    scan $ch1 %c ch1 ; scan $ch2 %c ch2
-    scan $ch3 %c ch3 ; scan $ch4 %c ch4
-    if {$intel} {
-        return [expr {(((($ch4 * 256) + $ch3) * 256) + $ch2) * 256 + $ch1}]
-    } else {
-        return [expr {(((($ch1 * 256) + $ch2) * 256) + $ch3) * 256 + $ch4}]
-    }
-}
-
-proc ::exif::readIFDEntry {data format components offset} {
-    variable intel
-    if {$format == 2} {
-        # ASCII string
-        set value [string range $data $offset [expr {$offset+$components-1}]]
-        return [string trimright $value "\0"]
-    } elseif {$format == 3} {
-        # unsigned short
-        if {!$intel} {
-            set offset [expr {0xFFFF & ($offset >> 16)}]
-        }
-        return $offset
-    } elseif {$format == 4} {
-        # unsigned long
-        return $offset
-    } elseif {$format == 5} {
-        # unsigned rational
-        # This could be messy, if either is >2**31
-        set numerator [readLong $data $offset]
-        set denominator [readLong $data [expr {$offset + 4}]]
-        return [expr {(1.0*$numerator)/$denominator}]
-    } elseif {$format == 10} {
-        # signed rational
-        # Should work normally, since everything in Tcl is signed
-        set numerator [readLong $data $offset]
-        set denominator [readLong $data [expr {$offset + 4}]]
-        return [expr {(1.0*$numerator)/$denominator}]
-    } else {
-        set x [format %08x $format]
-        error "Invalid IFD entry format: $x"
-    }
-}
-
-proc ::exif::compensationFraction {value} {
-    if {$value==0} {return 0}
-    if {$value < 0} {
-        set result "-"
-        set value [expr {0-$value}]
-    } else {
-        set result "+"
-    }
-    set value [expr {int(0.5 + $value * 6)}]
-    set integer [expr {int($value / 6)}]
-    set sixths [expr {$value % 6}]
-    if {$integer != 0} {
-        append result $integer
-        if {$sixths != 0} {
-            append result " "
-        }
-    }
-    if {$sixths == 2} {
-        append result "1/3"
-    } elseif {$sixths == 3} {
-        append result "1/2" 
-    } elseif {$sixths == 4} {
-        append result "2/3"
-    } else {
-        # Added by DNew
-        append result "$sixths/6"
-    }
-    return $result
-}
-
-# This returns the list of all possible fieldnames
-# that analyze might return.
-proc ::exif::fieldnames {} {
-    variable cached_fieldnames 
-    if {[info exists cached_fieldnames]} {
-        return $cached_fieldnames
-    }
-    # Otherwise, parse the source to find the fieldnames.
-    # Cool, huh? Don'tcha just love Tcl?
-    # Because of this, "result(...)" should only appear
-    # in these functions when "..." is the literal name
-    # of a field to be returned.
-    array set namelist {}
-    foreach proc {analyze app1 exifSubIFD makerNote} {
-        set body [info body ::exif::$proc]
-        foreach line [split $body \n] {
-            if {[regexp {result\(([^)]+)\)} $line junk name]} {
-                set namelist($name) {}
-            }
-        }
-    }
-    set cached_fieldnames [lsort -dictionary [array names namelist]]
-    return $cached_fieldnames
-}
-
-
-
-# # # # # # # # # # # # # #
-# What follows is the original header comments
-# from the Perl code from which this is 
-# translated. Any changes I made directly
-# are marked by "DNew".
-
-# PERL script to extract EXIF information from JPEGs generated by Canon
-# digital cameras.
-# This software is free and you may do anything like with it except sell it.
-#
-# Current version: 1.3
-# Author: Chris Breeze
-# email: chris@breezesys.com
-# Web: http://www.breezesys.com
-#
-# Based on experimenting with my G1 and information from:
-# http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
-#
-# Also Canon MakerNote from David Burren's page:
-# http://www.burren.cx/david/canon.html
-#
-# More EXIF info and specs:
-# http://exif.org
-#
-# Warnings: 
-# 1) The Subject distance is unreliable. It seems reasonably accurate
-# for the G1 but on the D30 it is highly dependent on the lens fitted.
-#
-# Perl for Windows is available for free from:
-# http://www.activestate.com
-#
-# History
-# 11 Jan 2001
-# v0.1: Initial version
-#
-# 14 Jan 2001
-# v0.2: Updated with data from David Burren's page
-#
-# 15 Jan 2001
-# v0.3: Added more info for D30 (supplied by David Burren)
-# 1) D30 stores ISO in EXIF tag 0x8827, G1 uses MakerNote 0x1/16
-# 2) MakerNote 0x1/10, ImageSize appears to be large, medium, small
-# 3) D30 allows 1/2 or 1/3 stop exposure compensation
-# 4) Added D30 custom function details, but can't test them
-#
-# 17 Jan 2001
-# v1.0 Tidied up AutoFocusMode for G1 vs D30 + added manual auto focus point (D30)
-#
-# 18 Jan 2001
-# v1.1 Removed some debug code left in by mistake
-#
-# 29 Jan 2001
-# v1.2 Added flash mode (MakerNote Tag 1, field 4)
-#
-# 7 Mar 2001
-# v1.3 Added ImageQuality (MakerNote Tag 1, field 3)
-#
-# 21 Apr 2001
-# v1.4 added ImageStabilisation for Pro90 IS
-#
-# 17 Sep 2001
-# v1.5 Incorporated D30 improvements from Jim Leonard
-
-if {0} {
-    # Trivial usage example
-    set x [exif::fieldnames]
-    puts "fieldnames = $x"
-    set f [open [lindex $argv 0]]
-    array set v [exif::analyze $f]
-    close $f
-    parray v
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/exif/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/exif/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded exif 1.1.2 [list source [file join $dir exif.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/fileutil.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/fileutil.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2118 +1,0 @@
-# fileutil.tcl --
-#
-#	Tcl implementations of standard UNIX utilities.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2002      by Phil Ehrens <phil@slug.org> (fileType)
-# Copyright (c) 2005-2007 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: fileutil.tcl,v 1.70 2007/08/10 19:40:49 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require cmdline
-package provide fileutil 1.13.3
-
-namespace eval ::fileutil {
-    namespace export \
-	    grep find findByPattern cat touch foreachLine \
-	    jail stripPwd stripN stripPath tempdir tempfile \
-	    install fileType writeFile appendToFile \
-	    insertIntoFile removeFromFile replaceInFile \
-	    updateInPlace test tempdirReset
-}
-
-# ::fileutil::grep --
-#
-#	Implementation of grep.  Adapted from the Tcler's Wiki.
-#
-# Arguments:
-#	pattern		pattern to search for.
-#	files		list of files to search; if NULL, uses stdin.
-#
-# Results:
-#	results		list of matches
-
-proc ::fileutil::grep {pattern {files {}}} {
-    set result [list]
-    if {[llength $files] == 0} {
-	# read from stdin
-	set lnum 0
-	while {[gets stdin line] >= 0} {
-	    incr lnum
-	    if {[regexp -- $pattern $line]} {
-		lappend result "${lnum}:${line}"
-	    }
-	}
-    } else {
-	foreach filename $files {
-	    set file [open $filename r]
-	    set lnum 0
-	    while {[gets $file line] >= 0} {
-		incr lnum
-		if {[regexp -- $pattern $line]} {
-		    lappend result "${filename}:${lnum}:${line}"
-		}
-	    }
-	    close $file
-	}
-    }
-    return $result
-}
-
-# ::fileutil::find ==
-
-# Below is the core command, which is portable across Tcl versions and
-# platforms. Functionality which is common or platform and/or Tcl
-# version dependent, has been factored out/ encapsulated into separate
-# (small) commands. Only these commands may have multiple variant
-# implementations per the available features of the Tcl core /
-# platform.
-#
-# These commands are
-#
-# FADD   - Add path result, performs filtering. Portable!
-# GLOBF  - Return files in a directory.         Tcl version/platform dependent.
-# GLOBD  - Return dirs  in a directory.         Tcl version/platform dependent.
-# ACCESS - Check directory for accessibility.   Tcl version/platform dependent.
-
-proc ::fileutil::find {{basedir .} {filtercmd {}}} {
-    set result {}
-    set filt   [string length $filtercmd]
-
-    if {[file isfile $basedir]} {
-	# The base is a file, and therefore only possible result,
-	# modulo filtering.
-
-	FADD $basedir
-
-    } elseif {[file isdirectory $basedir]} {
-
-	# For a directory as base we do an iterative recursion through
-	# the directory hierarchy starting at the base. We use a queue
-	# (Tcl list) of directories we have to check. We access it by
-	# index, and stop when we have reached beyond the end of the
-	# list. This is faster than removing elements from the be-
-	# ginning of the list, as that entails copying down a possibly
-	# large list of directories, making it O(n*n). The index is
-	# faster, O(n), at the expense of memory. Nothing is deleted
-	# from the list until we have processed all directories in the
-	# hierarchy.
-	#
-	# We scan each directory at least twice. First for files, then
-	# for directories. The scans may internally make several
-	# passes (normal vs hidden files).
-	#
-	# Looped directory structures due to symbolic links are
-	# handled by _fully_ normalizing directory paths and checking
-	# if we encountered the normalized form before. The array
-	# 'known' is our cache where we record the known normalized
-	# paths.
-
-	set pending [list $basedir]
-	set at      0
-	array set   known {}
-
-	while {$at < [llength $pending]} {
-	    # Get next directory not yet processed.
-	    set current [lindex $pending $at]
-	    incr at
-
-	    # Is the directory accessible? Continue if not.
-	    ACCESS $current
-
-	    # Files first, then the sub-directories ...
-
-	    foreach f [GLOBF $current] { FADD $f }
-
-	    foreach f [GLOBD $current] {
-		# Ignore current and parent directory, this needs
-		# explicit filtering outside of the filter command.
-		if {
-		    [string equal [file tail $f]  "."] ||
-		    [string equal [file tail $f] ".."]
-		} continue
-
-		# Extend result, modulo filtering.
-		FADD $f
-
-		# Detection of symlink loops via a portable path
-		# normalization computing a canonical form of the path
-		# followed by a check if that canonical form was
-		# encountered before. If ok, record directory for
-		# expansion in future iterations.
-
-		set norm [fileutil::fullnormalize $f]
-		if {[info exists known($norm)]} continue
-		set known($norm) .
-
-		lappend pending $f
-	    }
-	}
-    } else {
-	return -code error "$basedir does not exist"
-    }
-
-    return $result
-}
-
-# Helper command for fileutil::find. Performs the filtering of the
-# result per a filter command for the candidates found by the
-# traversal core, see above. This is portable.
-
-proc ::fileutil::FADD {filename} {
-    upvar 1 result result filt filt filtercmd filtercmd
-    if {!$filt} {
-	lappend result $filename
-	return
-    }
-
-    set here [pwd]
-    cd [file dirname $filename]
-
-    if {[uplevel 2 [linsert $filtercmd end [file tail $filename]]]} {
-	lappend result $filename
-    }
-
-    cd $here
-    return
-}
-
-# The next three helper commands for fileutil::find depend strongly on
-# the version of Tcl, and partially on the platform.
-
-# 1. The -directory and -types swithes were added to glob in Tcl
-#    8.3. This means that we have to emulate them for Tcl 8.2.
-#
-# 2. In Tcl 8.3 using -types f will return only true files, but not
-#    links to files. This changed in 8.4+ where links to files are
-#    returned as well. So for 8.3 we have to handle the links
-#    separately (-types l) and also filter on our own.
-#    Note that Windows file links are hard links which are reported by
-#    -types f, but not -types l, so we can optimize that for the two
-#    platforms.
-#
-# 3. In Tcl 8.3 we also have a crashing bug in glob (SIGABRT, "stat on
-#    a known file") when trying to perform 'glob -types {hidden f}' on
-#    a directory without e'x'ecute permissions. We code around by
-#    testing if we can cd into the directory (stat might return enough
-#    information too (mode), but possibly also not portable).
-#
-#    For Tcl 8.2 and 8.4+ glob simply delivers an empty result
-#    (-nocomplain), without crashing. For them this command is defined
-#    so that the bytecode compiler removes it from the bytecode.
-#
-#    This bug made the ACCESS helper necessary.
-#    We code around the problem by testing if we can cd into the
-#    directory (stat might return enough information too (mode), but
-#    possibly also not portable).
-
-if {[package vsatisfies [package present Tcl] 8.4]} {
-    # Tcl 8.4+.
-    # (Ad 1) We have -directory, and -types,
-    # (Ad 2) Links are returned for -types f/d if they refer to files/dirs.
-    # (Ad 3) No bug to code around
-
-    proc ::fileutil::ACCESS {args} {}
-
-    proc ::fileutil::GLOBF {current} {
-	concat \
-	    [glob -nocomplain -directory $current -types f          -- *] \
-	    [glob -nocomplain -directory $current -types {hidden f} -- *]
-    }
-
-    proc ::fileutil::GLOBD {current} {
-	concat \
-	    [glob -nocomplain -directory $current -types d          -- *] \
-	    [glob -nocomplain -directory $current -types {hidden d} -- *]
-    }
-
-} elseif {[package vsatisfies [package present Tcl] 8.3]} {
-    # 8.3.
-    # (Ad 1) We have -directory, and -types,
-    # (Ad 2) Links are NOT returned for -types f/d, collect separately.
-    #        No symbolic file links on Windows.
-    # (Ad 3) Bug to code around.
-
-    proc ::fileutil::ACCESS {current} {
-	if {[catch {
-	    set h [pwd] ; cd $current ; cd $h
-	}]} {return -code continue}
-	return
-    }
-
-    if {[string equal $::tcl_platform(platform) windows]} {
-	proc ::fileutil::GLOBF {current} {
-	    concat \
-		[glob -nocomplain -directory $current -types f          -- *] \
-		[glob -nocomplain -directory $current -types {hidden f} -- *]]
-	}
-    } else {
-	proc ::fileutil::GLOBF {current} {
-	    set l [concat \
-		       [glob -nocomplain -directory $current -types f          -- *] \
-		       [glob -nocomplain -directory $current -types {hidden f} -- *]]
-
-	    foreach x [concat \
-			   [glob -nocomplain -directory $current -types l          -- *] \
-			   [glob -nocomplain -directory $current -types {hidden l} -- *]] {
-		if {![file isfile $x]} continue
-		lappend l $x
-	    }
-
-	    return $l
-	}
-    }
-
-    proc ::fileutil::GLOBD {current} {
-	set l [concat \
-		   [glob -nocomplain -directory $current -types d          -- *] \
-		   [glob -nocomplain -directory $current -types {hidden d} -- *]]
-
-	foreach x [concat \
-		       [glob -nocomplain -directory $current -types l          -- *] \
-		       [glob -nocomplain -directory $current -types {hidden l} -- *]] {
-	    if {![file isdirectory $x]} continue
-	    lappend l $x
-	}
-
-	return $l
-    }
-} else {
-    # 8.2.
-    # (Ad 1,2,3) We do not have -directory, nor -types. Full emulation required.
-
-    proc ::fileutil::ACCESS {args} {}
-
-    if {[string equal $::tcl_platform(platform) windows]} {
-	# Hidden files cannot be handled by Tcl 8.2 in glob. We have
-	# to punt.
-
-	proc ::fileutil::GLOBF {current} {
-	    set current \\[join [split $current {}] \\]
-	    set res {}
-	    foreach x [glob -nocomplain -- [file join $current *]] {
-		if {![file isfile $x]} continue
-		lappend res $x
-	    }
-	    return $res
-	}
-
-	proc ::fileutil::GLOBD {current} {
-	    set current \\[join [split $current {}] \\]
-	    set res {}
-	    foreach x [glob -nocomplain -- [file join $current *]] {
-		if {![file isdirectory $x]} continue
-		lappend res $x
-	    }
-	    return $res
-	}
-    } else {
-	# Hidden files on Unix are dot-files. We emulate the switch
-	# '-types hidden' by using an explicit pattern.
-
-	proc ::fileutil::GLOBF {current} {
-	    set current \\[join [split $current {}] \\]
-	    set res {}
-	    foreach x [glob -nocomplain -- [file join $current *] [file join $current .*]] {
-		if {![file isfile $x]} continue
-		lappend res $x
-	    }
-	    return $res
-	}
-
-	proc ::fileutil::GLOBD {current} {
-	    set current \\[join [split $current {}] \\]
-	    set res {}
-	    foreach x [glob -nocomplain -- [file join $current *] [file join $current .*]] {
-		if {![file isdirectory $x]} continue
-		lappend res $x
-	    }
-	    return $res
-	}
-    }
-}
-
-# ::fileutil::findByPattern --
-#
-#	Specialization of find. Finds files based on their names,
-#	which have to match the specified patterns. Options are used
-#	to specify which type of patterns (regexp-, glob-style) is
-#	used.
-#
-# Arguments:
-#	basedir		Directory to start searching from.
-#	args		Options (-glob, -regexp, --) followed by a
-#			list of patterns to search for.
-#
-# Results:
-#	files		a list of interesting files.
-
-proc ::fileutil::findByPattern {basedir args} {
-    set pos 0
-    set cmd ::fileutil::FindGlob
-    foreach a $args {
-	incr pos
-	switch -glob -- $a {
-	    --      {break}
-	    -regexp {set cmd ::fileutil::FindRegexp}
-	    -glob   {set cmd ::fileutil::FindGlob}
-	    -*      {return -code error "Unknown option $a"}
-	    default {incr pos -1 ; break}
-	}
-    }
-
-    set args [lrange $args $pos end]
-
-    if {[llength $args] != 1} {
-	set pname [lindex [info level 0] 0]
-	return -code error \
-		"wrong#args for \"$pname\", should be\
-		\"$pname basedir ?-regexp|-glob? ?--? patterns\""
-    }
-
-    set patterns [lindex $args 0]
-    return [find $basedir [list $cmd $patterns]]
-}
-
-
-# ::fileutil::FindRegexp --
-#
-#	Internal helper. Filter command used by 'findByPattern'
-#	to match files based on regular expressions.
-#
-# Arguments:
-#	patterns	List of regular expressions to match against.
-#	filename	Name of the file to match against the patterns.
-# Results:
-#	interesting	A boolean flag. Set to true if the file
-#			matches at least one of the patterns.
-
-proc ::fileutil::FindRegexp {patterns filename} {
-    foreach p $patterns {
-	if {[regexp -- $p $filename]} {
-	    return 1
-	}
-    }
-    return 0
-}
-
-# ::fileutil::FindGlob --
-#
-#	Internal helper. Filter command used by 'findByPattern'
-#	to match files based on glob expressions.
-#
-# Arguments:
-#	patterns	List of glob expressions to match against.
-#	filename	Name of the file to match against the patterns.
-# Results:
-#	interesting	A boolean flag. Set to true if the file
-#			matches at least one of the patterns.
-
-proc ::fileutil::FindGlob {patterns filename} {
-    foreach p $patterns {
-	if {[string match $p $filename]} {
-	    return 1
-	}
-    }
-    return 0
-}
-
-# ::fileutil::stripPwd --
-#
-#	If the specified path references is a path in [pwd] (or [pwd] itself) it
-#	is made relative to [pwd]. Otherwise it is left unchanged.
-#	In the case of [pwd] itself the result is the string '.'.
-#
-# Arguments:
-#	path		path to modify
-#
-# Results:
-#	path		The (possibly) modified path.
-
-proc ::fileutil::stripPwd {path} {
-
-    # [file split] is used to generate a canonical form for both
-    # paths, for easy comparison, and also one which is easy to modify
-    # using list commands.
-
-    set pwd [pwd]
-    if {[string equal $pwd $path]} {
-	return "."
-    }
-
-    set pwd   [file split $pwd]
-    set npath [file split $path]
-
-    if {[string match ${pwd}* $npath]} {
-	set path [eval [linsert [lrange $npath [llength $pwd] end] 0 file join ]]
-    }
-    return $path
-}
-
-# ::fileutil::stripN --
-#
-#	Removes N elements from the beginning of the path.
-#
-# Arguments:
-#	path		path to modify
-#	n		number of elements to strip
-#
-# Results:
-#	path		The modified path
-
-proc ::fileutil::stripN {path n} {
-    set path [file split $path]
-    if {$n >= [llength $path]} {
-	return {}
-    } else {
-	return [eval [linsert [lrange $path $n end] 0 file join]]
-    }
-}
-
-# ::fileutil::stripPath --
-#
-#	If the specified path references/is a path in prefix (or prefix itself) it
-#	is made relative to prefix. Otherwise it is left unchanged.
-#	In the case of it being prefix itself the result is the string '.'.
-#
-# Arguments:
-#	prefix		prefix to strip from the path.
-#	path		path to modify
-#
-# Results:
-#	path		The (possibly) modified path.
-
-proc ::fileutil::stripPath {prefix path} {
-    # [file split] is used to generate a canonical form for both
-    # paths, for easy comparison, and also one which is easy to modify
-    # using list commands.
-
-    if {[string equal $prefix $path]} {
-	return "."
-    }
-
-    set prefix [file split $prefix]
-    set npath  [file split $path]
-
-    if {[string match ${prefix}* $npath]} {
-	set path [eval [linsert [lrange $npath [llength $prefix] end] 0 file join ]]
-    }
-    return $path
-}
-
-# ::fileutil::jail --
-#
-#	Ensures that the input path 'filename' stays within the the
-#	directory 'jail'. In this way it preventsuser-supplied paths
-#	from escaping the jail.
-#
-# Arguments:
-#	jail		The path to the directory the other must
-#			not escape from.
-#	filename	The path to prevent from escaping.
-#
-# Results:
-#	path		The (possibly) modified path surely within
-#			the confines of the jail.
-
-proc fileutil::jail {jail filename} {
-    if {![string equal [file pathtype $filename]  "relative"]} {
-	# Although the path to check is absolute (or volumerelative on
-	# windows) we cannot perform a simple prefix check to see if
-	# the path is inside the jail or not. We have to normalize
-	# both path and jail and then we can check. If the path is
-	# outside we make the original path relative and prefix it
-	# with the original jail. We do make the jail pseudo-absolute
-	# by prefixing it with the current working directory for that.
-
-	# Normalized jail. Fully resolved sym links, if any. Our main
-	# complication is that normalize does not resolve symlinks in the
-	# last component of the path given to it, so we add a bogus
-	# component, resolve, and then strip it off again. That is why the
-	# code is so large and long.
-
-	set njail [eval [list file join] [lrange [file split \
-		[Normalize [file join $jail __dummy__]]] 0 end-1]]
-
-	# Normalize filename. Fully resolved sym links, if
-	# any. S.a. for an explanation of the complication.
-
-	set nfile [eval [list file join] [lrange [file split \
-		[Normalize [file join $filename __dummy__]]] 0 end-1]]
-
-	if {[string match ${njail}* $nfile]} {
-	    return $filename
-	}
-
-	# Outside the jail, put it inside. ... We normalize the input
-	# path lexically for this, to prevent escapes still lurking in
-	# the original path. (We cannot use the normalized path,
-	# symlinks may have bent it out of shape in unrecognizable ways.
-
-	return [eval [linsert [lrange [file split \
-		[LexNormalize $filename]] 1 end] 0 file join [pwd] $jail]]
-    } else {
-	# The path is relative, consider it as outside
-	# implicitly. Normalize it lexically! to prevent escapes, then
-	# put the jail in front, use PWD to ensure absoluteness.
-
-	return [eval [linsert [file split [LexNormalize $filename]] 0 \
-		file join [pwd] $jail]]
-    }
-}
-
-
-# ::fileutil::test --
-#
-#	Simple API to testing various properties of
-#	a path (read, write, file/dir, existence)
-#
-# Arguments:
-#	path	path to test
-#	codes	names of the properties to test
-#	msgvar	Name of variable to leave an error
-#		message in. Optional.
-#	label	Label for error message, optional
-#
-# Results:
-#	ok	boolean flag, set if the path passes
-#		all tests.
-
-namespace eval ::fileutil {
-    variable  test
-    array set test {
-	read   {readable    {Read access is denied}}
-	write  {writable    {Write access is denied}}
-	exec   {executable  {Is not executable}}
-	exists {exists      {Does not exist}}
-	file   {isfile      {Is not a file}}
-	dir    {isdirectory {Is not a directory}}
-    }
-}
-
-proc ::fileutil::test {path codes {msgvar {}} {label {}}} {
-    variable test
-
-    if {[string equal $msgvar ""]} {
-	set msg ""
-    } else {
-	upvar 1 $msgvar msg
-    }
-
-    if {![string equal $label ""]} {append label { }}
-
-    if {![regexp {^(read|write|exec|exists|file|dir)} $codes]} {
-	# Translate single characters into proper codes
-	set codes [string map {
-	    r read w write e exists x exec f file d dir
-	} [split $codes {}]]
-    }
-
-    foreach c $codes {
-	foreach {cmd text} $test($c) break
-	if {![file $cmd $path]} {
-	    set msg "$label\"$path\": $text"
-	    return 0
-	}
-    }
-
-    return 1
-}
-
-# ::fileutil::cat --
-#
-#	Tcl implementation of the UNIX "cat" command.  Returns the contents
-#	of the specified files.
-#
-# Arguments:
-#	args	names of the files to read, interspersed with options
-#		to set encodings, translations, or eofchar.
-#
-# Results:
-#	data	data read from the file.
-
-proc ::fileutil::cat {args} {
-    # Syntax: (?options? file)+
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    if {![llength $args]} {
-	# Argument processing stopped with arguments missing.
-	return -code error \
-		"wrong#args: should be\
-		[lindex [info level 0] 0] ?-eofchar|-translation|-encoding arg?+ file ..."
-    }
-
-    # We go through the arguments using foreach and keeping track of
-    # the index we are at. We do not shift the arguments out to the
-    # left. That is inherently quadratic, copying everything down.
-
-    set opts {}
-    set mode maybeopt
-    set channels {}
-
-    foreach a $args {
-	if {[string equal $mode optarg]} {
-	    lappend opts $a
-	    set mode maybeopt
-	    continue
-	} elseif {[string equal $mode maybeopt]} {
-	    if {[string match -* $a]} {
-		switch -exact -- $a {
-		    -encoding -
-		    -translation -
-		    -eofchar {
-			lappend opts $a
-			set mode optarg
-			continue
-		    }
-		    -- {
-			set mode file
-			continue
-		    }
-		    default {
-			return -code error \
-				"Bad option \"$a\",\
-				expected one of\
-				-encoding, -eofchar,\
-				or -translation"
-		    }
-		}
-	    }
-	    # Not an option, but a file. Change mode and fall through.
-	    set mode file
-	}
-	# Process file arguments
-
-	if {[string equal $a -]} {
-	    # Stdin reference is special.
-
-	    # Test that the current options are all ok.
-	    # For stdin we have to avoid closing it.
-
-	    set old [fconfigure stdin]
-	    set fail [catch {
-		SetOptions stdin $opts
-	    } msg] ; # {}
-	    SetOptions stdin $old
-
-	    if {$fail} {
-		return -code error $msg
-	    }
-
-	    lappend channels [list $a $opts 0]
-	} else {
-	    if {![file exists $a]} {
-		return -code error "Cannot read file \"$a\", does not exist"
-	    } elseif {![file isfile $a]} {
-		return -code error "Cannot read file \"$a\", is not a file"
-	    } elseif {![file readable $a]} {
-		return -code error "Cannot read file \"$a\", read access is denied"
-	    }
-
-	    # Test that the current options are all ok.
-	    set c [open $a r]
-	    set fail [catch {
-		SetOptions $c $opts
-	    } msg] ; # {}
-	    close $c
-	    if {$fail} {
-		return -code error $msg
-	    }
-
-	    lappend channels [list $a $opts [file size $a]]
-	}
-
-	# We may have more options and files coming after.
-	set mode maybeopt
-    }
-
-    if {![string equal $mode maybeopt]} {
-	# Argument processing stopped with arguments missing.
-	return -code error \
-		"wrong#args: should be\
-		[lindex [info level 0] 0] ?-eofchar|-translation|-encoding arg?+ file ..."
-    }
-
-    set data ""
-    foreach c $channels {
-	foreach {fname opts size} $c break
-
-	if {[string equal $fname -]} {
-	    set old [fconfigure stdin]
-	    SetOptions stdin $opts
-	    append data [read stdin]
-	    SetOptions stdin $old
-	    continue
-	}
-
-	set c [open $fname r]
-	SetOptions $c $opts
-
-	if {$size > 0} {
-	    # Used the [file size] command to get the size, which
-	    # preallocates memory, rather than trying to grow it as
-	    # the read progresses.
-	    append data [read $c $size]
-	} else {
-	    # if the file has zero bytes it is either empty, or
-	    # something where [file size] reports 0 but the file
-	    # actually has data (like the files in the /proc
-	    # filesystem on Linux).
-	    append data [read $c]
-	}
-	close $c
-    }
-
-    return $data
-}
-
-# ::fileutil::writeFile --
-#
-#	Write the specified data into the named file,
-#	creating it if necessary.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to write.
-#	data		The data to write into the file
-#
-# Results:
-#	None.
-
-proc ::fileutil::writeFile {args} {
-    # Syntax: ?options? file data
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec Writable $args opts fname data
-
-    # Now perform the requested operation.
-
-    file mkdir [file dirname $fname]
-    set              c [open $fname w]
-    SetOptions      $c $opts
-    puts -nonewline $c $data
-    close           $c
-    return
-}
-
-# ::fileutil::appendToFile --
-#
-#	Append the specified data at the end of the named file,
-#	creating it if necessary.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to extend.
-#	data		The data to extend the file with.
-#
-# Results:
-#	None.
-
-proc ::fileutil::appendToFile {args} {
-    # Syntax: ?options? file data
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec Writable $args opts fname data
-
-    # Now perform the requested operation.
-
-    file mkdir [file dirname $fname]
-    set              c [open $fname a]
-    SetOptions      $c $opts
-    set at    [tell $c]
-    puts -nonewline $c $data
-    close           $c
-    return $at
-}
-
-# ::fileutil::insertIntoFile --
-#
-#	Insert the specified data into the named file,
-#	creating it if necessary, at the given locaton.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to extend.
-#	data		The data to extend the file with.
-#
-# Results:
-#	None.
-
-proc ::fileutil::insertIntoFile {args} {
-
-    # Syntax: ?options? file at data
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec ReadWritable $args opts fname at data
-
-    set max [file size $fname]
-    CheckLocation $at $max insertion
-
-    if {[string length $data] == 0} {
-	# Another degenerate case, inserting nothing.
-	# Leave the file well enough alone.
-	return
-    }
-
-    foreach {c o t} [Open2 $fname $opts] break
-
-    # The degenerate cases of both appending and insertion at the
-    # beginning of the file allow more optimized implementations of
-    # the operation.
-
-    if {$at == 0} {
-	puts -nonewline    $o $data
-	fcopy           $c $o
-    } elseif {$at == $max} {
-	fcopy           $c $o
-	puts -nonewline    $o $data
-    } else {
-	fcopy           $c $o -size $at
-	puts -nonewline    $o $data
-	fcopy           $c $o
-    }
-
-    Close2 $fname $t $c $o
-    return
-}
-
-# ::fileutil::removeFromFile --
-#
-#	Remove n characters from the named file,
-#	starting at the given locaton.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to extend.
-#	at		Location to start the removal from.
-#	n		Number of characters to remove.
-#
-# Results:
-#	None.
-
-proc ::fileutil::removeFromFile {args} {
-
-    # Syntax: ?options? file at n
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec ReadWritable $args opts fname at n
-
-    set max [file size $fname]
-    CheckLocation    $at $max removal
-    CheckLength   $n $at $max removal
-
-    if {$n == 0} {
-	# Another degenerate case, removing nothing.
-	# Leave the file well enough alone.
-	return
-    }
-
-    foreach {c o t} [Open2 $fname $opts] break
-
-    # The degenerate cases of both removal from the beginning or end
-    # of the file allow more optimized implementations of the
-    # operation.
-
-    if {$at == 0} {
-	seek  $c    $n current
-	fcopy $c $o
-    } elseif {($at + $n) == $max} {
-	fcopy $c $o -size $at
-	# Nothing further to copy.
-    } else {
-	fcopy $c $o -size $at
-	seek  $c    $n current
-	fcopy $c $o
-    }
-
-    Close2 $fname $t $c $o
-    return
-}
-
-# ::fileutil::replaceInFile --
-#
-#	Remove n characters from the named file,
-#	starting at the given locaton, and replace
-#	it with the given data.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to extend.
-#	at		Location to start the removal from.
-#	n		Number of characters to remove.
-#	data		The replacement data.
-#
-# Results:
-#	None.
-
-proc ::fileutil::replaceInFile {args} {
-
-    # Syntax: ?options? file at n data
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec ReadWritable $args opts fname at n data
-
-    set max [file size $fname]
-    CheckLocation    $at $max replacement
-    CheckLength   $n $at $max replacement
-
-    if {
-	($n == 0) &&
-	([string length $data] == 0)
-    } {
-	# Another degenerate case, replacing nothing with
-	# nothing. Leave the file well enough alone.
-	return
-    }
-
-    foreach {c o t} [Open2 $fname $opts] break
-
-    # Check for degenerate cases and handle them separately,
-    # i.e. strip the no-op parts out of the general implementation.
-
-    if {$at == 0} {
-	if {$n == 0} {
-	    # Insertion instead of replacement.
-
-	    puts -nonewline    $o $data
-	    fcopy           $c $o
-
-	} elseif {[string length $data] == 0} {
-	    # Removal instead of replacement.
-
-	    seek  $c    $n current
-	    fcopy $c $o
-
-	} else {
-	    # General replacement at front.
-
-	    seek         $c    $n current
-	    puts -nonewline $o $data
-	    fcopy        $c $o
-	}
-    } elseif {($at + $n) == $max} {
-	if {$n == 0} {
-	    # Appending instead of replacement
-
-	    fcopy           $c $o
-	    puts -nonewline    $o $data
-
-	} elseif {[string length $data] == 0} {
-	    # Truncating instead of replacement
-
-	    fcopy $c $o -size $at
-	    # Nothing further to copy.
-
-	} else {
-	    # General replacement at end
-
-	    fcopy        $c $o -size $at
-	    puts -nonewline $o $data
-	}
-    } else {
-	if {$n == 0} {
-	    # General insertion.
-
-	    fcopy           $c $o -size $at
-	    puts -nonewline    $o $data
-	    fcopy           $c $o
-
-	} elseif {[string length $data] == 0} {
-	    # General removal.
-
-	    fcopy $c $o -size $at
-	    seek  $c    $n current
-	    fcopy $c $o
-
-	} else {
-	    # General replacement.
-
-	    fcopy        $c $o -size $at
-	    seek         $c    $n current
-	    puts -nonewline $o $data
-	    fcopy        $c $o
-	}
-    }
-
-    Close2 $fname $t $c $o
-    return
-}
-
-# ::fileutil::updateInPlace --
-#
-#	Run command prefix on the contents of the
-#	file and replace them with the result of
-#	the command.
-#
-# Arguments:
-#	options...	Options and arguments.
-#	filename	Path to the file to extend.
-#	cmd		Command prefix to run.
-#
-# Results:
-#	None.
-
-proc ::fileutil::updateInPlace {args} {
-    # Syntax: ?options? file cmd
-    # options = -encoding    ENC
-    #         | -translation TRA
-    #         | -eofchar     ECH
-    #         | --
-
-    Spec ReadWritable $args opts fname cmd
-
-    # readFile/cat inlined ...
-
-    set             c [open $fname r]
-    SetOptions     $c $opts
-    set data [read $c]
-    close          $c
-
-    # Transformation. Abort and do not modify the target file if an
-    # error was raised during this step.
-
-    lappend cmd $data
-    set code [catch {uplevel 1 $cmd} res]
-    if {$code} {
-	return -code $code $res
-    }
-
-    # writeFile inlined, with careful preservation of old contents
-    # until we are sure that the write was ok.
-
-    if {[catch {
-	file rename -force $fname ${fname}.bak
-
-	set              o [open $fname w]
-	SetOptions      $o $opts
-	puts -nonewline $o $res
-	close           $o
-
-	file delete -force ${fname}.bak
-    } msg]} {
-	if {[file exists ${fname}.bak]} {
-	    catch {
-		file rename -force ${fname}.bak $fname
-	    }
-	    return -code error $msg
-	}
-    }
-    return
-}
-
-proc ::fileutil::Writable {fname mv} {
-    upvar 1 $mv msg
-    if {[file exists $fname]} {
-	if {![file isfile $fname]} {
-	    set msg "Cannot use file \"$fname\", is not a file"
-	    return 0
-	} elseif {![file writable $fname]} {
-	    set msg "Cannot use file \"$fname\", write access is denied"
-	    return 0
-	}
-    }
-    return 1
-}
-
-proc ::fileutil::ReadWritable {fname mv} {
-    upvar 1 $mv msg
-    if {![file exists $fname]} {
-	set msg "Cannot use file \"$fname\", does not exist"
-	return 0
-    } elseif {![file isfile $fname]} {
-	set msg "Cannot use file \"$fname\", is not a file"
-	return 0
-    } elseif {![file writable $fname]} {
-	set msg "Cannot use file \"$fname\", write access is denied"
-	return 0
-    } elseif {![file readable $fname]} {
-	set msg "Cannot use file \"$fname\", read access is denied"
-	return 0
-    }
-    return 1
-}
-
-proc ::fileutil::Spec {check alist ov fv args} {
-    upvar 1 $ov opts $fv fname
-
-    set  n [llength $args] ; # Num more args
-    incr n                 ; # Count path as well
-
-    set opts {}
-    set mode maybeopt
-
-    set at 0
-    foreach a $alist {
-	if {[string equal $mode optarg]} {
-	    lappend opts $a
-	    set mode maybeopt
-	    incr at
-	    continue
-	} elseif {[string equal $mode maybeopt]} {
-	    if {[string match -* $a]} {
-		switch -exact -- $a {
-		    -encoding -
-		    -translation -
-		    -eofchar {
-			lappend opts $a
-			set mode optarg
-			incr at
-			continue
-		    }
-		    -- {
-			# Stop processing.
-			incr at
-			break
-		    }
-		    default {
-			return -code error \
-				"Bad option \"$a\",\
-				expected one of\
-				-encoding, -eofchar,\
-				or -translation"
-		    }
-		}
-	    }
-	    # Not an option, but a file.
-	    # Stop processing.
-	    break
-	}
-    }
-
-    if {([llength $alist] - $at) != $n} {
-	# Argument processing stopped with arguments missing, or too
-	# many
-	return -code error \
-		"wrong#args: should be\
-		[lindex [info level 1] 0] ?-eofchar|-translation|-encoding arg? file $args"
-    }
-
-    set fname [lindex $alist $at]
-    incr at
-    foreach \
-	    var $args \
-	    val [lrange $alist $at end] {
-	upvar 1 $var A
-	set A $val
-    }
-
-    # Check given path ...
-
-    if {![eval [linsert $check end $a msg]]} {
-	return -code error $msg
-    }
-
-    return
-}
-
-proc ::fileutil::Open2 {fname opts} {
-    set c [open $fname r]
-    set t [tempfile]
-    set o [open $t     w]
-
-    SetOptions $c $opts
-    SetOptions $o $opts
-
-    return [list $c $o $t]
-}
-
-proc ::fileutil::Close2 {f temp in out} {
-    close $in
-    close $out
-
-    file copy   -force $f ${f}.bak
-    file rename -force $temp $f
-    file delete -force ${f}.bak
-    return
-}
-
-proc ::fileutil::SetOptions {c opts} {
-    if {![llength $opts]} return
-    eval [linsert $opts 0 fconfigure $c]
-    return
-}
-
-proc ::fileutil::CheckLocation {at max label} {
-    if {![string is integer -strict $at]} {
-	return -code error \
-		"Expected integer but got \"$at\""
-    } elseif {$at < 0} {
-	return -code error \
-		"Bad $label point $at, before start of data"
-    } elseif {$at > $max} {
-	return -code error \
-		"Bad $label point $at, behind end of data"
-    }
-}
-
-proc ::fileutil::CheckLength {n at max label} {
-    if {![string is integer -strict $n]} {
-	return -code error \
-		"Expected integer but got \"$n\""
-    } elseif {$n < 0} {
-	return -code error \
-		"Bad $label size $n"
-    } elseif {($at + $n) > $max} {
-	return -code error \
-		"Bad $label size $n, going behind end of data"
-    }
-}
-
-# ::fileutil::foreachLine --
-#
-#	Executes a script for every line in a file.
-#
-# Arguments:
-#	var		name of the variable to contain the lines
-#	filename	name of the file to read.
-#	cmd		The script to execute.
-#
-# Results:
-#	None.
-
-proc ::fileutil::foreachLine {var filename cmd} {
-    upvar 1 $var line
-    set fp [open $filename r]
-
-    # -future- Use try/eval from tcllib/control
-    catch {
-	set code 0
-	set result {}
-	while {[gets $fp line] >= 0} {
-	    set code [catch {uplevel 1 $cmd} result]
-	    if {($code != 0) && ($code != 4)} {break}
-	}
-    }
-    close $fp
-
-    if {($code == 0) || ($code == 3) || ($code == 4)} {
-        return $result
-    }
-    if {$code == 1} {
-        global errorCode errorInfo
-        return \
-		-code      $code      \
-		-errorcode $errorCode \
-		-errorinfo $errorInfo \
-		$result
-    }
-    return -code $code $result
-}
-
-# ::fileutil::touch --
-#
-#	Tcl implementation of the UNIX "touch" command.
-#
-#	touch [-a] [-m] [-c] [-r ref_file] [-t time] filename ...
-#
-# Arguments:
-#	-a		change the access time only, unless -m also specified
-#	-m		change the modification time only, unless -a also specified
-#	-c		silently prevent creating a file if it did not previously exist
-#	-r ref_file	use the ref_file's time instead of the current time
-#	-t time		use the specified time instead of the current time
-#			("time" is an integer clock value, like [clock seconds])
-#	filename ...	the files to modify
-#
-# Results
-#	None.
-#
-# Errors:
-#	Both of "-r" and "-t" cannot be specified.
-
-if {[package vsatisfies [package provide Tcl] 8.3]} {
-    namespace eval ::fileutil {
-	namespace export touch
-    }
-
-    proc ::fileutil::touch {args} {
-        # Don't bother catching errors, just let them propagate up
-        
-        set options {
-            {a          "set the atime only"}
-            {m          "set the mtime only"}
-            {c          "do not create non-existant files"}
-            {r.arg  ""  "use time from ref_file"}
-            {t.arg  -1  "use specified time"}
-        }
-        set usage ": [lindex [info level 0] 0]\
-                      \[options] filename ...\noptions:"
-        array set params [::cmdline::getoptions args $options $usage]
-        
-        # process -a and -m options
-        set set_atime [set set_mtime "true"]
-        if {  $params(a) && ! $params(m)} {set set_mtime "false"}
-        if {! $params(a) &&   $params(m)} {set set_atime "false"}
-        
-        # process -r and -t
-        set has_t [expr {$params(t) != -1}]
-        set has_r [expr {[string length $params(r)] > 0}]
-        if {$has_t && $has_r} {
-            return -code error "Cannot specify both -r and -t"
-        } elseif {$has_t} {
-            set atime [set mtime $params(t)]
-        } elseif {$has_r} {
-            file stat $params(r) stat
-            set atime $stat(atime)
-            set mtime $stat(mtime)
-        } else {
-            set atime [set mtime [clock seconds]]
-        }
-
-        # do it
-        foreach filename $args {
-            if {! [file exists $filename]} {
-                if {$params(c)} {continue}
-                close [open $filename w]
-            }
-            if {$set_atime} {file atime $filename $atime}
-            if {$set_mtime} {file mtime $filename $mtime}
-        }
-        return
-    }
-}
-
-# ::fileutil::fileType --
-#
-#	Do some simple heuristics to determine file type.
-#
-#
-# Arguments:
-#	filename        Name of the file to test.
-#
-# Results
-#	type            Type of the file.  May be a list if multiple tests
-#                       are positive (eg, a file could be both a directory 
-#                       and a link).  In general, the list proceeds from most
-#                       general (eg, binary) to most specific (eg, gif), so
-#                       the full type for a GIF file would be 
-#                       "binary graphic gif"
-#
-#                       At present, the following types can be detected:
-#
-#                       directory
-#                       empty
-#                       binary
-#                       text
-#                       script <interpreter>
-#                       executable [elf, dos, ne, pe]
-#                       binary graphic [gif, jpeg, png, tiff, bitmap, icns]
-#                       ps, eps, pdf
-#                       html
-#                       xml <doctype>
-#                       message pgp
-#                       compressed [bzip, gzip, zip, tar]
-#                       audio [mpeg, wave]
-#                       gravity_wave_data_frame
-#                       link
-#			doctools, doctoc, and docidx documentation files.
-#                  
-
-proc ::fileutil::fileType {filename} {
-    ;## existence test
-    if { ! [ file exists $filename ] } {
-        set err "file not found: '$filename'"
-        return -code error $err
-    }
-    ;## directory test
-    if { [ file isdirectory $filename ] } {
-        set type directory
-        if { ! [ catch {file readlink $filename} ] } {
-            lappend type link
-        }
-        return $type
-    }
-    ;## empty file test
-    if { ! [ file size $filename ] } {
-        set type empty
-        if { ! [ catch {file readlink $filename} ] } {
-            lappend type link
-        }
-        return $type
-    }
-    set bin_rx {[\x00-\x08\x0b\x0e-\x1f]}
-
-    if { [ catch {
-        set fid [ open $filename r ]
-        fconfigure $fid -translation binary
-        fconfigure $fid -buffersize 1024
-        fconfigure $fid -buffering full
-        set test [ read $fid 1024 ]
-        ::close $fid
-    } err ] } {
-        catch { ::close $fid }
-        return -code error "::fileutil::fileType: $err"
-    }
-
-    if { [ regexp $bin_rx $test ] } {
-        set type binary
-        set binary 1
-    } else {
-        set type text
-        set binary 0
-    }
-
-    # SF Tcllib bug [795585]. Allowing whitespace between #!
-    # and path of script interpreter
-
-    set metakit 0
-
-    if { [ regexp {^\#\!\s*(\S+)} $test -> terp ] } {
-        lappend type script $terp
-    } elseif {[regexp "\\\[manpage_begin " $test]} {
-	lappend type doctools
-    } elseif {[regexp "\\\[toc_begin " $test]} {
-	lappend type doctoc
-    } elseif {[regexp "\\\[index_begin " $test]} {
-	lappend type docidx
-    } elseif { $binary && [ regexp {^[\x7F]ELF} $test ] } {
-        lappend type executable elf
-    } elseif { $binary && [string match "MZ*" $test] } {
-        if { [scan [string index $test 24] %c] < 64 } {
-            lappend type executable dos
-        } else {
-            binary scan [string range $test 60 61] s next
-            set sig [string range $test $next [expr {$next + 1}]]
-            if { $sig == "NE" || $sig == "PE" } {
-                lappend type executable [string tolower $sig]
-            } else {
-                lappend type executable dos
-            }
-        }
-    } elseif { $binary && [string match "BZh91AY\&SY*" $test] } {
-        lappend type compressed bzip
-    } elseif { $binary && [string match "\x1f\x8b*" $test] } {
-        lappend type compressed gzip
-    } elseif { $binary && [string range $test 257 262] == "ustar\x00" } {
-        lappend type compressed tar
-    } elseif { $binary && [string match "\x50\x4b\x03\x04*" $test] } {
-        lappend type compressed zip
-    } elseif { $binary && [string match "GIF*" $test] } {
-        lappend type graphic gif
-    } elseif { $binary && [string match "icns*" $test] } {
-        lappend type graphic icns bigendian
-    } elseif { $binary && [string match "snci*" $test] } {
-        lappend type graphic icns smallendian
-    } elseif { $binary && [string match "\x89PNG*" $test] } {
-        lappend type graphic png
-    } elseif { $binary && [string match "\xFF\xD8\xFF*" $test] } {
-        binary scan $test x3H2x2a5 marker txt
-        if { $marker == "e0" && $txt == "JFIF\x00" } {
-            lappend type graphic jpeg jfif
-        } elseif { $marker == "e1" && $txt == "Exif\x00" } {
-            lappend type graphic jpeg exif
-        }
-    } elseif { $binary && [string match "MM\x00\**" $test] } {
-        lappend type graphic tiff
-    } elseif { $binary && [string match "BM*" $test] && [string range $test 6 9] == "\x00\x00\x00\x00" } {
-        lappend type graphic bitmap
-    } elseif { $binary && [string match "\%PDF\-*" $test] } {
-        lappend type pdf
-    } elseif { ! $binary && [string match -nocase "*\<html\>*" $test] } {
-        lappend type html
-    } elseif { [string match "\%\!PS\-*" $test] } {
-       lappend type ps
-       if { [string match "* EPSF\-*" $test] } {
-           lappend type eps
-       }
-    } elseif { [string match -nocase "*\<\?xml*" $test] } {
-        lappend type xml
-        if { [ regexp -nocase {\<\!DOCTYPE\s+(\S+)} $test -> doctype ] } {
-            lappend type $doctype
-        }
-    } elseif { [string match {*BEGIN PGP MESSAGE*} $test] } {
-        lappend type message pgp
-    } elseif { $binary && [string match {IGWD*} $test] } {
-        lappend type gravity_wave_data_frame
-    } elseif {[string match "JL\x1a\x00*" $test] && ([file size $filename] >= 27)} {
-	lappend type metakit smallendian
-	set metakit 1
-    } elseif {[string match "LJ\x1a\x00*" $test] && ([file size $filename] >= 27)} {
-	lappend type metakit bigendian
-	set metakit 1
-    } elseif { $binary && [string match "RIFF*" $test] && [string range $test 8 11] == "WAVE" } {
-        lappend type audio wave
-    } elseif { $binary && [string match "ID3*" $test] } {
-        lappend type audio mpeg
-    } elseif { $binary && [binary scan $test S tmp] && [expr {$tmp & 0xFFE0}] == 65504 } {
-        lappend type audio mpeg
-    }
-
-    # Additional checks of file contents at the end of the file,
-    # possibly pointing into the middle too (attached metakit,
-    # attached zip).
-
-    ## Metakit File format: http://www.equi4.com/metakit/metakit-ff.html
-    ## Metakit database attached ? ##
-
-    if {!$metakit && ([file size $filename] >= 27)} {
-	# The offsets in the footer are in always bigendian format
-
-	if { [ catch {
-	    set fid [ open $filename r ]
-	    fconfigure $fid -translation binary
-	    fconfigure $fid -buffersize 1024
-	    fconfigure $fid -buffering full
-	    seek $fid -16 end
-	    set test [ read $fid 16 ]
-	    ::close $fid
-	} err ] } {
-	    catch { ::close $fid }
-	    return -code error "::fileutil::fileType: $err"
-	}
-
-	binary scan $test IIII __ hdroffset __ __
-	set hdroffset [expr {[file size $filename] - 16 - $hdroffset}]
-
-	# Further checks iff the offset is actually inside the file.
-
-	if {($hdroffset >= 0) && ($hdroffset < [file size $filename])} {
-	    # Seek to the specified location and try to match a metakit header
-	    # at this location.
-
-	    if { [ catch {
-		set         fid [ open $filename r ]
-		fconfigure $fid -translation binary
-		fconfigure $fid -buffersize 1024
-		fconfigure $fid -buffering full
-		seek       $fid $hdroffset start
-		set test [ read $fid 16 ]
-		::close $fid
-	    } err ] } {
-		catch { ::close $fid }
-		return -code error "::fileutil::fileType: $err"
-	    }
-
-	    if {[string match "JL\x1a\x00*" $test]} {
-		lappend type attached metakit smallendian
-		set metakit 1
-	    } elseif {[string match "LJ\x1a\x00*" $test]} {
-		lappend type attached metakit bigendian
-		set metakit 1
-	    }
-	}
-    }
-
-    ## Zip File Format: http://zziplib.sourceforge.net/zzip-parse.html
-    ## http://www.pkware.com/products/enterprise/white_papers/appnote.html
-
-
-    ;## lastly, is it a link?
-    if { ! [ catch {file readlink $filename} ] } {
-        lappend type link
-    }
-    return $type
-}
-
-# ::fileutil::tempdir --
-#
-#	Return the correct directory to use for temporary files.
-#	Python attempts this sequence, which seems logical:
-#
-#       1. The directory named by the `TMPDIR' environment variable.
-#
-#       2. The directory named by the `TEMP' environment variable.
-#
-#       3. The directory named by the `TMP' environment variable.
-#
-#       4. A platform-specific location:
-#            * On Macintosh, the `Temporary Items' folder.
-#
-#            * On Windows, the directories `C:\\TEMP', `C:\\TMP',
-#              `\\TEMP', and `\\TMP', in that order.
-#
-#            * On all other platforms, the directories `/tmp',
-#              `/var/tmp', and `/usr/tmp', in that order.
-#
-#       5. As a last resort, the current working directory.
-#
-#	The code here also does
-#
-#	0. The directory set by invoking tempdir with an argument.
-#	   If this is present it is used exclusively.
-#
-# Arguments:
-#	None.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	The directory for temporary files.
-
-proc ::fileutil::tempdir {args} {
-    if {[llength $args] > 1} {
-	return -code error {wrong#args: should be "::fileutil::tempdir ?path?"}
-    } elseif {[llength $args] == 1} {
-	variable tempdir    [lindex $args 0]
-	variable tempdirSet 1
-	return
-    }
-    return [Normalize [TempDir]]
-}
-
-proc ::fileutil::tempdirReset {} {
-    variable tempdir    {}
-    variable tempdirSet 0
-    return
-}
-
-proc ::fileutil::TempDir {} {
-    global tcl_platform env
-    variable tempdir
-    variable tempdirSet
-
-    set attempdirs [list]
-    set problems   {}
-
-    if {$tempdirSet} {
-	lappend attempdirs $tempdir
-	lappend problems {User/Application specified tempdir}
-    } else {
-	foreach tmp {TMPDIR TEMP TMP} {
-	    if { [info exists env($tmp)] } {
-		lappend attempdirs $env($tmp)
-	    } else {
-		lappend problems "No environment variable $tmp"
-	    }
-	}
-
-	switch $tcl_platform(platform) {
-	    windows {
-		lappend attempdirs "C:\\TEMP" "C:\\TMP" "\\TEMP" "\\TMP"
-	    }
-	    macintosh {
-		set tmpdir $env(TRASH_FOLDER)  ;# a better place?
-	    }
-	    default {
-		lappend attempdirs \
-		    [file join / tmp] \
-		    [file join / var tmp] \
-		    [file join / usr tmp]
-	    }
-	}
-
-	lappend attempdirs [pwd]
-    }
-
-    foreach tmp $attempdirs {
-	if { [file isdirectory $tmp] && [file writable $tmp] } {
-	    return $tmp
-	} elseif { ![file isdirectory $tmp] } {
-	    lappend problems "Not a directory: $tmp"
-	} else {
-	    lappend problems "Not writable: $tmp"
-	}
-    }
-
-    # Fail if nothing worked.
-    return -code error "Unable to determine a proper directory for temporary files\n[join $problems \n]"
-}
-
-namespace eval ::fileutil {
-    variable tempdir    {}
-    variable tempdirSet 0
-}
-
-# ::fileutil::tempfile --
-#
-#   generate a temporary file name suitable for writing to
-#   the file name will be unique, writable and will be in the 
-#   appropriate system specific temp directory
-#   Code taken from http://mini.net/tcl/772 attributed to
-#    Igor Volobouev and anon.
-#
-# Arguments:
-#   prefix     - a prefix for the filename, p
-# Results:
-#   returns a file name
-#
-
-proc ::fileutil::tempfile {{prefix {}}} {
-    return [Normalize [TempFile $prefix]]
-}
-
-proc ::fileutil::TempFile {prefix} {
-    set tmpdir [tempdir]
-
-    set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-    set nrand_chars 10
-    set maxtries 10
-    set access [list RDWR CREAT EXCL TRUNC]
-    set permission 0600
-    set channel ""
-    set checked_dir_writable 0
-    set mypid [pid]
-    for {set i 0} {$i < $maxtries} {incr i} {
- 	set newname $prefix
- 	for {set j 0} {$j < $nrand_chars} {incr j} {
- 	    append newname [string index $chars \
-		    [expr {int(rand()*62)}]]
- 	}
-	set newname [file join $tmpdir $newname]
- 	if {[file exists $newname]} {
- 	    after 1
- 	} else {
- 	    if {[catch {open $newname $access $permission} channel]} {
- 		if {!$checked_dir_writable} {
- 		    set dirname [file dirname $newname]
- 		    if {![file writable $dirname]} {
- 			return -code error "Directory $dirname is not writable"
- 		    }
- 		    set checked_dir_writable 1
- 		}
- 	    } else {
- 		# Success
-		close $channel
- 		return $newname
- 	    }
- 	}
-    }
-    if {[string compare $channel ""]} {
- 	return -code error "Failed to open a temporary file: $channel"
-    } else {
- 	return -code error "Failed to find an unused temporary file name"
-    }
-}
-
-# ::fileutil::install --
-#
-#	Tcl version of the 'install' command, which copies files from
-#	one places to another and also optionally sets some attributes
-#	such as group, owner, and permissions.
-#
-# Arguments:
-#	-m		Change the file permissions to the specified
-#                       value.  Valid arguments are those accepted by
-#			file attributes -permissions
-#
-# Results:
-#	None.
-
-# TODO - add options for group/owner manipulation.
-
-proc ::fileutil::install {args} {
-    set options {
-	{m.arg "" "Set permission mode"}
-    }
-    set usage ": [lindex [info level 0] 0]\
-\[options] source destination \noptions:"
-    array set params [::cmdline::getoptions args $options $usage]
-    # Args should now just be the source and destination.
-    if { [llength $args] < 2 } {
-	return -code error $usage
-    }
-    set src [lindex $args 0]
-    set dst [lindex $args 1]
-    file copy -force $src $dst
-    if { $params(m) != "" } {
-	set targets [::fileutil::find $dst]
-	foreach fl $targets {
-	    file attributes $fl -permissions $params(m)
-	}
-    }
-}
-
-# ### ### ### ######### ######### #########
-
-proc ::fileutil::LexNormalize {sp} {
-    set spx [file split $sp]
-
-    # Resolution of embedded relative modifiers (., and ..).
-
-    if {
-	([lsearch -exact $spx . ] < 0) &&
-	([lsearch -exact $spx ..] < 0)
-    } {
-	# Quick path out if there are no relative modifiers
-	return $sp
-    }
-
-    set absolute [expr {![string equal [file pathtype $sp] relative]}]
-    # A volumerelative path counts as absolute for our purposes.
-
-    set sp $spx
-    set np {}
-    set noskip 1
-
-    while {[llength $sp]} {
-	set ele    [lindex $sp 0]
-	set sp     [lrange $sp 1 end]
-	set islast [expr {[llength $sp] == 0}]
-
-	if {[string equal $ele ".."]} {
-	    if {
-		($absolute  && ([llength $np] >  1)) ||
-		(!$absolute && ([llength $np] >= 1))
-	    } {
-		# .. : Remove the previous element added to the
-		# new path, if there actually is enough to remove.
-		set np [lrange $np 0 end-1]
-	    }
-	} elseif {[string equal $ele "."]} {
-	    # Ignore .'s, they stay at the current location
-	    continue
-	} else {
-	    # A regular element.
-	    lappend np $ele
-	}
-    }
-    if {[llength $np] > 0} {
-	return [eval [linsert $np 0 file join]]
-	# 8.5: return [file join {*}$np]
-    }
-    return {}
-}
-
-# ### ### ### ######### ######### #########
-## Forward compatibility. Some routines require path normalization,
-## something we have supported by the builtin 'file' only since Tcl
-## 8.4. For versions of Tcl before that, to be supported by the
-## module, we implement a normalizer in Tcl itself. Slow, but working.
-
-if {[package vcompare [package provide Tcl] 8.4] < 0} {
-    # Pre 8.4. We do not have 'file normalize'. We create an
-    # approximation for it based on earlier commands.
-
-    # ... Hm. This is lexical normalization. It does not resolve
-    # symlinks in the path to their origin.
-
-    proc ::fileutil::Normalize {sp} {
-	set sp [file split $sp]
-
-	# Conversion of the incoming path to absolute.
-	if {[string equal [file pathtype [lindex $sp 0]] "relative"]} {
-	    set sp [file split [eval [list file join [pwd]] $sp]]
-	}
-
-	# Resolution of symlink components, and embedded relative
-	# modifiers (., and ..).
-
-	set np {}
-	set noskip 1
-	while {[llength $sp]} {
-	    set ele    [lindex $sp 0]
-	    set sp     [lrange $sp 1 end]
-	    set islast [expr {[llength $sp] == 0}]
-
-	    if {[string equal $ele ".."]} {
-		if {[llength $np] > 1} {
-		    # .. : Remove the previous element added to the
-		    # new path, if there actually is enough to remove.
-		    set np [lrange $np 0 end-1]
-		}
-	    } elseif {[string equal $ele "."]} {
-		# Ignore .'s, they stay at the current location
-		continue
-	    } else {
-		# A regular element. If it is not the last component
-		# then check if the combination is a symlink, and if
-		# yes, resolve it.
-
-		lappend np $ele
-
-		if {!$islast && $noskip} {
-		    # The flag 'noskip' is technically not required,
-		    # just 'file exists'. However if a path P does not
-		    # exist, then all longer paths starting with P can
-		    # not exist either, and using the flag to store
-		    # this knowledge then saves us a number of
-		    # unnecessary stat calls. IOW this a performance
-		    # optimization.
-
-		    set p [eval file join $np]
-		    set noskip [file exists $p]
-		    if {$noskip} {
-			if {[string equal link [file type $p]]} {
-			    set dst [file readlink $p]
-
-			    # We always push the destination in front of
-			    # the source path (in expanded form). So that
-			    # we handle .., .'s, and symlinks inside of
-			    # this path as well. An absolute path clears
-			    # the result, a relative one just removes the
-			    # last, now resolved component.
-
-			    set sp [eval [linsert [file split $dst] 0 linsert $sp 0]]
-
-			    if {![string equal relative [file pathtype $dst]]} {
-				# Absolute|volrelative destination, clear
-				# result, we have to start over.
-				set np {}
-			    } else {
-				# Relative link, just remove the resolved
-				# component again.
-				set np [lrange $np 0 end-1]
-			    }
-			}
-		    }
-		}
-	    }
-	}
-	if {[llength $np] > 0} {
-	    return [eval file join $np]
-	}
-	return {}
-    }
-} else {
-    proc ::fileutil::Normalize {sp} {
-	file normalize $sp
-    }
-}
-
-# ::fileutil::relative --
-#
-#	Taking two _directory_ paths, a base and a destination, computes the path
-#	of the destination relative to the base.
-#
-# Arguments:
-#	base	The path to make the destination relative to.
-#	dst	The destination path
-#
-# Results:
-#	The path of the destination, relative to the base.
-
-proc ::fileutil::relative {base dst} {
-    # Ensure that the link to directory 'dst' is properly done relative to
-    # the directory 'base'.
-
-    if {![string equal [file pathtype $base] [file pathtype $dst]]} {
-	return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)"
-    }
-
-    set base [LexNormalize [file join [pwd] $base]]
-    set dst  [LexNormalize [file join [pwd] $dst]]
-
-    set save $dst
-    set base [file split $base]
-    set dst  [file split $dst]
-
-    while {[string equal [lindex $dst 0] [lindex $base 0]]} {
-	set dst  [lrange $dst  1 end]
-	set base [lrange $base 1 end]
-	if {![llength $dst]} {break}
-    }
-
-    set dstlen  [llength $dst]
-    set baselen [llength $base]
-
-    if {($dstlen == 0) && ($baselen == 0)} {
-	# Cases:
-	# (a) base == dst
-
-	set dst .
-    } else {
-	# Cases:
-	# (b) base is: base/sub = sub
-	#     dst  is: base     = {}
-
-	# (c) base is: base     = {}
-	#     dst  is: base/sub = sub
-
-	while {$baselen > 0} {
-	    set dst [linsert $dst 0 ..]
-	    incr baselen -1
-	}
-	# 8.5: set dst [file join {*}$dst]
-	set dst [eval [linsert $dst 0 file join]]
-    }
-
-    return $dst
-}
-
-# ::fileutil::relativeUrl --
-#
-#	Taking two _file_ paths, a base and a destination, computes the path
-#	of the destination relative to the base, from the inside of the base.
-#
-#	This is how a browser resolves relative links in a file, hence the
-#	url in the command name.
-#
-# Arguments:
-#	base	The file path to make the destination relative to.
-#	dst	The destination file path
-#
-# Results:
-#	The path of the destination file, relative to the base file.
-
-proc ::fileutil::relativeUrl {base dst} {
-    # Like 'relative', but for links from _inside_ a file to a
-    # different file.
-
-    if {![string equal [file pathtype $base] [file pathtype $dst]]} {
-	return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)"
-    }
-
-    set base [LexNormalize [file join [pwd] $base]]
-    set dst  [LexNormalize [file join [pwd] $dst]]
-
-    set basedir [file dirname $base]
-    set dstdir  [file dirname $dst]
-
-    set dstdir  [relative $basedir $dstdir]
-
-    # dstdir == '.' on input => dstdir output has trailing './'. Strip
-    # this superfluous segment off.
-
-    if {[string equal $dstdir "."]} {
-	return [file tail $dst]
-    } elseif {[string equal [file tail $dstdir] "."]} {
-	return [file join [file dirname $dstdir] [file tail $dst]]
-    } else {
-	return [file join $dstdir [file tail $dst]]
-    }
-}
-
-# ::fileutil::fullnormalize --
-#
-#	Normalizes a path completely. I.e. a symlink in the last
-#	element is resolved as well, not only symlinks in the higher
-#	elements.
-#
-# Arguments:
-#	path	The path to normalize
-#
-# Results:
-#	The input path with all symlinks resolved.
-
-proc ::fileutil::fullnormalize {path} {
-    # When encountering symlinks in a file copy operation Tcl copies
-    # the link, not the contents of the file it references. There are
-    # situations there this is not acceptable. For these this command
-    # resolves all symbolic links in the path, including in the last
-    # element of the path. A "file copy" using the return value of
-    # this command copies an actual file, it will not encounter
-    # symlinks.
-
-    # BUG / WORKAROUND. Using the / instead of the join seems to work
-    # around a bug in the path handling on windows which can break the
-    # core 'file normalize' for symbolic links. This was exposed by
-    # the find testsuite which could not reproduced outside. I believe
-    # that there is some deep path bug in the core triggered under
-    # special circumstances. Use of / likely forces a refresh through
-    # the string rep and so avoids the problem with the path intrep.
-
-    return [file dirname [Normalize $path/__dummy__]]
-    #return [file dirname [Normalize [file join $path __dummy__]]]
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/multi.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/multi.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,28 +1,0 @@
-# ### ### ### ######### ######### #########
-##
-# (c) 2007 Andreas Kupries.
-
-# Multi file operations. Singleton based on the multiop processor.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require fileutil::multi::op
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-namespace eval ::fileutil {}
-
-# Create the multiop processor object and make its do method the main
-# command of this package.
-::fileutil::multi::op ::fileutil::multi::obj
-
-proc ::fileutil::multi {args} {
-    return [uplevel 1 [linsert $args 0 ::fileutil::multi::obj do]]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide fileutil::multi 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/multiop.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/multiop.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,628 +1,0 @@
-# ### ### ### ######### ######### #########
-##
-# (c) 2007 Andreas Kupries.
-
-# DSL allowing the easy specification of multi-file copy and/or move
-# and/or deletion operations. Alternate names would be scatter/gather
-# processor, or maybe even assembler.
-
-# Examples:
-# (1) copy
-#     into [installdir_of tls]
-#     from c:/TDK/PrivateOpenSSL/bin
-#     the  *.dll
-#
-# (2) move
-#     from /sources
-#     into /scratch
-#     the  *
-#     but not *.html
-#  (Alternatively: except for *.html)
-#
-# (3) into /scratch
-#     from /sources
-#     move
-#     as   pkgIndex.tcl
-#     the  index
-#
-# (4) in /scratch
-#     remove
-#     the *.txt
-
-# The language is derived from the parts of TclApp's option language
-# dealing with files and their locations, yet not identical. In parts
-# simplified, in parts more capable, keyword names were changed
-# throughout.
-
-# Language commands
-
-# From the examples
-#
-# into        DIR           : Specify destination directory.
-# in          DIR           : See 'into'.
-# from        DIR           : Specify source directory.
-# the         PATTERN (...) : Specify files to operate on.
-# but not     PATTERN       : Specify exceptions to 'the'.
-# but exclude PATTERN       : Specify exceptions to 'the'.
-# except for  PATTERN       : See 'but not'.
-# as          NAME          : New name for file.
-# move                      : Move files.
-# copy                      : Copy files.
-# remove                    : Delete files.
-#
-# Furthermore
-#
-# reset     : Force to defaults.
-# cd    DIR : Change destination to subdirectory.
-# up        : Change destination to parent directory.
-# (         : Save a copy of the current state.
-# )         : Restore last saved state and make it current.
-
-# The main active element is the command 'the'. In other words, this
-# command not only specifies the files to operate on, but also
-# executes the operation as defined in the current state. All other
-# commands modify the state to set the operation up, and nothing
-# else. To allow for a more natural syntax the active command also
-# looks ahead for the commands 'as', 'but', and 'except', and executes
-# them, like qualifiers, so that they take effect as if they had been
-# written before. The command 'but' and 'except use identical
-# constructions to handle their qualifiers, i.e. 'not' and 'for'.
-
-# Note that the fact that most commands just modify the state allows
-# us to use more off forms as specifications instead of just natural
-# language sentences For example the example 2 can re-arranged into:
-#
-# (5) from /sources
-#     into /scratch
-#     but not *.html
-#     move
-#     the  *
-#
-# and the result is still a valid specification.
-
-# Further note that the information collected by 'but', 'except', and
-# 'as' is automatically reset after the associated 'the' was
-# executed. However no other state is reset in that manner, allowing
-# the user to avoid repetitions of unchanging information. Lets us for
-# example merge the examples 2 and 3. The trivial merge is:
-
-# (6) move
-#     into /scratch
-#     from /sources
-#     the  *
-#     but not *.html not index
-#     move
-#     into /scratch
-#     from /sources
-#     the  index
-#     as   pkgIndex.tcl
-#
-# With less repetitions
-#
-# (7) move
-#     into /scratch
-#     from /sources
-#     the  *
-#     but not *.html not index
-#     the  index
-#     as   pkgIndex.tcl
-
-# I have not yet managed to find a suitable syntax to specify when to
-# add a new extension to the moved/copied files, or have to strip all
-# extensions, a specific extension, or even replace extensions.
-
-# Other possibilities to muse about: Load the patterns for 'not'/'for'
-# from a file ... Actually, load the whole exceptions from a file,
-# with its contents a proper interpretable word list. Which makes it
-# general processing of include files.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# This processor uses the 'wip' word list interpreter as its
-# foundation.
-
-package require fileutil      ; # File testing
-package require snit          ; # OO support
-package require struct::stack ; # Context stack
-package require wip           ; # DSL execution core
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-snit::type ::fileutil::multi::op {
-    # ### ### ### ######### ######### #########
-    ## API
-
-    constructor {args} {} ; # create processor
-
-    # ### ### ### ######### ######### #########
-    ## API - Implementation.
-
-    constructor {args} {
-	install stack using struct::stack::stack ${selfns}::stack
-	$self wip_setup
-
-	# Mapping dsl commands to methods.
-	defdva \
-	    reset  Reset	(    Push	)       Pop	\
-	    into   Into		in   Into	from    From	\
-	    cd     ChDir	up   ChUp	as      As	\
-	    move   Move		copy Copy	remove  Remove	\
-	    but    But		not  Exclude	the     The	\
-	    except Except	for  Exclude    exclude Exclude \
-	    to     Into         ->   Save       the-set TheSet  \
-	    recursive Recursive recursively Recursive           \
-	    for-win     ForWindows   for-unix   ForUnix         \
-	    for-windows ForWindows   expand     Expand          \
-	    invoke Invoke strict Strict !strict NotStrict \
-	    files  Files  links  Links  all Everything    \
-	    dirs   Directories directories Directories    \
-	    state? QueryState from? QueryFrom into? QueryInto \
-	    excluded? QueryExcluded as? QueryAs type? QueryType \
-	    recursive? QueryRecursive operation? QueryOperation \
-	    strict? QueryStrict !recursive NotRecursive
-
-	$self Reset
-	runl $args
-	return
-    }
-
-    destructor {
-	$wip destroy
-	return
-    }
-
-    method do {args} {
-	return [runl $args]
-    }
-
-    # ### ### ### ######### ######### #########
-    ## DSL Implementation
-    wip::dsl
-
-    # General reset of processor state
-    method Reset {} {
-	$stack clear
-	set base     ""
-	set alias    ""
-	set op       ""
-	set recursive 0 
-	set src      ""
-	set excl     ""
-	set types    {}
-	set strict   0
-	return
-    }
-
-    # Stack manipulation
-    method Push {} {
-	$stack push [list $base $alias $op $opcmd $recursive $src $excl $types $strict]
-	return
-    }
-
-    method Pop {} {
-	if {![$stack size]} {
-	    return -code error {Stack underflow}
-	}
-	foreach {base alias op opcmd recursive src excl types strict} [$stack pop] break
-	return
-    }
-
-    # Destination directory
-    method Into {dir} {
-	if {$dir eq ""} {set dir [pwd]}
-	if {$strict && ![fileutil::test $dir edr msg {Destination directory}]} {
-	    return -code error $msg
-	}
-	set base $dir
-	return
-    }
-
-    method ChDir {dir} { $self Into [file join    $base $dir] ; return }
-    method ChUp  {}    { $self Into [file dirname $base]      ; return }
-
-    # Detail
-    method As {fname} {
-	set alias [ForceRelative $fname]
-	return
-    }
-
-    # Operations
-    method Move   {} { set op move   ; return }
-    method Copy   {} { set op copy   ; return }
-    method Remove {} { set op remove ; return }
-    method Expand {} { set op expand ; return }
-
-    method Invoke {cmdprefix} {
-	set op    invoke
-	set opcmd $cmdprefix
-	return
-    }
-
-    # Operation qualifier
-    method Recursive    {} { set recursive 1 ; return }
-    method NotRecursive {} { set recursive 0 ; return }
-
-    # Source directory
-    method From {dir} {
-	if {$dir eq ""} {set dir [pwd]}
-	if {![fileutil::test $dir edr msg {Source directory}]} {
-	    return -code error $msg
-	}
-	set src $dir
-	return
-    }
-
-    # Exceptions
-    method But    {} { run_next_while {not exclude} ; return }
-    method Except {} { run_next_while {for}         ; return }
-
-    method Exclude {pattern} {
-	lappend excl $pattern
-	return
-    }
-
-    # Define the files to operate on, and perform the operation.
-    method The {pattern} {
-	run_next_while {as but except exclude from into in to files dirs directories links all}
-
-	switch -exact -- $op {
-	    invoke {Invoke [Resolve [Remember [Exclude [Expand $src  $pattern]]]]}
-	    move   {Move   [Resolve [Remember [Exclude [Expand $src  $pattern]]]]}
-	    copy   {Copy   [Resolve [Remember [Exclude [Expand $src  $pattern]]]]}
-	    remove {Remove          [Remember [Exclude [Expand $base $pattern]]] }
-	    expand {                 Remember [Exclude [Expand $base $pattern]]  }
-	}
-
-	# Reset the per-pattern flags of the resolution context back
-	# to their defaults, for the next pattern.
-
-	set alias    {}
-	set excl     {}
-	set recursive 0
-	return
-    }
-
-    # Like 'The' above, except that the fileset is taken from the
-    # specified variable. Semi-complementary to 'Save' below.
-    # Exclusion data and recursion info do not apply for this, this is
-    # already implicitly covered by the set, when it was generated.
-
-    method TheSet {varname} {
-	# See 'Save' for the levels we jump here.
-	upvar 5 $varname var
-
-	run_next_while {as from into in to}
-
-	switch -exact -- $op {
-	    invoke {Invoke [Resolve $var]}
-	    move   {Move   [Resolve $var]}
-	    copy   {Copy   [Resolve $var]}
-	    remove {Remove          $var }
-	    expand {
-		return -code error "Expansion does not make sense\
-                                    when we already have a set of files."
-	    }
-	}
-
-	# Reset the per-pattern flags of the resolution context back
-	# to their defaults, for the next pattern.
-
-	set alias    {}
-	return
-    }
-
-    # Save the last expansion result to a variable for use by future commands.
-
-    method Save {varname} {
-	# Levels to jump. Brittle.
-	# 5: Caller
-	# 4:   object do ...
-	# 3:     runl
-	# 2:       wip::runl
-	# 1:         run_next
-	# 0: Here
-	upvar 5 $varname v
-	set v $lastexpansion
-	return
-    }
-
-    # Platform conditionals ...
-
-    method ForUnix {} {
-	global tcl_platform
-	if {$tcl_platform(platform) eq "unix"} return
-	# Kill the remaining code. This effectively aborts processing.
-	replacel {}
-	return
-    }
-
-    method ForWindows {} {
-	global tcl_platform
-	if {$tcl_platform(platform) eq "windows"} return
-	# Kill the remaining code. This effectively aborts processing.
-	replacel {}
-	return
-    }
-
-    # Strictness
-
-    method Strict {} {
-	set strict 1
-	return
-    }
-
-    method NotStrict {} {
-	set strict 0
-	return
-    }
-
-    # Type qualifiers
-
-    method Files {} {
-	set types files
-	return
-    }
-
-    method Links {} {
-	set types links
-	return
-    }
-
-    method Directories {} {
-	set types dirs
-	return
-    }
-
-    method Everything {} {
-	set types {}
-	return
-    }
-
-    # State interogation
-
-    method QueryState {} {
-	return [list \
-		    from      $src \
-		    into      $base \
-		    as        $alias \
-		    op        $op \
-		    excluded  $excl \
-		    recursive $recursive \
-		    type      $types \
-		    strict    $strict \
-		   ]
-    }
-    method QueryExcluded {} {
-	return $excl
-    }
-    method QueryFrom {} {
-	return $src
-    }
-    method QueryInto {} {
-	return $base
-    }
-    method QueryAs {} {
-	return $alias
-    }
-    method QueryOperation {} {
-	return $op
-    }
-    method QueryRecursive {} {
-	return $recursive
-    }
-    method QueryType {} {
-	return $types
-    }
-    method QueryStrict {} {
-	return $strict
-    }
-
-    # ### ### ### ######### ######### #########
-    ## DSL State
-
-    component stack       ; # State stack     - ( )
-    variable  base     "" ; # Destination dir - into, in, cd, up
-    variable  alias    "" ; # Detail          - as
-    variable  op       "" ; # Operation       - move, copy, remove, expand, invoke
-    variable  opcmd    "" ; # Command prefix for invoke.
-    variable  recursive 0 ; # Op. qualifier: recursive expansion?
-    variable  src      "" ; # Source dir      - from
-    variable  excl     "" ; # Excluded files  - but not|exclude, except for
-    # incl                ; # Included files  - the (immediate use)
-    variable types     {} ; # Limit glob/find to specific types (f, l, d).
-    variable strict    0  ; # Strictness of into/Expand
-
-    variable lastexpansion "" ; # Area for last expansion result, for 'Save' to take from.
-
-    # ### ### ### ######### ######### #########
-    ## Internal -- Path manipulation helpers.
-
-    proc ForceRelative {path} {
-	set pathtype [file pathtype $path]
-	switch -exact -- $pathtype {
-	    relative {
-		return $path
-	    }
-	    absolute {
-		# Chop off the first element in the path, which is the
-		# root, either '/' or 'x:/'. If this was the only
-		# element assume an empty path.
-
-		set path [lrange [file split $path] 1 end]
-		if {![llength $path]} {return {}}
-		return [eval [linsert $path 0 file join]]
-	    }
-	    volumerelative {
-		return -code error {Unable to handle volumerelative path, yet}
-	    }
-	}
-
-	return -code error \
-	    "file pathtype returned unknown type \"$pathtype\""
-    }
-
-    proc ForceAbsolute {path} {
-	return [file join [pwd] $path]
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal - Operation execution helpers
-
-    proc Invoke {files} {
-	upvar 1 base base src src opcmd opcmd
-	uplevel #0 [linsert $opcmd end $src $base $files]
-	return
-    }
-
-    proc Move {files} {
-	upvar 1 base base src src
-
-	foreach {s d} $files {
-	    set s [file join $src  $s]
-	    set d [file join $base $d]
-
-	    file mkdir [file dirname $d]
-	    file rename -force $s $d
-	}
-	return
-    }
-
-    proc Copy {files} {
-	upvar 1 base base src src
-
-	foreach {s d} $files {
-	    set s [file join $src  $s]
-	    set d [file join $base $d]
-
-	    file mkdir [file dirname $d]
-	    file copy -force $s $d
-	}
-	return
-    }
-
-    proc Remove {files} {
-	upvar 1 base base
-
-	foreach f $files {
-	    file delete -force [file join $base $f]
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal -- Resolution helper commands
-
-    typevariable tmap -array {
-	files {f TFile}
-	links {l TLink}
-	dirs  {d TDir}
-	{}    {{} {}}
-    }
-
-    proc Expand {dir pattern} {
-	upvar 1 recursive recursive strict strict types types tmap tmap
-	# FUTURE: struct::list filter ...
-
-	set files {}
-	if {$recursive} {
-	    # Recursion through the entire directory hierarchy, save
-	    # all matching paths.
-
-	    set filter [lindex $tmap($types) 1]
-	    if {$filter ne ""} {
-		set filter [myproc $filter]
-	    }
-
-	    foreach f [fileutil::find $dir $filter] {
-		if {![string match $pattern [file tail $f]]} continue
-		lappend files [fileutil::stripPath $dir $f]
-	    }
-	} else {
-	    # No recursion, just scan the whole directory for matching paths.
-	    # check for specific types integrated.
-
-	    set filter [lindex $tmap($types) 0]
-	    if {$filter ne ""} {
-		foreach f [glob -nocomplain -directory $dir -types $filter -- $pattern] {
-		    lappend files [fileutil::stripPath $dir $f]
-		}
-	    } else {
-		foreach f [glob -nocomplain -directory $dir -- $pattern] {
-		    lappend files [fileutil::stripPath $dir $f]
-		}
-	    }
-	}
-
-	if {[llength $files]} {return $files}
-	if {!$strict}         {return {}}
-
-	return -code error \
-	    "No files matching pattern \"$pattern\" in directory \"$dir\""
-    }
-
-    proc TFile {f} {file isfile $f}
-    proc TDir  {f} {file isdirectory $f}
-    proc TLink {f} {expr {[file type $f] eq "link"}}
-
-    proc Exclude {files} {
-	upvar 1 excl excl
-
-	# FUTURE: struct::list filter ...
-	set res {}
-	foreach f $files {
-	    if {[IsExcluded $f $excl]} continue
-	    lappend res $f
-	}
-	return $res
-    }
-
-    proc IsExcluded {f patterns} {
-	foreach p $patterns {
-	    if {[string match $p $f]} {return 1}
-	}
-	return 0
-    }
-
-    proc Resolve {files} {
-	upvar 1 alias alias
-	set res {}
-	foreach f $files {
-
-	    # Remember alias for processing and auto-invalidate to
-	    # prevent contamination of the next file.
-
-	    set thealias $alias
-	    set alias    ""
-
-	    if {$thealias eq ""} {
-		set d $f
-	    } else {
-		set d [file dirname $f]
-		if {$d eq "."} {
-		    set d $thealias
-		} else {
-		    set d [file join $d $thealias]
-		}
-	    }
-
-	    lappend res $f $d
-	}
-	return $res
-    }
-
-    proc Remember {files} {
-	upvar 1 lastexpansion lastexpansion
-	set lastexpansion $files
-	return $files
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide fileutil::multi::op 0.5
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,9 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded fileutil 1.13.3 [list source [file join $dir fileutil.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded fileutil::traverse 0.3 [list source [file join $dir traverse.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded fileutil::multi     0.1 [list source [file join $dir multi.tcl]]
-package ifneeded fileutil::multi::op 0.5 [list source [file join $dir multiop.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/traverse.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fileutil/traverse.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,397 +1,0 @@
-# traverse.tcl --
-#
-#	Directory traversal.
-#
-# Copyright (c) 2006-2007 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: traverse.tcl,v 1.4 2007/08/08 19:42:43 andreas_kupries Exp $
-
-package require Tcl 8.3
-package require snit    ; # OO core
-package require control ; # Helpers for control structures
-
-snit::type ::fileutil::traverse {
-
-    # Incremental directory traversal.
-
-    # API
-    # create  %AUTO% basedirectory options... -> object
-    # next    filevar                         -> boolean
-    # foreach filevar script
-    # files                                   -> list (path ...)
-
-    # Options
-    # -prefilter command-prefix
-    # -filter    command-prefix
-    # -errorcmd  command-prefix
-
-    # Use cases
-    #
-    # (a) Basic incremental
-    # - Create and configure a traversal object.
-    # - Execute 'next' to retrieve one path at a time,
-    #   until the command returns False, signaling that
-    #   the iterator has exhausted the supply of paths.
-    #   (The path is stored in the named variable).
-    #
-    # The execution of 'next' can be done in a loop, or via event
-    # processing.
-
-    # (b) Basic loop
-    # - Create and configure a traversal object.
-    # - Run a script for each path, using 'foreach'.
-    #   This is a convenient standard wrapper around 'next'.
-    #
-    # The loop properly handles all possible Tcl result codes.
-
-    # (c) Non-incremental, non-looping.
-    # - Create and configure a traversal object.
-    # - Retrieve a list of all paths via 'files'.
-
-    # The -prefilter callback is executed for directories. Its result
-    # determines if the traverser recurses into the directory or not.
-    # The default is to always recurse into all directories. The call-
-    # back is invoked with a single argument, the path of the
-    # directory.
-    #
-    # The -filter callback is executed for all paths. Its result
-    # determines if the current path is a valid result, and returned
-    # by 'next'. The default is to accept all paths as valid. The
-    # callback is invoked with a single argument, the path to check.
-
-    # The -errorcmd callback is executed for all paths the traverser
-    # has trouble with. Like being unable to cd into them, get their
-    # status, etc. The default is to ignore any such problems. The
-    # callback is invoked with a two arguments, the path for which the
-    # error occured, and the error message. Errors thrown by the
-    # filter callbacks are handled through this callback too. Errors
-    # thrown by the error callback itself are not caught and ignored,
-    # but allowed to pass to the caller, usually of 'next'.
-
-    # Note: Low-level functionality, version and platform dependent is
-    # implemented in procedures, and conditioally defined for optimal
-    # use of features, etc. ...
-
-    # Note: Traversal is done in depth-first pre-order.
-
-    # Note: The options are handled only during
-    # construction. Afterward they are read-only and attempts to
-    # modify them will cause the system to throw errors.
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    option -filter    -default {} -readonly 1
-    option -prefilter -default {} -readonly 1
-    option -errorcmd  -default {} -readonly 1
-
-    constructor {basedir args} {
-	set _base $basedir
-	$self configurelist $args
-	return
-    }
-
-    method files {} {
-	set files {}
-	$self foreach f {lappend files $f}
-	return $files
-    }
-
-    method foreach {fvar body} {
-	upvar 1 $fvar currentfile
-
-	# (Re-)initialize the traversal state on every call.
-	$self Init
-
-	while {[$self next currentfile]} {
-	    set code [catch {uplevel 1 $body} result]
-
-	    # decide what to do upon the return code:
-	    #
-	    #               0 - the body executed successfully
-	    #               1 - the body raised an error
-	    #               2 - the body invoked [return]
-	    #               3 - the body invoked [break]
-	    #               4 - the body invoked [continue]
-	    # everything else - return and pass on the results
-	    #
-	    switch -exact -- $code {
-		0 {}
-		1 {
-		    return -errorinfo [::control::ErrorInfoAsCaller uplevel foreach]  \
-			    -errorcode $::errorCode -code error $result
-		}
-		3 {
-		    # FRINK: nocheck
-		    return
-		}
-		4 {}
-		default {
-		    return -code $code $result
-		}
-	    }
-	}
-	return
-    }
-
-    method next {fvar} {
-	upvar 1 $fvar currentfile
-
-	# Initialize on first call.
-	if {!$_init} {
-	    $self Init
-	}
-
-	# We (still) have valid paths in the result stack, return the
-	# next one.
-
-	if {[llength $_results]} {
-	    set top      [lindex   $_results end]
-	    set _results [lreplace $_results end end]
-	    set currentfile $top
-	    return 1
-	}
-
-	# Take the next directory waiting in the processing stack and
-	# fill the result stack with all valid files and sub-
-	# directories contained in it. Extend the processing queue
-	# with all sub-directories not yet seen already (!circular
-	# symlinks) and accepted by the prefilter. We stop iterating
-	# when we either have no directories to process anymore, or
-	# the result stack contains at least one path we can return.
-
-	while {[llength $_pending]} {
-	    set top      [lindex   $_pending end]
-	    set _pending [lreplace $_pending end end]
-
-	    # Directory accessible? Skip if not.
-	    if {![ACCESS $top]} {
-		Error $top "Inacessible directory"
-		continue
-	    }
-
-	    # Expand the result stack with all files in the directory,
-	    # modulo filtering.
-
-	    foreach f [GLOBF $top] {
-		if {![Valid $f]} continue
-		lappend _results $f
-	    }
-
-	    # Expand the result stack with all sub-directories in the
-	    # directory, modulo filtering. Further expand the
-	    # processing stack with the same directories, if not seen
-	    # yet and modulo pre-filtering.
-
-	    foreach f [GLOBD $top] {
-		if {
-		    [string equal [file tail $f]  "."] ||
-		    [string equal [file tail $f] ".."]
-		} continue
-
-		if {[Valid $f]} {
-		    lappend _results $f
-		}
-
-		set norm [fileutil::fullnormalize $f]
-		if {[info exists _known($norm)]} continue
-		set _known($norm) .
-
-		if {[Recurse $f]} {
-		    lappend _pending $f
-		}
-	    }
-
-	    # Stop expanding if we have paths to return.
-
-	    if {[llength $_results]} {
-		set top    [lindex   $_results end]
-		set _results [lreplace $_results end end]
-		set currentfile $top
-		return 1
-	    }
-	}
-
-	# Allow re-initialization with next call.
-
-	set _init 0
-	return 0
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Traversal state
-
-    # * Initialization flag. Checked in 'next', reset by next when no
-    #   more files are available. Set in 'Init'.
-    # * Base directory (or file) to start the traversal from.
-    # * Stack of prefiltered unknown directories waiting for
-    #   processing, i.e. expansion (TOP at end).
-    # * Stack of valid paths waiting to be returned as results.
-    # * Set of directories already visited (normalized paths), for
-    #   detection of circular symbolic links.
-
-    variable _init         0  ; # Initialization flag.
-    variable _base         {} ; # Base directory.
-    variable _pending      {} ; # Processing stack.
-    variable _results      {} ; # Result stack.
-    variable _known -array {} ; # Seen paths.
-
-    # ### ### ### ######### ######### #########
-    ## Internal helpers.
-
-    method Init {} {
-	# Path ok as result?
-	if {[Valid $_base]} {
-	    lappend _results $_base
-	}
-
-	# Expansion allowed by prefilter?
-	if {[file isdirectory $_base] && [Recurse $_base]} {
-	    lappend _pending $_base
-	}
-
-	array unset _known *
-
-	# System is set up now.
-	set _init 1
-	return
-    }
-
-    proc Valid {path} {
-	upvar 1 options options
-	if {![llength $options(-filter)]} {return 1}
-	set code [catch {uplevel \#0 [linsert $options(-filter) end $path]} valid]
-	if {!$code} {return $valid}
-	Error $path $valid
-	return 0
-    }
-
-    proc Recurse {path} {
-	upvar 1 options options
-	if {![llength $options(-prefilter)]} {return 1}
-	set code [catch {uplevel \#0 [linsert $options(-prefilter) end $path]} valid]
-	if {!$code} {return $valid}
-	Error $path $valid
-	return 0
-    }
-
-    proc Error {path msg} {
-	upvar 1 options options
-	if {![llength $options(-errorcmd)]} return
-	uplevel \#0 [linsert $options(-errorcmd) end $path $msg]
-	return
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-##
-
-# The next three helper commands for the traverser depend strongly on
-# the version of Tcl, and partially on the platform.
-
-# 1. In Tcl 8.3 using -types f will return only true files, but not
-#    links to files. This changed in 8.4+ where links to files are
-#    returned as well. So for 8.3 we have to handle the links
-#    separately (-types l) and also filter on our own.
-#    Note that Windows file links are hard links which are reported by
-#    -types f, but not -types l, so we can optimize that for the two
-#    platforms.
-#
-# 2. In Tcl 8.3 we also have a crashing bug in glob (SIGABRT, "stat on
-#    a known file") when trying to perform 'glob -types {hidden f}' on
-#    a directory without e'x'ecute permissions. We code around by
-#    testing if we can cd into the directory (stat might return enough
-#    information too (mode), but possibly also not portable).
-#
-#    For Tcl 8.2 and 8.4+ glob simply delivers an empty result
-#    (-nocomplain), without crashing. For them this command is defined
-#    so that the bytecode compiler removes it from the bytecode.
-#
-#    This bug made the ACCESS helper necessary.
-#    We code around the problem by testing if we can cd into the
-#    directory (stat might return enough information too (mode), but
-#    possibly also not portable).
-
-if {[package vsatisfies [package present Tcl] 8.4]} {
-    # Tcl 8.4+.
-    # (Ad 1) We have -directory, and -types,
-    # (Ad 2) Links are returned for -types f/d if they refer to files/dirs.
-    # (Ad 3) No bug to code around
-
-    proc ::fileutil::traverse::ACCESS {args} {return 1}
-
-    proc ::fileutil::traverse::GLOBF {current} {
-	concat \
-	    [glob -nocomplain -directory $current -types f          -- *] \
-	    [glob -nocomplain -directory $current -types {hidden f} -- *]
-    }
-
-    proc ::fileutil::traverse::GLOBD {current} {
-	concat \
-	    [glob -nocomplain -directory $current -types d          -- *] \
-	    [glob -nocomplain -directory $current -types {hidden d} -- *]
-    }
-
-} else {
-    # 8.3.
-    # (Ad 1) We have -directory, and -types,
-    # (Ad 2) Links are NOT returned for -types f/d, collect separately.
-    #        No symbolic file links on Windows.
-    # (Ad 3) Bug to code around.
-
-    proc ::fileutil::traverse::ACCESS {current} {
-	if {[catch {
-	    set h [pwd] ; cd $current ; cd $h
-	}]} {return 0}
-	return 1
-    }
-
-    if {[string equal $::tcl_platform(platform) windows]} {
-	proc ::fileutil::traverse::GLOBF {current} {
-	    concat \
-		[glob -nocomplain -directory $current -types f          -- *] \
-		[glob -nocomplain -directory $current -types {hidden f} -- *]]
-	}
-    } else {
-	proc ::fileutil::traverse::GLOBF {current} {
-	    set l [concat \
-		       [glob -nocomplain -directory $current -types f          -- *] \
-		       [glob -nocomplain -directory $current -types {hidden f} -- *]]
-
-	    foreach x [concat \
-			   [glob -nocomplain -directory $current -types l          -- *] \
-			   [glob -nocomplain -directory $current -types {hidden l} -- *]] {
-		if {![file isfile $x]} continue
-		lappend l $x
-	    }
-
-	    return $l
-	}
-    }
-
-    proc ::fileutil::traverse::GLOBD {current} {
-	set l [concat \
-		   [glob -nocomplain -directory $current -types d          -- *] \
-		   [glob -nocomplain -directory $current -types {hidden d} -- *]]
-
-	foreach x [concat \
-		       [glob -nocomplain -directory $current -types l          -- *] \
-		       [glob -nocomplain -directory $current -types {hidden l} -- *]] {
-	    if {![file isdirectory $x]} continue
-	    lappend l $x
-	}
-
-	return $l
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide fileutil::traverse 0.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ftp/ftp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ftp/ftp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3013 +1,0 @@
-# ftp.tcl --
-#
-#	FTP library package for Tcl 8.2+.  Originally written by Steffen
-#	Traeger (Steffen.Traeger@t-online.de); modified by Peter MacDonald
-#	(peter@pdqi.com) to support multiple simultaneous FTP sessions;
-#	Modified by Steve Ball (Steve.Ball@zveno.com) to support
-#	asynchronous operation.
-#
-# Copyright (c) 1996-1999 by Steffen Traeger <Steffen.Traeger@t-online.de>
-# Copyright (c) 2000 by Ajuba Solutions
-# Copyright (c) 2000 by Zveno Pty Ltd
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: ftp.tcl,v 1.46 2007/05/07 21:15:19 andreas_kupries Exp $
-#
-#   core ftp support: 	ftp::Open <server> <user> <passwd> <?options?>
-#			ftp::Close <s>
-#			ftp::Cd <s> <directory>
-#			ftp::Pwd <s>
-#			ftp::Type <s> <?ascii|binary|tenex?>	
-#			ftp::List <s> <?directory?>
-#			ftp::NList <s> <?directory?>
-#			ftp::FileSize <s> <file>
-#			ftp::ModTime <s> <file> <?newtime?>
-#			ftp::Delete <s> <file>
-#			ftp::Rename <s> <from> <to>
-#			ftp::Put <s> <(local | -data "data" -channel chan)> <?remote?>
-#			ftp::Append <s> <(local | -data "data" | -channel chan)> <?remote?>
-#			ftp::Get <s> <remote> <?(local | -variable varname | -channel chan)?>
-#			ftp::Reget <s> <remote> <?local?>
-#			ftp::Newer <s> <remote> <?local?>
-#			ftp::MkDir <s> <directory>
-#			ftp::RmDir <s> <directory>
-#			ftp::Quote <s> <arg1> <arg2> ...
-#
-# Internal documentation. Contents of a session state array.
-#
-# ---------------------------------------------
-# key             value
-# ---------------------------------------------
-# State           Current state of the session and the currently executing command.
-# RemoteFileName  Name of the remote file, for put/get
-# LocalFileName   Name of local file, for put/get
-# inline          1 - Put/Get is inline (from data, to variable)
-# filebuffer  
-# PutData         Data to move when inline
-# SourceCI        Channel to read from, "Put"
-# ---------------------------------------------
-#
-
-package require Tcl 8.2
-package require log     ; # tcllib/log, general logging facility.
-
-namespace eval ::ftp {
-    namespace export DisplayMsg Open Close Cd Pwd Type List NList \
-	    FileSize ModTime Delete Rename Put Append Get Reget \
-	    Newer Quote MkDir RmDir
-
-    set serial 0
-    set VERBOSE 0
-    set DEBUG 0
-}
-
-#############################################################################
-#
-# DisplayMsg --
-#
-# This is a simple procedure to display any messages on screen.
-# Can be intercepted by the -output option to Open
-#
-#	namespace ftp {
-#		proc DisplayMsg {msg} {
-#			......
-#		}
-#	}
-#
-# Arguments:
-# msg - 		message string
-# state -		different states {normal, data, control, error}
-#
-proc ::ftp::DisplayMsg {s msg {state ""}} {
-
-    upvar ::ftp::ftp$s ftp
-
-    if { ([info exists ftp(Output)]) && ($ftp(Output) != "") } {
-        eval [concat $ftp(Output) {$s $msg $state}]
-        return
-    }
-
-    # FIX #476729. Instead of changing the documentation this
-    #              procedure is changed to enforce the documented
-    #              behaviour. IOW, this procedure will not throw
-    #              errors anymore. At the same time printing to stdout
-    #              is exchanged against calls into the 'log' module
-    #              tcllib, which is much easier to customize for the
-    #              needs of any application using the ftp module. The
-    #              variable VERBOSE is still relevant as it controls
-    #              whether this procedure is called or not.
-
-    global errorInfo
-    switch -exact -- $state {
-        data    {log::log debug "$state | $msg"}
-        control {log::log debug "$state | $msg"}
-        error   {log::log error "$state | E: $msg:\n$errorInfo"}
-        default {log::log debug "$state | $msg"}
-    }
-    return
-}
-
-#############################################################################
-#
-# Timeout --
-#
-# Handle timeouts
-# 
-# Arguments:
-#  -
-#
-proc ::ftp::Timeout {s} {
-    upvar ::ftp::ftp$s ftp
-
-    after cancel $ftp(Wait)
-    set ftp(state.control) 1
-
-    DisplayMsg "" "Timeout of control connection after $ftp(Timeout) sec.!" error
-    Command $ftp(Command) timeout
-    return
-}
-
-#############################################################################
-#
-# WaitOrTimeout --
-#
-# Blocks the running procedure and waits for a variable of the transaction 
-# to complete. It continues processing procedure until a procedure or 
-# StateHandler sets the value of variable "finished". 
-# If a connection hangs the variable is setting instead of by this procedure after 
-# specified seconds in $ftp(Timeout).
-#  
-# 
-# Arguments:
-#  -		
-#
-
-proc ::ftp::WaitOrTimeout {s} {
-    upvar ::ftp::ftp$s ftp
-
-    set retvar 1
-
-    if { ![string length $ftp(Command)] && [info exists ftp(state.control)] } {
-
-        set ftp(Wait) [after [expr {$ftp(Timeout) * 1000}] [list [namespace current]::Timeout $s]]
-
-        vwait ::ftp::ftp${s}(state.control)
-        set retvar $ftp(state.control)
-    }
-
-    if {$ftp(Error) != ""} {
-        set errmsg $ftp(Error)
-        set ftp(Error) ""
-        DisplayMsg $s $errmsg error
-    }
-
-    return $retvar
-}
-
-#############################################################################
-#
-# WaitComplete --
-#
-# Transaction completed.
-# Cancel execution of the delayed command declared in procedure WaitOrTimeout.
-# 
-# Arguments:
-# value -	result of the transaction
-#			0 ... Error
-#			1 ... OK
-#
-
-proc ::ftp::WaitComplete {s value} {
-    upvar ::ftp::ftp$s ftp
-
-    if {![info exists ftp(Command)]} {
-	set ftp(state.control) $value
-	return $value
-    }
-    if { ![string length $ftp(Command)] && [info exists ftp(state.data)] } {
-        vwait ::ftp::ftp${s}(state.data)
-    }
-
-    catch {after cancel $ftp(Wait)}
-    set ftp(state.control) $value
-    return $ftp(state.control)
-}
-
-#############################################################################
-#
-# PutsCtrlSocket --
-#
-# Puts then specified command to control socket,
-# if DEBUG is set than it logs via DisplayMsg
-# 
-# Arguments:
-# command - 		ftp command
-#
-
-proc ::ftp::PutsCtrlSock {s {command ""}} {
-    upvar ::ftp::ftp$s ftp
-    variable DEBUG
-	
-    if { $DEBUG } {
-        DisplayMsg $s "---> $command"
-    }
-
-    puts $ftp(CtrlSock) $command
-    flush $ftp(CtrlSock)
-    return
-}
-
-#############################################################################
-#
-# StateHandler --
-#
-# Implements a finite state handler and a fileevent handler
-# for the control channel
-# 
-# Arguments:
-# sock - 		socket name
-#			If called from a procedure than this argument is empty.
-# 			If called from a fileevent than this argument contains
-#			the socket channel identifier.
-
-proc ::ftp::StateHandler {s {sock ""}} {
-    upvar ::ftp::ftp$s ftp
-    variable DEBUG 
-    variable VERBOSE
-
-    # disable fileevent on control socket, enable it at the and of the state machine
-    # fileevent $ftp(CtrlSock) readable {}
-		
-    # there is no socket (and no channel to get) if called from a procedure
-
-    set rc "   "
-    set msgtext {}
-
-    if { $sock != "" } {
-
-        set number 0                            ;# Error condition
-        catch {set number [gets $sock bufline]}
-
-        if { $number > 0 } {
-
-            # get return code, check for multi-line text
-            
-            if {![regexp -- "^-?(\[0-9\]+)( |-)?(.*)$" $bufline all rc multi_line msgtext]} {
-		set errmsg "C: Internal Error @ line 255.\
-			Regex pattern not matching the input \"$bufline\""
-		if {$VERBOSE} {
-		    DisplayMsg $s $errmsg control
-		}
-	    } else {
-		# multi-line format detected ("-"), get all the lines
-		# until the real return code
-
-		set buffer $bufline
-			
-		while { [string equal $multi_line "-"] } {
-		    set number [gets $sock bufline]	
-		    if { $number > 0 } {
-			append buffer \n "$bufline"
-			regexp -- "(^\[0-9\]+)( |-)?(.*)$" $bufline all rc multi_line
-			# multi_line is not set if the bufline does not match the regexp,
-			# I.e. this keeps the '-' which started this around until the
-			# closing line does match and sets it to space.
-		    }
-		}
-
-		# Export the accumulated response. [Bug 1191607].
-		set msgtext $buffer
-	    }
-        } elseif { [eof $ftp(CtrlSock)] } {
-            # remote server has closed control connection. kill
-            # control socket, unset State to disable all following
-            # commands. Killing the socket is done before
-            # 'WaitComplete' to prevent it from recursively entering
-            # this code, overflowing the stack (socket still existing,
-            # still readable, still eof). [SF Tcllib Bug 15822535].
-            
-            set rc 421
-            catch {close $ftp(CtrlSock)}
-            catch {unset  ftp(CtrlSock)}
-            catch {unset  ftp(state.data)}
-            if { $VERBOSE } {
-                DisplayMsg $s "C: 421 Service not available, closing control connection." control
-            }
-            if {![string equal $ftp(State) "quit_sent"]} {
-		set ftp(Error) "Service not available!"
-	    }
-            CloseDataConn $s
-            WaitComplete $s 0
-	    Command $ftp(Command) terminated
-            catch {unset ftp(State)}
-            return
-        } else {
-	    # Fix SF bug #466746: Incomplete line, do nothing.
-	    return	   
-	}
-    } 
-	
-    if { $DEBUG } {
-        DisplayMsg $s "-> rc=\"$rc\"\n-> msgtext=\"$msgtext\"\n-> state=\"$ftp(State)\""
-    }
-
-    # In asynchronous mode, should we move on to the next state?
-    set nextState 0
-	
-    # system status replay
-    if { [string equal $rc "211"] } {
-        return
-    }
-
-    # use only the first digit 
-    regexp -- "^\[0-9\]?" $rc rc
-	
-    switch -exact -- $ftp(State) {
-        user { 
-            switch -exact -- $rc {
-                2 {
-                    PutsCtrlSock $s "USER $ftp(User)"
-                    set ftp(State) passwd
-		    Command $ftp(Command) user
-                }
-                default {
-                    set errmsg "Error connecting! $msgtext"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        passwd {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    Command $ftp(Command) password
-                }
-                3 {
-                    PutsCtrlSock $s "PASS $ftp(Passwd)"
-                    set ftp(State) connect
-		    Command $ftp(Command) password
-                }
-                default {
-                    set errmsg "Error connecting! $msgtext"
-                    set complete_with 0
-		    Command $ftp(Command) error $msgtext
-                }
-            }
-        }
-        connect {
-            switch -exact -- $rc {
-                2 {
-		    # The type is set after this, and we want to report
-		    # that the connection is complete once the type is done
-		    set nextState 1
-		    if {[info exists ftp(NextState)] && ![llength $ftp(NextState)]} {
-			Command $ftp(Command) connect $s
-		    } else {
-			set complete_with 1
-		    }
-                }
-                default {
-                    set errmsg "Error connecting! $msgtext"
-                    set complete_with 0
-		    Command $ftp(Command) error $msgtext
-                }
-            }
-        }   
-	connect_last {
-	    Command $ftp(Command) connect $s
-	    set complete_with 1
-	}
-        quit {
-            PutsCtrlSock $s "QUIT"
-            set ftp(State) quit_sent
-        }
-        quit_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) quit
-                }
-                default {
-                    set errmsg "Error disconnecting! $msgtext"
-                    set complete_with 0
-		    Command $ftp(Command) error $msgtext
-                }
-            }
-        }
-        quote {
-            PutsCtrlSock $s $ftp(Cmd)
-            set ftp(State) quote_sent
-        }
-        quote_sent {
-            set complete_with 1
-            set ftp(Quote) $buffer
-	    set nextState 1
-	    Command $ftp(Command) quote $buffer
-        }
-        type {
-            if { [string equal $ftp(Type) "ascii"] } {
-                PutsCtrlSock $s "TYPE A"
-            } elseif { [string equal $ftp(Type) "binary"] } {
-                PutsCtrlSock $s "TYPE I"
-            } else {
-                PutsCtrlSock $s "TYPE L"
-            }
-            set ftp(State) type_sent
-        }
-        type_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) type $ftp(Type)
-                }
-                default {
-                    set errmsg "Error setting type \"$ftp(Type)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error "error setting type \"$ftp(Type)\""
-                }
-            }
-        }
-	type_change {
-	    set ftp(Type) $ftp(type:changeto)
-	    set ftp(State) type
-	    StateHandler $s
-	}
-        nlist_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) nlist_open
-            } else {
-                set errmsg "Error setting port!"
-            }
-        }
-        nlist_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) nlist_open
-        }
-        nlist_open {
-            switch -exact -- $rc {
-                1 {}
-		2 {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error "error setting passive mode"
-                        }
-                    }   
-                    PutsCtrlSock $s "NLST$ftp(Dir)"
-                    set ftp(State) list_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        list_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) list_open
-            } else {
-                set errmsg "Error setting port!"
-		Command $ftp(Command) error $errmsg
-            }
-        }
-        list_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) list_open
-        }
-        list_open {
-            switch -exact -- $rc {
-                1 {}
-		2 {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error $errmsg
-                        }
-                    }   
-                    PutsCtrlSock $s "LIST$ftp(Dir)"
-                    set ftp(State) list_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        list_sent {
-            switch -exact -- $rc {
-                1 -
-		2 {
-                    set ftp(State) list_close
-                }
-                default {  
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        catch {unset ftp(state.data)}
-                    }    
-                    set errmsg "Error getting directory listing!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        list_close {
-            switch -exact -- $rc {
-                1 {}
-		2 {
-		    set nextState 1
-		    if {[info exists ftp(NextState)] && ![llength $ftp(NextState)]} {
-			Command $ftp(Command) list [ListPostProcess $ftp(List)]
-		    } else {
-			set complete_with 1
-		    }
-                }
-                default {
-                    set errmsg "Error receiving list!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-	list_last {
-	    Command $ftp(Command) list [ListPostProcess $ftp(List)]
-	    set complete_with 1
-	}
-        size {
-            PutsCtrlSock $s "SIZE $ftp(File)"
-            set ftp(State) size_sent
-        }
-        size_sent {
-            switch -exact -- $rc {
-                2 {
-                    regexp -- "^\[0-9\]+ (.*)$" $buffer all ftp(FileSize)
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) size $ftp(File) $ftp(FileSize)
-                }
-                default {
-                    set errmsg "Error getting file size!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        } 
-        modtime {
-            if {$ftp(DateTime) != ""} {
-              PutsCtrlSock $s "MDTM $ftp(DateTime) $ftp(File)"
-            } else { ;# No DateTime Specified
-              PutsCtrlSock $s "MDTM $ftp(File)"
-            }
-            set ftp(State) modtime_sent
-        }  
-        modtime_sent {
-            switch -exact -- $rc {
-                2 {
-                    regexp -- "^\[0-9\]+ (.*)$" $buffer all ftp(DateTime)
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) modtime $ftp(File) [ModTimePostProcess $ftp(DateTime)]
-                }
-                default {
-                    if {$ftp(DateTime) != ""} {
-                      set errmsg "Error setting modification time! No server MDTM support?"
-                    } else {
-                      set errmsg "Error getting modification time!"
-                    }
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        } 
-        pwd {
-            PutsCtrlSock $s "PWD"
-            set ftp(State) pwd_sent
-        }
-        pwd_sent {
-            switch -exact -- $rc {
-                2 {
-                    regexp -- "^.*\"(.*)\"" $buffer temp ftp(Dir)
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) pwd $ftp(Dir)
-                }
-                default {
-                    set errmsg "Error getting working dir!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        cd {
-            PutsCtrlSock $s "CWD$ftp(Dir)"
-            set ftp(State) cd_sent
-        }
-        cd_sent {
-            switch -exact -- $rc {
-                1 {}
-		2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) cd $ftp(Dir)
-                }
-                default {
-                    set errmsg "Error changing directory to \"$ftp(Dir)\""
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        mkdir {
-            PutsCtrlSock $s "MKD $ftp(Dir)"
-            set ftp(State) mkdir_sent
-        }
-        mkdir_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) mkdir $ftp(Dir)
-                }
-                default {
-                    set errmsg "Error making dir \"$ftp(Dir)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        rmdir {
-            PutsCtrlSock $s "RMD $ftp(Dir)"
-            set ftp(State) rmdir_sent
-        }
-        rmdir_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) rmdir $ftp(Dir)
-                }
-                default {
-                    set errmsg "Error removing directory!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        delete {
-            PutsCtrlSock $s "DELE $ftp(File)"
-            set ftp(State) delete_sent
-        }
-        delete_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) delete $ftp(File)
-                }
-                default {
-                    set errmsg "Error deleting file \"$ftp(File)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        rename {
-            PutsCtrlSock $s "RNFR $ftp(RenameFrom)"
-            set ftp(State) rename_to
-        }
-        rename_to {
-            switch -exact -- $rc {
-                3 {
-                    PutsCtrlSock $s "RNTO $ftp(RenameTo)"
-                    set ftp(State) rename_sent
-                }
-                default {
-                    set errmsg "Error renaming file \"$ftp(RenameFrom)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        rename_sent {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) rename $ftp(RenameFrom) $ftp(RenameTo)
-                }
-                default {
-                    set errmsg "Error renaming file \"$ftp(RenameFrom)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        put_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) put_open
-            } else {
-                set errmsg "Error setting port!"
-		Command $ftp(Command) error $errmsg
-            }
-        }
-        put_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) put_open
-        }
-        put_open {
-            switch -exact -- $rc {
-                1 -
-		2 {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error $errmsg
-                        }
-                    } 
-                    PutsCtrlSock $s "STOR $ftp(RemoteFilename)"
-                    set ftp(State) put_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        put_sent {
-            switch -exact -- $rc {
-                1 -
-		2 {
-                    set ftp(State) put_close
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        # close already opened DataConnection
-                        catch {unset ftp(state.data)}
-                    }  
-                    set errmsg "Error opening connection!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        put_close {
-            switch -exact -- $rc {
-		1 {
-		    # Keep going
-		    return
-		}
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) put $ftp(RemoteFilename)
-                }
-                default {
-		    DisplayMsg $s "rc = $rc msgtext = \"$msgtext\""
-                    set errmsg "Error storing file \"$ftp(RemoteFilename)\" due to \"$msgtext\""
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        append_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) append_open
-            } else {
-                set errmsg "Error setting port!"
-		Command $ftp(Command) error $errmsg
-            }
-        }
-        append_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) append_open
-        }
-        append_open {
-            switch -exact -- $rc {
-		1 -
-                2 {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error $errmsg
-                        }
-                    }   
-                    PutsCtrlSock $s "APPE $ftp(RemoteFilename)"
-                    set ftp(State) append_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        append_sent {
-            switch -exact -- $rc {
-                1 {
-                    set ftp(State) append_close
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        # close already opened DataConnection
-                        catch {unset ftp(state.data)}
-                    }  
-                    set errmsg "Error opening connection!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        append_close {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) append $ftp(RemoteFilename)
-                }
-                default {
-                    set errmsg "Error storing file \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        reget_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) reget_restart
-            } else {
-                set errmsg "Error setting port!"
-		Command $ftp(Command) error $errmsg
-            }
-        }
-        reget_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) reget_restart
-        }
-        reget_restart {
-            switch -exact -- $rc {
-                2 { 
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error $errmsg
-                        }
-                    }   
-                    if { $ftp(FileSize) != 0 } {
-                        PutsCtrlSock $s "REST $ftp(FileSize)"
-                        set ftp(State) reget_open
-                    } else {
-                        PutsCtrlSock $s "RETR $ftp(RemoteFilename)"
-                        set ftp(State) reget_sent
-                    } 
-                }
-                default {
-                    set errmsg "Error restarting filetransfer of \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        reget_open {
-            switch -exact -- $rc {
-                2 -
-                3 {
-                    PutsCtrlSock $s "RETR $ftp(RemoteFilename)"
-                    set ftp(State) reget_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        reget_sent {
-            switch -exact -- $rc {
-                1 {
-                    set ftp(State) reget_close
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        # close already opened DataConnection
-                        catch {unset ftp(state.data)}
-                    }  
-                    set errmsg "Error retrieving file \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        reget_close {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    Command $ftp(Command) get $ftp(RemoteFilename):$ftp(From):$ftp(To)
-		    unset ftp(From) ftp(To)
-                }
-                default {
-                    set errmsg "Error retrieving file \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        get_active {
-            if { [OpenActiveConn $s] } {
-                PutsCtrlSock $s "PORT $ftp(LocalAddr),$ftp(DataPort)"
-                set ftp(State) get_open
-            } else {
-                set errmsg "Error setting port!"
-		Command $ftp(Command) error $errmsg
-            }
-        } 
-        get_passive {
-            PutsCtrlSock $s "PASV"
-            set ftp(State) get_open
-        }
-        get_open {
-            switch -exact -- $rc {
-                1 -
-		2 -
-                3 {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        if { ![OpenPassiveConn $s $buffer] } {
-                            set errmsg "Error setting PASSIVE mode!"
-                            set complete_with 0
-			    Command $ftp(Command) error $errmsg
-                        }
-                    }   
-                    PutsCtrlSock $s "RETR $ftp(RemoteFilename)"
-                    set ftp(State) get_sent
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        set errmsg "Error setting PASSIVE mode!"
-                    } else {
-                        set errmsg "Error setting port!"
-                    }  
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        get_sent {
-            switch -exact -- $rc {
-                1 {
-                    set ftp(State) get_close
-                }
-                default {
-                    if { [string equal $ftp(Mode) "passive"] } {
-                        # close already opened DataConnection
-                        catch {unset ftp(state.data)}
-                    }  
-                    set errmsg "Error retrieving file \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-        get_close {
-            switch -exact -- $rc {
-                2 {
-                    set complete_with 1
-		    set nextState 1
-		    if {$ftp(inline)} {
-			upvar #0 $ftp(get:varname) returnData
-			set returnData $ftp(GetData)
-			Command $ftp(Command) get $ftp(GetData)
-		    } else {
-			Command $ftp(Command) get $ftp(RemoteFilename)
-		    }
-                }
-                default {
-                    set errmsg "Error retrieving file \"$ftp(RemoteFilename)\"!"
-                    set complete_with 0
-		    Command $ftp(Command) error $errmsg
-                }
-            }
-        }
-	default {
-	    error "Unknown state \"$ftp(State)\""
-	}
-    }
-
-    # finish waiting 
-    if { [info exists complete_with] } {
-        WaitComplete $s $complete_with
-    }
-
-    # display control channel message
-    if { [info exists buffer] } {
-        if { $VERBOSE } {
-            foreach line [split $buffer \n] {
-                DisplayMsg $s "C: $line" control
-            }
-        }
-    }
-	
-    # Rather than throwing an error in the event loop, set the ftp(Error)
-    # variable to hold the message so that it can later be thrown after the
-    # the StateHandler has completed.
-
-    if { [info exists errmsg] } {
-        set ftp(Error) $errmsg
-    }
-
-    # If operating asynchronously, commence next state
-    if {$nextState && [info exists ftp(NextState)] && [llength $ftp(NextState)]} {
-	# Pop the head of the NextState queue
-	set ftp(State) [lindex $ftp(NextState) 0]
-	set ftp(NextState) [lreplace $ftp(NextState) 0 0]
-	StateHandler $s
-    }
-
-    # enable fileevent on control socket again
-    #fileevent $ftp(CtrlSock) readable [list ::ftp::StateHandler $ftp(CtrlSock)]
-
-}
-
-#############################################################################
-#
-# Type --
-#
-# REPRESENTATION TYPE - Sets the file transfer type to ascii or binary.
-# (exported)
-#
-# Arguments:
-# type - 		specifies the representation type (ascii|binary)
-# 
-# Returns:
-# type	-		returns the current type or {} if an error occurs
-
-proc ::ftp::Type {s {type ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return {}
-    }
-
-    # return current type
-    if { $type == "" } {
-        return $ftp(Type)
-    }
-
-    # save current type
-    set old_type $ftp(Type) 
-	
-    set ftp(Type) $type
-    set ftp(State) type
-    StateHandler $s
-	
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-    if { $rc } {
-        return $ftp(Type)
-    } else {
-        # restore old type
-        set ftp(Type) $old_type
-        return {}
-    }
-}
-
-#############################################################################
-#
-# NList --
-#
-# NAME LIST - This command causes a directory listing to be sent from
-# server to user site.
-# (exported)
-# 
-# Arguments:
-# dir - 		The $dir should specify a directory or other system 
-#			specific file group descriptor; a null argument 
-#			implies the current directory. 
-#
-# Arguments:
-# dir - 		directory to list 
-# 
-# Returns:
-# sorted list of files or {} if listing fails
-
-proc ::ftp::NList {s { dir ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return {}
-    }
-
-    set ftp(List) {}
-    if { $dir == "" } {
-        set ftp(Dir) ""
-    } else {
-        set ftp(Dir) " $dir"
-    }
-
-    # save current type and force ascii mode
-    set old_type $ftp(Type)
-    if { $ftp(Type) != "ascii" } {
-	if {[string length $ftp(Command)]} {
-	    set ftp(NextState) [list nlist_$ftp(Mode) type_change list_last]
-	    set ftp(type:changeto) $old_type
-	    Type $s ascii
-	    return {}
-	}
-        Type $s ascii
-    }
-
-    set ftp(State) nlist_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-
-    # restore old type
-    if { [Type $s] != $old_type } {
-        Type $s $old_type
-    }
-
-    unset ftp(Dir)
-    if { $rc } {
-	return [lsort [split [string trim $ftp(List) \n] \n]]
-    } else {
-        CloseDataConn $s
-        return {}
-    }
-}
-
-#############################################################################
-#
-# List --
-#
-# LIST - This command causes a list to be sent from the server
-# to user site.
-# (exported)
-# 
-# Arguments:
-# dir - 		If the $dir specifies a directory or other group of 
-#			files, the server should transfer a list of files in 
-#			the specified directory. If the $dir specifies a file
-#			then the server should send current information on the
-# 			file.  A null argument implies the user's current 
-#			working or default directory.  
-# 
-# Returns:
-# list of files or {} if listing fails
-
-proc ::ftp::List {s {dir ""}} {
-
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return {}
-    }
-
-    set ftp(List) {}
-    if { $dir == "" } {
-        set ftp(Dir) ""
-    } else {
-        set ftp(Dir) " $dir"
-    }
-
-    # save current type and force ascii mode
-
-    set old_type $ftp(Type)
-    if { ![string equal "$ftp(Type)" "ascii"] } {
-	if {[string length $ftp(Command)]} {
-	    set ftp(NextState) [list list_$ftp(Mode) type_change list_last]
-	    set ftp(type:changeto) $old_type
-	    Type $s ascii
-	    return {}
-	}
-        Type $s ascii
-    }
-
-    set ftp(State) list_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-
-    set rc [WaitOrTimeout $s]
-
-    # restore old type
-
-    if { ![string equal "[Type $s]" "$old_type"] } {
-        Type $s $old_type
-    }
-
-    unset ftp(Dir)
-    if { $rc } { 
-	return [ListPostProcess $ftp(List)]
-    } else {
-        CloseDataConn $s
-        return {}
-    }
-}
-
-proc ::ftp::ListPostProcess l {
-
-    # clear "total"-line
-
-    set l [split $l "\n"]
-    set index [lsearch -regexp $l "^total"]
-    if { $index != "-1" } { 
-	set l [lreplace $l $index $index]
-    }
-
-    # clear blank line
-
-    set index [lsearch -regexp $l "^$"]
-    if { $index != "-1" } { 
-	set l [lreplace $l $index $index]
-    }
-
-    return $l
-}
-
-#############################################################################
-#
-# FileSize --
-#
-# REMOTE FILE SIZE - This command gets the file size of the
-# file on the remote machine. 
-# ATTENTION! Doesn't work properly in ascii mode!
-# (exported)
-# 
-# Arguments:
-# filename - 		specifies the remote file name
-# 
-# Returns:
-# size -		files size in bytes or {} in error cases
-
-proc ::ftp::FileSize {s {filename ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return {}
-    }
-	
-    if { $filename == "" } {
-        return {}
-    } 
-
-    set ftp(File) $filename
-    set ftp(FileSize) 0
-	
-    set ftp(State) size
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-	
-    if {![string length $ftp(Command)]} {
-	unset ftp(File)
-    }
-		
-    if { $rc } {
-        return $ftp(FileSize)
-    } else {
-        return {}
-    }
-}
-
-
-#############################################################################
-#
-# ModTime --
-#
-# MODIFICATION TIME - This command gets the last modification time of the
-# file on the remote machine.
-# (exported)
-# 
-# Arguments:
-# filename - 		specifies the remote file name
-# datetime -            optional new timestamp for file
-# 
-# Returns:
-# clock -		files date and time as a system-depentend integer
-#			value in seconds (see tcls clock command) or {} in 
-#			error cases
-# if MDTM not supported on server, returns original timestamp
-
-proc ::ftp::ModTime {s {filename ""} {datetime ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        } 
-        return {}
-    }
-	
-    if { $filename == "" } {
-        return {}
-    } 
-
-    set ftp(File) $filename
-
-    if {$datetime != ""} {
-      set datetime [clock format $datetime -format "%Y%m%d%H%M%S"]
-    }
-    set ftp(DateTime) $datetime
-	
-    set ftp(State) modtime
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-	
-    if {![string length $ftp(Command)]} {
-	unset ftp(File)
-    }
-    if { ![string length $ftp(Command)] && $rc } {
-        return [ModTimePostProcess $ftp(DateTime)]
-    } else {
-        return {}
-    }
-}
-
-proc ::ftp::ModTimePostProcess {clock} {
-    foreach {year month day hour min sec} {1 1 1 1 1 1} break
-
-    # Bug #478478. Special code to detect ftp servers with a Y2K patch
-    # gone bad and delivering, hmmm, non-standard date information.
-
-    if {[string length $clock] == 15} {
-        scan $clock "%2s%3s%2s%2s%2s%2s%2s" cent year month day hour min sec
-        set year [expr {($cent * 100) + $year}]
-	log::log warning "data | W: server with non-standard time, bad Y2K patch."
-    } else {
-        scan $clock "%4s%2s%2s%2s%2s%2s" year month day hour min sec
-    }
-
-    set clock [clock scan "$month/$day/$year $hour:$min:$sec" -gmt 1]
-    return $clock
-}
-
-#############################################################################
-#
-# Pwd --
-#
-# PRINT WORKING DIRECTORY - Causes the name of the current working directory.
-# (exported)
-# 
-# Arguments:
-# None.
-# 
-# Returns:
-# current directory name
-
-proc ::ftp::Pwd {s } {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return {}
-    }
-
-    set ftp(Dir) {}
-
-    set ftp(State) pwd
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-	
-    if { $rc } {
-        return $ftp(Dir)
-    } else {
-        return {}
-    }
-}
-
-#############################################################################
-#
-# Cd --
-#   
-# CHANGE DIRECTORY - Sets the working directory on the server host.
-# (exported)
-# 
-# Arguments:
-# dir -			pathname specifying a directory
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::Cd {s {dir ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        if { ![string is digit -strict $s] } {
-            DisplayMsg $s "Bad connection name \"$s\"" error
-        } else {
-            DisplayMsg $s "Not connected!" error
-        }
-        return 0
-    }
-
-    if { $dir == "" } {
-        set ftp(Dir) ""
-    } else {
-        set ftp(Dir) " $dir"
-    }
-
-    set ftp(State) cd
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    if {![string length $ftp(Command)]} {
-	unset ftp(Dir)
-    }
-	
-    if { $rc } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# MkDir --
-#
-# MAKE DIRECTORY - This command causes the directory specified in the $dir
-# to be created as a directory (if the $dir is absolute) or as a subdirectory
-# of the current working directory (if the $dir is relative).
-# (exported)
-# 
-# Arguments:
-# dir -			new directory name
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::MkDir {s dir} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    set ftp(Dir) $dir
-
-    set ftp(State) mkdir
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    if {![string length $ftp(Command)]} {
-	unset ftp(Dir)
-    }
-	
-    if { $rc } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# RmDir --
-#
-# REMOVE DIRECTORY - This command causes the directory specified in $dir to 
-# be removed as a directory (if the $dir is absolute) or as a 
-# subdirectory of the current working directory (if the $dir is relative).
-# (exported)
-#
-# Arguments:
-# dir -			directory name
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::RmDir {s dir} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    set ftp(Dir) $dir
-
-    set ftp(State) rmdir
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    if {![string length $ftp(Command)]} {
-	unset ftp(Dir)
-    }
-	
-    if { $rc } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# Delete --
-#
-# DELETE - This command causes the file specified in $file to be deleted at 
-# the server site.
-# (exported)
-# 
-# Arguments:
-# file -			file name
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::Delete {s file} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    set ftp(File) $file
-
-    set ftp(State) delete
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    if {![string length $ftp(Command)]} {
-	unset ftp(File)
-    }
-	
-    if { $rc } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# Rename --
-#
-# RENAME FROM TO - This command causes the file specified in $from to be 
-# renamed at the server site.
-# (exported)
-# 
-# Arguments:
-# from -			specifies the old file name of the file which 
-#				is to be renamed
-# to -				specifies the new file name of the file 
-#				specified in the $from agument
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::Rename {s from to} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    set ftp(RenameFrom) $from
-    set ftp(RenameTo) $to
-
-    set ftp(State) rename
-
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    if {![string length $ftp(Command)]} {
-	unset ftp(RenameFrom)
-	unset ftp(RenameTo)
-    }
-	
-    if { $rc } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# ElapsedTime --
-#
-# Gets the elapsed time for file transfer
-# 
-# Arguments:
-# stop_time - 		ending time
-
-proc ::ftp::ElapsedTime {s stop_time} {
-    variable VERBOSE
-    upvar ::ftp::ftp$s ftp
-
-    set elapsed [expr {$stop_time - $ftp(Start_Time)}]
-    if { $elapsed == 0 } {
-        set elapsed 1
-    }
-    set persec [expr {$ftp(Total) / $elapsed}]
-    if { $VERBOSE } {
-        DisplayMsg $s "$ftp(Total) bytes sent in $elapsed seconds ($persec Bytes/s)"
-    }
-    return
-}
-
-#############################################################################
-#
-# PUT --
-#
-# STORE DATA - Causes the server to accept the data transferred via the data 
-# connection and to store the data as a file at the server site.  If the file
-# exists at the server site, then its contents shall be replaced by the data
-# being transferred.  A new file is created at the server site if the file
-# does not already exist.
-# (exported)
-#
-# Arguments:
-# source -			local file name
-# dest -			remote file name, if unspecified, ftp assigns
-#				the local file name.
-# Returns:
-# 0 -			file not stored
-# 1 - 			OK
-
-proc ::ftp::Put {s args} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-    if {([llength $args] < 1) || ([llength $args] > 4)} {
-        DisplayMsg $s \
-		"wrong # args: should be \"ftp::Put handle (-data \"data\" | -channel chan | localFilename) remoteFilename\"" error
-	return 0    
-    }
-
-    set ftp(inline) 0
-    set flags 1
-    set source ""
-    set dest ""
-    foreach arg $args {
-        if {[string equal $arg "--"]} {
-            set flags 0
-        } elseif {($flags) && ([string equal $arg "-data"])} {
-            set ftp(inline) 1
-            set ftp(filebuffer) ""
-        } elseif {($flags) && ([string equal $arg "-channel"])} {
-            set ftp(inline) 2
-	} elseif {$source == ""} {
-            set source $arg
-	} elseif {$dest == ""} {
-            set dest $arg
-	} else {
-            DisplayMsg $s "wrong # args: should be \"ftp::Put handle (-data \"data\" | -channel chan | localFilename) remoteFilename\"" error
-	    return 0
-        }
-    }
-
-    if {($source == "")} {
-        DisplayMsg $s "Must specify a valid data source to Put" error
-        return 0
-    }        
-
-    set ftp(RemoteFilename) $dest
-
-    if {$ftp(inline) == 1} {
-        set ftp(PutData) $source
-        if { $dest == "" } {
-            set dest ftp.tmp
-        }
-        set ftp(RemoteFilename) $dest
-    } else {
-	if {$ftp(inline) == 0} {
-	    # File transfer
-
-	    set ftp(PutData) ""
-	    if { ![file exists $source] } {
-		DisplayMsg $s "File \"$source\" not exist" error
-		return 0
-	    }
-	    if { $dest == "" } {
-		set dest [file tail $source]
-	    }
-	    set ftp(LocalFilename) $source
-	    set ftp(SourceCI) [open $ftp(LocalFilename) r]
-	} else {
-	    # Channel transfer. We fake the rest of the system into
-	    # believing that a file transfer is happening. This makes
-	    # the handling easier.
-
-	    set ftp(SourceCI) $source
-	    set ftp(inline) 0
-	}
-        set ftp(RemoteFilename) $dest
-
-	# TODO: read from source file asynchronously
-        if { [string equal $ftp(Type) "ascii"] } {
-            fconfigure $ftp(SourceCI) -buffering line -blocking 1
-        } else {
-            fconfigure $ftp(SourceCI) -buffering line -translation binary -blocking 1
-        }
-    }
-
-    set ftp(State) put_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-    if { $rc } {
-	if {![string length $ftp(Command)]} {
-	    ElapsedTime $s [clock seconds]
-	}
-        return 1
-    } else {
-        CloseDataConn $s
-        return 0
-    }
-}
-
-#############################################################################
-#
-# APPEND --
-#
-# APPEND DATA - Causes the server to accept the data transferred via the data 
-# connection and to store the data as a file at the server site.  If the file
-# exists at the server site, then the data shall be appended to that file; 
-# otherwise the file specified in the pathname shall be created at the
-# server site.
-# (exported)
-#
-# Arguments:
-# source -			local file name
-# dest -			remote file name, if unspecified, ftp assigns
-#				the local file name.
-# Returns:
-# 0 -			file not stored
-# 1 - 			OK
-
-proc ::ftp::Append {s args} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if {([llength $args] < 1) || ([llength $args] > 4)} {
-        DisplayMsg $s "wrong # args: should be \"ftp::Append handle (-data \"data\" | -channel chan | localFilename) remoteFilename\"" error
-        return 0
-    }
-
-    set ftp(inline) 0
-    set flags 1
-    set source ""
-    set dest ""
-    foreach arg $args {
-        if {[string equal $arg "--"]} {
-            set flags 0
-        } elseif {($flags) && ([string equal $arg "-data"])} {
-            set ftp(inline) 1
-            set ftp(filebuffer) ""
-        } elseif {($flags) && ([string equal $arg "-channel"])} {
-            set ftp(inline) 2
-        } elseif {$source == ""} {
-            set source $arg
-        } elseif {$dest == ""} {
-            set dest $arg
-        } else {
-            DisplayMsg $s "wrong # args: should be \"ftp::Append handle (-data \"data\" | -channel chan | localFilename) remoteFilename\"" error
-            return 0
-        }
-    }
-
-    if {($source == "")} {
-        DisplayMsg $s "Must specify a valid data source to Append" error
-        return 0
-    }   
-
-    set ftp(RemoteFilename) $dest
-
-    if {$ftp(inline) == 1} {
-        set ftp(PutData) $source
-        if { $dest == "" } {
-            set dest ftp.tmp
-        }
-        set ftp(RemoteFilename) $dest
-    } else {
-	if {$ftp(inline) == 0} {
-	    # File transfer
-
-	    set ftp(PutData) ""
-	    if { ![file exists $source] } {
-		DisplayMsg $s "File \"$source\" not exist" error
-		return 0
-	    }
-			
-	    if { $dest == "" } {
-		set dest [file tail $source]
-	    }
-
-	    set ftp(LocalFilename) $source
-	    set ftp(SourceCI) [open $ftp(LocalFilename) r]
-	} else {
-	    # Channel transfer. We fake the rest of the system into
-	    # believing that a file transfer is happening. This makes
-	    # the handling easier.
-
-	    set ftp(SourceCI) $source
-	    set ftp(inline) 0
-	}
-        set ftp(RemoteFilename) $dest
-
-        if { [string equal $ftp(Type) "ascii"] } {
-            fconfigure $ftp(SourceCI) -buffering line -blocking 1
-        } else {
-            fconfigure $ftp(SourceCI) -buffering line -translation binary \
-                    -blocking 1
-        }
-    }
-
-    set ftp(State) append_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-    if { $rc } {
-	if {![string length $ftp(Command)]} {
-	    ElapsedTime $s [clock seconds]
-	}
-        return 1
-    } else {
-        CloseDataConn $s
-        return 0
-    }
-}
-
-
-#############################################################################
-#
-# Get --
-#
-# RETRIEVE DATA - Causes the server to transfer a copy of the specified file
-# to the local site at the other end of the data connection.
-# (exported)
-#
-# Arguments:
-# source -			remote file name
-# dest -			local file name, if unspecified, ftp assigns
-#				the remote file name.
-# Returns:
-# 0 -			file not retrieved
-# 1 - 			OK
-
-proc ::ftp::Get {s args} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if {([llength $args] < 1) || ([llength $args] > 4)} {
-        DisplayMsg $s "wrong # args: should be \"ftp::Get handle remoteFile ?(-variable varName | -channel chan | localFilename)?\"" error
-	return 0    
-    }
-
-    set ftp(inline) 0
-    set flags 1
-    set source ""
-    set dest ""
-    set varname "**NONE**"
-    foreach arg $args {
-        if {[string equal $arg "--"]} {
-            set flags 0
-        } elseif {($flags) && ([string equal $arg "-variable"])} {
-            set ftp(inline) 1
-            set ftp(filebuffer) ""
-        } elseif {($flags) && ([string equal $arg "-channel"])} {
-            set ftp(inline) 2
-	} elseif {($ftp(inline) == 1) && ([string equal $varname "**NONE**"])} {
-            set varname $arg
-	    set ftp(get:varname) $varname
-	} elseif {($ftp(inline) == 2) && ([string equal $varname "**NONE**"])} {
-	    set ftp(get:channel) $arg
-	} elseif {$source == ""} {
-            set source $arg
-	} elseif {$dest == ""} {
-            set dest $arg
-	} else {
-            DisplayMsg $s "wrong # args: should be \"ftp::Get handle remoteFile
-?(-variable varName | -channel chan | localFilename)?\"" error
-	    return 0
-        }
-    }
-
-    if {($ftp(inline) != 0) && ($dest != "")} {
-        DisplayMsg $s "Cannot return data in a variable or channel, and place it in destination file." error
-        return 0
-    }
-
-    if {$source == ""} {
-        DisplayMsg $s "Must specify a valid data source to Get" error
-        return 0
-    }
-
-    if {$ftp(inline) == 0} {
-	if { $dest == "" } {
-	    set dest $source
-	} else {
-	    if {[file isdirectory $dest]} {
-		set dest [file join $dest [file tail $source]]
-	    }
-	}
-	if {![file exists [file dirname $dest]]} {
-	    return -code error "ftp::Get, directory \"[file dirname $dest]\" for destination \"$dest\" does not exist"
-	}
-	set ftp(LocalFilename) $dest
-    }
-
-    set ftp(RemoteFilename) $source
-
-    if {$ftp(inline) == 2} {
-	set ftp(inline) 0
-    }
-    set ftp(State) get_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-
-    # It is important to unset 'get:channel' in all cases or it will
-    # interfere with any following ftp command (as its existence
-    # suppresses the closing of the destination channel identifier
-    # (DestCI). We cannot do it earlier than just before the 'return'
-    # or code depending on it for the current command may not execute
-    # correctly.
-
-    if { $rc } {
-	if {![string length $ftp(Command)]} {
-	    ElapsedTime $s [clock seconds]
-	    if {$ftp(inline)} {
-		catch {unset ftp(get:channel)}
-		upvar $varname returnData
-		set returnData $ftp(GetData)
-	    }
-	}
-	# catch {unset ftp(get:channel)}
-	# SF Bug 1708350. DISABLED. In async mode (Open -command) the
-	# unset here causes HandleData to blow up, see marker <@>. In
-	# essence in async mode HandleData can be entered multiple
-	# times, and unsetting get:channel here causes it to think
-	# that the data goes into a local file, not a channel, but the
-	# state does not contain local file information, so an error
-	# is thrown. Removing the catch here seems to fix it without
-	# adverse effects elsewhere. Maybe. We hope.
-        return 1
-    } else {
-        if {$ftp(inline)} {
-	    catch {unset ftp(get:channel)}
-            return ""
-	}
-        CloseDataConn $s
-	catch {unset ftp(get:channel)}
-        return 0
-    }
-}
-
-#############################################################################
-#
-# Reget --
-#
-# RESTART RETRIEVING DATA - Causes the server to transfer a copy of the specified file
-# to the local site at the other end of the data connection like get but skips over 
-# the file to the specified data checkpoint. 
-# (exported)
-#
-# Arguments:
-# source -			remote file name
-# dest -			local file name, if unspecified, ftp assigns
-#				the remote file name.
-# Returns:
-# 0 -			file not retrieved
-# 1 - 			OK
-
-proc ::ftp::Reget {s source {dest ""} {from_bytes 0} {till_bytes -1}} {
-    upvar ::ftp::ftp$s ftp
-    
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if { $dest == "" } {
-        set dest $source
-    }
-    if {![file exists [file dirname $dest]]} {
-	return -code error \
-	"ftp::Reget, directory \"[file dirname $dest]\" for destination \"$dest\" does not exist"
-    }
-
-    set ftp(RemoteFilename) $source
-    set ftp(LocalFilename) $dest
-    set ftp(From) $from_bytes
-
-
-    # Assumes that the local file has a starting offset of $from_bytes
-    # The following calculation ensures that the download starts from the
-    # correct offset
-
-    if { [file exists $ftp(LocalFilename)] } {
-	set ftp(FileSize) [ expr {[file size $ftp(LocalFilename)] + $from_bytes }]
-	 	
-	if { $till_bytes != -1 } {
-	    set ftp(To)   $till_bytes	
-	    set ftp(Bytes_to_go) [ expr {$till_bytes - $ftp(FileSize)} ]
-	
-	    if { $ftp(Bytes_to_go) <= 0 } {return 0}
-
-	} else {
-	    # till_bytes not set
-	    set ftp(To)   end
-	}
-
-    } else {
-	# local file does not exist
-        set ftp(FileSize) $from_bytes
-		  
-	if { $till_bytes != -1 } {
-	    set ftp(Bytes_to_go) [ expr {$till_bytes - $from_bytes }]
-	    set ftp(To) $till_bytes
-	} else {
-	    #till_bytes not set
-	    set ftp(To)   end
-	}
-    }
-	
-    set ftp(State) reget_$ftp(Mode)
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s]
-    if { $rc } {
-	if {![string length $ftp(Command)]} {
-	    ElapsedTime $s [clock seconds]
-	}
-        return 1
-    } else {
-        CloseDataConn $s
-        return 0
-    }
-}
-
-#############################################################################
-#
-# Newer --
-#
-# GET NEWER DATA - Get the file only if the modification time of the remote 
-# file is more recent that the file on the current system. If the file does
-# not exist on the current system, the remote file is considered newer.
-# Otherwise, this command is identical to get. 
-# (exported)
-#
-# Arguments:
-# source -			remote file name
-# dest -			local file name, if unspecified, ftp assigns
-#				the remote file name.
-#
-# Returns:
-# 0 -			file not retrieved
-# 1 - 			OK
-
-proc ::ftp::Newer {s source {dest ""}} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if {[string length $ftp(Command)]} {
-	return -code error "unable to retrieve file asynchronously (not implemented yet)"
-    }
-
-    if { $dest == "" } {
-        set dest $source
-    }
-    if {![file exists [file dirname $dest]]} {
-	return -code error "ftp::Newer, directory \"[file dirname $dest]\" for destination \"$dest\" does not exist"
-    }
-
-    set ftp(RemoteFilename) $source
-    set ftp(LocalFilename) $dest
-
-    # get remote modification time
-    set rmt [ModTime $s $ftp(RemoteFilename)]
-    if { $rmt == "-1" } {
-        return 0
-    }
-
-    # get local modification time
-    if { [file exists $ftp(LocalFilename)] } {
-        set lmt [file mtime $ftp(LocalFilename)]
-    } else {
-        set lmt 0
-    }
-	
-    # remote file is older than local file
-    if { $rmt < $lmt } {
-        return 0
-    }
-
-    # remote file is newer than local file or local file doesn't exist
-    # get it
-    set rc [Get $s $ftp(RemoteFilename) $ftp(LocalFilename)]
-    return $rc
-		
-}
-
-#############################################################################
-#
-# Quote -- 
-#
-# The arguments specified are sent, verbatim, to the remote ftp server.     
-#
-# Arguments:
-# 	arg1 arg2 ...
-#
-# Returns:
-#  string sent back by the remote ftp server or null string if any error
-#
-
-proc ::ftp::Quote {s args} {
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    set ftp(Cmd) $args
-    set ftp(Quote) {}
-
-    set ftp(State) quote
-    StateHandler $s
-
-    # wait for synchronization
-    set rc [WaitOrTimeout $s] 
-
-    unset ftp(Cmd)
-
-    if { $rc } {
-        return $ftp(Quote)
-    } else {
-        return {}
-    }
-}
-
-
-#############################################################################
-#
-# Abort -- 
-#
-# ABORT - Tells the server to abort the previous ftp service command and 
-# any associated transfer of data. The control connection is not to be 
-# closed by the server, but the data connection must be closed.
-# 
-# NOTE: This procedure doesn't work properly. Thus the ftp::Abort command
-# is no longer available!
-#
-# Arguments:
-# None.
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-#
-# proc Abort {} {
-#
-# }
-
-#############################################################################
-#
-# Close -- 
-#
-# Terminates a ftp session and if file transfer is not in progress, the server
-# closes the control connection.  If file transfer is in progress, the 
-# connection will remain open for result response and the server will then
-# close it. 
-# (exported)
-# 
-# Arguments:
-# None.
-#
-# Returns:
-# 0 -			ERROR
-# 1 - 			OK
-
-proc ::ftp::Close {s } {
-    variable connections
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if {[info exists \
-            connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost),afterid)]} {
-        unset connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost),afterid)
-        unset connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost))
-    }
-
-    set ftp(State) quit
-    StateHandler $s
-
-    # wait for synchronization
-    WaitOrTimeout $s
-
-    catch {close $ftp(CtrlSock)}
-    catch {unset ftp}
-    return 1
-}
-
-proc ::ftp::LazyClose {s } {
-    variable connections
-    upvar ::ftp::ftp$s ftp
-
-    if { ![info exists ftp(State)] } {
-        DisplayMsg $s "Not connected!" error
-        return 0
-    }
-
-    if {[info exists connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost))]} {
-        set connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost),afterid) \
-                [after 5000 [list ftp::Close $s]]
-    }
-    return 1
-}
-
-#############################################################################
-#
-# Open --
-#
-# Starts the ftp session and sets up a ftp control connection.
-# (exported)
-# 
-# Arguments:
-# server - 		The ftp server hostname.
-# user -		A string identifying the user. The user identification 
-#			is that which is required by the server for access to 
-#			its file system.  
-# passwd -		A string specifying the user's password.
-# options -		-blocksize size		writes "size" bytes at once
-#						(default 4096)
-#			-timeout seconds	if non-zero, sets up timeout to
-#						occur after specified number of
-#						seconds (default 120)
-#			-progress proc		procedure name that handles callbacks
-#						(no default)  
-#			-output proc		procedure name that handles output
-#						(no default)  
-#			-mode mode		switch active or passive file transfer
-#						(default active)
-#			-port number		alternative port (default 21)
-#			-command proc		callback for completion notification
-#						(no default)
-# 
-# Returns:
-# 0 -			Not logged in
-# 1 - 			User logged in
-
-proc ::ftp::Open {server user passwd args} {
-    variable DEBUG 
-    variable VERBOSE
-    variable serial
-    variable connections
-
-    set s $serial
-    incr serial
-    upvar ::ftp::ftp$s ftp
-#    if { [info exists ftp(State)] } {
-#        DisplayMsg $s "Mmh, another attempt to open a new connection? There is already a hot wire!" error
-#        return 0
-#    }
-
-    # default NO DEBUG
-    if { ![info exists DEBUG] } {
-        set DEBUG 0
-    }
-
-    # default NO VERBOSE
-    if { ![info exists VERBOSE] } {
-        set VERBOSE 0
-    }
-	
-    if { $DEBUG } {
-        DisplayMsg $s "Starting new connection with: "
-    }
-
-    set ftp(inline) 	0
-    set ftp(User)       $user
-    set ftp(Passwd) 	$passwd
-    set ftp(RemoteHost) $server
-    set ftp(LocalHost) 	[info hostname]
-    set ftp(DataPort) 	0
-    set ftp(Type) 	{}
-    set ftp(Error) 	""
-    set ftp(Progress) 	{}
-    set ftp(Command)	{}
-    set ftp(Output) 	{}
-    set ftp(Blocksize) 	4096	
-    set ftp(Timeout) 	600	
-    set ftp(Mode) 	active	
-    set ftp(Port) 	21	
-
-    set ftp(State) 	user
-	
-    # set state var
-    set ftp(state.control) ""
-	
-    # Get and set possible options
-    set options {-blocksize -timeout -mode -port -progress -output -command}
-    foreach {option value} $args {
-        if { [lsearch -exact $options $option] != "-1" } {
-            if { $DEBUG } {
-                DisplayMsg $s "  $option = $value"
-            }
-            regexp -- {^-(.?)(.*)$} $option all first rest
-            set option "[string toupper $first]$rest"
-            set ftp($option) $value
-        } 
-    }
-    if { $DEBUG && ([llength $args] == 0) } {
-        DisplayMsg $s "  no option"
-    }
-
-    if {[info exists \
-            connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost),afterid)]} {
-        after cancel $connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost),afterid)
-	Command $ftp(Command) connect $connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost))
-        return $connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost))
-    }
-
-
-    # No call of StateHandler is required at this time.
-    # StateHandler at first time is called automatically
-    # by a fileevent for the control channel.
-
-    # Try to open a control connection
-    if { ![OpenControlConn $s [expr {[string length $ftp(Command)] > 0}]] } {
-        return -1
-    }
-
-    # waits for synchronization
-    #   0 ... Not logged in
-    #   1 ... User logged in
-    if {[string length $ftp(Command)]} {
-	# Don't wait - asynchronous operation
-	set ftp(NextState) {type connect_last}
-        set connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost)) $s
-	return $s
-    } elseif { [WaitOrTimeout $s] } {
-        # default type is binary
-        Type $s binary
-        set connections($ftp(User),$ftp(Passwd),$ftp(RemoteHost)) $s
-	Command $ftp(Command) connect $s
-        return $s
-    } else {
-        # close connection if not logged in
-        Close $s
-        return -1
-    }
-}
-
-#############################################################################
-#
-# CopyNext --
-#
-# recursive background copy procedure for ascii/binary file I/O
-# 
-# Arguments:
-# bytes - 		indicates how many bytes were written on $ftp(DestCI)
-
-proc ::ftp::CopyNext {s bytes {error {}}} {
-    upvar ::ftp::ftp$s ftp
-    variable DEBUG
-    variable VERBOSE
-
-    # summary bytes
-
-    incr ftp(Total) $bytes
-
-    # update bytes_to_go and blocksize
-
-    if { [info exists ftp(Bytes_to_go)] } {
-	set ftp(Bytes_to_go) [expr {$ftp(Bytes_to_go) - $bytes}]
-	 
-	if { $ftp(Blocksize) <= $ftp(Bytes_to_go) } {
-	    set blocksize $ftp(Blocksize)
-	} else {
-	    set blocksize $ftp(Bytes_to_go)
-	}
-    } else {
-	set blocksize $ftp(Blocksize)
-    } 
-    
-    # callback for progress bar procedure
-    
-    if { ([info exists ftp(Progress)]) && \
-	    [string length $ftp(Progress)] && \
-	    ([info commands [lindex $ftp(Progress) 0]] != "") } { 
-        eval $ftp(Progress) $ftp(Total)
-    }
-
-    # setup new timeout handler
-
-    catch {after cancel $ftp(Wait)}
-    set ftp(Wait) [after [expr {$ftp(Timeout) * 1000}] [namespace current]::Timeout $s]
-
-    if { $DEBUG } {
-        DisplayMsg $s "-> $ftp(Total) bytes $ftp(SourceCI) -> $ftp(DestCI)" 
-    }
-
-    if { $error != "" } {
-	# Protect the destination channel from destruction if it came
-	# from the caller. Closing it is not our responsibility in that case.
-
-	if {![info exists ftp(get:channel)]} {
-	    catch {close $ftp(DestCI)}
-	}
-        catch {close $ftp(SourceCI)}
-        catch {unset ftp(state.data)}
-        DisplayMsg $s $error error
-
-    } elseif { ([eof $ftp(SourceCI)] || ($blocksize <= 0)) } {
-	# Protect the destination channel from destruction if it came
-	# from the caller. Closing it is not our responsibility in that case.
-
-	if {![info exists ftp(get:channel)]} {
-	    close $ftp(DestCI)
-	}
-        close $ftp(SourceCI)
-        catch {unset ftp(state.data)}
-        if { $VERBOSE } {
-            DisplayMsg $s "D: Port closed" data
-        }
-
-    } else {
-	fcopy $ftp(SourceCI) $ftp(DestCI) \
-		-command [list [namespace current]::CopyNext $s] \
-		-size $blocksize
-    }
-    return
-}
-
-#############################################################################
-#
-# HandleData --
-#
-# Handles ascii/binary data transfer for Put and Get 
-# 
-# Arguments:
-# sock - 		socket name (data channel)
-
-proc ::ftp::HandleData {s sock} {
-    upvar ::ftp::ftp$s ftp
-
-    # Turn off any fileevent handlers
-
-    fileevent $sock writable {}		
-    fileevent $sock readable {}
-
-    # create local file for ftp::Get 
-
-    if { [string match "get*" $ftp(State)]  && (!$ftp(inline))} {
-
-	# A channel was specified by the caller. Use that instead of a
-	# file.
-
-	# SF Bug 1708350 <@>
-	if {[info exists ftp(get:channel)]} {
-	    set ftp(DestCI) $ftp(get:channel)
-	    set rc 0
-	} else {
-	    set rc [catch {set ftp(DestCI) [open $ftp(LocalFilename) w]} msg]
-	}
-        if { $rc != 0 } {
-            DisplayMsg $s "$msg" error
-            return 0
-        }
-	# TODO: Use non-blocking I/O
-        if { [string equal $ftp(Type) "ascii"] } {
-            fconfigure $ftp(DestCI) -buffering line -blocking 1
-        } else {
-            fconfigure $ftp(DestCI) -buffering line -translation binary -blocking 1
-        }
-    }	
-
-    # append local file for ftp::Reget 
-
-    if { [string match "reget*" $ftp(State)] } {
-        set rc [catch {set ftp(DestCI) [open $ftp(LocalFilename) a]} msg]
-        if { $rc != 0 } {
-            DisplayMsg $s "$msg" error
-            return 0
-        }
-	# TODO: Use non-blocking I/O
-        if { [string equal $ftp(Type) "ascii"] } {
-            fconfigure $ftp(DestCI) -buffering line -blocking 1
-        } else {
-            fconfigure $ftp(DestCI) -buffering line -translation binary -blocking 1
-        }
-    }	
-
-
-    set ftp(Total) 0
-    set ftp(Start_Time) [clock seconds]
-	 
-    # calculate blocksize
-	 
-    if { [ info exists ftp(Bytes_to_go) ] } {
-			
-	if { $ftp(Blocksize) <= $ftp(Bytes_to_go) } {
-	    set Blocksize $ftp(Blocksize)
-	} else {
-	    set Blocksize $ftp(Bytes_to_go)
-	}
-	
-    } else {
-	set Blocksize $ftp(Blocksize)
-    }
-	
-    # perform fcopy
-    fcopy $ftp(SourceCI) $ftp(DestCI) \
-	    -command [list [namespace current]::CopyNext $s ] \
-	    -size $Blocksize
-    return 1
-}
-
-#############################################################################
-#
-# HandleList --
-#
-# Handles ascii data transfer for list commands
-# 
-# Arguments:
-# sock - 		socket name (data channel)
-
-proc ::ftp::HandleList {s sock} {
-    upvar ::ftp::ftp$s ftp
-    variable VERBOSE
-
-    if { ![eof $sock] } {
-        set buffer [read $sock]
-        if { $buffer != "" } {
-            set ftp(List) [append ftp(List) $buffer]
-        }	
-    } else {
-        close $sock
-        catch {unset ftp(state.data)}
-        if { $VERBOSE } {
-            DisplayMsg $s "D: Port closed" data
-        }
-    }
-    return
-}
-
-#############################################################################
-#
-# HandleVar --
-#
-# Handles data transfer for get/put commands that use buffers instead
-# of files.
-# 
-# Arguments:
-# sock - 		socket name (data channel)
-
-proc ::ftp::HandleVar {s sock} {
-    upvar ::ftp::ftp$s ftp
-    variable VERBOSE
-
-    if {$ftp(Start_Time) == -1} {
-        set ftp(Start_Time) [clock seconds]
-    }
-
-    if { ![eof $sock] } {
-        set buffer [read $sock]
-        if { $buffer != "" } {
-            append ftp(GetData) $buffer
-            incr ftp(Total) [string length $buffer]
-        }	
-    } else {
-        close $sock
-        catch {unset ftp(state.data)}
-        if { $VERBOSE } {
-            DisplayMsg $s "D: Port closed" data
-        }
-    }
-    return
-}
-
-#############################################################################
-#
-# HandleOutput --
-#
-# Handles data transfer for get/put commands that use buffers instead
-# of files.
-# 
-# Arguments:
-# sock - 		socket name (data channel)
-
-proc ::ftp::HandleOutput {s sock} {
-    upvar ::ftp::ftp$s ftp
-    variable VERBOSE
-
-    if {$ftp(Start_Time) == -1} {
-        set ftp(Start_Time) [clock seconds]
-    }
-
-    if { $ftp(Total) < [string length $ftp(PutData)] } {
-        set substr [string range $ftp(PutData) $ftp(Total) \
-                [expr {$ftp(Total) + $ftp(Blocksize)}]]
-        if {[catch {puts -nonewline $sock "$substr"} result]} {
-            close $sock
-            catch {unset ftp(state.data)}
-            if { $VERBOSE } {
-                DisplayMsg $s "D: Port closed" data
-            }
-        } else {
-            incr ftp(Total) [string length $substr]
-        }
-    } else {
-        fileevent $sock writable {}		
-        close $sock
-        catch {unset ftp(state.data)}
-        if { $VERBOSE } {
-            DisplayMsg $s "D: Port closed" data
-        }
-    }
-    return
-}
-
-############################################################################
-#
-# CloseDataConn -- 
-#
-# Closes all sockets and files used by the data conection
-#
-# Arguments:
-# None.
-#
-# Returns:
-# None.
-#
-proc ::ftp::CloseDataConn {s } {
-    upvar ::ftp::ftp$s ftp
-
-    # Protect the destination channel from destruction if it came
-    # from the caller. Closing it is not our responsibility.
-
-    if {[info exists ftp(get:channel)]} {
-	catch {unset ftp(get:channel)}
-	catch {unset ftp(DestCI)}
-    }
-
-    catch {after cancel $ftp(Wait)}
-    catch {fileevent $ftp(DataSock) readable {}}
-    catch {close $ftp(DataSock); unset ftp(DataSock)}
-    catch {close $ftp(DestCI); unset ftp(DestCI)} 
-    catch {close $ftp(SourceCI); unset ftp(SourceCI)}
-    catch {close $ftp(DummySock); unset ftp(DummySock)}
-    return
-}
-
-#############################################################################
-#
-# InitDataConn --
-#
-# Configures new data channel for connection to ftp server 
-# ATTENTION! The new data channel "sock" is not the same as the 
-# server channel, it's a dummy.
-# 
-# Arguments:
-# sock -		the name of the new channel
-# addr -		the address, in network address notation, 
-#			of the client's host,
-# port -		the client's port number
-
-proc ::ftp::InitDataConn {s sock addr port} {
-    upvar ::ftp::ftp$s ftp
-    variable VERBOSE
-
-    # If the new channel is accepted, the dummy channel will be closed
-
-    catch {close $ftp(DummySock); unset ftp(DummySock)}
-
-    set ftp(state.data) 0
-
-    # Configure translation and blocking modes
-
-    set blocking 1
-    if {[string length $ftp(Command)]} {
-	set blocking 0
-    }
-
-    if { [string equal $ftp(Type) "ascii"] } {
-        fconfigure $sock -buffering line -blocking $blocking
-    } else {
-        fconfigure $sock -buffering line -translation binary -blocking $blocking
-    }
-
-    # assign fileevent handlers, source and destination CI (Channel Identifier)
-
-    # NB: this really does need to be -regexp [PT] 18Mar03
-    switch -regexp -- $ftp(State) {
-        list {
-            fileevent $sock readable [list [namespace current]::HandleList $s $sock]
-            set ftp(SourceCI) $sock
-        }
-        get {
-            if {$ftp(inline)} {
-                set ftp(GetData) ""
-                set ftp(Start_Time) -1
-                set ftp(Total) 0
-                fileevent $sock readable [list [namespace current]::HandleVar $s $sock]
-	    } else {
-                fileevent $sock readable [list [namespace current]::HandleData $s $sock]
-                set ftp(SourceCI) $sock
-	    }
-        }
-        append -
-        put {
-            if {$ftp(inline)} {
-                set ftp(Start_Time) -1
-                set ftp(Total) 0
-                fileevent $sock writable [list [namespace current]::HandleOutput $s $sock]
-	    } else {
-                fileevent $sock writable [list [namespace current]::HandleData $s $sock]
-                set ftp(DestCI) $sock
-	    }
-        }
-	default {
-	    error "Unknown state \"$ftp(State)\""
-	}
-    }
-
-    if { $VERBOSE } {
-        DisplayMsg $s "D: Connection from $addr:$port" data
-    }
-    return
-}
-
-#############################################################################
-#
-# OpenActiveConn --
-#
-# Opens a ftp data connection
-# 
-# Arguments:
-# None.
-# 
-# Returns:
-# 0 -			no connection
-# 1 - 			connection established
-
-proc ::ftp::OpenActiveConn {s } {
-    upvar ::ftp::ftp$s ftp
-    variable VERBOSE
-
-    # Port address 0 is a dummy used to give the server the responsibility 
-    # of getting free new port addresses for every data transfer.
-    
-    set rc [catch {set ftp(DummySock) [socket -server [list [namespace current]::InitDataConn $s] 0]} msg]
-    if { $rc != 0 } {
-        DisplayMsg $s "$msg" error
-        return 0
-    }
-
-    # get a new local port address for data transfer and convert it to a format
-    # which is useable by the PORT command
-
-    set p [lindex [fconfigure $ftp(DummySock) -sockname] 2]
-    if { $VERBOSE } {
-        DisplayMsg $s "D: Port is $p" data
-    }
-    set ftp(DataPort) "[expr {$p / 256}],[expr {$p % 256}]"
-
-    return 1
-}
-
-#############################################################################
-#
-# OpenPassiveConn --
-#
-# Opens a ftp data connection
-# 
-# Arguments:
-# buffer - returned line from server control connection 
-# 
-# Returns:
-# 0 -			no connection
-# 1 - 			connection established
-
-proc ::ftp::OpenPassiveConn {s buffer} {
-    upvar ::ftp::ftp$s ftp
-
-    if { [regexp -- {([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)} $buffer all a1 a2 a3 a4 p1 p2] } {
-        set ftp(LocalAddr) "$a1.$a2.$a3.$a4"
-        set ftp(DataPort) "[expr {$p1 * 256 + $p2}]"
-
-        # establish data connection for passive mode
-
-        set rc [catch {set ftp(DataSock) [socket $ftp(LocalAddr) $ftp(DataPort)]} msg]
-        if { $rc != 0 } {
-            DisplayMsg $s "$msg" error
-            return 0
-        }
-
-        InitDataConn $s $ftp(DataSock) $ftp(LocalAddr) $ftp(DataPort)
-        return 1
-    } else {
-        return 0
-    }
-}
-
-#############################################################################
-#
-# OpenControlConn --
-#
-# Opens a ftp control connection
-# 
-# Arguments:
-#	s	connection id
-#	block	blocking or non-blocking mode
-# 
-# Returns:
-# 0 -			no connection
-# 1 - 			connection established
-
-proc ::ftp::OpenControlConn {s {block 1}} {
-    upvar ::ftp::ftp$s ftp
-    variable DEBUG
-    variable VERBOSE
-
-    # open a control channel
-
-    set rc [catch {set ftp(CtrlSock) [socket $ftp(RemoteHost) $ftp(Port)]} msg]
-    if { $rc != 0 } {
-        if { $VERBOSE } {
-            DisplayMsg $s "C: No connection to server!" error
-        }
-        if { $DEBUG } {
-            DisplayMsg $s "[list $msg]" error
-        }
-        unset ftp(State)
-        return 0
-    }
-
-    # configure control channel
-
-    fconfigure $ftp(CtrlSock) -buffering line -blocking $block -translation {auto crlf}
-    fileevent $ftp(CtrlSock) readable [list [namespace current]::StateHandler $s $ftp(CtrlSock)]
-	
-    # prepare local ip address for PORT command (convert pointed format
-    # to comma format)
-
-    set ftp(LocalAddr) [lindex [fconfigure $ftp(CtrlSock) -sockname] 0]
-    set ftp(LocalAddr) [string map {. ,} $ftp(LocalAddr)]
-
-    # report ready message
-
-    set peer [fconfigure $ftp(CtrlSock) -peername]
-    if { $VERBOSE } {
-        DisplayMsg $s "C: Connection from [lindex $peer 0]:[lindex $peer 2]" control
-    }
-	
-    return 1
-}
-
-# ::ftp::Command --
-#
-#	Wrapper for evaluated user-supplied command callback
-#
-# Arguments:
-#	cb	callback script
-#	msg	what happened
-#	args	additional info
-#
-# Results:
-#	Depends on callback script
-
-proc ::ftp::Command {cb msg args} {
-    if {[string length $cb]} {
-	uplevel #0 $cb [list $msg] $args
-    }
-}
-
-# ==================================================================
-# ?????? Hmm, how to do multithreaded for tkcon?
-# added TkCon support
-# TkCon is (c) 1995-2001 Jeffrey Hobbs, http://tkcon.sourceforge.net/
-# started with: tkcon -load ftp
-if { [string equal [uplevel "#0" {info commands tkcon}] "tkcon"] } {
-
-    # new ftp::List proc makes the output more readable
-    proc ::ftp::__ftp_ls {args} {
-        foreach i [eval ::ftp::List_org $args] {
-            puts $i
-        }
-    }
-
-    # rename the original ftp::List procedure
-    rename ::ftp::List ::ftp::List_org
-
-    alias ::ftp::List	::ftp::__ftp_ls
-    alias bye		catch {::ftp::Close; exit}
-
-    set ::ftp::VERBOSE 1
-    set ::ftp::DEBUG 0
-}
-
-# ==================================================================
-# At last, everything is fine, we can provide the package.
-
-package provide ftp [lindex {Revision: 2.4.8} 1]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ftp/ftp_geturl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ftp/ftp_geturl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,131 +1,0 @@
-# ftp_geturl.tcl --
-#
-# Copyright (c) 2001 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# ftp::geturl url
-
-package require ftp
-package require uri
-
-namespace eval ::ftp {
-    namespace export geturl
-}
-
-# ::ftp::geturl
-#
-# Command useable by uri to retrieve the contents of an ftp url.
-# Returns the contents of the requested url.
-
-proc ::ftp::geturl {url} {
-    # FUTURE: -validate to validate existence of url, but no download
-    # of contents.
-
-    array set urlparts [uri::split $url]
-
-    if {$urlparts(user) == {}} {
-        set urlparts(user) "anonymous"
-    }
-    if {$urlparts(pwd) == {}} {
-        set urlparts(pwd) "user@localhost.localdomain"
-    }
-    if {$urlparts(port) == {}} {
-        set urlparts(port) 21
-    }
-
-    set fdc [ftp::Open $urlparts(host) $urlparts(user) $urlparts(pwd) \
-                 -port $urlparts(port)]
-    if {$fdc < 0} {
-	return -code error "Cannot reach host for url \"$url\""
-    }
-
-    # We have reached the host, now get on to retrieve the item.
-    # We are very careful in accessing the item because we don't know
-    # if it is a file, directory or link. So we change into the
-    # directory containing the item, get a list of all entries and
-    # then determine if the item actually exists and what type it is,
-    # and what actions to perform.
-
-    set ftp_dir  [file dirname $urlparts(path)]
-    set ftp_file [file tail    $urlparts(path)]
-
-    set result [ftp::Cd $fdc $ftp_dir]
-    if { $result == 0 } {
-	ftp::Close $fdc
-	return -code error "Cannot reach directory of url \"$url\""
-    }
-
-    # Fix for the tkcon List enhancements in ftp.tcl
-    set List ::ftp::List_org
-    if {[info command $List] == {}} {
-        set List ::ftp::List 
-    }
-
-    # The result of List is a list of entries in the given directory.
-    # Note that it is in 'ls -l format. We parse that into a more
-    # readable array.
-
-    #array set flist [ftp::ParseList [$List $fdc ""]]
-    #if {![info exists flist($ftp_file)]} {}
-    set flist [$List $fdc $ftp_file]
-    if {$flist == {}} {
-	ftp::Close $fdc
-	return -code error "Cannot reach item of url \"$url\""
-    }
-
-    # The item exists, what is it ?
-    # File     : Download the contents.
-    # Directory: Download a listing, this is its contents.
-    # Link     : For now we do not follow the link but return the
-    #            meta information, i.e. the path it is pointing to.
-
-    #switch -exact -- [lindex $flist($ftp_file) 0] {}
-    switch -exact -- [string index [lindex $flist 0] 0] {
-	- {
-	    ftp::Get $fdc $ftp_file -variable contents
-	}
-	d {
-	    set contents [ftp::NList $fdc $ftp_file]
-	}
-	l {
-	    set contents $flist
-	}
-        default {
-            ftp::Close $fdc
-            return -code error "File information \"$flist\" not recognised"
-        }
-    }
-
-    ftp::Close $fdc
-    return $contents
-}
-
-# Internal helper to parse a directory listing into something which
-# can be better handled by tcl than raw ls -l format.
-
-proc ::ftp::ParseList {flist} {
-    array set data {}
-    foreach item $flist {
-	foreach {mode dummy owner group size month day yrtime name} $item break
-
-	if {[string first : $yrtime] >=0} {
-	    set date "$month/$day/[clock format [clock seconds] -format %Y] $yrtime"
-	} else {
-	    set date "$month/$day/$yrtime 00:00"
-	}
-	set info [list owner $owner group $group size $size date $date]
-
-	switch -exact -- [string index $mode 0] {
-	    - {set type file}
-	    d {set type dir}
-	    l {set type link ; lappend info link [lindex $item end]}
-	}
-
-	set data($name) [list $type $info]
-    }
-    array get data
-}
-
-# ==================================================================
-# At last, everything is fine, we can provide the package.
-
-package provide ftp::geturl [lindex {Revision: 0.2} 1]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ftp/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ftp/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded ftp         2.4.8 [list source [file join $dir ftp.tcl]]
-package ifneeded ftp::geturl 0.2   [list source [file join $dir ftp_geturl.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ftpd/ftpd.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ftpd/ftpd.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2042 +1,0 @@
-# ftpd.tcl --
-#
-#       This file contains Tcl/Tk package to create a ftp daemon.
-#       I believe it was originally written by Matt Newman (matt@sensus.org).  
-#       Modified by Dan Kuchler (kuchler@ajubasolutions.com) to handle
-#       more ftp commands and to fix some bugs in the original implementation
-#       that was found in the stdtcl module.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: ftpd.tcl,v 1.27 2007/08/20 20:41:19 andreas_kupries Exp $
-#
-
-# Define the ftpd package version 1.1.2
-
-package require Tcl 8.2
-namespace eval ::ftpd {
-
-    # The listening port.
-
-    variable port 21
-
-    variable contact
-    if {![info exists contact]} {
-        global tcl_platform
-	set contact "$tcl_platform(user)@[info hostname]"
-    }
-
-    variable cwd
-    if {![info exists cwd]} {
-	set cwd ""
-    }
-    
-    variable welcome
-    if {![info exists welcome]} {
-	set welcome "[info hostname] FTP server ready."
-    }
-
-    # Global configuration.
-
-    variable cfg
-    if {![info exists cfg]} {
-	array set cfg [list \
-	    closeCmd  {} \
-	    authIpCmd  {} \
-	    authUsrCmd {::ftpd::anonAuth} \
-            authFileCmd {::ftpd::fileAuth} \
-	    logCmd     {::ftpd::logStderr} \
-	    fsCmd      {::ftpd::fsFile::fs} \
-	    xferDoneCmd  {}]
-    }
-
-    variable commands
-    if {![info exists commands]} {
-	array set commands [list \
-	    ABOR       {ABOR (abort operation)} \
-	    ACCT       {(specify account); unimplemented.} \
-	    ALLO       {(allocate storage - vacuously); unimplemented.} \
-	    APPE       {APPE <sp> file-name} \
-	    CDUP       {CDUP (change to parent directory)} \
-	    CWD        {CWD [ <sp> directory-name ]} \
-	    DELE       {DELE <sp> file-name} \
-            HELP       {HELP [ <sp> <string> ]} \
-	    LIST       {LIST [ <sp> path-name ]} \
-	    NLST       {NLST [ <sp> path-name ]} \
-	    MAIL       {(mail to user); unimplemented.} \
-            MDTM       {MDTM <sp> path-name} \
-	    MKD        {MKD <sp> path-name} \
-	    MLFL       {(mail file); unimplemented.} \
-	    MODE       {(specify transfer mode); unimplemented.} \
-	    MRCP       {(mail recipient); unimplemented.} \
-	    MRSQ       {(mail recipient scheme question); unimplemented.} \
-	    MSAM       {(mail send to terminal and mailbox); unimplemented.} \
-	    MSND       {(mail send to terminal); unimplemented.} \
-	    MSOM       {(mail send to terminal or mailbox); unimplemented.} \
-	    NOOP       {NOOP} \
-	    PASS       {PASS <sp> password} \
-            PASV       {(set server in passive mode); unimplemented.} \
-	    PORT       {PORT <sp> b0, b1, b2, b3, b4, b5} \
-            PWD        {PWD (return current directory)} \
-	    QUIT       {QUIT (terminate service)} \
-	    REIN       {REIN (reinitialize server state)} \
-	    REST       {(restart command); unimplemented.} \
-	    RETR       {RETR <sp> file-name} \
-	    RMD        {RMD <sp> path-name} \
-	    RNFR       {RNFR <sp> file-name} \
-	    RNTO       {RNTO <sp> file-name} \
-	    SIZE       {SIZE <sp> path-name} \
-	    SMNT       {(structure mount); unimplemented.} \
-	    STOR       {STOR <sp> file-name} \
-	    STOU       {STOU <sp> file-name} \
-	    STRU       {(specify file structure); unimplemented.} \
-	    SYST       {SYST (get type of operating system)} \
-	    TYPE       {TYPE <sp> [ A | E | I | L ]} \
-	    USER       {USER <sp> username} \
-	    XCUP       {XCUP (change to parent directory)} \
-	    XCWD       {XCWD [ <sp> directory-name ]} \
-	    XMKD       {XMKD <sp> path-name} \
-	    XPWD       {XPWD (return current directory)} \
-	    XRMD       {XRMD <sp> path-name}]
-    }
-
-    variable passwords [list ]
-
-    # Exported procedures
-
-    namespace export config hasCallback logStderr 
-    namespace export fileAuth anonAuth unixAuth server accept read
-}
-
-
-
-# ::ftpd::config --
-#
-#       Configure the configurable parameters of the ftp daemon.
-#
-# Arguments:
-#       options -    -authIpCmd proc      procedure that accepts or rejects an
-#                                         incoming connection. A value of 0 or
-#                                         an error causes the connection to be
-#                                         rejected. There is no  default.
-#                    -authUsrCmd proc     procedure that accepts or rejects a
-#                                         login.  Defaults to ::ftpd::anonAuth
-#                    -authFileCmd proc    procedure that accepts or rejects
-#                                         access to read or write a certain
-#                                         file or path.  Defaults to
-#                                         ::ftpd::userAuth
-#                    -logCmd proc         procedure that logs information from
-#                                         the ftp engine.  Default is
-#                                         ::ftpd::logStderr
-#                    -fsCmd proc          procedure to connect the ftp engine
-#                                         to the file system it operates on.
-#                                         Default is ::ftpd::fsFile::fs
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Changes the value of the specified configurables.
-
-proc ::ftpd::config {args} {
-
-    # Processing of global configuration changes.
-
-    package require cmdline
-
-    variable cfg
-
-    array set cfg [cmdline::getoptions args [list \
-	{closeCmd.arg {} {Callback when a connection is closed.}} \
-	{authIpCmd.arg  {} {Callback to authenticate new connections based on the ip-address of the peer. Optional}} \
-	{authUsrCmd.arg {::ftpd::anonAuth} {Callback to authenticate new connections based on the user logging in.}} \
-	{authFileCmd.arg {::ftpd::fileAuth} {Callback to accept or deny a users access to read and write to a specific path or file.}} \
-	{logCmd.arg {::ftpd::logStderr} {Callback for log information generated by the FTP engine.}} \
-	{xferDoneCmd.arg {} {Callback for transfer completion notification. Optional}} \
-	{fsCmd.arg {::ftpd::fsFile::fs} {Callback to connect the engine to the filesystem it operates on.}}]]
-    return
-}
-
-
-
-# ::ftpd::hasCallback --
-#
-#       Determines whether or not a non-NULL callback has been defined for one
-#       of the callback types.
-#
-# Arguments:
-#       callbackType -        One of authIpCmd, authUsrCmd, logCmd, or fsCmd
-#
-# Results:
-#       Returns 1 if a non-NULL callback has been specified for the
-#       callbackType that is passed in.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::hasCallback {callbackType} {
-    variable cfg
-
-    return [expr {[info exists cfg($callbackType)] && [string length $cfg($callbackType)]}]
-}
-
-
-
-# ::ftpd::logStderr --
-#
-#       Outputs a message with the specified severity to stderr.  The default
-#       logCmd callback.
-#
-# Arguments:
-#       severity -            The severity of the error.  One of debug, error,
-#                             or note.
-#       text -                The error message.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A message is written to the stderr channel.
-
-proc ::ftpd::logStderr {severity text} {
-
-    # Standard log handler. Prints to stderr.
-
-    puts stderr "\[$severity\] $text"
-    return
-}
-
-
-
-# ::ftpd::Log --
-#
-#       Used for all ftpd logging.
-#
-# Arguments:
-#       severity -            The severity of the error.  One of debug, error,
-#                             or note.
-#       text -                The error message.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The ftpd logCmd callback is called with the specified severity and
-#       text if there is a non-NULL ftpCmd.
-
-proc ::ftpd::Log {severity text} {
-
-    # Central call out to log handlers.
-
-    variable     cfg
-    
-    if {[hasCallback logCmd]} {
-        set cmd $cfg(logCmd)
-        lappend cmd $severity $text
-        eval $cmd
-    }
-    return
-}
-
-
-
-# ::ftpd::fileAuth --
-#
-#       Given a username, path, and operation- decides whether or not to accept
-#       the attempted read or write operation.
-#
-# Arguments:
-#       user -                The name of the user that is attempting to
-#                             connect to the ftpd.
-#       path -                The path or filename that the user is attempting
-#                             to read or write.
-#       operation -           read or write.
-#
-# Results:
-#       Returns 0 if it rejects access and 1 if it accepts access.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::fileAuth {user path operation} {
-    # Standard authentication handler
-
-    if {(![Fs exists $path]) && ([string equal $operation "write"])} {
-        if {[Fs exists [file dirname $path]]} {
-            set path [file dirname $path]
-	}
-    } elseif {(![Fs exists $path]) && ([string equal $operation "read"])} {
-        return 0
-    }
-
-    if {[Fs exists $path]} {
-        set mode [Fs permissions $path]
-        if {([string equal $operation "read"] && (($mode & 00004) > 0)) || \
-                ([string equal $operation "write"] && (($mode & 00002) > 0))} {
-            return 1
-        }
-    }
-    return 0
-}
-
-# ::ftpd::anonAuth --
-#
-#       Given a username and password, decides whether or not to accept the
-#       attempted login.  This is the default ftpd authUsrCmd callback. By
-#       default it accepts the annonymous user and does some basic checking
-#       checking on the form of the password to see if it has the form of an
-#       email address.
-#
-# Arguments:
-#       user -                The name of the user that is attempting to
-#                             connect to the ftpd.
-#       pass -                The password of the user that is attempting to
-#                             connect to the ftpd.
-#
-# Results:
-#       Returns 0 if it rejects the login and 1 if it accepts the login.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::anonAuth {user pass} {
-    # Standard authentication handler
-    #
-    # Accept user 'anonymous' if a password was
-    # provided which is at least similar to an
-    # fully qualified email address.
-
-    if {(![string equal $user anonymous]) && (![string equal $user ftp])} {
-	return 0
-    }
-
-    set pass [split $pass @]
-    if {[llength $pass] != 2} {
-	return 0
-    }
-
-    set domain [split [lindex $pass 1] .]
-    if {[llength $domain] < 2} {
-	return 0
-    }
-
-    return 1
-}
-
-# ::ftpd::unixAuth --
-#
-#       Given a username and password, decides whether or not to accept the
-#       attempted login.  This is an alternative to the default ftpd
-#       authUsrCmd callback. By default it accepts the annonymous user and does
-#       some basic checking checking on the form of the password to see if it
-#       has the form of an email address.
-#
-# Arguments:
-#       user -                The name of the user that is attempting to
-#                             connect to the ftpd.
-#       pass -                The password of the user that is attempting to
-#                             connect to the ftpd.
-#
-# Results:
-#       Returns 0 if it rejects the login and 1 if it accepts the login.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::unixAuth {user pass} {
-
-    variable passwords
-    array set password $passwords
-
-    # Standard authentication handler
-    #
-    # Accept user 'anonymous' if a password was
-    # provided which is at least similar to an
-    # fully qualified email address.
-
-    if {([llength $passwords] == 0) && (![catch {package require crypt}])} {
-        foreach file [list /etc/passwd /etc/shadow] {
-            if {([file exists $file]) && ([file readable $file])} {
-                set fh [open $file r]
-                set data [read $fh [file size $file]]
-                foreach line [split $data \n] {
-                    foreach {username passwd uid gid dir sh} [split $line :] {
-                        if {[string length $passwd] > 2} {
-                            set password($username) $passwd
-		        } elseif {$passwd == ""} {
-                            set password($username) ""
-		        }
-                        break
-		    }
-		}
-	    }
-	}
-        set passwords [array get password]
-    }
-
-    ::ftpd::Log debug $passwords
-
-    if {[string equal $user anonymous] || [string equal $user ftp]} {
-
-        set pass [split $pass @]
-        if {[llength $pass] != 2} {
-	    return 0
-        }
-
-        set domain [split [lindex $pass 1] .]
-        if {[llength $domain] < 2} {
-	    return 0
-        }
-
-        return 1
-    }
-
-    if {[info exists password($user)]} {
-        if {$password($user) == ""} {
-            return 1
-	}
-        if {[string equal $password($user) [::crypt $pass $password($user)]]} {
-	    return 1
-        }
-    }
-
-    return 0
-}
-
-# ::ftpd::server --
-#
-#       Creates a server socket at the specified port.
-#
-# Arguments:
-#       myaddr -              The domain-style name or numerical IP address of
-#                             the client-side network interface to use for the
-#                             connection. The name of the user that is
-#                             attempting to connect to the ftpd.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A listener is setup on the specified port which will call
-#       ::ftpd::accept when it is connected to.
-
-proc ::ftpd::server {{myaddr {}}} {
-    variable port
-    if {[string length $myaddr]} {
-	set f [socket -server ::ftpd::accept -myaddr $myaddr $port]
-    } else {
-	set f [socket -server ::ftpd::accept $port]
-    }
-    set port [lindex [fconfigure $f -sockname] 2]
-    return
-}
-
-# ::ftpd::accept --
-#
-#       Checks if the connecting IP is authorized to connect or not.  If not
-#       the socket is closed and failure is logged.  Otherwise, a welcome is
-#       printed out, and a ftpd::read filevent is placed on the socket.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       ipaddr -              The client's IP address.
-#       client_port -         The client's port number.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Sets up a ftpd::read fileevent to trigger whenever the channel is
-#       readable.  Logs an error and closes the connection if the IP is
-#       not authorized to connect.
-
-proc ::ftpd::accept {sock ipaddr client_port} {
-    upvar #0 ::ftpd::$sock data
-    variable welcome
-    variable cfg
-    variable cwd
-    variable CurrentSocket 
-
-    set CurrentSocket $sock
-    if {[info exists data]} {
-	unset data
-    }
-
-    if {[hasCallback authIpCmd]} {
-	# Call out to authenticate the peer. A return value of 0 or an
-	# error causes the system to reject the connection. Everything
-	# else (with 1 prefered) leads to acceptance.
-
-	set     cmd $cfg(authIpCmd)
-	lappend cmd $ipaddr
-
-	set fail [catch {eval $cmd} res]
-
-	if {$fail} {
-	    Log error "AuthIp error: $res"
-	}
-	if {$fail || ($res == 0)} {
-	    Log note "AuthIp: Access denied to $ipaddr"
-
-	    # Now: Close the connection. (Is there a standard response
-	    # before closing down to signal the peer that we don't want
-	    # to talk to it ? -> read RFC).
-
-	    close $sock
-	    return
-	}
-
-	# Accept the connection (for now, 'authUsrCmd' may revoke this
-	# decision).
-    }
-
-    array set data [list \
-        access          0 \
-	ip              $ipaddr \
-	state		command \
-	buffering	line \
-	cwd		"$cwd" \
-	mode		binary \
-	sock2a          "" \
-        sock2           ""]
-
-    fconfigure $sock -buffering line
-    fileevent  $sock readable [list ::ftpd::read $sock]
-    puts       $sock "220 $welcome"
-
-    Log debug "Accept $ipaddr"
-    return
-}
-
-# ::ftpd::read --
-#
-#       Checks the state of a channel and then reads a command from the
-#       channel if it is not at end of file yet.  If there is a command named
-#       ftpd::command::* where '*' is the all upper case name of the command,
-#       then that proc is called to handle the command with the remaining parts
-#       of the command that was read from the channel as arguments.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Runs the appropriate command depending on the state in the state
-#       machine, and the command that is specified.
-
-proc ::ftpd::read {sock} {
-    upvar #0 ::ftpd::$sock data
-    variable CurrentSocket 
-
-    set CurrentSocket $sock
-    if {[eof $sock]} {
-	Finish $sock
-	return
-    }
-    switch -exact -- $data(state) {
-	command {
-	    gets $sock command
-	    set argument ""
-	    if {![regexp {^([^ ]+) (.*)$} $command -> cmd argument]} {
-		if {![regexp {^([^ ]+)$} $command -> cmd]} {
-		    # Very bad command syntax.
-		    puts $sock "500 Command not understood."
-		    return
-		}
-	    }
-	    set cmd [string toupper $cmd]
-	    auto_load ::ftpd::command::$cmd
-            if {($data(access) == 0) && ((![info exists data(user)]) || \
-	            ($data(user) == "")) && (![string equal $cmd "USER"])} {
-                if {[string equal $cmd "PASS"]} {
-		    puts $sock "503 Login with USER first."
-                } else {
-                    puts $sock "530 Please login with USER and PASS."
-		}
-	    } elseif {($data(access) == 0) && (![string equal $cmd "PASS"]) \
-                    && (![string equal $cmd "USER"]) \
-                    && (![string equal $cmd "QUIT"])} {
-                puts $sock "530 Please login with USER and PASS."
-	    } elseif {[info command ::ftpd::command::$cmd] != ""} {
-		Log debug $command
-		::ftpd::command::$cmd $sock $argument
-		catch {flush $sock}
-	    } else {
-		Log error "Unknown command: $cmd"
-		puts $sock "500 Unknown command $cmd"
-	    }
-	}
-	default {
-	    error "Unknown state \"$data(state)\""
-	}
-    }
-    return
-}
-
-# ::ftpd::Finish --
-#
-#       Closes the socket connection between the ftpd and client.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The channel is closed.
-
-proc ::ftpd::Finish {sock} {
-    upvar #0 ::ftpd::$sock data
-    variable cfg
-
-    if {[hasCallback closeCmd]} then {
-	##
-	## User specified a close command so invoke it
-	##
-	uplevel #0 $cfg(closeCmd)
-    }
-    close $sock
-    if {[info exists data]} {
-	unset data
-    }
-    return
-}
-
-# ::ftpd::FinishData --
-#
-#       Closes the data socket connection that is created when the 'PORT'
-#       command is recieved.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The data channel is closed.
-
-proc ::ftpd::FinishData {sock} {
-    upvar #0 ::ftpd::$sock data
-    catch {close $data(sock2)}
-    set   data(sock2) {}
-    return
-}
-
-# ::ftpd::Fs --
-#
-#       The general filesystem command.  Used as an intermediary for filesystem
-#       access to allow alternate (virtual, etc.) filesystems to be used.  The
-#       ::ftpd::Fs command will call out to the fsCmd callback with the
-#       subcommand and arguments that are passed to it.
-#
-# The fsCmd callback is called in the following ways:
-#
-# <cmd> append <path>
-# <cmd> delete <path> <channel-to-write-to>
-# <cmd> dlist <path> <style> <channel-to-write-dir-list-to>
-# <cmd> exists <path>
-# <cmd> mkdir <path> <channel-to-write-to>
-# <cmd> mtime <path> <channel-to-write-mtime-to>
-# <cmd> permissions <path>
-# <cmd> rename <path> <newpath> <channel-to-write-to>
-# <cmd> retr  <path>
-# <cmd> rmdir <path> <channel-to-write-to>
-# <cmd> size  <path> <channel-to-write-size-to>
-# <cmd> store <path>
-#
-# Arguments:
-#       command -                The filesystem command (one of dlist, retr, or
-#                                store).  'dlist' will list files in a
-#                                directory, 'retr' will get a channel to
-#                                to read the specified file from, 'store'
-#                                will return the channel to write to, and
-#                                'mtime' will print the modification time.
-#       path -                   The file name or directory to read, write, or
-#                                list.
-#       args -                   Additional arguments for filesystem commands.
-#                                Currently this is used by 'dlist' which
-#                                has two additional arguments 'style' and
-#                                'channel-to-write-dir-list-to'. It is also
-#                                used by 'size' and 'mtime' which have one
-#                                additional argument 'channel-to-write-to'.
-#
-# Results:
-#       For a 'appe', 'retr', or 'stor' a channel is returned. For 'exists'
-#       a 1 is returned if the path exists, and is not a directory.  Otherwise
-#       a 0 is returned. For 'permissions' the octal file permissions (i.e.
-#       the 'file stat' mode) are returned.
-#
-# Side Effects:
-#       For 'dlist' a directory listing for the specified path is written to
-#       the specified channel.  For 'mtime' the modification time is written
-#       or an error is thrown.  An error is thrown if there is no fsCmd
-#       callback configured for the ftpd.
-
-proc ::ftpd::Fs {command path args} {
-    variable cfg
-
-    if {![hasCallback fsCmd]} {
-	error "-fsCmd must not be empty, need a way to access files."
-    }
-
-    return [eval [list $cfg(fsCmd) $command $path] $args]
-}
-
-# Create a namespace to hold one proc for each ftp command (in upper case
-# letters) that is supported by the ftp daemon.  The existance of a proc
-# in this namespace is the way that the list of supported commands is
-# determined, and the procs in this namespace are invoked to handle the
-# ftp commands with the same name as the procs.
-
-namespace eval ::ftpd::command {
-    # All commands in this namespace are private, no export.
-}
-
-# ::ftpd::command::ABOR --
-#
-#       Handle the ABOR ftp command.  Closes the data socket if it
-#       is open, and then prints the appropriate success message.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the APPE command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The data is copied to from the socket data(sock2) to the
-#       writable channel to create a file.
-
-proc ::ftpd::command::ABOR {sock list} {
-
-    ::ftpd::FinishData $sock
-    puts $sock "225 ABOR command successful."
-
-    return
-}
-
-# ::ftpd::command::APPE --
-#
-#       Handle the APPE ftp command.  Gets a writable channel for the file
-#       specified from ::ftpd::Fs and copies the data from data(sock2) to
-#       the writable channel.  If the filename already exists the data is
-#       appended, otherwise the file is created and then written.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the APPE command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The data is copied to from the socket data(sock2) to the
-#       writable channel to create a file.
-
-proc ::ftpd::command::APPE {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-    #
-    # Patched Mark O'Connor
-    #
-    if {![catch {::ftpd::Fs append $path $data(mode)} f]} {
-	puts $sock "150 Copy Started ($data(mode))"
-	fcopy $data(sock2) $f -command [list ::ftpd::GetDone $sock $data(sock2) $f ""]
-    } else {
-	puts $sock "500 Copy Failed: $path $f"
-	::ftpd::FinishData $sock
-    }
-    return
-}
-
-# ::ftpd::command::CDUP --
-#
-#       Handle the CDUP ftp command.  Change the current working directory to
-#       the directory above the current working directory.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the CDUP command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Changes the data(cwd) to the appropriate directory.
-
-proc ::ftpd::command::CDUP {sock list} {
-    upvar #0 ::ftpd::$sock data
-
-    set data(cwd) [file dirname $data(cwd)]
-    puts $sock "200 CDUP command successful."
-    return
-}
-
-# ::ftpd::command::CWD --
-#
-#       Handle the CWD ftp command.  Change the current working directory.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the CWD command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Changes the data(cwd) to the appropriate directory.
-
-proc ::ftpd::command::CWD {sock relativepath} {
-    upvar #0 ::ftpd::$sock data
-
-    if {[string equal $relativepath .]} {
-	puts $sock "250 CWD command successful."
-	return
-    }
-
-    if {[string equal $relativepath ..]} {
-	set data(cwd) [file dirname $data(cwd)]
-	puts $sock "250 CWD command successful."
-	return
-    }
-
-    set data(cwd) [file join $data(cwd) $relativepath]
-    puts $sock "250 CWD command successful."
-    return
-}
-
-# ::ftpd::command::DELE --
-#
-#       Handle the DELE ftp command.  Delete the specified file.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the DELE command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The specified file is deleted.
-
-proc ::ftpd::command::DELE {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-    if {[catch {::ftpd::Fs delete $path $sock} msg]} {
-	puts $sock "500 DELE Failed: $path $msg"
-    }
-    return
-}
-
-# ::ftpd::command::HELP --
-#
-#       Handle the HELP ftp command.  Display a list of commands
-#       or syntax information about the supported commands.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the HELP command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Displays a helpful message.
-
-proc ::ftpd::command::HELP {sock command} {
-    upvar #0 ::ftpd::$sock data
-
-    if {$command != ""} {
-        set command [string toupper $command]
-        if {![info exists ::ftpd::commands($command)]} {
-            puts $sock "502 Unknown command '$command'."
-	} elseif {[info commands ::ftpd::command::$command] == ""} {
-            puts $sock "214 $command\t$::ftpd::commands($command)"
-	} else {
-	    puts $sock "214 Syntax: $::ftpd::commands($command)"
-        }
-    } else {
-        set commandList [lsort [array names ::ftpd::commands]]
-        puts $sock "214-The following commands are recognized (* =>'s unimplemented)."
-        set i 1
-        foreach commandName $commandList {
-            if {[info commands ::ftpd::command::$commandName] == ""} {
-                puts -nonewline $sock [format " %-7s" "${commandName}*"]
-	    } else {
-                puts -nonewline $sock [format " %-7s" $commandName]
-	    }
-            if {($i % 8) == 0} {
-                puts $sock ""
-	    }
-            incr i
-	}
-        incr i -1
-        if {($i % 8) != 0} {
-            puts $sock ""
-	}
-        puts $sock "214 Direct comments to $::ftpd::contact."
-    }
-
-    return
-}
-
-# ::ftpd::command::LIST --
-#
-#       Handle the LIST ftp command.  Lists the names of the files in the
-#       specified path.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the LIST command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A listing of files is written to the socket.
-
-proc ::ftpd::command::LIST {sock filename} {
-    ::ftpd::List $sock $filename list
-    return
-}
-
-# ::ftpd::command::MDTM --
-#
-#       Handle the MDTM ftp command.  Prints the modification time of the
-#       specified file to the socket.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the MDTM command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Prints the modification time of the specified file to the socket.
-
-proc ::ftpd::command::MDTM {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[catch {::ftpd::Fs mtime $path $sock} msg]} {
-	puts $sock "500 MDTM Failed: $path $msg"
-	::ftpd::FinishData $sock
-    }
-    return
-}
-
-# ::ftpd::command::MKD --
-#
-#       Handle the MKD ftp command.  Create the specified directory.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the MKD command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The directory specified by $path (if it exists) is deleted.
-
-proc ::ftpd::command::MKD {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-    if {[catch {::ftpd::Fs mkdir $path $sock} f]} {
-	puts $sock "500 MKD Failed: $path $f"
-    }
-    return
-}
-
-# ::ftpd::command::NOOP --
-#
-#       Handle the NOOP ftp command.  Do nothing.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the NOOP command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Prints the proper NOOP response.
-
-proc ::ftpd::command::NOOP {sock list} {
-
-    puts $sock "200 NOOP command successful."
-    return
-}
-
-# ::ftpd::command::NLST --
-#
-#       Handle the NLST ftp command.  Lists the full file stat of all of the
-#       files that are in the specified path.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the NLST command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A listing of file stats is written to the socket.
-
-proc ::ftpd::command::NLST {sock filename} {
-    ::ftpd::List $sock $filename nlst
-    return
-}
-
-# ::ftpd::command::PASS --
-#
-#       Handle the PASS ftp command.  Check whether the specified user
-#       and password are allowed to log in (using the authUsrCmd).  If
-#       they are allowed to log in, they are allowed to continue.  If
-#       not ::ftpd::Log is used to log and error, and an "Access Denied"
-#       error is sent back.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the PASS command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The user is accepted, or an error is logged and the user/password is
-#       denied..
-
-proc ::ftpd::command::PASS {sock password} {
-    upvar #0 ::ftpd::$sock data
-
-    if {$password == ""} {
-        puts $sock "530 Please login with USER and PASS."
-        return
-    }
-    set data(pass) $password
-
-    ::ftpd::Log debug "pass <$data(pass)>"
-
-    if {![::ftpd::hasCallback authUsrCmd]} {
-	error "-authUsrCmd must not be empty, need a way to authenticate the user."
-    }
-
-    # Call out to authenticate the user. A return value of 0 or an
-    # error causes the system to reject the connection. Everything
-    # else (with 1 prefered) leads to acceptance.
-    
-    set cmd $::ftpd::cfg(authUsrCmd)
-    lappend cmd $data(user) $data(pass)
-
-    set fail [catch {eval $cmd} res]
-
-    if {$fail} {
-	::ftpd::Log error "AuthUsr error: $res"
-    }
-    if {$fail || ($res == 0)} {
-	::ftpd::Log note "AuthUsr: Access denied to <$data(user)> <$data(pass)>."
-	unset data(user)
-        unset data(pass)
-        puts $sock "551 Access Denied"
-    } else {
-	puts $sock "230 OK"
-	set data(access) 1
-    }
-    return
-}
-
-# ::ftpd::command::PORT --
-#
-#       Handle the PORT ftp command.  Create a new socket with the specified
-#       paramaters.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the PORT command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A new socket, data(sock2), is opened.
-
-proc ::ftpd::command::PORT {sock numbers} {
-    upvar #0 ::ftpd::$sock data
-    set x [split $numbers ,]
-
-    ::ftpd::FinishData $sock
-
-    set data(sock2) [socket [join [lrange $x 0 3] .] \
-	[expr {([lindex $x 4] << 8) | [lindex $x 5]}]]
-    fconfigure $data(sock2) -translation $data(mode)
-    puts $sock "200 PORT OK"
-    return
-}
-
-# ::ftpd::command::PWD --
-#
-#       Handle the PWD ftp command.  Prints the current working directory to
-#       the socket.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the PWD command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Prints the current working directory to the socket.
-
-proc ::ftpd::command::PWD {sock list} {
-    upvar #0 ::ftpd::$sock data
-    ::ftpd::Log debug $data(cwd)
-    puts $sock "257 \"$data(cwd)\" is current directory."
-    return
-}
-
-# ::ftpd::command::QUIT --
-#
-#       Handle the QUIT ftp command.  Closes the socket.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the PWD command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Closes the connection.
-
-proc ::ftpd::command::QUIT {sock list} {
-    ::ftpd::Log note "Closed $sock"
-    puts $sock "221 Goodbye."
-    ::ftpd::Finish $sock
-    # FRINK: nocheck
-    #unset ::ftpd::$sock
-    return
-}
-
-# ::ftpd::command::REIN --
-#
-#       Handle the REIN ftp command. This command terminates a USER, flushing
-#       all I/O and account information, except to allow any transfer in
-#       progress to be completed.  All parameters are reset to the default
-#       settings and the control connection is left open.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the REIN command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The file specified by $path (if it exists) is copied to the socket
-#       data(sock2) otherwise a 'Copy Failed' message is output.
-
-proc ::ftpd::command::REIN {sock list} {
-    upvar #0 ::ftpd::$sock data
-
-    ::ftpd::FinishData $sock
-    catch {close $data(sock2a)}
-
-    # Reinitialize the user and connection data.
-
-    array set data [list \
-        access          0 \
-	state		command \
-	buffering	line \
-	cwd		"$::ftpd::cwd" \
-	mode		binary \
-	sock2a          "" \
-        sock2           ""]
-
-    return
-}
-
-# ::ftpd::command::RETR --
-#
-#       Handle the RETR ftp command.  Gets a readable channel for the file
-#       specified from ::ftpd::Fs and copies the file to second socket 
-#       data(sock2).
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the RETR command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The file specified by $path (if it exists) is copied to the socket
-#       data(sock2) otherwise a 'Copy Failed' message is output.
-
-proc ::ftpd::command::RETR {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path read
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-    #
-    # Patched Mark O'Connor
-    #
-    if {![catch {::ftpd::Fs retr $path $data(mode)} f]} {
-	puts $sock "150 Copy Started ($data(mode))"
-	fcopy $f $data(sock2) -command [list ::ftpd::GetDone $sock $data(sock2) $f ""]
-    } else {
-	puts $sock "500 Copy Failed: $path $f"
-	::ftpd::FinishData $sock
-    }
-    return
-}
-
-# ::ftpd::command::RMD --
-#
-#       Handle the RMD ftp command.  Remove the specified directory.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the RMD command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The directory specified by $path (if it exists) is deleted.
-
-proc ::ftpd::command::RMD {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-    if {[catch {::ftpd::Fs rmdir $path $sock} f]} {
-	puts $sock "500 RMD Failed: $path $f"
-    }
-    return
-}
-
-# ::ftpd::command::RNFR --
-#
-#       Handle the RNFR ftp command.  Stores the name of the file to rename
-#       from.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the RNFR command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       If the file specified by $path exists, then store the name and request
-#       the next name.
-
-proc ::ftpd::command::RNFR {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-
-    if {[file exists $path]} {
-        if {[::ftpd::hasCallback authFileCmd]} {
-            set cmd $::ftpd::cfg(authFileCmd)
-            lappend cmd $data(user) $path write
-            if {[eval $cmd] == 0} {
-	        puts $sock "550 $filename: Permission denied"
-                return
-            }
-	}
-
-        puts $sock "350 File exists, ready for destination name"
-        set data(renameFrom) $path
-    } else {
-        puts $sock "550 $path: No such file or directory."
-    }
-    return
-}
-
-# ::ftpd::command::RNTO --
-#
-#       Handle the RNTO ftp command.  Renames the file specified by 'RNFR' if
-#       one was specified.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the RNTO command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The specified file is renamed.
-
-proc ::ftpd::command::RNTO {sock filename} {
-
-    if {$filename == ""} {
-        puts $sock "500 'RNTO': command not understood."
-        return
-    }
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-
-    if {![info exists data(renameFrom)]} {
-        puts $sock "503 Bad sequence of commands."
-        return
-    }
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-            puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-
-    if {![catch {::ftpd::Fs rename $data(renameFrom) $path} msg]} {
-        unset data(renameFrom)
-    } else {
-        unset data(renameFrom)
-        puts $sock "500 'RNTO': command not understood."
-    }
-    return
-}
-
-# ::ftpd::command::SIZE --
-#
-#       Handle the SIZE ftp command.  Prints the modification time of the
-#       specified file to the socket.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the MDTM command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Prints the size of the specified file to the socket.
-
-proc ::ftpd::command::SIZE {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[catch {::ftpd::Fs size $path $sock} msg]} {
-	puts $sock "500 SIZE Failed: $path $msg"
-	::ftpd::FinishData $sock
-    }
-    return
-}
- 
-# ::ftpd::command::STOR --
-#
-#       Handle the STOR ftp command.  Gets a writable channel for the file
-#       specified from ::ftpd::Fs and copies the data from data(sock2) to
-#       the writable channel.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the STOR command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The data is copied to from the socket data(sock2) to the
-#       writable channel to create a file.
-
-proc ::ftpd::command::STOR {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-
-    #
-    # Patched Mark O'Connor
-    #
-    if {![catch {::ftpd::Fs store $path $data(mode)} f]} {
-	puts $sock "150 Copy Started ($data(mode))"
-	fcopy $data(sock2) $f -command [list ::ftpd::GetDone $sock $data(sock2) $f ""]
-    } else {
-	puts $sock "500 Copy Failed: $path $f"
-	::ftpd::FinishData $sock
-    }
-    return
-}
-
-# ::ftpd::command::STOU --
-#
-#       Handle the STOR ftp command.  Gets a writable channel for the file
-#       specified from ::ftpd::Fs and copies the data from data(sock2) to
-#       the writable channel.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the STOU command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The data is copied to from the socket data(sock2) to the
-#       writable channel to create a file.
-
-proc ::ftpd::command::STOU {sock filename} {
-    upvar #0 ::ftpd::$sock data
-
-    set path [file join $data(cwd) [string trimleft $filename /]]
-    if {[::ftpd::hasCallback authFileCmd]} {
-        set cmd $::ftpd::cfg(authFileCmd)
-        lappend cmd $data(user) $path write
-        if {[eval $cmd] == 0} {
-	    puts $sock "550 $filename: Permission denied"
-            return
-        }
-    }
-    
-    set file $path
-    set i 0
-    while {[::ftpd::Fs exists $file]} {
-        set file "$path.$i"
-        incr i
-    }
-
-    #
-    # Patched Mark O'Connor
-    #
-    if {![catch {::ftpd::Fs store $file $data(mode)} f]} {
-	puts $sock "150 Copy Started ($data(mode))"
-	fcopy $data(sock2) $f -command [list ::ftpd::GetDone $sock $data(sock2) $f $file]
-    } else {
-	puts $sock "500 Copy Failed: $path $f"
-	::ftpd::FinishData $sock
-    }
-    return
-}
-
-# ::ftpd::command::SYST --
-#
-#       Handle the SYST ftp command.  Print the system information.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the SYST command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Prints the system information.
-
-proc ::ftpd::command::SYST {sock list} {
-    upvar #0 ::ftpd::$sock data
-
-    global tcl_platform
-
-    if {[string equal $tcl_platform(platform) "unix"]} {
-        set platform UNIX
-    } elseif {[string equal $tcl_platform(platform) "windows"]} {
-        set platform WIN32
-    } elseif {[string equal $tcl_platform(platform) "macintosh"]} {
-        set platform MACOS
-    } else {
-        set platform UNKNOWN
-    }
-    set version [string toupper $tcl_platform(os)]
-    puts $sock "215 $platform Type: L8 Version: $version"
-
-    return
-}
-
-# ::ftpd::command::TYPE --
-#
-#       Handle the TYPE ftp command.  Sets up the proper translation mode on
-#       the data socket data(sock2)
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the TYPE command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The translation mode of the data channel is changed to the appropriate
-#       mode.
- 
-proc ::ftpd::command::TYPE {sock type} {
-    upvar #0 ::ftpd::$sock data
-
-    if {[string compare i [string tolower $type]] == 0} {
-	set data(mode) binary
-    } else {
-	set data(mode) auto
-    }
-
-    if {$data(sock2) != {}} {
-	fconfigure $data(sock2) -translation $data(mode)
-    }
-    puts $sock "200 Type set to $type."
-    return
-}
-
-# ::ftpd::command::USER --
-#
-#       Handle the USER ftp command.  Store the username, and request a
-#       password.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       list -                   The arguments to the USER command.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A message is printed asking for the password.
-
-proc ::ftpd::command::USER {sock username} {
-    upvar #0 ::ftpd::$sock data
-
-    if {$username == ""} {
-        puts $sock "530 Please login with USER and PASS."
-        return
-    }
-    set data(user) $username
-    puts $sock "331 Password Required"
-
-    ::ftpd::Log debug "user <$data(user)>"
-    return
-}
-
-# ::ftpd::GetDone --
-#
-#       The fcopy command callback for both the RETR and STOR calls.  Called
-#       after the fcopy completes.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       sock2 -                  The data socket data(sock2).
-#       f -                      The file channel.
-#       filename -               The name of the unique file (if a unique
-#                                transfer was requested), and the empty string
-#                                otherwise
-#       bytes -                  The number of bytes that were copied.
-#       err -                    Passed if an error occurred during the fcopy.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       The open file channel is closed and a 'complete' message is printed to
-#       the socket.
-
-proc ::ftpd::GetDone {sock sock2 f filename bytes {err {}}} {
-    upvar #0 ::ftpd::$sock data
-    variable cfg
-
-    close $f
-    FinishData $sock
-
-    if {[string length $err]} {
-	puts $sock "226- $err"
-    } elseif {$filename == ""} {
-        puts $sock "226 Transfer complete ($bytes bytes)"
-    } else {
-        puts $sock "226 Transfer complete (unique file name: $filename)."
-    }
-    if {[hasCallback xferDoneCmd]} then {
-	catch {$cfg(xferDoneCmd) $sock $sock2 $f $bytes $filename $err}
-    }
-    Log debug "GetDone $f $sock2 $bytes bytes filename: $filename"
-    return
-}
-
-# ::ftpd::List --
-#
-#       Handle the NLST and LIST ftp commands.  Shared command to do the
-#       actual listing of files.
-#
-# Arguments:
-#       sock -                   The channel for this connection to the ftpd.
-#       filename -               The path/filename to list.
-#       style -                  The type of listing -- nlst or list.
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       A listing of file stats is written to the socket.
-
-proc ::ftpd::List {sock filename style} {
-    upvar #0 ::ftpd::$sock data
-    puts $sock "150 Opening data channel"
-
-    set path [file join $data(cwd) $filename]
-
-    Fs dlist $path $style $data(sock2)
-
-    FinishData $sock
-    puts $sock "226 Listing complete"
-    return
-}
-
-# Standard filesystem - Assume the files are held on a standard disk.  This
-# namespace contains the commands to act as the default fsCmd callback for the
-# ftpd.
-
-namespace eval ::ftpd::fsFile {
-    # Our document root directory
-
-    variable docRoot
-    if {![info exists docRoot]} {
-	set docRoot /
-    }
-
-    namespace export docRoot fs
-}
-
-# ::ftpd::fsFile::docRoot --
-#
-#       Set or query the root of the ftpd file system.  If no 'dir' argument
-#       is passed, or if the 'dir' argument is the null string, then the
-#       current docroot is returned.  If a non-NULL 'dir' argument is passed
-#       in it is set as the docRoot.
-#
-# Arguments:
-#       dir  -                   The directory to set as the ftp docRoot.
-#                                (optional. If unspecified, the current docRoot
-#                                is returned).
-#
-# Results:
-#       None.
-#
-# Side Effects:
-#       Sets the docRoot to the specified directory if a directory is
-#       specified.
-
-proc ::ftpd::fsFile::docRoot {{dir {}}} {
-    variable docRoot
-    if {[string length $dir] == 0} {
-	return $docRoot
-    } else {
-	set docRoot $dir
-    }
-    return ""
-}
-
-# ::ftpd::fsFile::fs --
-#
-#       Handles the a standard file systems file system requests and is the
-#       default fsCmd callback.
-#
-# Arguments:
-#       command -                The filesystem command (one of dlist, retr, or
-#                                store).  'dlist' will list files in a
-#                                directory, 'retr' will get a channel to
-#                                to read the specified file from, and 'store'
-#                                will return the channel to write to.
-#       path -                   The file name or directory to read, write or
-#                                list.
-#       args -                   Additional arguments for filesystem commands.
-#                                Currently this is used by 'dlist' which
-#                                has two additional arguments 'style' and
-#                                'channel-to-write-dir-list-to'. It is also
-#                                used by 'size' and 'mtime' which have one
-#                                additional argument 'channel-to-write-to'.
-#
-# Results:
-#       For a 'appe', 'retr', or 'stor' a channel is returned. For 'exists' a 1
-#       is returned if the path exists, and is not a directory.  Otherwise a
-#       0 is returned.  For 'permissions' the octal file permissions (i.e.
-#       the 'file stat' mode) are returned.
-#
-# Side Effects:
-#       For 'dlist' a directory listing for the specified path is written to
-#       the specified channel.  For 'mtime' the modification time is written
-#       or an error is thrown.  An error is thrown if there is no fsCmd
-#       callback configured for the ftpd.
-
-proc ::ftpd::fsFile::fs {command path args} {
-    # append <path>
-    # delete <path> <channel-to-write-to>
-    # dlist <path> <style> <channel-to-write-dir-list-to>
-    # exists <path>
-    # mkdir <path> <channel-to-write-to>
-    # mtime <path> <channel-to-write-mtime-to>
-    # permissions <path>
-    # rename <path> <newpath> <channel-to-write-to>
-    # retr  <path>
-    # rmdir <path> <channel-to-write-to>
-    # size  <path> <channel-to-write-size-to>
-    # store <path>
-
-    global tcl_platform
-
-    variable docRoot
-
-    set path [file join $docRoot $path]
-
-    switch -exact -- $command {
-        append {
-	    #
-	    # Patched Mark O'Connor
-	    #
-	    set fhandle [open $path a]
-	    if {[lindex $args 0] == "binary"} {
-		fconfigure $fhandle -translation binary -encoding binary
-	    }
-	    return $fhandle
-        }
-	retr {
-	    #
-	    # Patched Mark O'Connor
-	    #
-	    set fhandle [open $path r]
-	    if {[lindex $args 0] == "binary"} {
-		fconfigure $fhandle -translation binary -encoding binary
-	    }
-	    return $fhandle
-	}
-	store {
-	    #
-	    # Patched Mark O'Connor
-	    #
-	    set fhandle [open $path w]
-	    if {[lindex $args 0] == "binary"} {
-		fconfigure $fhandle -translation binary -encoding binary
-	    }
-	    return $fhandle
-	}
-	dlist {
-	    foreach {style outchan} $args break
-	    ::ftpd::Log debug "at dlist {$style} {$outchan} {$path}"
-	    #set path [glob -nocomplain $path]
-	    #::ftpd::Log debug "at dlist2 {$style} {$outchan} {$path}"
-
-            # Attempt to get a list of all files (even ones that start with .)
-
-	    if {[file isdirectory $path]} {
-		set path1 [file join $path *]
-                set path2 [file join $path .*]
-	    } else {
-                set path1 $path
-                set path2 $path
-	    }
-
-            # Get a list of all files that match the glob pattern
-
-            set fileList [lsort -unique [concat [glob -nocomplain $path1] \
-                    [glob -nocomplain $path2]]]
-	    
-	    ::ftpd::Log debug "File list is {$fileList}"
-
-	    switch -- $style {
-	        nlst {
-		    ::ftpd::Log debug "In nlist"
-	            foreach f [lsort $fileList] {
-                        if {[string equal [file tail $f] "."] || \
-                                [string equal [file tail $f] ".."]} {
-                            continue
-                        }
-			if {[string equal {} $f]} then continue
-			::ftpd::Log debug [file tail $f]
-		        puts $outchan [file tail $f]
-	            }
-	        }
-		list {
-		    # [ 766112 ] report . and .. directories (linux)
-		    # Copied the code from 'nlst' above to handle this.
-
-	            foreach f [lsort $fileList] {
-                        if {[string equal [file tail $f] "."] || \
-                                [string equal [file tail $f] ".."]} {
-                            continue
-                        }
-			file stat $f stat
-                        if {[string equal $tcl_platform(platform) "unix"]} {
-                            set user [file attributes $f -owner]
-                            set group [file attributes $f -group]
-                        } else {
-                            set user owner
-                            set group group
-                        }
-			puts $outchan [format "%s %3d %s %8s %11s %s %s" \
-			        [PermBits $f $stat(mode)] $stat(nlink) \
-	                        $user $group $stat(size) \
-                                [FormDate $stat(mtime)] [file tail $f]]
-		    }
-		}
-		default {
-		    error "Unknown list style <$style>"
-		}
-	    }
-	}
-        delete {
-	    foreach {outchan} $args break
-
-            if {![file exists $path]} {
-                puts $outchan "550 $path: No such file or directory."
-	    } elseif {![file isfile $path]} {
-                puts $outchan "550 $path: File exists."
-	    } else {
-                file delete $path
-                puts $outchan "250 DELE command successful."
-	    }
-	}
-        exists {
-            if {[file isdirectory $path]} {
-                return 0
-	    } else {
-                return [file exists $path]
-	    }
-	}
-        mkdir {
-	    foreach {outchan} $args break
-
-            set path [string trimright $path /]
-            if {[file exists $path]} {
-                if {[file isdirectory $path]} {
-                    puts $outchan "521 \"$path\" directory exists"
-		} else {
-		    puts $outchan "521 \"$path\" already exists"
-                }
-	    } elseif {[file exists [file dirname $path]]} {
-                file mkdir $path
-                puts $outchan "257 \"$path\" new directory created."
-	    } else {
-                puts $outchan "550 $path: No such file or directory."
-	    }
-	}
-        mtime {
-	    foreach {outchan} $args break
-
-            if {![file exists $path]} {
-                puts $outchan "550 $path: No such file or directory"
-            } elseif {![file isfile $path]} {
-	        puts $outchan "550 $path: not a plain file."
-            } else {
-                set time [file mtime $path]
-                puts $outchan [clock format $time -format "213 %Y%m%d%H%M%S"]
-	    }
-        }
-        permissions {
-	    file stat $path stat
-            return $stat(mode)
-        }
-        rename {
-            foreach {newname outchan} $args break
-
-            if {![file isdirectory [file dirname $newname]]} {
-	        puts $outchan "550 rename: No such file or directory."
-            }
-            file rename $path $newname
-            puts $sock "250 RNTO command successful."
-	}
-        rmdir {
-	    foreach {outchan} $args break
-
-            if {![file isdirectory $path]} {
-                puts $outchan "550 $path: Not a directory."
-	    } elseif {[llength [glob -nocomplain [file join $path *]]] != 0} {
-                puts $outchan "550 $path: Directory not empty."
-            } else {
-                file delete $path
-                puts $outchan "250 RMD command successful."
-	    }
-	}
-        size {
-	    foreach {outchan} $args break
-
-            if {![file exists $path]} {
-                puts $outchan "550 $path: No such file or directory"
-            } elseif {![file isfile $path]} {
-	        puts $outchan "550 $path: not a plain file."
-            } else {
-                puts $outchan "213 [file size $path]"
-	    }
-        }
-	default {
-	    error "Unknown command \"$command\""
-	}
-    }
-    return ""
-}
-
-# ::ftpd::fsFile::PermBits --
-#
-#       Returns the file permissions for the specified file.
-#
-# Arguments:
-#       file  -                  The file to return the permissions of.
-#
-# Results:
-#       The permissions for the specified file are returned.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::fsFile::PermBits {file mode} {
-
-    array set s {
-        0 --- 1 --x 2 -w- 3 -wx 4 r-- 5 r-x 6 rw- 7 rwx
-    }
-
-    set type [file type $file]
-    if {[string equal $type "file"]} {
-        set permissions "-"
-    } else {
-        set permissions [string index $type 0]
-    }
-    foreach j [split [format %03o [expr {$mode&0777}]] {}] {
-        append permissions $s($j)
-    }
-
-    return $permissions
-}
-
-# ::ftpd::fsFile::FormDate --
-#
-#       Returns the file permissions for the specified file.
-#
-# Arguments:
-#       seconds  -              The number of seconds returned by 'file mtime'.
-#
-# Results:
-#       A formatted date is returned.
-#
-# Side Effects:
-#       None.
-
-proc ::ftpd::fsFile::FormDate {seconds} {
-
-    set currentTime [clock seconds]
-    set oldTime [clock scan "6 months ago" -base $currentTime]
-    if {$seconds <= $oldTime} {
-        set time [clock format $seconds -format "%Y"]
-    } else {
-        set time [clock format $seconds -format "%H:%M"]
-    }
-    set day [string trimleft [clock format $seconds -format "%d"] 0]
-    set month [clock format $seconds -format "%b"]
-    return [format "%3s %2s %5s" $month $day $time]
-}
-
-# Only provide the package if it has been successfully
-# sourced into the interpreter.
-
-#
-# Patched Mark O'Connor
-#
-package provide ftpd 1.2.3
-
-
-
-##
-## Implementation of passive command
-##
-proc ::ftpd::command::PASV {sock argument} {
-    upvar #0 ::ftpd::$sock data
-
-    set data(sock2a) [socket -server [list ::ftpd::PasvAccept $sock] 0]
-    set list1 [fconfigure $sock -sockname]
-    set ip [lindex $list1 0]
-    set list2 [fconfigure $data(sock2a) -sockname]
-    set port [lindex $list2 2]
-    ::ftpd::Log debug "PASV on {$list1} {$list2} $ip $port"
-    set ans [split $ip {.}]
-    lappend ans [expr {($port >> 8) & 0xff}] [expr {$port & 0xff}]
-    set ans [join $ans {,}]
-    puts $sock "227 Entering Passive Mode ($ans)."
-    return
-}
-
-
-
-proc ::ftpd::PasvAccept {sock sock2 ip port} {
-    upvar #0 ::ftpd::$sock data
-
-    ::ftpd::Log debug "In Pasv Accept with {$sock} {$sock2} {$ip} {$port}"
-    ##
-    ## Verify this is from who it should be
-    ##
-    if {![string equal $ip $data(ip)]} then {
-	##
-	## Nope, so close it and wait some more
-	##
-	close $sock2
-	return
-    }
-    ::ftpd::FinishData $sock
-
-    set data(sock2) $sock2
-    fconfigure $data(sock2) -translation $data(mode)
-    close $data(sock2a)
-    set data(sock2a) ""
-    return
-}
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ftpd/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ftpd/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded ftpd 1.2.3 [list source [file join $dir ftpd.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/cfront.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/cfront.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,396 +1,0 @@
-# cfront.tcl --
-#
-#	Generator frontend for compiler of magic(5) files into recognizers
-#	based on the 'rtcore'. Parses magic(5) into a basic 'script'.
-#
-# Copyright (c) 2004-2005 Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005      Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: cfront.tcl,v 1.6 2007/06/23 03:39:34 andreas_kupries Exp $
-
-#####
-#
-# "mime type recognition in pure tcl"
-# http://wiki.tcl.tk/12526
-#
-# Tcl code harvested on:  10 Feb 2005, 04:06 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-
-# file to compile the magic file from magic(5) into a tcl program
-package require fileutil              ; # File processing (input)
-package require fileutil::magic::cgen ; # Code generator.
-package require fileutil::magic::rt   ; # Runtime (typemap)
-package require struct::list          ; # lrepeat.
-
-package provide fileutil::magic::cfront 1.0
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::fileutil::magic::cfront {
-    # Configuration flag. (De)activate debugging output.
-    # This is done during initialization.
-    # Changes at runtime have no effect.
-
-    variable debug 0
-
-    # Constants
-
-    variable hashprotection  [list "\#" "\\#" \" \\\" \{ \\\{ \} \\\}]      ;#"
-    variable hashprotectionB [list "\#" "\\\#" \" \\\" \} \\\} ( \\( ) \\)] ;#"
-
-    # Make backend functionality accessible
-    namespace import ::fileutil::magic::cgen::*
-
-    namespace export compile prodef install
-}
-
-# parse an individual line
-proc ::fileutil::magic::cfront::parseline {line {maxlevel 10000}} {
-    # calculate the line's level
-    set unlevel [string trimleft $line >]
-    set level   [expr {[string length $line] - [string length $unlevel]}]
-    if {$level > $maxlevel} {
-   	return -code continue "Skip - too high a level"
-    }
-
-    # regexp parse line into (offset, type, value, command)
-    set parse [regexp -expanded -inline {^(\S+)\s+(\S+)\s*((\S|(\B\s))*)\s*(.*)$} $unlevel]
-    if {$parse == {}} {
-   	error "Can't parse: '$unlevel'"
-    }
-
-    # unpack parsed line
-    set value   ""
-    set command ""
-    foreach {junk offset type value junk1 junk2 command} $parse break
-
-    # handle trailing spaces
-    if {[string index $value end] eq "\\"} {
-   	append value " "
-    }
-    if {[string index $command end] eq "\\"} {
-   	append command " "
-    }
-
-    if {$value eq ""} {
-	# badly formatted line
-   	return -code error "no value"
-    }
-
-    ::fileutil::magic::cfront::Debug {
-   	puts "level:$level offset:$offset type:$type value:'$value' command:'$command'"
-    }
-
-    # return the line's fields
-    return [list $level $offset $type $value $command]
-}
-
-# process a magic file
-proc ::fileutil::magic::cfront::process {file {maxlevel 10000}} {
-    variable hashprotection
-    variable hashprotectionB
-    variable level	;# level of line
-    variable linenum	;# line number
-
-    set level  0
-    set script {}
-
-    set linenum 0
-    ::fileutil::foreachLine line $file {
-   	incr linenum
-   	set line [string trim $line " "]
-   	if {[string index $line 0] eq "#"} {
-   	    continue	;# skip comments
-   	} elseif {$line == ""} {
-   	    continue	;# skip blank lines
-   	} else {
-   	    # parse line
-   	    if {[catch {parseline $line $maxlevel} parsed]} {
-   		continue	;# skip erroring lines
-   	    }
-
-   	    # got a valid line
-   	    foreach {level offset type value message} $parsed break
-
-   	    # strip comparator out of value field,
-   	    # (they are combined)
-   	    set compare [string index $value 0]
-   	    switch -glob --  $value {
-   		[<>]=* {
-   		    set compare [string range $value 0 1]
-   		    set value   [string range $value 2 end]
-   		}
-
-   		<* - >* - &* - ^* {
-   		    set value [string range $value 1 end]
-   		}
-
-   		=* {
-   		    set compare "=="
-   		    set value   [string range $value 1 end]
-   		}
-
-   		!* {
-   		    set compare "!="
-   		    set value   [string range $value 1 end]
-   		}
-
-   		x {
-   		    # this is the 'don't care' match
-   		    # used for collecting values
-   		    set value ""
-   		}
-
-   		default {
-   		    # the default comparator is equals
-   		    set compare "=="
-   		    if {[string match {\\[<!>=]*} $value]} {
-   			set value [string range $value 1 end]
-   		    }
-   		}
-   	    }
-
-   	    # process type field
-   	    set qual ""
-   	    switch -glob -- $type {
-   		pstring* - string* {
-   		    # String or Pascal string type
-
-   		    # extract string match qualifiers
-		    foreach {type qual} [split $type /] break
-
-   		    # convert pstring to string + qualifier
-   		    if {$type eq "pstring"} {
-   			append qual "p"
-   			set type "string"
-   		    }
-
-   		    # protect hashes in output script value
-   		    set value [string map $hashprotection $value]
-
-   		    if {($value eq "\\0") && ($compare eq ">")} {
-   			# record 'any string' match
-   			set value   ""
-   			set compare x
-   		    } elseif {$compare eq "!="} {
-   			# string doesn't allow !match
-   			set value   !$value
-   			set compare "=="
-   		    }
-
-   		    if {$type ne "string"} {
-   			# don't let any odd string types sneak in
-   			puts stderr "Reject String: ${file}:$linenum $type - $line"
-   			continue
-   		    }
-   		}
-
-   		regex {
-   		    # I am *not* going to handle regex
-   		    puts stderr "Reject Regex: ${file}:$linenum $type - $line"
-   		    continue
-   		}
-
-   		*byte* - *short* - *long* - *date* {
-   		    # Numeric types
-
-   		    # extract numeric match &qualifiers
-   		    set type [split  $type &]
-   		    set qual [lindex $type 1]
-
-   		    if {$qual ne ""} {
-   			# this is an &-qualifier
-   			set qual &$qual
-   		    } else {
-   			# extract -qualifier from type
-   			set type [split  $type -]
-   			set qual [lindex $type 1]
-   			if {$qual ne ""} {
-   			    set qual -$qual
-   			}
-   		    }
-   		    set type [lindex $type 0]
-
-   		    # perform value adjustments
-   		    if {$compare ne "x"} {
-   			# trim redundant Long value qualifier
-   			set value [string trimright $value L]
-
-   			if {[catch {set value [expr $value]} x]} {
-			    upvar #0 errorInfo eo
-   			    # check that value is representable in tcl
-   			    puts stderr "Reject Value Error: ${file}:$linenum '$value' '$line' - $eo"
-   			    continue;
-   			}
-
-   			# coerce numeric value into hex
-   			set value [format "0x%x" $value]
-   		    }
-   		}
-
-   		default {
-   		    # this is not a type we can handle
-   		    puts stderr "Reject Unknown Type: ${file}:$linenum $type - $line"
-   		    continue
-   		}
-   	    }
-   	}
-
-   	# collect some summaries
-   	::fileutil::magic::cfront::Debug {
-   	    variable types
-   	    set types($type) $type
-   	    variable quals
-   	    set quals($qual) $qual
-   	}
-
-   	#puts $linenum level:$level offset:$offset type:$type
-	#puts qual:$qual compare:$compare value:'$value' message:'$message'
-
-   	# protect hashes in output script message
-   	set message [string map $hashprotectionB $message]
-
-   	if {![string match "(*)" $offset]} {
-   	    catch {set offset [expr $offset]}
-   	}
-
-   	# record is the complete match command,
-   	# encoded for tcl code generation
-   	set record [list $linenum $type $qual $compare $offset $value $message]
-   	if {$script == {}} {
-   	    # the original script has level 0,
-   	    # regardless of what the script says
-   	    set level 0
-   	}
-
-   	if {$level == 0} {
-   	    # add a new 0-level record
-   	    lappend script $record
-   	} else {
-   	    # find the growing edge of the script
-   	    set depth [::struct::list repeat [expr $level] end]
-   	    while {[catch {
-   		# get the insertion point
-   		set insertion [eval [linsert $depth 0 lindex $script]]
-		# 8.5 #	set insertion [lindex $script {*}$depth]
-   	    }]} {
-   		# handle scripts which jump levels,
-   		# reduce depth to current-depth+1
-   		set depth [lreplace $depth end end]
-   	    }
-
-   	    # add the record at the insertion point
-   	    lappend insertion $record
-
-   	    # re-insert the record into its correct position
-   	    eval [linsert [linsert $depth 0 lset script] end $insertion]
-   	    # 8.5 # lset script {*}$depth $insertion
-   	}
-    }
-    #puts "Script: $script"
-    return $script
-}
-
-# compile up magic files or directories of magic files into a single recognizer.
-proc ::fileutil::magic::cfront::compile {args} {
-    set tcl ""
-    set script {}
-    foreach arg $args {
-   	if {[file type $arg] == "directory"} {
-   	    foreach file [glob [file join $arg *]] {
-   		set script1 [process $file]
-		eval [linsert $script1 0 lappend script [list file $file]]
-   		# 8.5 # lappend script [list file $file] {*}$script1
-
-   		#append tcl "magic::file_start $file" \n
-   		#append tcl [run $script1] \n
-   	    }
-   	} else {
-   	    set file $arg
-   	    set script1 [process $file]
-   	     eval [linsert $script1 0 lappend script [list file $file]]
-   	    # 8.5 # lappend script [list file $file] {*}$script1
-
-   	    #append tcl "magic::file_start $file" \n
-   	    #append tcl [run $script1] \n
-   	}
-    }
-
-    #puts stderr $script
-    ::fileutil::magic::cfront::Debug {puts "\# $args"}
-
-    set    t   [2tree $script]
-    set    tcl [treegen $t root]
-    append tcl "\nreturn \{\}"
-
-    ::fileutil::magic::cfront::Debug {puts [treedump $t]}
-    #set tcl [run $script]
-
-    return $tcl
-}
-
-proc ::fileutil::magic::cfront::procdef {procname args} {
-
-    set pspace [namespace qualifiers $procname]
-
-    if {$pspace eq ""} {
-	return -code error "Cannot generate recognizer in the global namespace"
-    }
-
-    set     script {}
-    lappend script "package require fileutil::magic::rt"
-    lappend script "namespace eval [list ${pspace}] \{"
-    lappend script "    namespace import ::fileutil::magic::rt::*"
-    lappend script "\}"
-    lappend script ""
-    lappend script [list proc ${procname} {} \n[eval [linsert $args 0 compile]]\n]
-    return [join $script \n]
-}
-
-proc ::fileutil::magic::cfront::install {args} {
-    foreach arg $args {
-	set path [file tail $arg]
-	eval [procdef ::fileutil::magic::/${path}::run $arg]
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal, debugging.
-
-if {!$::fileutil::magic::cfront::debug} {
-    # This procedure definition is optimized out of using code by the
-    # core bcc. It knows that neither argument checks are required,
-    # nor is anything done. So neither results, nor errors are
-    # possible, a true no-operation.
-    proc ::fileutil::magic::cfront::Debug {args} {}
-
-} else {
-    proc ::fileutil::magic::cfront::Debug {script} {
-	# Run the commands in the debug script. This usually generates
-	# some output. The uplevel is required to ensure the proper
-	# resolution of all variables found in the script.
-	uplevel 1 $script
-	return
-    }
-}
-
-#set script [magic::compile {} /usr/share/misc/file/magic]
-#puts "\# types:[array names magic::types]"
-#puts "\# quals:[array names magic::quals]"
-#puts "Script: $script"
-
-# ### ### ### ######### ######### #########
-## Ready for use.
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/cgen.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/cgen.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,671 +1,0 @@
-# cgen.tcl --
-#
-#	Generator core for compiler of magic(5) files into recognizers
-#	based on the 'rtcore'.
-#
-# Copyright (c) 2004-2005 Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005      Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: cgen.tcl,v 1.7 2007/06/23 03:39:34 andreas_kupries Exp $
-
-#####
-#
-# "mime type recognition in pure tcl"
-# http://wiki.tcl.tk/12526
-#
-# Tcl code harvested on:  10 Feb 2005, 04:06 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-package require fileutil::magic::rt ; # Runtime core, for Access to the typemap
-package require struct::list        ; # Our data structures.
-package require struct::tree        ; #
-
-package provide fileutil::magic::cgen 1.0
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::fileutil::magic::cgen {
-    # Import the runtime typemap into our scope.
-    variable ::fileutil::magic::rt::typemap
-
-    # The tree most operations use for their work.
-    variable tree {}
-
-    # Generator data structure.
-    variable regions
-
-    # Type mapping for indirect offsets.
-    # empty -> long/Q, because this uses native byteorder.
-
-    array set otmap {
-        .b c    .B c
-        .s s    .S S
-        .l i    .L I
-	{} Q
-    }
-
-    # Export the API
-    namespace export 2tree treedump treegen
-}
-
-
-# Optimisations:
-
-# reorder tests according to expected or observed frequency this
-# conflicts with reduction in strength optimisations.
-
-# Rewriting within a level will require pulling apart the list of
-# tests at that level and reordering them.  There is an inconsistency
-# between handling at 0-level and deeper level - this has to be
-# removed or justified.
-
-# Hypothetically, every test at the same level should be mutually
-# exclusive, but this is not given, and should be detected.  If true,
-# this allows reduction in strength to switch on Numeric tests
-
-# reduce Numeric tests at the same level to switches
-#
-# - first pass through clauses at same level to categorise as
-#   variant values over same test (type and offset).
-
-# work out some way to cache String comparisons
-
-# Reduce seek/reads for String comparisons at same level:
-#
-# - first pass through clauses at same level to determine string ranges.
-#
-# - String tests at same level over overlapping ranges can be
-#   written as sub-string comparisons over the maximum range
-#   this saves re-reading the same string from file.
-#
-# - common prefix strings will have to be guarded against, by
-#   sorting string values, then sorting the tests in reverse length order.
-
-
-proc ::fileutil::magic::cgen::path {tree} {
-    # Annotates the tree. In each node we store the path from the root
-    # to this node, as list of nodes, with the current node the last
-    # element. The root node is never stored in the path.
-
-    $tree set root path {}
-    foreach child [$tree children root] {
-   	$tree walk $child -type dfs node {
-   	    set path [$tree get [$tree parent $node] path]
-   	    lappend path [$tree index $node]
-   	    $tree set $node path $path
-   	}
-    }
-    return
-}
-
-proc ::fileutil::magic::cgen::tree_el {tree parent file line type qual comp offset val message args} {
-
-    # Recursively creates and annotates a node for the specified
-    # tests, and its sub-tests (args).
-
-    set     node [$tree insert $parent end]
-    set     path [$tree get    $parent path]
-    lappend path [$tree index  $node]
-    $tree set $node path $path
-
-    # generate a proc call type for the type, Numeric or String
-    variable ::fileutil::magic::rt::typemap
-
-    switch -glob -- $type {
-   	*byte* -
-   	*short* -
-   	*long* -
-   	*date* {
-   	    set otype N
-   	    set type [lindex $typemap($type) 1]
-   	}
-   	*string {
-   	    set otype S
-   	}
-   	default {
-   	    puts stderr "Unknown type: '$type'"
-   	}
-    }
-
-    # Stores the type determined above, and the arguments into
-    # attributes of the new node.
-
-    foreach key {line type qual comp offset val message file otype} {
-   	if {[catch {
-   	    $tree set $node $key [set $key]
-   	} result]} {
-	    upvar ::errorInfo eo
-   	    puts "Tree: $eo - $file $line $type"
-   	}
-    }
-
-    # now add children
-    foreach el $args {
-	eval [linsert $el 0 tree_el $tree $node $file]
-   	# 8.5 # tree_el $tree $node $file {*}$el
-    }
-    return $node
-}
-
-proc ::fileutil::magic::cgen::2tree {script} {
-
-    # Converts a recognizer which is in a simple script form into a
-    # tree.
-
-    variable tree
-    set tree [::struct::tree]
-
-    $tree set root path ""
-    $tree set root otype Root
-    $tree set root type root
-    $tree set root message "unknown"
-
-    # generate a test for each match
-    set file "unknown"
-    foreach el $script {
-   	#puts "EL: $el"
-   	if {[lindex $el 0] eq "file"} {
-   	    set file [lindex $el 1]
-   	} else {
-	    set node [eval [linsert $el 0 tree_el $tree root $file]]
-	    # 8.5 # set more [tree_el $tree root $file {*}$el]
-   	    append result $node
-   	}
-    }
-    optNum $tree root
-    #optStr $tree root
-    puts stderr "Script contains [llength [$tree children root]] discriminators"
-    path $tree
-
-    # Decoding the offsets, determination if we have to handle
-    # relative offsets, and where. The less, the better.
-    Offsets $tree
-
-    return $tree
-}
-
-proc ::fileutil::magic::cgen::isStr {tree node} {
-    return [expr {"S" eq [$tree get $node otype]}]
-}
-
-proc ::fileutil::magic::cgen::sortRegion {r1 r2} {
-    set cmp 0
-    if {[catch {
-   	if {[string match (*) $r1] || [string match (*) $r2]} {
-   	    set cmp [string compare $r1 $r2]
-   	} else {
-   	    set cmp [expr {[lindex $r1 0] - [lindex $r2 0]}]
-   	    if {!$cmp} {
-   		set cmp 0
-   		set cmp [expr {[lindex $r1 1] - [lindex $r2 1]}]
-   	    }
-   	}
-    } result]} {
-   	set cmp [string compare $r1 $r2]
-    }
-    return $cmp
-}
-
-proc ::fileutil::magic::cgen::optStr {tree node} {
-    variable regions
-    catch {unset regions}
-    array set regions {}
-
-    optStr1 $tree $node
-
-    puts stderr "Regions [array statistics regions]"
-    foreach region [lsort \
-	    -index   0 \
-	    -command ::fileutil::magic::cgen::sortRegion \
-	    [array name regions]] {
-   	puts "$region - $regions($region)"
-    }
-}
-
-proc ::fileutil::magic::cgen::optStr1 {tree node} {
-    variable regions
-
-    # traverse each numeric element of this node's children,
-    # categorising them
-
-    set kids [$tree children $node]
-    foreach child $kids {
-   	optStr1 $tree $child
-    }
-
-    set strings [$tree children $node filter ::fileutil::magic::cgen::isStr]
-    #puts stderr "optstr: $node: $strings"
-
-    foreach el $strings {
-   	#if {[$tree get $el otype] eq "String"} {puts "[$tree getall $el] - [string length [$tree get $el val]]"}
-	if {[$tree get $el comp] eq "x"} {
-	    continue
-	}
-
-	set offset [$tree get $el offset]
-	set len    [string length [$tree get $el val]]
-	lappend regions([list $offset $len]) $el
-    }
-}
-
-proc ::fileutil::magic::cgen::isNum {tree node} {
-    return [expr {"N" eq [$tree get $node otype]}]
-}
-
-proc ::fileutil::magic::cgen::switchNSort {tree n1 n2} {
-    return [expr {[$tree get $n1 val] - [$tree get $n1 val]}]
-}
-
-proc ::fileutil::magic::cgen::optNum {tree node} {
-    array set offsets {}
-
-    # traverse each numeric element of this node's children,
-    # categorising them
-
-    set kids [$tree children $node]
-    foreach child $kids {
-	optNum $tree $child
-    }
-
-    set numerics [$tree children $node filter ::fileutil::magic::cgen::isNum]
-    #puts stderr "optNum: $node: $numerics"
-    if {[llength $numerics] < 2} {
-	return
-    }
-
-    foreach el $numerics {
-	if {[$tree get $el comp] ne "=="} {
-	    continue
-	}
-	lappend offsets([$tree get $el type],[$tree get $el offset],[$tree get $el qual]) $el
-    }
-
-    #puts "Offset: stderr [array get offsets]"
-    foreach {match nodes} [array get offsets] {
-	if {[llength $nodes] < 2} {
-	    continue
-	}
-
-	catch {unset matcher}
-	foreach n $nodes {
-	    set nv [expr [$tree get $n val]]
-	    if {[info exists matcher($nv)]} {
-		puts stderr "*====================================="
-		puts stderr "* Node         <[$tree getall $n]>"
-		puts stderr "* clashes with <[$tree getall $matcher($nv)]>"
-		puts stderr "*====================================="
-	    } else {
-		set matcher($nv) $n
-	    }
-	}
-
-	foreach {type offset qual} [split $match ,] break
-	set switch [$tree insert $node [$tree index [lindex $nodes 0]]]
-	$tree set $switch otype   Switch
-	$tree set $switch message $match
-	$tree set $switch offset  $offset
-	$tree set $switch type    $type
-	$tree set $switch qual    $qual
-
-	set nodes [lsort -command [list ::fileutil::magic::cgen::switchNSort $tree] $nodes]
-
-	eval [linsert $nodes 0 $tree move $switch end]
-	# 8.5 # $tree move $switch end {*}$nodes
-	set     path [$tree get [$tree parent $switch] path]
-	lappend path [$tree index $switch]
-	$tree set $switch path $path
-    }
-}
-
-proc ::fileutil::magic::cgen::Offsets {tree} {
-
-    # Indicator if a node has to save field location information for
-    # relative addressing. The 'kill' attribute is an accumulated
-    # 'save' over the whole subtree. It will be used to determine when
-    # level information was destroyed by subnodes and has to be
-    # regenerated at the current level.
-
-    $tree walk root -type dfs node {
-	$tree set $node save 0
-	$tree set $node kill 0
-    }
-
-    # We walk from the leafs up to the root, synthesizing the data
-    # needed, as we go.
-    $tree walk root -type dfs -order post node {
-	if {$node eq "root"} continue
-	DecodeOffset $tree $node [$tree get $node offset]
-
-	# If the current node's parent is a switch, and the node has
-	# to save, then the switch has to save. Because the current
-	# node is not relevant during code generation anymore, the
-	# switch is.
-
-	if {[$tree get $node save]} {
-	    # We save, therefore we kill.
-	    $tree set $node kill 1
-	    if {[$tree get [$tree parent $node] otype] eq "Switch"} {
-		$tree set [$tree parent $node] save 1
-	    }
-	} else {
-	    # We don't save i.e. kill, but we may inherit it from
-	    # children which kill.
-
-	    foreach c [$tree children $node] {
-		if {[$tree get $c kill]} {
-		    $tree set $node kill 1
-		    break
-		}
-	    }
-	}
-    }
-}
-
-proc ::fileutil::magic::cgen::DecodeOffset {tree node offset} {
-    if {[string match "(*)" $offset]} {
-	# Indirection offset. (Decoding is non-trivial, therefore
-	# packed into a proc).
-
-	set ind 1 ; # Indirect location
-	foreach {rel base itype idelta} [DecodeIndirectOffset $offset] break
-
-    } elseif {[string match "&*" $offset]} {
-	# Direct relative offset. (Decoding is trivial)
-
-	set ind    0       ; # Direct location
-	set rel    1       ; # Relative
-	set base   [string range $offset 1 end] ; # Base Delta
-	set itype  {}      ; # No data for indirect
-	set idelta {}      ; # s.a.
-
-    } else {
-	set ind    0       ; # Direct location
-	set rel    0       ; # Absolute
-	set base   $offset ; # Here!
-	set itype  {}      ; # No data for indirect
-	set idelta {}      ; # s.a.
-    }
-
-    # Store the expanded data back into the tree.
-
-    foreach v {ind rel base itype idelta} {
-	$tree set $node $v [set $v]
-    }
-
-    # For nodes with adressing relative to last field above the latter
-    # has to save this information.
-
-    if {$rel} {
-	$tree set [$tree parent $node] save 1
-    }
-    return
-}
-
-proc ::fileutil::magic::cgen::DecodeIndirectOffset {offset} {
-    variable otmap ; # Offset typemap.
-
-    # Offset parser.
-    # Syntax:
-    #   ( ?&? number ?.[bslBSL]? ?[+-]? ?number? )
-
-    set n {(([0-9]+)|(0x[0-9A-Fa-f]+))}
-    set o "\\((&?)(${n})((\\.\[bslBSL])?)(\[+-]?)(${n}?)\\)"
-    #         |   | ||| ||               |       | |||
-    #         1   2 345 67               8       9 012
-    #         ^   ^     ^                ^       ^
-    #         rel base  type             sign    index
-    #
-    #                            1   2    3 4 5 6    7 8    9   0 1 2
-    set ok [regexp $o $offset -> rel base _ _ _ type _ sign idx _ _ _]
-
-    if {!$ok} {
-        return -code error "Bad offset \"$offset\""
-    }
-
-    # rel is in {"", &}, map to 0|1
-    if {$rel eq ""} {set rel 0} else {set rel 1}
-
-    # base is a number, enforce decimal. Not optional.
-    set base [expr $base]
-
-    # Type is in .b .s .l .B .S .L, and "". Map to a regular magic
-    # type code.
-    set type $otmap($type)
-
-    # sign is in {+,-,""}. Map to -|"" (Becomes sign of index)
-    if {$sign eq "+"} {set sign ""}
-
-    # Index is optional number. Enforce decimal, empty is zero. Add in
-    # the sign as well for a proper signed index.
-
-    if {$idx eq ""} {set idx 0}
-    set idx $sign[expr $idx]
-
-    return [list $rel $base $type $idx]
-}
-
-proc ::fileutil::magic::cgen::treedump {tree} {
-    set result ""
-    $tree walk root -type dfs node {
-	set path  [$tree get $node path]
-	set depth [llength $path]
-
-	append result [string repeat "  " $depth] [list $path] ": " [$tree get $node type]:
-
-	if {[$tree keyexists $node offset]} {
-	    append result " ,O|[$tree get $node offset]|"
-
-	    set x {}
-	    foreach v {ind rel base itype idelta} {lappend x [$tree get $node $v]}
-	    append result "=<[join $x !]>"
-	}
-	if {[$tree keyexists $node qual]} {
-	    set q [$tree get $node qual]
-	    if {$q ne ""} {
-		append result " ,q/$q/"
-	    }
-	}
-
-	if {[$tree keyexists $node comp]} {
-	    append result " " C([$tree get $node comp])
-	}
-	if {[$tree keyexists $node val]} {
-	    append result " " V([$tree get $node val])
-	}
-
-	if {[$tree keyexists $node otype]} {
-	    append result " " [$tree get $node otype]/[$tree get $node save]
-	}
-
-	if {$depth == 1} {
-	    set msg [$tree get $node message]
-	    set n $node
-	    while {($n != {}) && ($msg == "")} {
-		set n [lindex [$tree children $n] 0]
-		if {$n != {}} {
-		    set msg [$tree get $n message]
-		}
-	    }
-	    append result " " ( $msg )
-	    if {[$tree keyexists $node file]} {
-		append result " - " [$tree get $node file]
-	    }
-	}
-
-	#append result " <" [$tree getall $node] >
-	append result \n
-    }
-    return $result
-}
-
-proc ::fileutil::magic::cgen::treegen {tree node} {
-    return "[treegen1 $tree $node]\nresult\n"
-}
-
-proc ::fileutil::magic::cgen::treegen1 {tree node} {
-    variable ::fileutil::magic::rt::typemap
-
-    set result ""
-    foreach k {otype type offset comp val qual message save path} {
-	if {[$tree keyexists $node $k]} {
-	    set $k [$tree get $node $k]
-	}
-    }
-
-    set level [llength $path]
-
-    # Generate code for each node per its type.
-
-    switch $otype {
-	N -
-	S {
-	    if {$save} {
-		# We have to save field data for relative adressing under this
-		# leaf.
-		if {$otype eq "N"} {
-		    set type [list Nx $level $type]
-		} elseif {$otype eq "S"} {
-		    set type [list Sx $level]
-		}
-	    } else {
-		# Regular fetching of information.
-		if {$otype eq "N"} {
-		    set type [list N $type]
-		} elseif {$otype eq "S"} {
-		    set type S
-		}
-	    }
-
-	    set offset [GenerateOffset $tree $node]
-
-	    if {$qual eq ""} {
-		append result "if \{\[$type $offset $comp [list $val]\]\} \{"
-	    } else {
-		append result "if \{\[$type $offset $comp [list $val] $qual\]\} \{"
-	    }
-
-	    if {[$tree isleaf $node]} {
-		if {$message ne ""} {
-		    append result "emit [list $message]"
-		} else {
-		    append result "emit [$tree get $node path]"
-		}
-	    } else {
-		# If we saved data the child branches may destroy
-		# level information. We regenerate it if needed.
-
-		if {$message ne ""} {
-		    append result "emit [list $message]\n"
-		}
-
-		set killed 0
-		foreach child [$tree children $node] {
-		    if {$save && $killed && [$tree get $child rel]} {
-			# This location already does not regenerate if
-			# the killing subnode was last. We also do not
-			# need to regenerate if the current subnode
-			# does not use relative adressing.
-			append result "L $level;"
-			set killed 0
-		    }
-		    append result [treegen1 $tree $child]
-		    set killed [expr {$killed || [$tree get $child kill]}]
-		}
-		#append result "\nreturn \$result"
-	    }
-
-	    append result "\}\n"
-	}
-	Root {
-	    foreach child [$tree children $node] {
-		append result [treegen1 $tree $child]
-	    }
-	}
-	Switch {
-	    set offset [GenerateOffset $tree $node]
-
-	    if {$save} {
-		set fetch "Nvx $level"
-	    } else {
-		set fetch Nv
-	    }
-
-	    append fetch " " $type " " $offset
-	    if {$qual ne ""} {
-		append fetch " " $qual
-	    }
-	    append result "switch -- \[$fetch\] "
-
-	    set scan [lindex $typemap($type) 1]
-
-	    set ckilled 0
-	    foreach child [$tree children $node] {
-		binary scan [binary format $scan [$tree get $child val]] $scan val
-		append result "$val \{"
-
-		if {$save && $ckilled} {
-		    # This location already does not regenerate if
-		    # the killing subnode was last. We also do not
-		    # need to regenerate if the current subnode
-		    # does not use relative adressing.
-		    append result "L $level;"
-		    set ckilled 0
-		}
-
-		if {[$tree isleaf $child]} {
-		    append result "emit [list [$tree get $child message]]"
-		} else {
-		    set killed 0
-		    append result "emit [list [$tree get $child message]]\n"
-		    foreach grandchild [$tree children $child] {
-			if {$save && $killed && [$tree get $grandchild rel]} {
-			    # This location already does not regenerate if
-			    # the killing subnode was last. We also do not
-			    # need to regenerate if the current subnode
-			    # does not use relative adressing.
-			    append result "L $level;"
-			    set killed 0
-			}
-			append result [treegen1 $tree $grandchild]
-			set killed [expr {$killed || [$tree get $grandchild kill]}]
-		    }
-		}
-
-		set ckilled [expr {$ckilled || [$tree get $child kill]}]
-		append result "\} "
-	    }
-	    append result "\n"
-	}
-    }
-    return $result
-}
-
-proc ::fileutil::magic::cgen::GenerateOffset {tree node} {
-    # Examples:
-    # direct absolute:     45      -> 45
-    # direct relative:    &45      -> [R 45]
-    # indirect absolute:  (45.s+1) -> [I 45 s 1]
-    # indirect relative: (&45.s+1) -> [I [R 45] s 1]
-
-    foreach v {ind rel base itype idelta} {
-	set $v [$tree get $node $v]
-    }
-
-    if {$rel} {set base "\[R $base\]"}
-    if {$ind} {set base "\[I $base $itype $idelta\]"}
-    return $base
-}
-
-# ### ### ### ######### ######### #########
-## Ready for use.
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/filetypes.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/filetypes.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5180 +1,0 @@
-# filetypes.tcl --
-#
-#	Tcl based file type recognizer using the runtime core and
-#	generated from /usr/share/misc/magic.mime. Limited output,
-#	but only mime-types, i.e. standardized.
-#
-# Copyright (c) 2004-2005 Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005-2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: filetypes.tcl,v 1.6 2006/09/27 21:19:35 andreas_kupries Exp $
-
-#####
-#
-# "mime type discriminator"
-# http://wiki.tcl.tk/12537
-#
-# Tcl code harvested on:  10 Feb 2005, 04:16 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# ### ### ### ######### ######### #########
-## Requirements.
-
-package require Tcl 8.4
-package require fileutil::magic::rt    ; # We need the runtime core.
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::fileutil::magic {}
-
-proc ::fileutil::magic::filetype {file} {
-    if {![file exists $file]} {
-        return -code error "file not found: \"$file\""
-    }
-    if {[file isdirectory $file]} {
-	return directory
-    }
-
-    rt::open $file
-    filetype::run
-    rt::close
-    set types [rt::resultv]
-
-    if {[llength $types]} {
-	# We postprocess the data if needed, as the low-level
-	# recognizer can return duplicate information.
-
-	array set _ {}
-	set utypes  {}
-	foreach t $types {
-	    if {[info exists _($t)]} continue
-	    lappend utypes $t
-	    set _($t) .
-	    set types $utypes
-	}
-    }
-    return [join $types]
-}
-
-package provide fileutil::magic::filetype 1.0.2
-# The actual recognizer is the command below.
-
-##
-## -- Do not edit after this line !
-## -- ** BEGIN GENERATED CODE ** --
-
-package require fileutil::magic::rt
-namespace eval ::fileutil::magic::filetype {
-    namespace import ::fileutil::magic::rt::*
-}
-
-proc ::fileutil::magic::filetype::run {} {
-switch -- [Nv S 0] 518 {emit {ALAN game data}
-if {[N c 2 < 0xa]} {emit {version 2.6%d}}
-} -7408 {emit {Amiga Workbench}
-if {[N S 2 == 0x1]} {switch -- [Nv c 48] 1 {emit {disk icon}} 2 {emit {drawer icon}} 3 {emit {tool icon}} 4 {emit {project icon}} 5 {emit {garbage icon}} 6 {emit {device icon}} 7 {emit {kickstart icon}} 8 {emit {workbench application icon}} 
-}
-if {[N S 2 > 0x1]} {emit {icon, vers. %d}}
-} 3840 {emit {AmigaOS bitmap font}} 3843 {emit {AmigaOS outline font}} 19937 {emit {MPEG-4 LO-EP audio stream}} 3599 {emit {Atari MSA archive data}
-if {[N S 2 x {}]} {emit {\b, %d sectors per track}}
-switch -- [Nv S 4] 0 {emit {\b, 1 sided}} 1 {emit {\b, 2 sided}} 
-if {[N S 6 x {}]} {emit {\b, starting track: %d}}
-if {[N S 8 x {}]} {emit {\b, ending track: %d}}
-} 368 {emit {WE32000 COFF}
-if {[N S 18 ^ 0x10]} {emit object}
-if {[N S 18 & 0x10]} {emit executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N S 18 ^ 0x1000]} {emit {N/A on 3b2/300 w/paging}}
-if {[N S 18 & 0x2000]} {emit {32100 required}}
-if {[N S 18 & 0x4000]} {emit {and MAU hardware required}}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(pure\)}} 267 {emit {\(demand paged\)}} 291 {emit {\(target shared library\)}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 369 {emit {WE32000 COFF executable \(TV\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 14541 {emit {C64 PCLink Image}} 30463 {emit {squeezed data,}
-if {[S 4 x {}]} {emit {original name %s}}
-} 30462 {emit {crunched data,}
-if {[S 2 x {}]} {emit {original name %s}}
-} 30461 {emit {LZH compressed data,}
-if {[S 2 x {}]} {emit {original name %s}}
-} -32760 {emit {Lynx cartridge,}
-if {[N S 2 x {}]} {emit {RAM start $%04x}}
-if {[S 6 == BS93]} {emit 0 12 1}
-if {[N I 16 == 0x3030 &0xfe00f0f0]} {emit {Infocom game data}}
-if {[N c 0 == 0x0]} {emit {\(false match\)}}
-if {[N c 0 > 0x0]} {emit {\(Z-machine %d,}
-if {[N S 2 x {}]} {emit {Release %d /}}
-if {[S 18 x {}]} {emit {Serial %.6s\)}}
-}
-} 2935 {emit {ATSC A/52 aka AC-3 aka Dolby Digital stream,}
-switch -- [Nv c 4 &0xc0] 0 {emit {48 kHz,}} 64 {emit {44.1 kHz,}} -128 {emit {32 kHz,}} -64 {emit {reserved frequency,}} 
-switch -- [Nv c 6 &0xe0] 0 {emit {1+1 front,}} 32 {emit {1 front/0 rear,}} 64 {emit {2 front/0 rear,}} 96 {emit {3 front/0 rear,}} -128 {emit {2 front/1 rear,}} -96 {emit {3 front/1 rear,}} -64 {emit {2 front/2 rear,}} -32 {emit {3 front/2 rear,}} 
-switch -- [Nv c 7 &0x40] 0 {emit {LFE off,}} 64 {emit {LFE on,}} 
-switch -- [Nv S 6 &0x0180] 0 {emit {Dolby Surround not indicated}} 128 {emit {not Dolby Surround encoded}} 256 {emit {Dolby Surround encoded}} 384 {emit {reserved Dolby Surround mode}} 
-} 5493 {emit {fsav \(linux\) macro virus}
-if {[N s 8 > 0x0]} {emit {\(%d-}}
-if {[N c 11 > 0x0]} {emit {\b%02d-}}
-if {[N c 10 > 0x0]} {emit {\b%02d\)}}
-} -26367 {emit {GPG key public ring}} 1280 {emit {Hitachi SH big-endian COFF}
-switch -- [Nv S 18 &0x0002] 0 {emit object} 2 {emit executable} 
-switch -- [Nv S 18 &0x0008] 8 {emit {\b, stripped}} 0 {emit {\b, not stripped}} 
-} 351 {emit {370 XA sysV executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %d}}
-if {[N I 30 > 0x0]} {emit {- 5.2 format}}
-} 346 {emit {370 XA sysV pure executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %d}}
-if {[N I 30 > 0x0]} {emit {- 5.2 format}}
-} 22529 {emit {370 sysV pure executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 23041 {emit {370 XA sysV pure executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 23809 {emit {370 sysV executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 24321 {emit {370 XA sysV executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 345 {emit {SVR2 executable \(Amdahl-UTS\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N I 24 > 0x0]} {emit {- version %ld}}
-} 348 {emit {SVR2 pure executable \(Amdahl-UTS\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N I 24 > 0x0]} {emit {- version %ld}}
-} 344 {emit {SVR2 pure executable \(USS/370\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N I 24 > 0x0]} {emit {- version %ld}}
-} 349 {emit {SVR2 executable \(USS/370\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N I 24 > 0x0]} {emit {- version %ld}}
-} 407 {emit {Apollo m68k COFF executable}
-if {[N S 18 ^ 0x4000]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 404 {emit {apollo a88k COFF executable}
-if {[N S 18 ^ 0x4000]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 200 {emit {hp200 \(68010\) BSD}
-switch -- [Nv S 2] 263 {emit {impure binary}} 264 {emit {read-only binary}} 267 {emit {demand paged binary}} 
-} 300 {emit {hp300 \(68020+68881\) BSD}
-switch -- [Nv S 2] 263 {emit {impure binary}} 264 {emit {read-only binary}} 267 {emit {demand paged binary}} 
-} 479 {emit {executable \(RISC System/6000 V3.1\) or obj module}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 260 {emit {shared library}} 261 {emit {ctab data}} -508 {emit {structured file}} 12320 {emit {character Computer Graphics Metafile}} 474 {emit {SGI image data}
-if {[N c 2 == 0x1]} {emit {\b, RLE}}
-if {[N c 3 == 0x2]} {emit {\b, high precision}}
-if {[N S 4 x {}]} {emit {\b, %d-D}}
-if {[N S 6 x {}]} {emit {\b, %d x}}
-if {[N S 8 x {}]} {emit %d}
-if {[N S 10 x {}]} {emit {\b, %d channel}}
-if {[N S 10 != 0x1]} {emit {\bs}}
-if {[S 80 > 0]} {emit {\b, \"%s\"}}
-} 4112 {emit {PEX Binary Archive}} 2560 {emit {PCX ver. 2.5 image data}} 2562 {emit {PCX ver. 2.8 image data, with palette}} 2563 {emit {PCX ver. 2.8 image data, without palette}} 2564 {emit {PCX for Windows image data}} 2565 {emit {PCX ver. 3.0 image data}
-if {[N s 4 x {}]} {emit {bounding box [%hd,}}
-if {[N s 6 x {}]} {emit {%hd] -}}
-if {[N s 8 x {}]} {emit {[%hd,}}
-if {[N s 10 x {}]} {emit %hd\],}
-if {[N c 65 > 0x1]} {emit {%d planes each of}}
-if {[N c 3 x {}]} {emit %hhd-bit}
-switch -- [Nv c 68] 0 {emit image,} 1 {emit colour,} 2 {emit grayscale,} 
-if {[N c 68 > 0x2]} {emit image,}
-if {[N c 68 < 0x0]} {emit image,}
-if {[N s 12 > 0x0]} {emit {%hd x}
-if {[N s 14 x {}]} {emit {%hd dpi,}}
-}
-switch -- [Nv c 2] 0 {emit uncompressed} 1 {emit {RLE compressed}} 
-} 12320 {emit {character Computer Graphics Metafile}} 21930 {emit {BIOS \(ia32\) ROM Ext.}
-if {[S 5 == USB]} {emit USB}
-if {[S 7 == LDR]} {emit {UNDI image}}
-if {[S 30 == IBM]} {emit {IBM comp. Video}}
-if {[S 26 == Adaptec]} {emit Adaptec}
-if {[S 28 == Adaptec]} {emit Adaptec}
-if {[S 42 == PROMISE]} {emit Promise}
-if {[N c 2 x {}]} {emit {\(%d*512\)}}
-} -21267 {emit {Java serialization data}
-if {[N S 2 > 0x4]} {emit {\b, version %d}}
-} -40 {emit {JPEG image data}
-if {[S 6 == JFIF]} {emit {\b, JFIF standard}
-if {[N c 11 x {}]} {emit {\b %d.}}
-if {[N c 12 x {}]} {emit {\b%02d}}
-if {[N c 18 != 0x0]} {emit {\b, thumbnail %dx}
-if {[N c 19 x {}]} {emit {\b%d}}
-}
-}
-if {[S 6 == Exif]} {emit {\b, EXIF standard}
-if {[S 12 == II]} {if {[N s 70 == 0x8769]} {if {[N s [I 78 i 14] == 0x9000]} {if {[N c [I 78 i 23] x {}]} {emit %c}
-if {[N c [I 78 i 24] x {}]} {emit {\b.%c}}
-if {[N c [I 78 i 25] != 0x30]} {emit {\b%c}}
-}
-}
-if {[N s 118 == 0x8769]} {if {[N s [I 126 i 38] == 0x9000]} {if {[N c [I 126 i 47] x {}]} {emit %c}
-if {[N c [I 126 i 48] x {}]} {emit {\b.%c}}
-if {[N c [I 126 i 49] != 0x30]} {emit {\b%c}}
-}
-}
-if {[N s 130 == 0x8769]} {if {[N s [I 138 i 38] == 0x9000]} {if {[N c [I 138 i 47] x {}]} {emit %c}
-if {[N c [I 138 i 48] x {}]} {emit {\b.%c}}
-if {[N c [I 138 i 49] != 0x30]} {emit {\b%c}}
-}
-if {[N s [I 138 i 50] == 0x9000]} {if {[N c [I 138 i 59] x {}]} {emit %c}
-if {[N c [I 138 i 60] x {}]} {emit {\b.%c}}
-if {[N c [I 138 i 61] != 0x30]} {emit {\b%c}}
-}
-if {[N s [I 138 i 62] == 0x9000]} {if {[N c [I 138 i 71] x {}]} {emit %c}
-if {[N c [I 138 i 72] x {}]} {emit {\b.%c}}
-if {[N c [I 138 i 73] != 0x30]} {emit {\b%c}}
-}
-}
-if {[N s 142 == 0x8769]} {if {[N s [I 150 i 38] == 0x9000]} {if {[N c [I 150 i 47] x {}]} {emit %c}
-if {[N c [I 150 i 48] x {}]} {emit {\b.%c}}
-if {[N c [I 150 i 49] != 0x30]} {emit {\b%c}}
-}
-if {[N s [I 150 i 50] == 0x9000]} {if {[N c [I 150 i 59] x {}]} {emit %c}
-if {[N c [I 150 i 60] x {}]} {emit {\b.%c}}
-if {[N c [I 150 i 61] != 0x30]} {emit {\b%c}}
-}
-if {[N s [I 150 i 62] == 0x9000]} {if {[N c [I 150 i 71] x {}]} {emit %c}
-if {[N c [I 150 i 72] x {}]} {emit {\b.%c}}
-if {[N c [I 150 i 73] != 0x30]} {emit {\b%c}}
-}
-}
-}
-if {[S 12 == MM]} {if {[N S 118 == 0x8769]} {if {[N S [I 126 I 14] == 0x9000]} {if {[N c [I 126 I 23] x {}]} {emit %c}
-if {[N c [I 126 I 24] x {}]} {emit {\b.%c}}
-if {[N c [I 126 I 25] != 0x30]} {emit {\b%c}}
-}
-if {[N S [I 126 I 38] == 0x9000]} {if {[N c [I 126 I 47] x {}]} {emit %c}
-if {[N c [I 126 I 48] x {}]} {emit {\b.%c}}
-if {[N c [I 126 I 49] != 0x30]} {emit {\b%c}}
-}
-}
-if {[N S 130 == 0x8769]} {if {[N S [I 138 I 38] == 0x9000]} {if {[N c [I 138 I 47] x {}]} {emit %c}
-if {[N c [I 138 I 48] x {}]} {emit {\b.%c}}
-if {[N c [I 138 I 49] != 0x30]} {emit {\b%c}}
-}
-if {[N S [I 138 I 62] == 0x9000]} {if {[N c [I 138 I 71] x {}]} {emit %c}
-if {[N c [I 138 I 72] x {}]} {emit {\b.%c}}
-if {[N c [I 138 I 73] != 0x30]} {emit {\b%c}}
-}
-}
-if {[N S 142 == 0x8769]} {if {[N S [I 150 I 50] == 0x9000]} {if {[N c [I 150 I 59] x {}]} {emit %c}
-if {[N c [I 150 I 60] x {}]} {emit {\b.%c}}
-if {[N c [I 150 I 61] != 0x30]} {emit {\b%c}}
-}
-}
-}
-}
-switch -- [Nv c [I 4 S 5]] -2 {emit {}
-if {[S [I 4 S 8] x {}]} {emit {\b, comment: \"%s\"}}
-} -64 {emit {\b, baseline}
-if {[N c [I 4 S 6] x {}]} {emit {\b, precision %d}}
-if {[N S [I 4 S 7] x {}]} {emit {\b, %dx}}
-if {[N S [I 4 S 9] x {}]} {emit {\b%d}}
-} -63 {emit {\b, extended sequential}
-if {[N c [I 4 S 6] x {}]} {emit {\b, precision %d}}
-if {[N S [I 4 S 7] x {}]} {emit {\b, %dx}}
-if {[N S [I 4 S 9] x {}]} {emit {\b%d}}
-} -62 {emit {\b, progressive}
-if {[N c [I 4 S 6] x {}]} {emit {\b, precision %d}}
-if {[N S [I 4 S 7] x {}]} {emit {\b, %dx}}
-if {[N S [I 4 S 9] x {}]} {emit {\b%d}}
-} 
-} -32768 {emit {lif file}} -30875 {emit {disk quotas file}} 1286 {emit {IRIS Showcase file}
-if {[N c 2 == 0x49]} {emit -}
-if {[N c 3 x {}]} {emit {- version %ld}}
-} 550 {emit {IRIS Showcase template}
-if {[N c 2 == 0x63]} {emit -}
-if {[N c 3 x {}]} {emit {- version %ld}}
-} 352 {emit {MIPSEB ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 22 x {}]} {emit {- version %ld}}
-if {[N c 23 x {}]} {emit .%ld}
-} 354 {emit {MIPSEL-BE ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %d}}
-if {[N c 22 x {}]} {emit .%ld}
-} 24577 {emit {MIPSEB-LE ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %d}}
-if {[N c 22 x {}]} {emit .%ld}
-} 25089 {emit {MIPSEL ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %ld}}
-if {[N c 22 x {}]} {emit .%ld}
-} 355 {emit {MIPSEB MIPS-II ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 22 x {}]} {emit {- version %ld}}
-if {[N c 23 x {}]} {emit .%ld}
-} 358 {emit {MIPSEL-BE MIPS-II ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 22 x {}]} {emit {- version %ld}}
-if {[N c 23 x {}]} {emit .%ld}
-} 25345 {emit {MIPSEB-LE MIPS-II ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %ld}}
-if {[N c 22 x {}]} {emit .%ld}
-} 26113 {emit {MIPSEL MIPS-II ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %ld}}
-if {[N c 22 x {}]} {emit .%ld}
-} 320 {emit {MIPSEB MIPS-III ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 22 x {}]} {emit {- version %ld}}
-if {[N c 23 x {}]} {emit .%ld}
-} 322 {emit {MIPSEL-BE MIPS-III ECOFF executable}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(swapped\)}} 267 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 22 x {}]} {emit {- version %ld}}
-if {[N c 23 x {}]} {emit .%ld}
-} 16385 {emit {MIPSEB-LE MIPS-III ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %ld}}
-if {[N c 22 x {}]} {emit .%ld}
-} 16897 {emit {MIPSEL MIPS-III ECOFF executable}
-switch -- [Nv S 20] 1793 {emit {\(impure\)}} 2049 {emit {\(swapped\)}} 2817 {emit {\(paged\)}} 
-if {[N I 8 > 0x0]} {emit {not stripped}}
-if {[N I 8 == 0x0]} {emit stripped}
-if {[N c 23 x {}]} {emit {- version %ld}}
-if {[N c 22 x {}]} {emit .%ld}
-} 384 {emit {MIPSEB Ucode}} 386 {emit {MIPSEL-BE Ucode}} 336 {emit {mc68k COFF}
-if {[N S 18 ^ 0x10]} {emit object}
-if {[N S 18 & 0x10]} {emit executable}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[S 168 == .lowmem]} {emit {Apple toolbox}}
-switch -- [Nv S 20] 263 {emit {\(impure\)}} 264 {emit {\(pure\)}} 267 {emit {\(demand paged\)}} 273 {emit {\(standalone\)}} 
-} 337 {emit {mc68k executable \(shared\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 338 {emit {mc68k executable \(shared demand paged\)}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-} 364 {emit {68K BCS executable}} 365 {emit {88K BCS executable}} 24602 {emit {Atari 68xxx executable,}
-if {[N I 2 x {}]} {emit {text len %lu,}}
-if {[N I 6 x {}]} {emit {data len %lu,}}
-if {[N I 10 x {}]} {emit {BSS len %lu,}}
-if {[N I 14 x {}]} {emit {symboltab len %lu,}}
-if {[N I 18 == 0x0]} {emit 0 70 4}
-if {[N I 22 & 0x1]} {emit {fastload flag,}}
-if {[N I 22 & 0x2]} {emit {may be loaded to alternate RAM,}}
-if {[N I 22 & 0x4]} {emit {malloc may be from alternate RAM,}}
-if {[N I 22 x {}]} {emit {flags: 0x%lX,}}
-if {[N S 26 == 0x0]} {emit {no relocation tab}}
-if {[N S 26 != 0x0]} {emit {+ relocation tab}}
-if {[S 30 == SFX]} {emit {[Self-Extracting LZH SFX archive]}}
-if {[S 38 == SFX]} {emit {[Self-Extracting LZH SFX archive]}}
-if {[S 44 == ZIP!]} {emit {[Self-Extracting ZIP SFX archive]}}
-} 100 {emit {Atari 68xxx CPX file}
-if {[N S 8 x {}]} {emit {\(version %04lx\)}}
-} 392 {emit {Tower/XP rel 2 object}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-switch -- [Nv S 20] 263 {emit executable} 264 {emit {pure executable}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 397 {emit {Tower/XP rel 2 object}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-switch -- [Nv S 20] 263 {emit executable} 264 {emit {pure executable}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 400 {emit {Tower/XP rel 3 object}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-switch -- [Nv S 20] 263 {emit executable} 264 {emit {pure executable}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 405 {emit {Tower/XP rel 3 object}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-switch -- [Nv S 20] 263 {emit executable} 264 {emit {pure executable}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 408 {emit {Tower32/600/400 68020 object}
-if {[N I 12 > 0x0]} {emit {not stripped}}
-switch -- [Nv S 20] 263 {emit executable} 264 {emit {pure executable}} 
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 416 {emit {Tower32/800 68020}
-if {[N S 18 & 0x2000]} {emit {w/68881 object}}
-if {[N S 18 & 0x4000]} {emit {compatible object}}
-if {[N S 18 & 0xffff9fff]} {emit object}
-switch -- [Nv S 20] 263 {emit executable} 267 {emit {pure executable}} 
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} 421 {emit {Tower32/800 68010}
-if {[N S 18 & 0x4000]} {emit {compatible object}}
-if {[N S 18 & 0xffff9fff]} {emit object}
-switch -- [Nv S 20] 263 {emit executable} 267 {emit {pure executable}} 
-if {[N I 12 > 0x0]} {emit {not stripped}}
-if {[N S 22 > 0x0]} {emit {- version %ld}}
-} -30771 {emit {OS9/6809 module:}
-switch -- [Nv c 6 &0x0f] 0 {emit non-executable} 1 {emit {machine language}} 2 {emit {BASIC I-code}} 3 {emit {Pascal P-code}} 4 {emit {C I-code}} 5 {emit {COBOL I-code}} 6 {emit {Fortran I-code}} 
-switch -- [Nv c 6 &0xf0] 16 {emit {program executable}} 32 {emit subroutine} 48 {emit multi-module} 64 {emit {data module}} -64 {emit {system module}} -48 {emit {file manager}} -32 {emit {device driver}} -16 {emit {device descriptor}} 
-} 19196 {emit {OS9/68K module:}
-if {[N c 20 == 0x80 &0x80]} {emit re-entrant}
-if {[N c 20 == 0x40 &0x40]} {emit ghost}
-if {[N c 20 == 0x20 &0x20]} {emit system-state}
-switch -- [Nv c 19] 1 {emit {machine language}} 2 {emit {BASIC I-code}} 3 {emit {Pascal P-code}} 4 {emit {C I-code}} 5 {emit {COBOL I-code}} 6 {emit {Fortran I-code}} 
-switch -- [Nv c 18] 1 {emit {program executable}} 2 {emit subroutine} 3 {emit multi-module} 4 {emit {data module}} 11 {emit {trap library}} 12 {emit {system module}} 13 {emit {file manager}} 14 {emit {device driver}} 15 {emit {device descriptor}} 
-} -26368 {emit {PGP key public ring}} -27391 {emit {PGP key security ring}} -27392 {emit {PGP key security ring}} -23040 {emit {PGP encrypted data}} -4693 {emit {}
-if {[N S 2 == 0xeedb]} {emit RPM
-if {[N c 4 x {}]} {emit v%d}
-switch -- [Nv S 6] 0 {emit bin} 1 {emit src} 
-switch -- [Nv S 8] 1 {emit i386} 2 {emit Alpha} 3 {emit Sparc} 4 {emit MIPS} 5 {emit PowerPC} 6 {emit 68000} 7 {emit SGI} 8 {emit RS6000} 9 {emit IA64} 10 {emit Sparc64} 11 {emit MIPSel} 12 {emit ARM} 
-if {[S 10 x {}]} {emit %s}
-}
-} -1279 {emit {QDOS object}
-if {[S 2 x {} p]} {emit '%s'}
-} -511 {emit {MySQL table definition file}
-if {[N c 2 x {}]} {emit {Version %d}}
-} 378 {emit {amd 29k coff noprebar executable}} 890 {emit {amd 29k coff prebar executable}} -8185 {emit {amd 29k coff archive}} 
-if {[S 0 == {TADS2\ bin}]} {emit TADS
-if {[N I 9 != 0xa0d1a00]} {emit {game data, CORRUPTED}}
-if {[N I 9 == 0xa0d1a00]} {if {[S 13 x {}]} {emit {%s game data}}
-}
-}
-if {[S 0 == {TADS2\ rsc}]} {emit TADS
-if {[N I 9 != 0xa0d1a00]} {emit {resource data, CORRUPTED}}
-if {[N I 9 == 0xa0d1a00]} {if {[S 13 x {}]} {emit {%s resource data}}
-}
-}
-if {[S 0 == {TADS2\ save/g}]} {emit TADS
-if {[N I 12 != 0xa0d1a00]} {emit {saved game data, CORRUPTED}}
-if {[N I 12 == 0xa0d1a00]} {if {[S [I 16 s 32] x {}]} {emit {%s saved game data}}
-}
-}
-if {[S 0 == {TADS2\ save}]} {emit TADS
-if {[N I 10 != 0xa0d1a00]} {emit {saved game data, CORRUPTED}}
-if {[N I 10 == 0xa0d1a00]} {if {[S 14 x {}]} {emit {%s saved game data}}
-}
-}
-switch -- [Nv i 0] -1010055483 {emit {RISC OS Chunk data}
-if {[S 12 == OBJ_]} {emit {\b, AOF object}}
-if {[S 12 == LIB_]} {emit {\b, ALF library}}
-} 65389 {emit {very old VAX archive}} 65381 {emit {old VAX archive}
-if {[S 8 == __.SYMDEF]} {emit {random library}}
-} 236525 {emit {PDP-11 old archive}} 236526 {emit {PDP-11 4.0 archive}} 6583086 {emit {DEC audio data:}
-switch -- [Nv i 12] 1 {emit {8-bit ISDN mu-law,}} 2 {emit {8-bit linear PCM [REF-PCM],}} 3 {emit {16-bit linear PCM,}} 4 {emit {24-bit linear PCM,}} 5 {emit {32-bit linear PCM,}} 6 {emit {32-bit IEEE floating point,}} 7 {emit {64-bit IEEE floating point,}} 23 {emit {8-bit ISDN mu-law compressed \(CCITT G.721 ADPCM voice data encoding\),}} 
-switch -- [Nv I 12] 8 {emit {Fragmented sample data,}} 10 {emit {DSP program,}} 11 {emit {8-bit fixed point,}} 12 {emit {16-bit fixed point,}} 13 {emit {24-bit fixed point,}} 14 {emit {32-bit fixed point,}} 18 {emit {16-bit linear with emphasis,}} 19 {emit {16-bit linear compressed,}} 20 {emit {16-bit linear with emphasis and compression,}} 21 {emit {Music kit DSP commands,}} 24 {emit {compressed \(8-bit CCITT G.722 ADPCM\)}} 25 {emit {compressed \(3-bit CCITT G.723.3 ADPCM\),}} 26 {emit {compressed \(5-bit CCITT G.723.5 ADPCM\),}} 27 {emit {8-bit A-law \(CCITT G.711\),}} 
-switch -- [Nv i 20] 1 {emit mono,} 2 {emit stereo,} 4 {emit quad,} 
-if {[N i 16 > 0x0]} {emit {%d Hz}}
-} 204 {emit {386 compact demand paged pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N c 32 == 0x6a]} {emit {\(uses shared libs\)}}
-} 263 {emit {386 executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N c 32 == 0x6a]} {emit {\(uses shared libs\)}}
-} 264 {emit {386 pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N c 32 == 0x6a]} {emit {\(uses shared libs\)}}
-} 267 {emit {386 demand paged pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N c 32 == 0x6a]} {emit {\(uses shared libs\)}}
-} 324508366 {emit {GNU dbm 1.x or ndbm database, little endian}} 340322 {emit {Berkeley DB 1.85/1.86}
-if {[N i 4 > 0x0]} {emit {\(Btree, version %d, little-endian\)}}
-} -109248628 {emit {SE Linux policy}
-if {[N i 16 x {}]} {emit v%d}
-if {[N i 20 == 0x1]} {emit MLS}
-if {[N i 24 x {}]} {emit {%d symbols}}
-if {[N i 28 x {}]} {emit {%d ocons}}
-} 453186358 {emit {Netboot image,}
-if {[N i 4 == 0x0 &0xFFFFFF00]} {switch -- [Nv i 4 &0x100] 0 {emit {mode 2}} 256 {emit {mode 3}} 
-}
-if {[N i 4 != 0x0 &0xFFFFFF00]} {emit {unknown mode}}
-} 684539205 {emit {Linux Compressed ROM File System data, little endian}
-if {[N i 4 x {}]} {emit {size %d}}
-if {[N i 8 & 0x1]} {emit {version \#2}}
-if {[N i 8 & 0x2]} {emit sorted_dirs}
-if {[N i 8 & 0x4]} {emit hole_support}
-if {[N i 32 x {}]} {emit {CRC 0x%x,}}
-if {[N i 36 x {}]} {emit {edition %d,}}
-if {[N i 40 x {}]} {emit {%d blocks,}}
-if {[N i 44 x {}]} {emit {%d files}}
-} 876099889 {emit {Linux Journalled Flash File system, little endian}} -536798843 {emit {Linux jffs2 filesystem data little endian}} 4 {emit {X11 SNF font data, LSB first}} 1279543401 {emit {ld.so hints file \(Little Endian}
-if {[N i 4 > 0x0]} {emit {\b, version %d\)}}
-if {[N I 4 <= 0x0]} {emit {\b\)}}
-} 1638399 {emit {GEM Metafile data}
-if {[N s 4 x {}]} {emit {version %d}}
-} 987654321 {emit {DCX multi-page PCX image data}} -681629056 {emit {Cineon image data}
-if {[N I 200 > 0x0]} {emit {\b, %ld x}}
-if {[N I 204 > 0x0]} {emit %ld}
-} 20000630 {emit {OpenEXR image data}} 6553863 {emit {Linux/i386 impure executable \(OMAGIC\)}
-if {[N i 16 == 0x0]} {emit {\b, stripped}}
-} 6553864 {emit {Linux/i386 pure executable \(NMAGIC\)}
-if {[N i 16 == 0x0]} {emit {\b, stripped}}
-} 6553867 {emit {Linux/i386 demand-paged executable \(ZMAGIC\)}
-if {[N i 16 == 0x0]} {emit {\b, stripped}}
-} 6553804 {emit {Linux/i386 demand-paged executable \(QMAGIC\)}
-if {[N i 16 == 0x0]} {emit {\b, stripped}}
-} 336851773 {emit {SYSLINUX' LSS16 image data}
-if {[N s 4 x {}]} {emit {\b, width %d}}
-if {[N s 6 x {}]} {emit {\b, height %d}}
-} -249691108 {emit {magic binary file for file\(1\) cmd}
-if {[N i 4 x {}]} {emit {\(version %d\) \(little endian\)}}
-} 574529400 {emit {Transport Neutral Encapsulation Format}} -21555 {emit {MLSSA datafile,}
-if {[N s 4 x {}]} {emit {algorithm %d,}}
-if {[N i 10 x {}]} {emit {%d samples}}
-} 134769520 {emit {TurboC BGI file}} 134761296 {emit {TurboC Font file}} 76 {emit {}
-if {[N i 4 == 0x21401]} {emit {Windows shortcut file}}
-} 1313096225 {emit {Microsoft Outlook binary email folder}} 220991 {emit {Windows 3.x help file}} 263 {emit {a.out NetBSD little-endian object file}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 459141 {emit {ECOFF NetBSD/alpha binary}
-switch -- [Nv s 10] 1 {emit {not stripped}} 0 {emit stripped} 
-} 33645 {emit {PDP-11 single precision APL workspace}} 33644 {emit {PDP-11 double precision APL workspace}} 268435511 {emit {Psion Series 5}
-switch -- [Nv i 4] 268435513 {emit {font file}} 268435514 {emit {printer driver}} 268435515 {emit clipboard} 268435522 {emit {multi-bitmap image}} 268435562 {emit {application infomation file}} 268435565 {emit {}
-switch -- [Nv i 8] 268435581 {emit {sketch image}} 268435582 {emit {voice note}} 268435583 {emit {word file}} 268435589 {emit {OPL program}} 268435592 {emit {sheet file}} 268435908 {emit {EasyFax initialisation file}} 
-} 268435571 {emit {OPO module}} 268435572 {emit {OPL application}} 268435594 {emit {exported multi-bitmap image}} 
-} 268435521 {emit {Psion Series 5 ROM multi-bitmap image}} 268435536 {emit {Psion Series 5}
-switch -- [Nv i 4] 268435565 {emit database} 268435684 {emit {ini file}} 
-} 268435577 {emit {Psion Series 5 binary:}
-switch -- [Nv i 4] 0 {emit DLL} 268435529 {emit {comms hardware library}} 268435530 {emit {comms protocol library}} 268435549 {emit OPX} 268435564 {emit application} 268435597 {emit DLL} 268435628 {emit {logical device driver}} 268435629 {emit {physical device driver}} 268435685 {emit {file transfer protocol}} 268435685 {emit {file transfer protocol}} 268435776 {emit {printer defintion}} 268435777 {emit {printer defintion}} 
-} 268435578 {emit {Psion Series 5 executable}} 234 {emit {BALANCE NS32000 .o}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 4330 {emit {BALANCE NS32000 executable \(0 @ 0\)}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 8426 {emit {BALANCE NS32000 executable \(invalid @ 0\)}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 12522 {emit {BALANCE NS32000 standalone executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 320013059 {emit {SpeedShop data file}} 16922978 {emit {mdbm file, version 0 \(obsolete\)}} -1582119980 {emit {tcpdump capture file \(little-endian\)}
-if {[N s 4 x {}]} {emit {- version %d}}
-if {[N s 6 x {}]} {emit {\b.%d}}
-switch -- [Nv i 20] 0 {emit {\(No link-layer encapsulation}} 1 {emit {\(Ethernet}} 2 {emit {\(3Mb Ethernet}} 3 {emit {\(AX.25}} 4 {emit {\(ProNET}} 5 {emit {\(CHAOS}} 6 {emit {\(Token Ring}} 7 {emit {\(ARCNET}} 8 {emit {\(SLIP}} 9 {emit {\(PPP}} 10 {emit {\(FDDI}} 11 {emit {\(RFC 1483 ATM}} 12 {emit {\(raw IP}} 13 {emit {\(BSD/OS SLIP}} 14 {emit {\(BSD/OS PPP}} 19 {emit {\(Linux ATM Classical IP}} 50 {emit {\(PPP or Cisco HDLC}} 51 {emit {\(PPP-over-Ethernet}} 99 {emit {\(Symantec Enterprise Firewall}} 100 {emit {\(RFC 1483 ATM}} 101 {emit {\(raw IP}} 102 {emit {\(BSD/OS SLIP}} 103 {emit {\(BSD/OS PPP}} 104 {emit {\(BSD/OS Cisco HDLC}} 105 {emit {\(802.11}} 106 {emit {\(Linux Classical IP over ATM}} 107 {emit {\(Frame Relay}} 108 {emit {\(OpenBSD loopback}} 109 {emit {\(OpenBSD IPsec encrypted}} 112 {emit {\(Cisco HDLC}} 113 {emit {\(Linux \"cooked\"}} 114 {emit {\(LocalTalk}} 117 {emit {\(OpenBSD PFLOG}} 119 {emit {\(802.11 with Prism header}} 122 {emit {\(RFC 2625 IP over Fibre Channel}} 123 {emit {\(SunATM}} 127 {emit {\(802.11 with radiotap header}} 129 {emit {\(Linux ARCNET}} 138 {emit {\(Apple IP over IEEE 1394}} 140 {emit {\(MTP2}} 141 {emit {\(MTP3}} 143 {emit {\(DOCSIS}} 144 {emit {\(IrDA}} 147 {emit {\(Private use 0}} 148 {emit {\(Private use 1}} 149 {emit {\(Private use 2}} 150 {emit {\(Private use 3}} 151 {emit {\(Private use 4}} 152 {emit {\(Private use 5}} 153 {emit {\(Private use 6}} 154 {emit {\(Private use 7}} 155 {emit {\(Private use 8}} 156 {emit {\(Private use 9}} 157 {emit {\(Private use 10}} 158 {emit {\(Private use 11}} 159 {emit {\(Private use 12}} 160 {emit {\(Private use 13}} 161 {emit {\(Private use 14}} 162 {emit {\(Private use 15}} 163 {emit {\(802.11 with AVS header}} 
-if {[N i 16 x {}]} {emit {\b, capture length %d\)}}
-} -1582117580 {emit {extended tcpdump capture file \(little-endian\)}
-if {[N s 4 x {}]} {emit {- version %d}}
-if {[N s 6 x {}]} {emit {\b.%d}}
-switch -- [Nv i 20] 0 {emit {\(No link-layer encapsulation}} 1 {emit {\(Ethernet}} 2 {emit {\(3Mb Ethernet}} 3 {emit {\(AX.25}} 4 {emit {\(ProNET}} 5 {emit {\(CHAOS}} 6 {emit {\(Token Ring}} 7 {emit {\(ARCNET}} 8 {emit {\(SLIP}} 9 {emit {\(PPP}} 10 {emit {\(FDDI}} 11 {emit {\(RFC 1483 ATM}} 12 {emit {\(raw IP}} 13 {emit {\(BSD/OS SLIP}} 14 {emit {\(BSD/OS PPP}} 
-if {[N i 16 x {}]} {emit {\b, capture length %d\)}}
-} 33647 {emit {VAX single precision APL workspace}} 33646 {emit {VAX double precision APL workspace}} 263 {emit {VAX executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 264 {emit {VAX pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 267 {emit {VAX demand paged pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 272 {emit {VAX demand paged \(first page unmapped\) pure executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 518 {emit b.out
-if {[N s 30 & 0x10]} {emit overlay}
-if {[N s 30 & 0x2]} {emit separate}
-if {[N s 30 & 0x4]} {emit pure}
-if {[N s 30 & 0x800]} {emit segmented}
-if {[N s 30 & 0x400]} {emit standalone}
-if {[N s 30 & 0x1]} {emit executable}
-if {[N s 30 ^ 0x1]} {emit {object file}}
-if {[N s 30 & 0x4000]} {emit V2.3}
-if {[N s 30 & 0x8000]} {emit V3.0}
-if {[N c 28 & 0x4]} {emit 86}
-if {[N c 28 & 0xb]} {emit 186}
-if {[N c 28 & 0x9]} {emit 286}
-if {[N c 28 & 0x29]} {emit 286}
-if {[N c 28 & 0xa]} {emit 386}
-if {[N s 30 & 0x4]} {emit {Large Text}}
-if {[N s 30 & 0x2]} {emit {Large Data}}
-if {[N s 30 & 0x102]} {emit {Huge Objects Enabled}}
-} 
-if {[N i 16 == 0xef000011]} {emit {RISC OS AIF executable}}
-if {[S 0 == Draw]} {emit {RISC OS Draw file data}}
-if {[S 0 == {FONT\0}]} {emit {RISC OS outline font data,}
-if {[N c 5 x {}]} {emit {version %d}}
-}
-if {[S 0 == {FONT\1}]} {emit {RISC OS 1bpp font data,}
-if {[N c 5 x {}]} {emit {version %d}}
-}
-if {[S 0 == {FONT\4}]} {emit {RISC OS 4bpp font data}
-if {[N c 5 x {}]} {emit {version %d}}
-}
-if {[S 0 == {Maestro\r}]} {emit {RISC OS music file}
-if {[N c 8 x {}]} {emit {version %d}}
-}
-switch -- [Nv s 0] 21020 {emit {COFF DSP21k}
-if {[N i 18 & 0x2]} {emit executable,}
-if {[N i 18 ^ 0x2]} {if {[N i 18 & 0x1]} {emit {static object,}}
-if {[N i 18 ^ 0x1]} {emit {relocatable object,}}
-}
-if {[N i 18 & 0x8]} {emit stripped}
-if {[N i 18 ^ 0x8]} {emit {not stripped}}
-} 387 {emit {COFF format alpha}
-if {[N s 22 != 0x2000 &030000]} {emit executable}
-switch -- [Nv s 24] 264 {emit pure} 267 {emit paged} 263 {emit object} 
-if {[N s 22 != 0x0 &020000]} {emit {dynamically linked}}
-if {[N i 16 != 0x0]} {emit {not stripped}}
-if {[N i 16 == 0x0]} {emit stripped}
-if {[N s 22 == 0x2000 &030000]} {emit {shared library}}
-if {[N c 27 x {}]} {emit {- version %d}}
-if {[N c 26 x {}]} {emit .%d}
-if {[N c 28 x {}]} {emit -%d}
-} -147 {emit {very old PDP-11 archive}} -155 {emit {old PDP-11 archive}
-if {[S 8 == __.SYMDEF]} {emit {random library}}
-} -5536 {emit {ARJ archive data}
-if {[N c 5 x {}]} {emit {\b, v%d,}}
-if {[N c 8 & 0x4]} {emit multi-volume,}
-if {[N c 8 & 0x10]} {emit slash-switched,}
-if {[N c 8 & 0x20]} {emit backup,}
-if {[S 34 x {}]} {emit {original name: %s,}}
-switch -- [Nv c 7] 0 {emit {os: MS-DOS}} 1 {emit {os: PRIMOS}} 2 {emit {os: Unix}} 3 {emit {os: Amiga}} 4 {emit {os: Macintosh}} 5 {emit {os: OS/2}} 6 {emit {os: Apple ][ GS}} 7 {emit {os: Atari ST}} 8 {emit {os: NeXT}} 9 {emit {os: VAX/VMS}} 
-if {[N c 3 > 0x0]} {emit %d\]}
-} -5247 {emit {PRCS packaged project}} 387 {emit {COFF format alpha}
-if {[N s 22 & 0x1000 &020000]} {emit {sharable library,}}
-if {[N s 22 ^ 0x1000 &020000]} {emit {dynamically linked,}}
-switch -- [Nv s 24] 264 {emit pure} 267 {emit {demand paged}} 
-if {[N i 8 > 0x0]} {emit {executable or object module, not stripped}}
-if {[N i 8 == 0x0]} {if {[N i 12 == 0x0]} {emit {executable or object module, stripped}}
-if {[N i 12 > 0x0]} {emit {executable or object module, not stripped}}
-}
-if {[N c 27 > 0x0]} {emit {- version %d.}}
-if {[N c 26 > 0x0]} {emit %d-}
-if {[N s 28 > 0x0]} {emit %d}
-} 392 {emit {Alpha compressed COFF}} 399 {emit {Alpha u-code object}} 6532 {emit {Linux old jffs2 filesystem data little endian}} 1360 {emit {Hitachi SH little-endian COFF}
-switch -- [Nv s 18 &0x0002] 0 {emit object} 2 {emit executable} 
-switch -- [Nv s 18 &0x0008] 8 {emit {\b, stripped}} 0 {emit {\b, not stripped}} 
-} -13230 {emit {RLE image data,}
-if {[N s 6 x {}]} {emit {%d x}}
-if {[N s 8 x {}]} {emit %d}
-if {[N s 2 > 0x0]} {emit {\b, lower left corner: %d}}
-if {[N s 4 > 0x0]} {emit {\b, lower right corner: %d}}
-if {[N c 10 == 0x1 &0x1]} {emit {\b, clear first}}
-if {[N c 10 == 0x2 &0x2]} {emit {\b, no background}}
-if {[N c 10 == 0x4 &0x4]} {emit {\b, alpha channel}}
-if {[N c 10 == 0x8 &0x8]} {emit {\b, comment}}
-if {[N c 11 > 0x0]} {emit {\b, %d color channels}}
-if {[N c 12 > 0x0]} {emit {\b, %d bits per pixel}}
-if {[N c 13 > 0x0]} {emit {\b, %d color map channels}}
-} 322 {emit {basic-16 executable}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 323 {emit {basic-16 executable \(TV\)}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 328 {emit {x86 executable}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 329 {emit {x86 executable \(TV\)}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 330 {emit {iAPX 286 executable small model \(COFF\)}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 338 {emit {iAPX 286 executable large model \(COFF\)}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-} 332 {emit {80386 COFF executable}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-if {[N s 22 > 0x0]} {emit {- version %ld}}
-} 1078 {emit {Linux/i386 PC Screen Font data,}
-switch -- [Nv c 2] 0 {emit {256 characters, no directory,}} 1 {emit {512 characters, no directory,}} 2 {emit {256 characters, Unicode directory,}} 3 {emit {512 characters, Unicode directory,}} 
-if {[N c 3 > 0x0]} {emit 8x%d}
-} 387 {emit {ECOFF alpha}
-switch -- [Nv s 24] 263 {emit executable} 264 {emit pure} 267 {emit {demand paged}} 
-if {[N Q 8 > 0x0]} {emit {not stripped}}
-if {[N Q 8 == 0x0]} {emit stripped}
-if {[N s 23 > 0x0]} {emit {- version %ld.}}
-} 332 {emit {MS Windows COFF Intel 80386 object file}} 358 {emit {MS Windows COFF MIPS R4000 object file}} 388 {emit {MS Windows COFF Alpha object file}} 616 {emit {MS Windows COFF Motorola 68000 object file}} 496 {emit {MS Windows COFF PowerPC object file}} 656 {emit {MS Windows COFF PA-RISC object file}} 6 {emit {DBase 3 index file}} -24712 {emit TNEF} 263 {emit {PDP-11 executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 257 {emit {PDP-11 UNIX/RT ldp}} 261 {emit {PDP-11 old overlay}} 264 {emit {PDP-11 pure executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 265 {emit {PDP-11 separate I&D executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 287 {emit {PDP-11 kernel overlay}} 267 {emit {PDP-11 demand-paged pure executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-} 280 {emit {PDP-11 overlaid pure executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-} 281 {emit {PDP-11 overlaid separate executable}
-if {[N s 8 > 0x0]} {emit {not stripped}}
-} 4843 {emit {SYMMETRY i386 .o}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 8939 {emit {SYMMETRY i386 executable \(0 @ 0\)}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 13035 {emit {SYMMETRY i386 executable \(invalid @ 0\)}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 17131 {emit {SYMMETRY i386 standalone executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-if {[N i 124 > 0x0]} {emit {version %ld}}
-} 21020 {emit {SHARC COFF binary}
-if {[N s 2 > 0x1]} {emit {, %hd sections}
-if {[N i 12 > 0x0]} {emit {, not stripped}}
-}
-} 4097 {emit {LANalyzer capture file}} 4103 {emit {LANalyzer capture file}} 376 {emit {VAX COFF executable}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-if {[N s 22 > 0x0]} {emit {- version %ld}}
-} 381 {emit {VAX COFF pure executable}
-if {[N i 12 > 0x0]} {emit {not stripped}}
-if {[N s 22 > 0x0]} {emit {- version %ld}}
-} -155 {emit x.out
-if {[S 2 == __.SYMDEF]} {emit randomized}
-if {[N c 0 x {}]} {emit archive}
-} 518 {emit {Microsoft a.out}
-if {[N s 8 == 0x1]} {emit {Middle model}}
-if {[N s 30 & 0x10]} {emit overlay}
-if {[N s 30 & 0x2]} {emit separate}
-if {[N s 30 & 0x4]} {emit pure}
-if {[N s 30 & 0x800]} {emit segmented}
-if {[N s 30 & 0x400]} {emit standalone}
-if {[N s 30 & 0x8]} {emit fixed-stack}
-if {[N c 28 & 0x80]} {emit byte-swapped}
-if {[N c 28 & 0x40]} {emit word-swapped}
-if {[N i 16 > 0x0]} {emit not-stripped}
-if {[N s 30 ^ 0xc000]} {emit pre-SysV}
-if {[N s 30 & 0x4000]} {emit V2.3}
-if {[N s 30 & 0x8000]} {emit V3.0}
-if {[N c 28 & 0x4]} {emit 86}
-if {[N c 28 & 0xb]} {emit 186}
-if {[N c 28 & 0x9]} {emit 286}
-if {[N c 28 & 0xa]} {emit 386}
-if {[N c 31 < 0x40]} {emit {small model}}
-switch -- [Nv c 31] 72 {emit {large model	}} 73 {emit {huge model}} 
-if {[N s 30 & 0x1]} {emit executable}
-if {[N s 30 ^ 0x1]} {emit {object file}}
-if {[N s 30 & 0x40]} {emit {Large Text}}
-if {[N s 30 & 0x20]} {emit {Large Data}}
-if {[N s 30 & 0x120]} {emit {Huge Objects Enabled}}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 320 {emit {old Microsoft 8086 x.out}
-if {[N c 3 & 0x4]} {emit separate}
-if {[N c 3 & 0x2]} {emit pure}
-if {[N c 0 & 0x1]} {emit executable}
-if {[N c 0 ^ 0x1]} {emit relocatable}
-if {[N i 20 > 0x0]} {emit {not stripped}}
-} 1408 {emit {XENIX 8086 relocatable or 80286 small model}} 
-switch -- [Nv Y 0] 381 {emit {CLIPPER COFF executable \(VAX \#\)}
-switch -- [Nv Y 20] 263 {emit {\(impure\)}} 264 {emit {\(5.2 compatible\)}} 265 {emit {\(pure\)}} 267 {emit {\(demand paged\)}} 291 {emit {\(target shared library\)}} 
-if {[N Q 12 > 0x0]} {emit {not stripped}}
-if {[N Y 22 > 0x0]} {emit {- version %ld}}
-} 383 {emit {CLIPPER COFF executable}
-switch -- [Nv Y 18 &074000] 0 {emit {C1 R1}} 2048 {emit {C2 R1}} 4096 {emit {C3 R1}} 30720 {emit TEST} 
-switch -- [Nv Y 20] 263 {emit {\(impure\)}} 264 {emit {\(pure\)}} 265 {emit {\(separate I&D\)}} 267 {emit {\(paged\)}} 291 {emit {\(target shared library\)}} 
-if {[N Q 12 > 0x0]} {emit {not stripped}}
-if {[N Y 22 > 0x0]} {emit {- version %ld}}
-if {[N Q 48 == 0x1 &01]} {emit {alignment trap enabled}}
-switch -- [Nv c 52] 1 {emit -Ctnc} 2 {emit -Ctsw} 3 {emit -Ctpw} 4 {emit -Ctcb} 
-switch -- [Nv c 53] 1 {emit -Cdnc} 2 {emit -Cdsw} 3 {emit -Cdpw} 4 {emit -Cdcb} 
-switch -- [Nv c 54] 1 {emit -Csnc} 2 {emit -Cssw} 3 {emit -Cspw} 4 {emit -Cscb} 
-} 272 {emit {0420 Alliant virtual executable}
-if {[N Y 2 & 0x20]} {emit {common library}}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} 273 {emit {0421 Alliant compact executable}
-if {[N Y 2 & 0x20]} {emit {common library}}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} 29127 {emit {cpio archive}} -14479 {emit {byte-swapped cpio archive}} -147 {emit {very old PDP-11 archive}} -155 {emit {old PDP-11 archive}} 1793 {emit {VAX-order 68K Blit \(standalone\) executable}} 262 {emit {VAX-order2 68k Blit mpx/mux executable}} 1537 {emit {VAX-order 68k Blit mpx/mux executable}} 7967 {emit {old packed data}} 8191 {emit {compacted data}} -13563 {emit {huf output}} 1281 {emit {locale data table}
-switch -- [Nv Y 6] 36 {emit {for MIPS}} 64 {emit {for Alpha}} 
-} 340 {emit Encore
-switch -- [Nv Y 20] 263 {emit executable} 264 {emit {pure executable}} 267 {emit {demand-paged executable}} 271 {emit {unsupported executable}} 
-if {[N Q 12 > 0x0]} {emit {not stripped}}
-if {[N Y 22 > 0x0]} {emit {- version %ld}}
-if {[N Y 22 == 0x0]} {emit -}
-} 341 {emit {Encore unsupported executable}
-if {[N Q 12 > 0x0]} {emit {not stripped}}
-if {[N Y 22 > 0x0]} {emit {- version %ld}}
-if {[N Y 22 == 0x0]} {emit -}
-} 286 {emit {Berkeley vfont data}} 7681 {emit {byte-swapped Berkeley vfont data}} 256 {emit {raw G3 data, byte-padded}} 5120 {emit {raw G3 data}} 373 {emit {i386 COFF object}} 10775 {emit {\"compact bitmap\" format \(Poskanzer\)}} 601 {emit {mumps avl global}
-if {[N c 2 > 0x0]} {emit {\(V%d\)}}
-if {[N c 6 > 0x0]} {emit {with %d byte name}}
-if {[N c 7 > 0x0]} {emit {and %d byte data cells}}
-} 602 {emit {mumps blt global}
-if {[N c 2 > 0x0]} {emit {\(V%d\)}}
-if {[N Y 8 > 0x0]} {emit {- %d byte blocks}}
-switch -- [Nv c 15] 0 {emit {- P/D format}} 1 {emit {- P/K/D format}} 2 {emit {- K/D format}} 
-if {[N c 15 > 0x2]} {emit {- Bad Flags}}
-} 10012 {emit {Sendmail frozen configuration}
-if {[S 16 x {}]} {emit {- version %s}}
-} -16162 {emit {Compiled PSI \(v1\) data}} -16166 {emit {Compiled PSI \(v2\) data}
-if {[S 3 x {}]} {emit {\(%s\)}}
-} -21846 {emit {SoftQuad DESC or font file binary}
-if {[N Y 2 > 0x0]} {emit {- version %d}}
-} 283 {emit {Curses screen image}} 284 {emit {Curses screen image}} 263 {emit {unknown machine executable}
-if {[N Y 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 264 {emit {unknown pure executable}
-if {[N Y 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 265 {emit {PDP-11 separate I&D}
-if {[N Y 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 267 {emit {unknown pure executable}
-if {[N Y 8 > 0x0]} {emit {not stripped}}
-if {[N c 15 > 0x0]} {emit {- version %ld}}
-} 392 {emit {Perkin-Elmer executable}} 21845 {emit {VISX image file}
-switch -- [Nv c 2] 0 {emit {\(zero\)}} 1 {emit {\(unsigned char\)}} 2 {emit {\(short integer\)}} 3 {emit {\(float 32\)}} 4 {emit {\(float 64\)}} 5 {emit {\(signed char\)}} 6 {emit {\(bit-plane\)}} 7 {emit {\(classes\)}} 8 {emit {\(statistics\)}} 10 {emit {\(ascii text\)}} 15 {emit {\(image segments\)}} 100 {emit {\(image set\)}} 101 {emit {\(unsigned char vector\)}} 102 {emit {\(short integer vector\)}} 103 {emit {\(float 32 vector\)}} 104 {emit {\(float 64 vector\)}} 105 {emit {\(signed char vector\)}} 106 {emit {\(bit plane vector\)}} 121 {emit {\(feature vector\)}} 122 {emit {\(feature vector library\)}} 124 {emit {\(chain code\)}} 126 {emit {\(bit vector\)}} -126 {emit {\(graph\)}} -125 {emit {\(adjacency graph\)}} -124 {emit {\(adjacency graph library\)}} 
-if {[S 2 == .VISIX]} {emit {\(ascii text\)}}
-} 
-if {[S 4 == pipe]} {emit {CLIPPER instruction trace}}
-if {[S 4 == prof]} {emit {CLIPPER instruction profile}}
-switch -- [Nv I 0] 1936484385 {emit {Allegro datafile \(packed\)}} 1936484398 {emit {Allegro datafile \(not packed/autodetect\)}} 1936484395 {emit {Allegro datafile \(appended exe data\)}} 1018 {emit {AmigaOS shared library}} 1011 {emit {AmigaOS loadseg\(\)ble executable/binary}} 999 {emit {AmigaOS object/library data}} -2147479551 {emit {AmigaOS outline tag}} 1 {emit {JVT NAL sequence}
-if {[N c 4 == 0x7 &0x1F]} {emit {\b, H.264 video}
-switch -- [Nv c 5] 66 {emit {\b, baseline}} 77 {emit {\b, main}} 88 {emit {\b, extended}} 
-if {[N c 7 x {}]} {emit {\b @ L %u}}
-}
-} 807842421 {emit {Microsoft ASF}} 333312 {emit {AppleSingle encoded Macintosh file}} 333319 {emit {AppleDouble encoded Macintosh file}} 1711210496 {emit {VAX 3.0 archive}} 1013019198 {emit {VAX 5.0 archive}} 1314148939 {emit {MultiTrack sound data}
-if {[N I 4 x {}]} {emit {- version %ld}}
-} 779248125 {emit {RealAudio sound file}} 1688404224 {emit {IRCAM file \(VAX\)}} 1688404480 {emit {IRCAM file \(Sun\)}} 1688404736 {emit {IRCAM file \(MIPS little-endian\)}} 1688404992 {emit {IRCAM file \(NeXT\)}} 1125466468 {emit {X64 Image}} -12432129 {emit {WRAptor packer \(c64\)}} 554074152 {emit {Sega Dreamcast VMU game image}} 931151890 {emit {V64 Nintendo 64 ROM dump}} 327 {emit {Convex old-style object}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 331 {emit {Convex old-style demand paged executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 333 {emit {Convex old-style pre-paged executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 335 {emit {Convex old-style pre-paged, non-swapped executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 70231 {emit {Core file}} 385 {emit {Convex SOFF}
-if {[N I 88 == 0x0 &0x000f0000]} {emit c1}
-if {[N I 88 & 0x10000]} {emit c2}
-if {[N I 88 & 0x20000]} {emit c2mp}
-if {[N I 88 & 0x40000]} {emit parallel}
-if {[N I 88 & 0x80000]} {emit intrinsic}
-if {[N I 88 & 0x1]} {emit {demand paged}}
-if {[N I 88 & 0x2]} {emit pre-paged}
-if {[N I 88 & 0x4]} {emit non-swapped}
-if {[N I 88 & 0x8]} {emit POSIX}
-if {[N I 84 & 0x80000000]} {emit executable}
-if {[N I 84 & 0x40000000]} {emit object}
-if {[N I 84 == 0x0 &0x20000000]} {emit {not stripped}}
-switch -- [Nv I 84 &0x18000000] 0 {emit {native fpmode}} 268435456 {emit {ieee fpmode}} 402653184 {emit {undefined fpmode}} 
-} 389 {emit {Convex SOFF core}} 391 {emit {Convex SOFF checkpoint}
-if {[N I 88 == 0x0 &0x000f0000]} {emit c1}
-if {[N I 88 & 0x10000]} {emit c2}
-if {[N I 88 & 0x20000]} {emit c2mp}
-if {[N I 88 & 0x40000]} {emit parallel}
-if {[N I 88 & 0x80000]} {emit intrinsic}
-if {[N I 88 & 0x8]} {emit POSIX}
-switch -- [Nv I 84 &0x18000000] 0 {emit {native fpmode}} 268435456 {emit {ieee fpmode}} 402653184 {emit {undefined fpmode}} 
-} 324508366 {emit {GNU dbm 1.x or ndbm database, big endian}} 398689 {emit {Berkeley DB}
-switch -- [Nv I 8] 4321 {emit {}
-if {[N I 4 > 0x2]} {emit 1.86}
-if {[N I 4 < 0x3]} {emit 1.85}
-if {[N I 4 > 0x0]} {emit {\(Hash, version %d, big-endian\)}}
-} 1234 {emit {}
-if {[N I 4 > 0x2]} {emit 1.86}
-if {[N I 4 < 0x3]} {emit 1.85}
-if {[N I 4 > 0x0]} {emit {\(Hash, version %d, native byte-order\)}}
-} 
-} 340322 {emit {Berkeley DB 1.85/1.86}
-if {[N I 4 > 0x0]} {emit {\(Btree, version %d, big-endian\)}}
-} 9994 {emit {ESRI Shapefile}
-if {[N I 4 == 0x0]} {emit 16 34 0}
-if {[N I 8 == 0x0]} {emit 16 34 1}
-if {[N I 12 == 0x0]} {emit 16 34 2}
-if {[N I 16 == 0x0]} {emit 16 34 3}
-if {[N I 20 == 0x0]} {emit 16 34 4}
-if {[N i 28 x {}]} {emit {version %d}}
-if {[N I 24 x {}]} {emit {length %d}}
-switch -- [Nv i 32] 0 {emit {type Null Shape}} 1 {emit {type Point}} 3 {emit {type PolyLine}} 5 {emit {type Polygon}} 8 {emit {type MultiPoint}} 11 {emit {type PointZ}} 13 {emit {type PolyLineZ}} 15 {emit {type PolygonZ}} 18 {emit {type MultiPointZ}} 21 {emit {type PointM}} 23 {emit {type PolyLineM}} 25 {emit {type PolygonM}} 28 {emit {type MultiPointM}} 31 {emit {type MultiPatch}} 
-} 199600449 {emit {SGI disk label \(volume header\)}} 1481003842 {emit {SGI XFS filesystem data}
-if {[N I 4 x {}]} {emit {\(blksz %d,}}
-if {[N S 104 x {}]} {emit {inosz %d,}}
-if {[N S 100 ^ 0x2004]} {emit {v1 dirs\)}}
-if {[N S 100 & 0x2004]} {emit {v2 dirs\)}}
-} 684539205 {emit {Linux Compressed ROM File System data, big endian}
-if {[N I 4 x {}]} {emit {size %d}}
-if {[N I 8 & 0x1]} {emit {version \#2}}
-if {[N I 8 & 0x2]} {emit sorted_dirs}
-if {[N I 8 & 0x4]} {emit hole_support}
-if {[N I 32 x {}]} {emit {CRC 0x%x,}}
-if {[N I 36 x {}]} {emit {edition %d,}}
-if {[N I 40 x {}]} {emit {%d blocks,}}
-if {[N I 44 x {}]} {emit {%d files}}
-} 876099889 {emit {Linux Journalled Flash File system, big endian}} 654645590 {emit {PPCBoot image}
-if {[S 4 == PPCBoot]} {if {[S 12 x {}]} {emit {version %s}}
-}
-} 4 {emit {X11 SNF font data, MSB first}} 335698201 {emit {libGrx font data,}
-if {[N s 8 x {}]} {emit %dx}
-if {[N s 10 x {}]} {emit {\b%d}}
-if {[S 40 x {}]} {emit %s}
-} -12169394 {emit {DOS code page font data collection}} 1279543401 {emit {ld.so hints file \(Big Endian}
-if {[N I 4 > 0x0]} {emit {\b, version %d\)}}
-if {[N I 4 <= 0x0]} {emit {\b\)}}
-} -951729837 {emit GEOS
-switch -- [Nv c 40] 1 {emit executable} 2 {emit VMFile} 3 {emit binary} 4 {emit {directory label}} 
-if {[N c 40 < 0x1]} {emit unknown}
-if {[N c 40 > 0x4]} {emit unknown}
-if {[S 4 x {}]} {emit {\b, name \"%s\"}}
-} 235082497 {emit {Hierarchical Data Format \(version 4\) data}} 34603270 {emit {PA-RISC1.1 relocatable object}} 34603271 {emit {PA-RISC1.1 executable}
-if {[N I 168 & 0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34603272 {emit {PA-RISC1.1 shared executable}
-if {[N I 168 == 0x4 &0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34603275 {emit {PA-RISC1.1 demand-load executable}
-if {[N I 168 == 0x4 &0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34603278 {emit {PA-RISC1.1 shared library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34603277 {emit {PA-RISC1.1 dynamic load library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34865414 {emit {PA-RISC2.0 relocatable object}} 34865415 {emit {PA-RISC2.0 executable}
-if {[N I 168 & 0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34865416 {emit {PA-RISC2.0 shared executable}
-if {[N I 168 & 0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34865419 {emit {PA-RISC2.0 demand-load executable}
-if {[N I 168 & 0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34865422 {emit {PA-RISC2.0 shared library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34865421 {emit {PA-RISC2.0 dynamic load library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34275590 {emit {PA-RISC1.0 relocatable object}} 34275591 {emit {PA-RISC1.0 executable}
-if {[N I 168 == 0x4 &0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34275592 {emit {PA-RISC1.0 shared executable}
-if {[N I 168 == 0x4 &0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34275595 {emit {PA-RISC1.0 demand-load executable}
-if {[N I 168 == 0x4 &0x4]} {emit {dynamically linked}}
-if {[N I [I 144 Q 0] == 0x54ef630]} {emit {dynamically linked}}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34275598 {emit {PA-RISC1.0 shared library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 34275597 {emit {PA-RISC1.0 dynamic load library}
-if {[N I 96 > 0x0]} {emit {- not stripped}}
-} 557605234 {emit {archive file}
-switch -- [Nv I 68] 34276889 {emit {- PA-RISC1.0 relocatable library}} 34604569 {emit {- PA-RISC1.1 relocatable library}} 34670105 {emit {- PA-RISC1.2 relocatable library}} 34866713 {emit {- PA-RISC2.0 relocatable library}} 
-} 34341128 {emit {HP s200 pure executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N I 8 & 0x80000000]} {emit {save fp regs}}
-if {[N I 8 & 0x40000000]} {emit {dynamically linked}}
-if {[N I 8 & 0x20000000]} {emit debuggable}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34341127 {emit {HP s200 executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N I 8 & 0x80000000]} {emit {save fp regs}}
-if {[N I 8 & 0x40000000]} {emit {dynamically linked}}
-if {[N I 8 & 0x20000000]} {emit debuggable}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34341131 {emit {HP s200 demand-load executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N I 8 & 0x80000000]} {emit {save fp regs}}
-if {[N I 8 & 0x40000000]} {emit {dynamically linked}}
-if {[N I 8 & 0x20000000]} {emit debuggable}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34341126 {emit {HP s200 relocatable executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N S 6 > 0x0]} {emit {- highwater %d}}
-if {[N I 8 & 0x80000000]} {emit {save fp regs}}
-if {[N I 8 & 0x20000000]} {emit debuggable}
-if {[N I 8 & 0x10000000]} {emit PIC}
-} 34210056 {emit {HP s200 \(2.x release\) pure executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34210055 {emit {HP s200 \(2.x release\) executable}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34341134 {emit {HP s200 shared library}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N S 6 > 0x0]} {emit {- highwater %d}}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 34341133 {emit {HP s200 dynamic load library}
-if {[N S 4 > 0x0]} {emit {- version %ld}}
-if {[N S 6 > 0x0]} {emit {- highwater %d}}
-if {[N I 36 > 0x0]} {emit {not stripped}}
-} 505 {emit {AIX compiled message catalog}} 1504078485 {emit {Sun raster image data}
-if {[N I 4 > 0x0]} {emit {\b, %d x}}
-if {[N I 8 > 0x0]} {emit %d,}
-if {[N I 12 > 0x0]} {emit %d-bit,}
-switch -- [Nv I 20] 0 {emit {old format,}} 2 {emit compressed,} 3 {emit RGB,} 4 {emit TIFF,} 5 {emit IFF,} 65535 {emit {reserved for testing,}} 
-switch -- [Nv I 24] 0 {emit {no colormap}} 1 {emit {RGB colormap}} 2 {emit {raw colormap}} 
-} 65544 {emit {GEM Image data}
-if {[N S 12 x {}]} {emit {%d x}}
-if {[N S 14 x {}]} {emit %d,}
-if {[N S 4 x {}]} {emit {%d planes,}}
-if {[N S 8 x {}]} {emit {%d x}}
-if {[N S 10 x {}]} {emit {%d pixelsize}}
-} 235082497 {emit {Hierarchical Data Format \(version 4\) data}} -889275714 {emit {compiled Java class data,}
-if {[N S 6 x {}]} {emit {version %d.}}
-if {[N S 4 x {}]} {emit {\b%d}}
-} -1195374706 {emit {Linux kernel}
-if {[S 483 == Loading]} {emit {version 1.3.79 or older}}
-if {[S 489 == Loading]} {emit {from prehistoric times}}
-} 1330597709 {emit {User-mode Linux COW file}
-if {[N I 4 x {}]} {emit {\b, version %d}}
-if {[S 8 x {}]} {emit {\b, backing file %s}}
-} -1195374706 {emit Linux
-if {[N I 486 == 0x454c4b53]} {emit {ELKS Kernel}}
-if {[N I 486 != 0x454c4b53]} {emit {style boot sector}}
-} -889275714 {emit {Mach-O fat file}
-if {[N I 4 == 0x1]} {emit {with 1 architecture}}
-if {[N I 4 > 0x1]} {if {[N I 4 x {}]} {emit {with %ld architectures		}}
-}
-} -17958194 {emit Mach-O
-switch -- [Nv I 12] 1 {emit object} 2 {emit executable} 3 {emit {shared library}} 4 {emit core} 5 {emit {preload executable}} 6 {emit {dynamically linked shared library}} 7 {emit {dynamic linker}} 8 {emit bundle} 
-if {[N I 12 > 0x8]} {if {[N I 12 x {}]} {emit filetype=%ld}
-}
-if {[N I 4 < 0x0]} {if {[N I 4 x {}]} {emit architecture=%ld}
-}
-switch -- [Nv I 4] 1 {emit vax} 2 {emit romp} 3 {emit architecture=3} 4 {emit ns32032} 5 {emit ns32332} 6 {emit {for m68k architecture}
-switch -- [Nv I 8] 2 {emit {\(mc68040\)}} 3 {emit {\(mc68030 only\)}} 
-} 7 {emit i386} 8 {emit mips} 9 {emit ns32532} 10 {emit architecture=10} 11 {emit {hp pa-risc}} 12 {emit acorn} 13 {emit m88k} 14 {emit sparc} 15 {emit i860-big} 16 {emit i860} 17 {emit rs6000} 18 {emit ppc} 
-if {[N I 4 > 0x12]} {if {[N I 4 x {}]} {emit architecture=%ld}
-}
-} -249691108 {emit {magic binary file for file\(1\) cmd}
-if {[N I 4 x {}]} {emit {\(version %d\) \(big endian\)}}
-} 440786851 {emit {}
-if {[N S 5 == 0x4282]} {if {[S 8 == matroska]} {emit {Matroska data}}
-}
-} 263 {emit {old SGI 68020 executable}} 264 {emit {old SGI 68020 pure executable}} 1396917837 {emit {IRIS Showcase file}
-if {[N c 4 x {}]} {emit {- version %ld}}
-} 1413695053 {emit {IRIS Showcase template}
-if {[N c 4 x {}]} {emit {- version %ld}}
-} -559039810 {emit {IRIX Parallel Arena}
-if {[N I 8 > 0x0]} {emit {- version %ld}}
-} -559043152 {emit {IRIX core dump}
-if {[N I 4 == 0x1]} {emit of}
-if {[S 16 x {}]} {emit '%s'}
-} -559043264 {emit {IRIX 64-bit core dump}
-if {[N I 4 == 0x1]} {emit of}
-if {[S 16 x {}]} {emit '%s'}
-} -1161903941 {emit {IRIX N32 core dump}
-if {[N I 4 == 0x1]} {emit of}
-if {[S 16 x {}]} {emit '%s'}
-} 834535424 {emit {Microsoft Word Document}} 6656 {emit {Lotus 1-2-3}
-switch -- [Nv I 4] 1049600 {emit {wk3 document data}} 34604032 {emit {wk4 document data}} 125829376 {emit {fm3 or fmb document data}} 125829120 {emit {fm3 or fmb document data}} 
-} 512 {emit {Lotus 1-2-3}
-switch -- [Nv I 4] 100926976 {emit {wk1 document data}} 109052416 {emit {fmt document data}} 
-} -976170042 {emit {DOS EPS Binary File}
-if {[N Q 4 > 0x0]} {emit {Postscript starts at byte %d}
-if {[N Q 8 > 0x0]} {emit {length %d}
-if {[N Q 12 > 0x0]} {emit {Metafile starts at byte %d}
-if {[N Q 16 > 0x0]} {emit {length %d}}
-}
-if {[N Q 20 > 0x0]} {emit {TIFF starts at byte %d}
-if {[N Q 24 > 0x0]} {emit {length %d}}
-}
-}
-}
-} 263 {emit {a.out NetBSD big-endian object file}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 326773060 {emit {NeWS bitmap font}} 326773063 {emit {NeWS font family}} 326773072 {emit {scalable OpenFont binary}} 326773073 {emit {encrypted scalable OpenFont binary}} 263 {emit {Plan 9 executable, Motorola 68k}} 491 {emit {Plan 9 executable, Intel 386}} 583 {emit {Plan 9 executable, Intel 960}} 683 {emit {Plan 9 executable, SPARC}} 1031 {emit {Plan 9 executable, MIPS R3000}} 1163 {emit {Plan 9 executable, AT&T DSP 3210}} 1303 {emit {Plan 9 executable, MIPS R4000 BE}} 1451 {emit {Plan 9 executable, AMD 29000}} 1607 {emit {Plan 9 executable, ARM 7-something}} 1771 {emit {Plan 9 executable, PowerPC}} 1943 {emit {Plan 9 executable, MIPS R4000 LE}} 2123 {emit {Plan 9 executable, DEC Alpha}} -976170042 {emit {DOS EPS Binary File}
-if {[N Q 4 > 0x0]} {emit {Postscript starts at byte %d}
-if {[N Q 8 > 0x0]} {emit {length %d}
-if {[N Q 12 > 0x0]} {emit {Metafile starts at byte %d}
-if {[N Q 16 > 0x0]} {emit {length %d}}
-}
-if {[N Q 20 > 0x0]} {emit {TIFF starts at byte %d}
-if {[N Q 24 > 0x0]} {emit {length %d}}
-}
-}
-}
-} 518517022 {emit {Pulsar POP3 daemon mailbox cache file.}
-if {[N I 4 x {}]} {emit {Version: %d.}}
-if {[N I 8 x {}]} {emit {\b%d}}
-} -1722938102 {emit {python 1.5/1.6 byte-compiled}} -2017063670 {emit {python 2.0 byte-compiled}} 720047370 {emit {python 2.1 byte-compiled}} 770510090 {emit {python 2.2 byte-compiled}} 1005718794 {emit {python 2.3 byte-compiled}} 1257963521 {emit {QL plugin-ROM data,}
-if {[S 9 == {\0} p]} {emit un-named}
-if {[S 9 x {} p]} {emit {named: %s}}
-} -1582119980 {emit {tcpdump capture file \(big-endian\)}
-if {[N S 4 x {}]} {emit {- version %d}}
-if {[N S 6 x {}]} {emit {\b.%d}}
-switch -- [Nv I 20] 0 {emit {\(No link-layer encapsulation}} 1 {emit {\(Ethernet}} 2 {emit {\(3Mb Ethernet}} 3 {emit {\(AX.25}} 4 {emit {\(ProNET}} 5 {emit {\(CHAOS}} 6 {emit {\(Token Ring}} 7 {emit {\(BSD ARCNET}} 8 {emit {\(SLIP}} 9 {emit {\(PPP}} 10 {emit {\(FDDI}} 11 {emit {\(RFC 1483 ATM}} 12 {emit {\(raw IP}} 13 {emit {\(BSD/OS SLIP}} 14 {emit {\(BSD/OS PPP}} 19 {emit {\(Linux ATM Classical IP}} 50 {emit {\(PPP or Cisco HDLC}} 51 {emit {\(PPP-over-Ethernet}} 99 {emit {\(Symantec Enterprise Firewall}} 100 {emit {\(RFC 1483 ATM}} 101 {emit {\(raw IP}} 102 {emit {\(BSD/OS SLIP}} 103 {emit {\(BSD/OS PPP}} 104 {emit {\(BSD/OS Cisco HDLC}} 105 {emit {\(802.11}} 106 {emit {\(Linux Classical IP over ATM}} 107 {emit {\(Frame Relay}} 108 {emit {\(OpenBSD loopback}} 109 {emit {\(OpenBSD IPsec encrypted}} 112 {emit {\(Cisco HDLC}} 113 {emit {\(Linux \"cooked\"}} 114 {emit {\(LocalTalk}} 117 {emit {\(OpenBSD PFLOG}} 119 {emit {\(802.11 with Prism header}} 122 {emit {\(RFC 2625 IP over Fibre Channel}} 123 {emit {\(SunATM}} 127 {emit {\(802.11 with radiotap header}} 129 {emit {\(Linux ARCNET}} 138 {emit {\(Apple IP over IEEE 1394}} 140 {emit {\(MTP2}} 141 {emit {\(MTP3}} 143 {emit {\(DOCSIS}} 144 {emit {\(IrDA}} 147 {emit {\(Private use 0}} 148 {emit {\(Private use 1}} 149 {emit {\(Private use 2}} 150 {emit {\(Private use 3}} 151 {emit {\(Private use 4}} 152 {emit {\(Private use 5}} 153 {emit {\(Private use 6}} 154 {emit {\(Private use 7}} 155 {emit {\(Private use 8}} 156 {emit {\(Private use 9}} 157 {emit {\(Private use 10}} 158 {emit {\(Private use 11}} 159 {emit {\(Private use 12}} 160 {emit {\(Private use 13}} 161 {emit {\(Private use 14}} 162 {emit {\(Private use 15}} 163 {emit {\(802.11 with AVS header}} 
-if {[N I 16 x {}]} {emit {\b, capture length %d\)}}
-} -1582117580 {emit {extended tcpdump capture file \(big-endian\)}
-if {[N S 4 x {}]} {emit {- version %d}}
-if {[N S 6 x {}]} {emit {\b.%d}}
-switch -- [Nv I 20] 0 {emit {\(No link-layer encapsulation}} 1 {emit {\(Ethernet}} 2 {emit {\(3Mb Ethernet}} 3 {emit {\(AX.25}} 4 {emit {\(ProNET}} 5 {emit {\(CHAOS}} 6 {emit {\(Token Ring}} 7 {emit {\(ARCNET}} 8 {emit {\(SLIP}} 9 {emit {\(PPP}} 10 {emit {\(FDDI}} 11 {emit {\(RFC 1483 ATM}} 12 {emit {\(raw IP}} 13 {emit {\(BSD/OS SLIP}} 14 {emit {\(BSD/OS PPP}} 
-if {[N I 16 x {}]} {emit {\b, capture length %d\)}}
-} 263 {emit {old sun-2 executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 264 {emit {old sun-2 pure executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 267 {emit {old sun-2 demand paged executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 525398 {emit {SunOS core file}
-switch -- [Nv I 4] 432 {emit {\(SPARC\)}
-if {[S 132 x {}]} {emit {from '%s'}}
-switch -- [Nv I 116] 3 {emit {\(quit\)}} 4 {emit {\(illegal instruction\)}} 5 {emit {\(trace trap\)}} 6 {emit {\(abort\)}} 7 {emit {\(emulator trap\)}} 8 {emit {\(arithmetic exception\)}} 9 {emit {\(kill\)}} 10 {emit {\(bus error\)}} 11 {emit {\(segmentation violation\)}} 12 {emit {\(bad argument to system call\)}} 29 {emit {\(resource lost\)}} 
-if {[N I 120 x {}]} {emit {\(T=%dK,}}
-if {[N I 124 x {}]} {emit D=%dK,}
-if {[N I 128 x {}]} {emit {S=%dK\)}}
-} 826 {emit {\(68K\)}
-if {[S 128 x {}]} {emit {from '%s'}}
-} 456 {emit {\(SPARC 4.x BCP\)}
-if {[S 152 x {}]} {emit {from '%s'}}
-} 
-} 50331648 {emit {VMS Alpha executable}
-if {[S 75264 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12 w/decryption}}
-} 1297241678 {emit {VMware nvram}} 1129273156 {emit VMware
-switch -- [Nv c 4] 3 {emit {virtual disk}
-if {[N i 32 x {}]} {emit {\(%d/}}
-if {[N i 36 x {}]} {emit {\b%d/}}
-if {[N i 40 x {}]} {emit {\b%d\)}}
-} 2 {emit {undoable disk}
-if {[S 32 x {}]} {emit {\(%s\)}}
-} 
-} 
-if {[S 0 == {Core\001}]} {emit {Alpha COFF format core dump \(Digital UNIX\)}
-if {[S 24 x {}]} {emit {\b, from '%s'}}
-}
-if {[S 0 == {Core\002}]} {emit {Alpha COFF format core dump \(Digital UNIX\)}
-if {[S 24 x {}]} {emit {\b, from '%s'}}
-}
-if {[S 0 == {AMANDA:\ }]} {emit AMANDA
-if {[S 8 == {TAPESTART\ DATE}]} {emit {tape header file,}
-if {[S 23 == X]} {if {[S 25 > {\ }]} {emit {Unused %s}}
-}
-if {[S 23 > {\ }]} {emit {DATE %s}}
-}
-if {[S 8 == {FILE\ }]} {emit {dump file,}
-if {[S 13 > {\ }]} {emit {DATE %s}}
-}
-}
-if {[S 0 == FC14]} {emit {Future Composer 1.4 Module sound file}}
-if {[S 0 == SMOD]} {emit {Future Composer 1.3 Module sound file}}
-if {[S 0 == AON4artofnoise]} {emit {Art Of Noise Module sound file}}
-if {[S 1 == MUGICIAN/SOFTEYES]} {emit {Mugician Module sound file}}
-if {[S 58 == {SIDMON\ II\ -\ THE}]} {emit {Sidmon 2.0 Module sound file}}
-if {[S 0 == Synth4.0]} {emit {Synthesis Module sound file}}
-if {[S 0 == ARP.]} {emit {The Holy Noise Module sound file}}
-if {[S 0 == {BeEp\0}]} {emit {JamCracker Module sound file}}
-if {[S 0 == {COSO\0}]} {emit {Hippel-COSO Module sound file}}
-if {[S 0 == {\#\#\ version}]} {emit {catalog translation}}
-if {[S 0 == RDSK]} {emit {Rigid Disk Block}
-if {[S 160 x {}]} {emit {on %.24s}}
-}
-if {[S 0 == {DOS\0}]} {emit {Amiga DOS disk}}
-if {[S 0 == {DOS\1}]} {emit {Amiga FFS disk}}
-if {[S 0 == {DOS\2}]} {emit {Amiga Inter DOS disk}}
-if {[S 0 == {DOS\3}]} {emit {Amiga Inter FFS disk}}
-if {[S 0 == {DOS\4}]} {emit {Amiga Fastdir DOS disk}}
-if {[S 0 == {DOS\5}]} {emit {Amiga Fastdir FFS disk}}
-if {[S 0 == KICK]} {emit {Kickstart disk}}
-if {[S 0 == MOVI]} {emit {Silicon Graphics movie file}}
-if {[S 4 == moov]} {emit {Apple QuickTime}
-if {[S 12 == mvhd]} {emit {\b movie \(fast start\)}}
-if {[S 12 == mdra]} {emit {\b URL}}
-if {[S 12 == cmov]} {emit {\b movie \(fast start, compressed header\)}}
-if {[S 12 == rmra]} {emit {\b multiple URLs}}
-}
-if {[S 4 == mdat]} {emit {Apple QuickTime movie \(unoptimized\)}}
-if {[S 4 == wide]} {emit {Apple QuickTime movie \(unoptimized\)}}
-if {[S 4 == skip]} {emit {Apple QuickTime movie \(modified\)}}
-if {[S 4 == free]} {emit {Apple QuickTime movie \(modified\)}}
-if {[S 4 == idsc]} {emit {Apple QuickTime image \(fast start\)}}
-if {[S 4 == idat]} {emit {Apple QuickTime image \(unoptimized\)}}
-if {[S 4 == pckg]} {emit {Apple QuickTime compressed archive}}
-if {[S 4 == jP B]} {emit {JPEG 2000 image}}
-if {[S 4 == ftyp]} {emit {ISO Media}
-if {[S 8 == isom]} {emit {\b, MPEG v4 system, version 1}}
-if {[S 8 == iso2]} {emit {\b, MPEG v4 system, part 12 revision}}
-if {[S 8 == mp41]} {emit {\b, MPEG v4 system, version 1}}
-if {[S 8 == mp42]} {emit {\b, MPEG v4 system, version 2}}
-if {[S 8 == mp7t]} {emit {\b, MPEG v4 system, MPEG v7 XML}}
-if {[S 8 == mp7b]} {emit {\b, MPEG v4 system, MPEG v7 binary XML}}
-if {[S 8 == jp2 B]} {emit {\b, JPEG 2000}}
-if {[S 8 == 3gp]} {emit {\b, MPEG v4 system, 3GPP}
-switch -- [Nv c 11] 4 {emit {\b v4 \(H.263/AMR GSM 6.10\)}} 5 {emit {\b v5 \(H.263/AMR GSM 6.10\)}} 6 {emit {\b v6 \(ITU H.264/AMR GSM 6.10\)}} 
-}
-if {[S 8 == mmp4]} {emit {\b, MPEG v4 system, 3GPP Mobile}}
-if {[S 8 == avc1]} {emit {\b, MPEG v4 system, 3GPP JVT AVC}}
-if {[S 8 == M4A B]} {emit {\b, MPEG v4 system, iTunes AAC-LC}}
-if {[S 8 == M4P B]} {emit {\b, MPEG v4 system, iTunes AES encrypted}}
-if {[S 8 == M4B B]} {emit {\b, MPEG v4 system, iTunes bookmarked}}
-if {[S 8 == qt B]} {emit {\b, Apple QuickTime movie}}
-}
-if {[N I 0 == 0x100 &0xFFFFFF00]} {emit {MPEG sequence}
-switch -- [Nv c 3] -70 {emit {}
-if {[N c 4 & 0x40]} {emit {\b, v2, program multiplex}}
-if {[N c 4 ^ 0x40]} {emit {\b, v1, system multiplex}}
-} -69 {emit {\b, v1/2, multiplex \(missing pack header\)}} -80 {emit {\b, v4}
-if {[N I 5 == 0x1b5]} {if {[N c 9 & 0x80]} {switch -- [Nv c 10 &0xF0] 16 {emit {\b, video}} 32 {emit {\b, still texture}} 48 {emit {\b, mesh}} 64 {emit {\b, face}} 
-}
-switch -- [Nv c 9 &0xF8] 8 {emit {\b, video}} 16 {emit {\b, still texture}} 24 {emit {\b, mesh}} 32 {emit {\b, face}} 
-}
-switch -- [Nv c 4] 1 {emit {\b, simple @ L1}} 2 {emit {\b, simple @ L2}} 3 {emit {\b, simple @ L3}} 4 {emit {\b, simple @ L0}} 17 {emit {\b, simple scalable @ L1}} 18 {emit {\b, simple scalable @ L2}} 33 {emit {\b, core @ L1}} 34 {emit {\b, core @ L2}} 50 {emit {\b, main @ L2}} 51 {emit {\b, main @ L3}} 53 {emit {\b, main @ L4}} 66 {emit {\b, n-bit @ L2}} 81 {emit {\b, scalable texture @ L1}} 97 {emit {\b, simple face animation @ L1}} 98 {emit {\b, simple face animation @ L2}} 99 {emit {\b, simple face basic animation @ L1}} 100 {emit {\b, simple face basic animation @ L2}} 113 {emit {\b, basic animation text @ L1}} 114 {emit {\b, basic animation text @ L2}} -127 {emit {\b, hybrid @ L1}} -126 {emit {\b, hybrid @ L2}} -111 {emit {\b, advanced RT simple @ L!}} -110 {emit {\b, advanced RT simple @ L2}} -109 {emit {\b, advanced RT simple @ L3}} -108 {emit {\b, advanced RT simple @ L4}} -95 {emit {\b, core scalable @ L1}} -94 {emit {\b, core scalable @ L2}} -93 {emit {\b, core scalable @ L3}} -79 {emit {\b, advanced coding efficiency @ L1}} -78 {emit {\b, advanced coding efficiency @ L2}} -77 {emit {\b, advanced coding efficiency @ L3}} -76 {emit {\b, advanced coding efficiency @ L4}} -63 {emit {\b, advanced core @ L1}} -62 {emit {\b, advanced core @ L2}} -47 {emit {\b, advanced scalable texture @ L1}} -46 {emit {\b, advanced scalable texture @ L2}} -45 {emit {\b, advanced scalable texture @ L3}} -31 {emit {\b, simple studio @ L1}} -30 {emit {\b, simple studio @ L2}} -29 {emit {\b, simple studio @ L3}} -28 {emit {\b, simple studio @ L4}} -27 {emit {\b, core studio @ L1}} -26 {emit {\b, core studio @ L2}} -25 {emit {\b, core studio @ L3}} -24 {emit {\b, core studio @ L4}} -16 {emit {\b, advanced simple @ L0}} -15 {emit {\b, advanced simple @ L1}} -14 {emit {\b, advanced simple @ L2}} -13 {emit {\b, advanced simple @ L3}} -12 {emit {\b, advanced simple @ L4}} -11 {emit {\b, advanced simple @ L5}} -9 {emit {\b, advanced simple @ L3b}} -8 {emit {\b, FGS @ L0}} -7 {emit {\b, FGS @ L1}} -6 {emit {\b, FGS @ L2}} -5 {emit {\b, FGS @ L3}} -4 {emit {\b, FGS @ L4}} -3 {emit {\b, FGS @ L5}} 
-} -75 {emit {\b, v4}
-if {[N c 4 & 0x80]} {switch -- [Nv c 5 &0xF0] 16 {emit {\b, video \(missing profile header\)}} 32 {emit {\b, still texture \(missing profile header\)}} 48 {emit {\b, mesh \(missing profile header\)}} 64 {emit {\b, face \(missing profile header\)}} 
-}
-switch -- [Nv c 4 &0xF8] 8 {emit {\b, video \(missing profile header\)}} 16 {emit {\b, still texture \(missing profile header\)}} 24 {emit {\b, mesh \(missing profile header\)}} 32 {emit {\b, face \(missing profile header\)}} 
-} -77 {emit {}
-switch -- [Nv I 12] 440 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 434 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 437 {emit {\b, v2,}
-switch -- [Nv c 16 &0x0F] 1 {emit {\b HP}} 2 {emit {\b Spt}} 3 {emit {\b SNR}} 4 {emit {\b MP}} 5 {emit {\b SP}} 
-switch -- [Nv c 17 &0xF0] 64 {emit {\b@HL}} 96 {emit {\b@H-14}} -128 {emit {\b@ML}} -96 {emit {\b@LL}} 
-if {[N c 17 & 0x8]} {emit {\b progressive}}
-if {[N c 17 ^ 0x8]} {emit {\b interlaced}}
-switch -- [Nv c 17 &0x06] 2 {emit {\b Y'CbCr 4:2:0 video}} 4 {emit {\b Y'CbCr 4:2:2 video}} 6 {emit {\b Y'CbCr 4:4:4 video}} 
-} 
-if {[N c 11 & 0x2]} {if {[N c 75 & 0x1]} {switch -- [Nv I 140] 440 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 434 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 437 {emit {\b, v2,}
-switch -- [Nv c 144 &0x0F] 1 {emit {\b HP}} 2 {emit {\b Spt}} 3 {emit {\b SNR}} 4 {emit {\b MP}} 5 {emit {\b SP}} 
-switch -- [Nv c 145 &0xF0] 64 {emit {\b@HL}} 96 {emit {\b@H-14}} -128 {emit {\b@ML}} -96 {emit {\b@LL}} 
-if {[N c 145 & 0x8]} {emit {\b progressive}}
-if {[N c 145 ^ 0x8]} {emit {\b interlaced}}
-switch -- [Nv c 145 &0x06] 2 {emit {\b Y'CbCr 4:2:0 video}} 4 {emit {\b Y'CbCr 4:2:2 video}} 6 {emit {\b Y'CbCr 4:4:4 video}} 
-} 
-}
-}
-switch -- [Nv I 76] 440 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 434 {emit {\b, v1, progressive Y'CbCr 4:2:0 video}} 437 {emit {\b, v2,}
-switch -- [Nv c 80 &0x0F] 1 {emit {\b HP}} 2 {emit {\b Spt}} 3 {emit {\b SNR}} 4 {emit {\b MP}} 5 {emit {\b SP}} 
-switch -- [Nv c 81 &0xF0] 64 {emit {\b@HL}} 96 {emit {\b@H-14}} -128 {emit {\b@ML}} -96 {emit {\b@LL}} 
-if {[N c 81 & 0x8]} {emit {\b progressive}}
-if {[N c 81 ^ 0x8]} {emit {\b interlaced}}
-switch -- [Nv c 81 &0x06] 2 {emit {\b Y'CbCr 4:2:0 video}} 4 {emit {\b Y'CbCr 4:2:2 video}} 6 {emit {\b Y'CbCr 4:4:4 video}} 
-} 
-switch -- [Nv I 4 &0xFFFFFF00] 2013542400 {emit {\b, HD-TV 1920P}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 16:9}}
-} 1342188800 {emit {\b, SD-TV 1280I}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 16:9}}
-} 805453824 {emit {\b, PAL Capture}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 4:3}}
-} 671211520 {emit {\b, LD-TV 640P}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 4:3}}
-} 335605760 {emit {\b, 320x240}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 4:3}}
-} 251699200 {emit {\b, 240x160}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 4:3}}
-} 167802880 {emit {\b, 160x120}
-if {[N c 7 == 0x10 &0xF0]} {emit {\b, 4:3}}
-} 
-switch -- [Nv S 4 &0xFFF0] 11264 {emit {\b, 4CIF}
-switch -- [Nv S 5 &0x0FFF] 480 {emit {\b NTSC}} 576 {emit {\b PAL}} 
-switch -- [Nv c 7 &0xF0] 32 {emit {\b, 4:3}} 48 {emit {\b, 16:9}} 64 {emit {\b, 11:5}} -128 {emit {\b, PAL 4:3}} -64 {emit {\b, NTSC 4:3}} 
-} 5632 {emit {\b, CIF}
-switch -- [Nv S 5 &0x0FFF] 240 {emit {\b NTSC}} 288 {emit {\b PAL}} 576 {emit {\b PAL 625}
-switch -- [Nv c 7 &0xF0] 32 {emit {\b, 4:3}} 48 {emit {\b, 16:9}} 64 {emit {\b, 11:5}} 
-} 
-switch -- [Nv c 7 &0xF0] 32 {emit {\b, 4:3}} 48 {emit {\b, 16:9}} 64 {emit {\b, 11:5}} -128 {emit {\b, PAL 4:3}} -64 {emit {\b, NTSC 4:3}} 
-} 11520 {emit {\b, CCIR/ITU}
-switch -- [Nv S 5 &0x0FFF] 480 {emit {\b NTSC 525}} 576 {emit {\b PAL 625}} 
-switch -- [Nv c 7 &0xF0] 32 {emit {\b, 4:3}} 48 {emit {\b, 16:9}} 64 {emit {\b, 11:5}} 
-} 7680 {emit {\b, SVCD}
-switch -- [Nv S 5 &0x0FFF] 480 {emit {\b NTSC 525}} 576 {emit {\b PAL 625}} 
-switch -- [Nv c 7 &0xF0] 32 {emit {\b, 4:3}} 48 {emit {\b, 16:9}} 64 {emit {\b, 11:5}} 
-} 
-switch -- [Nv c 7 &0x0F] 1 {emit {\b, 23.976 fps}} 2 {emit {\b, 24 fps}} 3 {emit {\b, 25 fps}} 4 {emit {\b, 29.97 fps}} 5 {emit {\b, 30 fps}} 6 {emit {\b, 50 fps}} 7 {emit {\b, 59.94 fps}} 8 {emit {\b, 60 fps}} 
-if {[N c 11 & 0x4]} {emit {\b, Constrained}}
-} 
-if {[N c 3 == 0x7 &0x1F]} {emit {\b, H.264 video}
-switch -- [Nv c 4] 66 {emit {\b, baseline}} 77 {emit {\b, main}} 88 {emit {\b, extended}} 
-if {[N c 6 x {}]} {emit {\b @ L %u}}
-}
-}
-switch -- [Nv S 0 &0xFFFE] -6 {emit {MPEG ADTS, layer III, v1}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,  32 kBits}} 32 {emit {\b,  40 kBits}} 48 {emit {\b,  48 kBits}} 64 {emit {\b,  56 kBits}} 80 {emit {\b,  64 kBits}} 96 {emit {\b,  80 kBits}} 112 {emit {\b,  96 kBits}} -128 {emit {\b, 112 kBits}} -112 {emit {\b, 128 kBits}} -96 {emit {\b, 160 kBits}} -80 {emit {\b, 192 kBits}} -64 {emit {\b, 224 kBits}} -48 {emit {\b, 256 kBits}} -32 {emit {\b, 320 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 44.1 kHz}} 4 {emit {\b, 48 kHz}} 8 {emit {\b, 32 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -4 {emit {MPEG ADTS, layer II, v1}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,  32 kBits}} 32 {emit {\b,  48 kBits}} 48 {emit {\b,  56 kBits}} 64 {emit {\b,  64 kBits}} 80 {emit {\b,  80 kBits}} 96 {emit {\b,  96 kBits}} 112 {emit {\b, 112 kBits}} -128 {emit {\b, 128 kBits}} -112 {emit {\b, 160 kBits}} -96 {emit {\b, 192 kBits}} -80 {emit {\b, 224 kBits}} -64 {emit {\b, 256 kBits}} -48 {emit {\b, 320 kBits}} -32 {emit {\b, 384 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 44.1 kHz}} 4 {emit {\b, 48 kHz}} 8 {emit {\b, 32 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -2 {emit {MPEG ADTS, layer I, v1}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,  32 kBits}} 32 {emit {\b,  64 kBits}} 48 {emit {\b,  96 kBits}} 64 {emit {\b, 128 kBits}} 80 {emit {\b, 160 kBits}} 96 {emit {\b, 192 kBits}} 112 {emit {\b, 224 kBits}} -128 {emit {\b, 256 kBits}} -112 {emit {\b, 288 kBits}} -96 {emit {\b, 320 kBits}} -80 {emit {\b, 352 kBits}} -64 {emit {\b, 384 kBits}} -48 {emit {\b, 416 kBits}} -32 {emit {\b, 448 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 44.1 kHz}} 4 {emit {\b, 48 kHz}} 8 {emit {\b, 32 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -14 {emit {MPEG ADTS, layer III, v2}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,   8 kBits}} 32 {emit {\b,  16 kBits}} 48 {emit {\b,  24 kBits}} 64 {emit {\b,  32 kBits}} 80 {emit {\b,  40 kBits}} 96 {emit {\b,  48 kBits}} 112 {emit {\b,  56 kBits}} -128 {emit {\b,  64 kBits}} -112 {emit {\b,  80 kBits}} -96 {emit {\b,  96 kBits}} -80 {emit {\b, 112 kBits}} -64 {emit {\b, 128 kBits}} -48 {emit {\b, 144 kBits}} -32 {emit {\b, 160 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 22.05 kHz}} 4 {emit {\b, 24 kHz}} 8 {emit {\b, 16 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -12 {emit {MPEG ADTS, layer II, v2}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,   8 kBits}} 32 {emit {\b,  16 kBits}} 48 {emit {\b,  24 kBits}} 64 {emit {\b,  32 kBits}} 80 {emit {\b,  40 kBits}} 96 {emit {\b,  48 kBits}} 112 {emit {\b,  56 kBits}} -128 {emit {\b,  64 kBits}} -112 {emit {\b,  80 kBits}} -96 {emit {\b,  96 kBits}} -80 {emit {\b, 112 kBits}} -64 {emit {\b, 128 kBits}} -48 {emit {\b, 144 kBits}} -32 {emit {\b, 160 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 22.05 kHz}} 4 {emit {\b, 24 kHz}} 8 {emit {\b, 16 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -10 {emit {MPEG ADTS, layer I, v2}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,  32 kBits}} 32 {emit {\b,  48 kBits}} 48 {emit {\b,  56 kBits}} 64 {emit {\b,  64 kBits}} 80 {emit {\b,  80 kBits}} 96 {emit {\b,  96 kBits}} 112 {emit {\b, 112 kBits}} -128 {emit {\b, 128 kBits}} -112 {emit {\b, 144 kBits}} -96 {emit {\b, 160 kBits}} -80 {emit {\b, 176 kBits}} -64 {emit {\b, 192 kBits}} -48 {emit {\b, 224 kBits}} -32 {emit {\b, 256 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 22.05 kHz}} 4 {emit {\b, 24 kHz}} 8 {emit {\b, 16 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} -30 {emit {MPEG ADTS, layer III,  v2.5}
-switch -- [Nv c 2 &0xF0] 16 {emit {\b,   8 kBits}} 32 {emit {\b,  16 kBits}} 48 {emit {\b,  24 kBits}} 64 {emit {\b,  32 kBits}} 80 {emit {\b,  40 kBits}} 96 {emit {\b,  48 kBits}} 112 {emit {\b,  56 kBits}} -128 {emit {\b,  64 kBits}} -112 {emit {\b,  80 kBits}} -96 {emit {\b,  96 kBits}} -80 {emit {\b, 112 kBits}} -64 {emit {\b, 128 kBits}} -48 {emit {\b, 144 kBits}} -32 {emit {\b, 160 kBits}} 
-switch -- [Nv c 2 &0x0C] 0 {emit {\b, 11.025 kHz}} 4 {emit {\b, 12 kHz}} 8 {emit {\b, 8 kHz}} 
-switch -- [Nv c 3 &0xC0] 0 {emit {\b, Stereo}} 64 {emit {\b, JntStereo}} -128 {emit {\b, 2x Monaural}} -64 {emit {\b, Monaural}} 
-} 
-if {[S 0 == ADIF]} {emit {MPEG ADIF, AAC}
-if {[N c 4 & 0x80]} {if {[N c 13 & 0x10]} {emit {\b, VBR}}
-if {[N c 13 ^ 0x10]} {emit {\b, CBR}}
-switch -- [Nv c 16 &0x1E] 2 {emit {\b, single stream}} 4 {emit {\b, 2 streams}} 6 {emit {\b, 3 streams}} 
-if {[N c 16 & 0x8]} {emit {\b, 4 or more streams}}
-if {[N c 16 & 0x10]} {emit {\b, 8 or more streams}}
-if {[N c 4 & 0x80]} {emit {\b, Copyrighted}}
-if {[N c 13 & 0x40]} {emit {\b, Original Source}}
-if {[N c 13 & 0x20]} {emit {\b, Home Flag}}
-}
-if {[N c 4 ^ 0x80]} {if {[N c 4 & 0x10]} {emit {\b, VBR}}
-if {[N c 4 ^ 0x10]} {emit {\b, CBR}}
-switch -- [Nv c 7 &0x1E] 2 {emit {\b, single stream}} 4 {emit {\b, 2 streams}} 6 {emit {\b, 3 streams}} 
-if {[N c 7 & 0x8]} {emit {\b, 4 or more streams}}
-if {[N c 7 & 0x10]} {emit {\b, 8 or more streams}}
-if {[N c 4 & 0x40]} {emit {\b, Original Stream\(s\)}}
-if {[N c 4 & 0x20]} {emit {\b, Home Source}}
-}
-}
-if {[N S 0 == 0xfff0 &0xFFF6]} {emit {MPEG ADTS, AAC}
-if {[N c 1 & 0x8]} {emit {\b, v2}}
-if {[N c 1 ^ 0x8]} {emit {\b, v4}
-if {[N c 2 & 0xc0]} {emit {\b LTP}}
-}
-switch -- [Nv c 2 &0xc0] 0 {emit {\b Main}} 64 {emit {\b LC}} -128 {emit {\b SSR}} 
-switch -- [Nv c 2 &0x3c] 0 {emit {\b, 96 kHz}} 4 {emit {\b, 88.2 kHz}} 8 {emit {\b, 64 kHz}} 12 {emit {\b, 48 kHz}} 16 {emit {\b, 44.1 kHz}} 20 {emit {\b, 32 kHz}} 24 {emit {\b, 24 kHz}} 28 {emit {\b, 22.05 kHz}} 32 {emit {\b, 16 kHz}} 36 {emit {\b, 12 kHz}} 40 {emit {\b, 11.025 kHz}} 44 {emit {\b, 8 kHz}} 
-switch -- [Nv S 2 &0x01c0] 64 {emit {\b, monaural}} 128 {emit {\b, stereo}} 192 {emit {\b, stereo + center}} 256 {emit {\b, stereo+center+LFE}} 320 {emit {\b, surround}} 384 {emit {\b, surround + LFE}} 
-if {[N S 2 & 0x1c0]} {emit {\b, surround + side}}
-}
-if {[N S 0 == 0x56e0 &0xFFE0]} {emit {MPEG-4 LOAS}
-if {[N c 3 == 0x40 &0xE0]} {switch -- [Nv c 4 &0x3C] 4 {emit {\b, single stream}} 8 {emit {\b, 2 streams}} 12 {emit {\b, 3 streams}} 
-if {[N c 4 & 0x8]} {emit {\b, 4 or more streams}}
-if {[N c 4 & 0x20]} {emit {\b, 8 or more streams}}
-}
-if {[N c 3 == 0x0 &0xC0]} {switch -- [Nv c 4 &0x78] 8 {emit {\b, single stream}} 16 {emit {\b, 2 streams}} 24 {emit {\b, 3 streams}} 
-if {[N c 4 & 0x20]} {emit {\b, 4 or more streams}}
-if {[N c 4 & 0x40]} {emit {\b, 8 or more streams}}
-}
-}
-switch -- [Nv s 4] -20719 {emit {FLI file}
-if {[N s 6 x {}]} {emit {- %d frames,}}
-if {[N s 8 x {}]} {emit {width=%d pixels,}}
-if {[N s 10 x {}]} {emit {height=%d pixels,}}
-if {[N s 12 x {}]} {emit depth=%d,}
-if {[N s 16 x {}]} {emit ticks/frame=%d}
-} -20718 {emit {FLC file}
-if {[N s 6 x {}]} {emit {- %d frames}}
-if {[N s 8 x {}]} {emit {width=%d pixels,}}
-if {[N s 10 x {}]} {emit {height=%d pixels,}}
-if {[N s 12 x {}]} {emit depth=%d,}
-if {[N s 16 x {}]} {emit ticks/frame=%d}
-} 
-if {[N I 0 == 0x47400010 &0xFF5FFF1F]} {emit {MPEG transport stream data}
-if {[N c 188 != 0x47]} {emit CORRUPTED}
-}
-switch -- [Nv I 0 &0xffffff00] 520552448 {emit DIF
-if {[N c 4 & 0x1]} {emit {\(DVCPRO\) movie file}}
-if {[N c 4 ^ 0x1]} {emit {\(DV\) movie file}}
-if {[N c 3 & 0x80]} {emit {\(PAL\)}}
-if {[N c 3 ^ 0x80]} {emit {\(NTSC\)}}
-} -2063526912 {emit {cisco IOS microcode}
-if {[S 7 x {}]} {emit {for '%s'}}
-} -2063480064 {emit {cisco IOS experimental microcode}
-if {[S 7 x {}]} {emit {for '%s'}}
-} -16907520 {emit {MySQL MISAM index file}
-if {[N c 3 x {}]} {emit {Version %d}}
-} -16906496 {emit {MySQL MISAM compressed data file}
-if {[N c 3 x {}]} {emit {Version %d}}
-} -16907008 {emit {MySQL ISAM index file}
-if {[N c 3 x {}]} {emit {Version %d}}
-} -16906752 {emit {MySQL ISAM compressed data file}
-if {[N c 3 x {}]} {emit {Version %d}}
-} 
-if {[S 0 == {\x8aMNG}]} {emit {MNG video data,}
-if {[N I 4 != 0xd0a1a0a]} {emit CORRUPTED,}
-if {[N I 4 == 0xd0a1a0a]} {if {[N I 16 x {}]} {emit {%ld x}}
-if {[N I 20 x {}]} {emit %ld}
-}
-}
-if {[S 0 == {\x8bJNG}]} {emit {JNG video data,}
-if {[N I 4 != 0xd0a1a0a]} {emit CORRUPTED,}
-if {[N I 4 == 0xd0a1a0a]} {if {[N I 16 x {}]} {emit {%ld x}}
-if {[N I 20 x {}]} {emit %ld}
-}
-}
-if {[S 3 == {\x0D\x0AVersion:Vivo}]} {emit {Vivo video data}}
-if {[S 0 == {\#VRML\ V1.0\ ascii} b]} {emit {VRML 1 file}}
-if {[S 0 == {\#VRML\ V2.0\ utf8} b]} {emit {ISO/IEC 14772 VRML 97 file}}
-if {[S 0 == HVQM4]} {emit %s
-if {[S 6 x {}]} {emit v%s}
-if {[N c 0 x {}]} {emit {GameCube movie,}}
-if {[N S 52 x {}]} {emit {%d x}}
-if {[N S 54 x {}]} {emit %d,}
-if {[N S 38 x {}]} {emit %dÂµs,}
-if {[N S 66 == 0x0]} {emit {no audio}}
-if {[N S 66 > 0x0]} {emit {%dHz audio}}
-}
-if {[S 0 == DVDVIDEO-VTS]} {emit {Video title set,}
-if {[N c 33 x {}]} {emit v%x}
-}
-if {[S 0 == DVDVIDEO-VMG]} {emit {Video manager,}
-if {[N c 33 x {}]} {emit v%x}
-}
-switch -- [Nv Q 0] 33132 {emit {APL workspace \(Ken's original?\)}} 65389 {emit {very old archive}} 65381 {emit {old archive}} 33132 {emit {apl workspace}} 557605234 {emit {archive file}} 262 {emit {68k Blit mpx/mux executable}} 269 {emit {i960 b.out relocatable object}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} 1145263299 {emit {DACT compressed data}
-if {[N c 4 > 0xffffffff]} {emit {\(version %i.}}
-if {[N c 5 > 0xffffffff]} {emit {$BS%i.}}
-if {[N c 6 > 0xffffffff]} {emit {$BS%i\)}}
-if {[N Q 7 > 0x0]} {emit {$BS, original size: %i bytes}}
-if {[N Q 15 > 0x1e]} {emit {$BS, block size: %i bytes}}
-} 398689 {emit {Berkeley DB}
-switch -- [Nv I 8] 4321 {emit {}
-if {[N I 4 > 0x2]} {emit 1.86}
-if {[N I 4 < 0x3]} {emit 1.85}
-if {[N I 4 > 0x0]} {emit {\(Hash, version %d, native byte-order\)}}
-} 1234 {emit {}
-if {[N I 4 > 0x2]} {emit 1.86}
-if {[N I 4 < 0x3]} {emit 1.85}
-if {[N I 4 > 0x0]} {emit {\(Hash, version %d, little-endian\)}}
-} 
-} 340322 {emit {Berkeley DB 1.85/1.86}
-if {[N Q 4 > 0x0]} {emit {\(Btree, version %d, native byte-order\)}}
-} 1234567 {emit {X image}} 168757262 {emit {TML 0123 byte-order format}} 252317192 {emit {TML 1032 byte-order format}} 135137807 {emit {TML 2301 byte-order format}} 235409162 {emit {TML 3210 byte-order format}} 34078982 {emit {HP s500 relocatable executable}
-if {[N Q 16 > 0x0]} {emit {- version %ld}}
-} 34078983 {emit {HP s500 executable}
-if {[N Q 16 > 0x0]} {emit {- version %ld}}
-} 34078984 {emit {HP s500 pure executable}
-if {[N Q 16 > 0x0]} {emit {- version %ld}}
-} 65381 {emit {HP old archive}} 34275173 {emit {HP s200 old archive}} 34406245 {emit {HP s200 old archive}} 34144101 {emit {HP s500 old archive}} 22552998 {emit {HP core file}} 1302851304 {emit {HP-WINDOWS font}
-if {[N c 8 > 0x0]} {emit {- version %ld}}
-} 34341132 {emit {compiled Lisp}} 1123028772 {emit {Artisan image data}
-switch -- [Nv Q 4] 1 {emit {\b, rectangular 24-bit}} 2 {emit {\b, rectangular 8-bit with colormap}} 3 {emit {\b, rectangular 32-bit \(24-bit with matte\)}} 
-} 1886817234 {emit {CLISP memory image data}} -762612112 {emit {CLISP memory image data, other endian}} -569244523 {emit {GNU-format message catalog data}} -1794895138 {emit {GNU-format message catalog data}} -1042103351 {emit {SPSS Portable File}
-if {[S 40 x {}]} {emit %s}
-} 31415 {emit {Mirage Assembler m.out executable}} 61374 {emit {OSF/Rose object}} 1351614727 {emit {Pyramid 90x family executable}} 1351614728 {emit {Pyramid 90x family pure executable}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} 1351614731 {emit {Pyramid 90x family demand paged pure executable}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} -97271666 {emit {SunPC 4.0 Hard Disk}} 268 {emit {unknown demand paged pure executable}
-if {[N Q 16 > 0x0]} {emit {not stripped}}
-} 270 {emit {unknown readable demand paged pure executable}} 395726 {emit {Jaleo XFS file}
-if {[N Q 4 x {}]} {emit {- version %ld}}
-if {[N Q 8 x {}]} {emit {- [%ld -}}
-if {[N Q 20 x {}]} {emit %ldx}
-if {[N Q 24 x {}]} {emit %ldx}
-switch -- [Nv Q 28] 1008 {emit YUV422\]} 1000 {emit RGB24\]} 
-} 59399 {emit {object file \(z8000 a.out\)}} 59400 {emit {pure object file \(z8000 a.out\)}} 59401 {emit {separate object file \(z8000 a.out\)}} 59397 {emit {overlay object file \(z8000 a.out\)}} 
-if {[S 0 == FiLeStArTfIlEsTaRt]} {emit {binscii \(apple ][\) text}}
-if {[S 0 == {\x0aGL}]} {emit {Binary II \(apple ][\) data}}
-if {[S 0 == {\x76\xff}]} {emit {Squeezed \(apple ][\) data}}
-if {[S 0 == NuFile]} {emit {NuFile archive \(apple ][\) data}}
-if {[S 0 == {N\xf5F\xe9l\xe5}]} {emit {NuFile archive \(apple ][\) data}}
-if {[S 0 == package0]} {emit {Newton package, NOS 1.x,}
-if {[N I 12 & 0x80000000]} {emit AutoRemove,}
-if {[N I 12 & 0x40000000]} {emit CopyProtect,}
-if {[N I 12 & 0x10000000]} {emit NoCompression,}
-if {[N I 12 & 0x4000000]} {emit Relocation,}
-if {[N I 12 & 0x2000000]} {emit UseFasterCompression,}
-if {[N I 16 x {}]} {emit {version %d}}
-}
-if {[S 0 == package1]} {emit {Newton package, NOS 2.x,}
-if {[N I 12 & 0x80000000]} {emit AutoRemove,}
-if {[N I 12 & 0x40000000]} {emit CopyProtect,}
-if {[N I 12 & 0x10000000]} {emit NoCompression,}
-if {[N I 12 & 0x4000000]} {emit Relocation,}
-if {[N I 12 & 0x2000000]} {emit UseFasterCompression,}
-if {[N I 16 x {}]} {emit {version %d}}
-}
-if {[S 0 == package4]} {emit {Newton package,}
-switch -- [Nv c 8] 8 {emit {NOS 1.x,}} 9 {emit {NOS 2.x,}} 
-if {[N I 12 & 0x80000000]} {emit AutoRemove,}
-if {[N I 12 & 0x40000000]} {emit CopyProtect,}
-if {[N I 12 & 0x10000000]} {emit NoCompression,}
-}
-if {[S 4 == O====]} {emit {AppleWorks word processor data}
-if {[N c 85 > 0x0 &0x01]} {emit {\b, zoomed}}
-if {[N c 90 > 0x0 &0x01]} {emit {\b, paginated}}
-if {[N c 92 > 0x0 &0x01]} {emit {\b, with mail merge}}
-}
-if {[N I 0 == 0x80000 &0xff00ff]} {emit {Applesoft BASIC program data}}
-if {[S 8144 == {\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F}]} {emit {Apple II image with white background}}
-if {[S 8144 == {\x55\x2A\x55\x2A\x55\x2A\x55\x2A}]} {emit {Apple II image with purple background}}
-if {[S 8144 == {\x2A\x55\x2A\x55\x2A\x55\x2A\x55}]} {emit {Apple II image with green background}}
-if {[S 8144 == {\xD5\xAA\xD5\xAA\xD5\xAA\xD5\xAA}]} {emit {Apple II image with blue background}}
-if {[S 8144 == {\xAA\xD5\xAA\xD5\xAA\xD5\xAA\xD5}]} {emit {Apple II image with orange background}}
-if {[N I 0 == 0x6400d000 &0xFF00FFFF]} {emit {Apple Mechanic font}}
-if {[S 0 == *BEGIN]} {emit Applixware
-if {[S 7 == WORDS]} {emit {Words Document}}
-if {[S 7 == GRAPHICS]} {emit Graphic}
-if {[S 7 == RASTER]} {emit Bitmap}
-if {[S 7 == SPREADSHEETS]} {emit Spreadsheet}
-if {[S 7 == MACRO]} {emit Macro}
-if {[S 7 == BUILDER]} {emit {Builder Object}}
-}
-if {[S 257 == {ustar\0}]} {emit {POSIX tar archive}}
-if {[S 257 == {ustar\040\040\0}]} {emit {GNU tar archive}}
-if {[S 0 == 070707]} {emit {ASCII cpio archive \(pre-SVR4 or odc\)}}
-if {[S 0 == 070701]} {emit {ASCII cpio archive \(SVR4 with no CRC\)}}
-if {[S 0 == 070702]} {emit {ASCII cpio archive \(SVR4 with CRC\)}}
-if {[S 0 == {!<arch>\ndebian}]} {if {[S 8 == debian-split]} {emit {part of multipart Debian package}}
-if {[S 8 == debian-binary]} {emit {Debian binary package}}
-if {[S 68 x {}]} {emit {\(format %s\)}}
-if {[S 81 == bz2]} {emit {\b, uses bzip2 compression}}
-if {[S 84 == gz]} {emit {\b, uses gzip compression}}
-}
-if {[S 0 == <ar>]} {emit archive}
-if {[S 0 == {!<arch>\n__________E}]} {emit {MIPS archive}
-if {[S 20 == U]} {emit {with MIPS Ucode members}}
-if {[S 21 == L]} {emit {with MIPSEL members}}
-if {[S 21 == B]} {emit {with MIPSEB members}}
-if {[S 19 == L]} {emit {and an EL hash table}}
-if {[S 19 == B]} {emit {and an EB hash table}}
-if {[S 22 == X]} {emit {-- out of date}}
-}
-if {[S 0 == -h-]} {emit {Software Tools format archive text}}
-if {[S 0 == !<arch>]} {emit {current ar archive}
-if {[S 8 == __.SYMDEF]} {emit {random library}}
-switch -- [Nv I 0] 65538 {emit {- pre SR9.5}} 65539 {emit {- post SR9.5}} 
-switch -- [Nv S 0] 2 {emit {- object archive}} 3 {emit {- shared library module}} 4 {emit {- debug break-pointed module}} 5 {emit {- absolute code program module}} 
-}
-if {[S 0 == <ar>]} {emit {System V Release 1 ar archive}}
-if {[S 0 == <ar>]} {emit archive}
-switch -- [Nv i 0 &0x8080ffff] 2074 {emit {ARC archive data, dynamic LZW}} 2330 {emit {ARC archive data, squashed}} 538 {emit {ARC archive data, uncompressed}} 794 {emit {ARC archive data, packed}} 1050 {emit {ARC archive data, squeezed}} 1562 {emit {ARC archive data, crunched}} 
-if {[S 0 == {\032}]} {emit {RISC OS archive \(spark format\)}}
-if {[S 0 == {Archive\000}]} {emit {RISC OS archive \(ArcFS format\)}}
-if {[S 0 == HPAK]} {emit {HPACK archive data}}
-if {[S 0 == {\351,\001JAM\	}]} {emit {JAM archive,}
-if {[S 7 x {}]} {emit {version %.4s}}
-if {[N c 38 == 0x27]} {emit -
-if {[S 43 x {}]} {emit {label %.11s,}}
-if {[N i 39 x {}]} {emit {serial %08x,}}
-if {[S 54 x {}]} {emit {fstype %.8s}}
-}
-}
-if {[S 2 == -lh0-]} {emit {LHarc 1.x archive data [lh0]}}
-if {[S 2 == -lh1-]} {emit {LHarc 1.x archive data [lh1]}}
-if {[S 2 == -lz4-]} {emit {LHarc 1.x archive data [lz4]}}
-if {[S 2 == -lz5-]} {emit {LHarc 1.x archive data [lz5]}}
-if {[S 2 == -lzs-]} {emit {LHa 2.x? archive data [lzs]}}
-if {[S 2 == {-lh\40-}]} {emit {LHa 2.x? archive data [lh ]}}
-if {[S 2 == -lhd-]} {emit {LHa 2.x? archive data [lhd]}}
-if {[S 2 == -lh2-]} {emit {LHa 2.x? archive data [lh2]}}
-if {[S 2 == -lh3-]} {emit {LHa 2.x? archive data [lh3]}}
-if {[S 2 == -lh4-]} {emit {LHa \(2.x\) archive data [lh4]}}
-if {[S 2 == -lh5-]} {emit {LHa \(2.x\) archive data [lh5]}}
-if {[S 2 == -lh6-]} {emit {LHa \(2.x\) archive data [lh6]}}
-if {[S 2 == -lh7-]} {emit {LHa \(2.x\) archive data [lh7]}
-if {[N c 20 x {}]} {emit {- header level %d}}
-}
-if {[S 0 == Rar!]} {emit {RAR archive data,}
-if {[N c 44 x {}]} {emit v%0x,}
-switch -- [Nv c 35] 0 {emit {os: MS-DOS}} 1 {emit {os: OS/2}} 2 {emit {os: Win32}} 3 {emit {os: Unix}} 
-}
-if {[S 0 == SQSH]} {emit {squished archive data \(Acorn RISCOS\)}}
-if {[S 0 == {UC2\x1a}]} {emit {UC2 archive data}}
-if {[S 0 == {PK\003\004}]} {emit {Zip archive data}
-switch -- [Nv c 4] 9 {emit {\b, at least v0.9 to extract}} 10 {emit {\b, at least v1.0 to extract}} 11 {emit {\b, at least v1.1 to extract}} 20 {emit {\b, at least v2.0 to extract}} 
-}
-if {[N i 20 == 0xfdc4a7dc]} {emit {Zoo archive data}
-if {[N c 4 > 0x30]} {emit {\b, v%c.}
-if {[N c 6 > 0x2f]} {emit {\b%c}
-if {[N c 7 > 0x2f]} {emit {\b%c}}
-}
-}
-if {[N c 32 > 0x0]} {emit {\b, modify: v%d}
-if {[N c 33 x {}]} {emit {\b.%d+}}
-}
-if {[N i 42 == 0xfdc4a7dc]} {emit {\b,}
-if {[N c 70 > 0x0]} {emit {extract: v%d}
-if {[N c 71 x {}]} {emit {\b.%d+}}
-}
-}
-}
-if {[S 10 == {\#\ This\ is\ a\ shell\ archive}]} {emit {shell archive text}}
-if {[S 0 == {\0\ \ \ \ \ \ \ \ \ \ \ \0\0}]} {emit {LBR archive data}}
-if {[S 2 == -pm0-]} {emit {PMarc archive data [pm0]}}
-if {[S 2 == -pm1-]} {emit {PMarc archive data [pm1]}}
-if {[S 2 == -pm2-]} {emit {PMarc archive data [pm2]}}
-if {[S 2 == -pms-]} {emit {PMarc SFX archive \(CP/M, DOS\)}}
-if {[S 5 == -pc1-]} {emit {PopCom compressed executable \(CP/M\)}}
-if {[S 4 == {gtktalog\ }]} {emit {GTKtalog catalog data,}
-if {[S 13 == 3]} {emit {version 3}
-if {[N S 14 == 0x677a]} {emit {\(gzipped\)}}
-if {[N S 14 != 0x677a]} {emit {\(not gzipped\)}}
-}
-if {[S 13 > 3]} {emit {version %s}}
-}
-if {[S 0 == {PAR\0}]} {emit {PARity archive data}
-if {[N s 48 == 0x0]} {emit {- Index file}}
-if {[N s 48 > 0x0]} {emit {- file number %d}}
-}
-if {[S 0 == d8:announce]} {emit {BitTorrent file}}
-if {[S 0 == {PK00PK\003\004}]} {emit {Zip archive data}}
-if {[S 7 == **ACE**]} {emit {ACE compressed archive}
-if {[N c 15 > 0x0]} {emit {version %d}}
-switch -- [Nv c 16] 0 {emit {\b, from MS-DOS}} 1 {emit {\b, from OS/2}} 2 {emit {\b, from Win/32}} 3 {emit {\b, from Unix}} 4 {emit {\b, from MacOS}} 5 {emit {\b, from WinNT}} 6 {emit {\b, from Primos}} 7 {emit {\b, from AppleGS}} 8 {emit {\b, from Atari}} 9 {emit {\b, from Vax/VMS}} 10 {emit {\b, from Amiga}} 11 {emit {\b, from Next}} 
-if {[N c 14 x {}]} {emit {\b, version %d to extract}}
-if {[N s 5 & 0x80]} {emit {\b, multiple volumes,}
-if {[N c 17 x {}]} {emit {\b \(part %d\),}}
-}
-if {[N s 5 & 0x2]} {emit {\b, contains comment}}
-if {[N s 5 & 0x200]} {emit {\b, sfx}}
-if {[N s 5 & 0x400]} {emit {\b, small dictionary}}
-if {[N s 5 & 0x800]} {emit {\b, multi-volume}}
-if {[N s 5 & 0x1000]} {emit {\b, contains AV-String}}
-if {[N s 5 & 0x2000]} {emit {\b, with recovery record}}
-if {[N s 5 & 0x4000]} {emit {\b, locked}}
-if {[N s 5 & 0x8000]} {emit {\b, solid}}
-}
-if {[S 26 == sfArk]} {emit {sfArk compressed Soundfont}
-if {[S 21 == 2]} {if {[S 1 x {}]} {emit {Version %s}}
-if {[S 42 x {}]} {emit {: %s}}
-}
-}
-if {[S 0 == {Packed\ File\ }]} {emit {Personal		NetWare Packed File}
-if {[S 12 x {}]} {emit {\b, was \"%.12s\"}}
-}
-if {[S 0 == *STA]} {emit Aster*x
-if {[S 7 == WORD]} {emit {Words Document}}
-if {[S 7 == GRAP]} {emit Graphic}
-if {[S 7 == SPRE]} {emit Spreadsheet}
-if {[S 7 == MACR]} {emit Macro}
-}
-if {[S 0 == 2278]} {emit {Aster*x Version 2}
-switch -- [Nv c 29] 54 {emit {Words Document}} 53 {emit Graphic} 50 {emit Spreadsheet} 56 {emit Macro} 
-}
-if {[S 0 == {\000\004\036\212\200}]} {emit {3b2 core file}
-if {[S 364 x {}]} {emit {of '%s'}}
-}
-if {[S 0 == .snd]} {emit {Sun/NeXT audio data:}
-switch -- [Nv I 12] 1 {emit {8-bit ISDN mu-law,}} 2 {emit {8-bit linear PCM [REF-PCM],}} 3 {emit {16-bit linear PCM,}} 4 {emit {24-bit linear PCM,}} 5 {emit {32-bit linear PCM,}} 6 {emit {32-bit IEEE floating point,}} 7 {emit {64-bit IEEE floating point,}} 8 {emit {Fragmented sample data,}} 10 {emit {DSP program,}} 11 {emit {8-bit fixed point,}} 12 {emit {16-bit fixed point,}} 13 {emit {24-bit fixed point,}} 14 {emit {32-bit fixed point,}} 18 {emit {16-bit linear with emphasis,}} 19 {emit {16-bit linear compressed,}} 20 {emit {16-bit linear with emphasis and compression,}} 21 {emit {Music kit DSP commands,}} 23 {emit {8-bit ISDN mu-law compressed \(CCITT G.721 ADPCM voice data encoding\),}} 24 {emit {compressed \(8-bit CCITT G.722 ADPCM\)}} 25 {emit {compressed \(3-bit CCITT G.723.3 ADPCM\),}} 26 {emit {compressed \(5-bit CCITT G.723.5 ADPCM\),}} 27 {emit {8-bit A-law \(CCITT G.711\),}} 
-switch -- [Nv I 20] 1 {emit mono,} 2 {emit stereo,} 4 {emit quad,} 
-if {[N I 16 > 0x0]} {emit {%d Hz}}
-}
-if {[S 0 == MThd]} {emit {Standard MIDI data}
-if {[N S 8 x {}]} {emit {\(format %d\)}}
-if {[N S 10 x {}]} {emit {using %d track}}
-if {[N S 10 > 0x1]} {emit {\bs}}
-if {[N S 12 x {} &0x7fff]} {emit {at 1/%d}}
-if {[N S 12 > 0x0 &0x8000]} {emit SMPTE}
-}
-if {[S 0 == CTMF]} {emit {Creative Music \(CMF\) data}}
-if {[S 0 == SBI]} {emit {SoundBlaster instrument data}}
-if {[S 0 == {Creative\ Voice\ File}]} {emit {Creative Labs voice data}
-if {[N c 19 == 0x1a]} {emit 139 0}
-if {[N c 23 > 0x0]} {emit {- version %d}}
-if {[N c 22 > 0x0]} {emit {\b.%d}}
-}
-if {[S 0 == EMOD]} {emit {Extended MOD sound data,}
-if {[N c 4 x {} &0xf0]} {emit {version %d}}
-if {[N c 4 x {} &0x0f]} {emit {\b.%d,}}
-if {[N c 45 x {}]} {emit {%d instruments}}
-switch -- [Nv c 83] 0 {emit {\(module\)}} 1 {emit {\(song\)}} 
-}
-if {[S 0 == .RMF]} {emit {RealMedia file}}
-if {[S 0 == MAS_U]} {emit {ULT\(imate\) Module sound data}}
-if {[S 44 == SCRM]} {emit {ScreamTracker III Module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 0 == {GF1PATCH110\0ID\#000002\0}]} {emit {GUS patch}}
-if {[S 0 == {GF1PATCH100\0ID\#000002\0}]} {emit {Old GUS	patch}}
-if {[S 0 == MAS_UTrack_V00]} {if {[S 14 > /0]} {emit {ultratracker V1.%.1s module sound data}}
-}
-if {[S 0 == UN05]} {emit {MikMod UNI format module sound data}}
-if {[S 0 == {Extended\ Module:}]} {emit {Fasttracker II module sound data}
-if {[S 17 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 21 == !SCREAM! c]} {emit {Screamtracker 2 module sound data}}
-if {[S 21 == BMOD2STM]} {emit {Screamtracker 2 module sound data}}
-if {[S 1080 == M.K.]} {emit {4-channel Protracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == M!K!]} {emit {4-channel Protracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == FLT4]} {emit {4-channel Startracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == FLT8]} {emit {8-channel Startracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == 4CHN]} {emit {4-channel Fasttracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == 6CHN]} {emit {6-channel Fasttracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == 8CHN]} {emit {8-channel Fasttracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == CD81]} {emit {8-channel Octalyser module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == OKTA]} {emit {8-channel Oktalyzer module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == 16CN]} {emit {16-channel Taketracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 1080 == 32CN]} {emit {32-channel Taketracker module sound data}
-if {[S 0 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 0 == TOC]} {emit {TOC sound file}}
-if {[S 0 == {SIDPLAY\ INFOFILE}]} {emit {Sidplay info file}}
-if {[S 0 == PSID]} {emit {PlaySID v2.2+ \(AMIGA\) sidtune}
-if {[N S 4 > 0x0]} {emit {w/ header v%d,}}
-if {[N S 14 == 0x1]} {emit {single song,}}
-if {[N S 14 > 0x1]} {emit {%d songs,}}
-if {[N S 16 > 0x0]} {emit {default song: %d}}
-if {[S 22 x {}]} {emit {name: \"%s\"}}
-if {[S 54 x {}]} {emit {author: \"%s\"}}
-if {[S 86 x {}]} {emit {copyright: \"%s\"}}
-}
-if {[S 0 == RSID]} {emit {RSID sidtune PlaySID compatible}
-if {[N S 4 > 0x0]} {emit {w/ header v%d,}}
-if {[N S 14 == 0x1]} {emit {single song,}}
-if {[N S 14 > 0x1]} {emit {%d songs,}}
-if {[N S 16 > 0x0]} {emit {default song: %d}}
-if {[S 22 x {}]} {emit {name: \"%s\"}}
-if {[S 54 x {}]} {emit {author: \"%s\"}}
-if {[S 86 x {}]} {emit {copyright: \"%s\"}}
-}
-if {[S 0 == {NIST_1A\n\ \ \ 1024\n}]} {emit {NIST SPHERE file}}
-if {[S 0 == {SOUND\ SAMPLE\ DATA\ }]} {emit {Sample Vision file}}
-if {[S 0 == 2BIT]} {emit {Audio Visual Research file,}
-switch -- [Nv S 12] 0 {emit mono,} -1 {emit stereo,} 
-if {[N S 14 x {}]} {emit {%d bits}}
-switch -- [Nv S 16] 0 {emit unsigned,} -1 {emit signed,} 
-if {[N I 22 x {} &0x00ffffff]} {emit {%d Hz,}}
-switch -- [Nv S 18] 0 {emit {no loop,}} -1 {emit loop,} 
-if {[N c 21 <= 0x7f]} {emit {note %d,}}
-switch -- [Nv c 22] 0 {emit {replay 5.485 KHz}} 1 {emit {replay 8.084 KHz}} 2 {emit {replay 10.971 Khz}} 3 {emit {replay 16.168 Khz}} 4 {emit {replay 21.942 KHz}} 5 {emit {replay 32.336 KHz}} 6 {emit {replay 43.885 KHz}} 7 {emit {replay 47.261 KHz}} 
-}
-if {[S 0 == _SGI_SoundTrack]} {emit {SGI SoundTrack project file}}
-if {[S 0 == ID3]} {emit {MP3 file with ID3 version 2.}
-if {[N c 3 < 0xff]} {emit {\b%d.}}
-if {[N c 4 < 0xff]} {emit {\b%d tag}}
-}
-if {[S 0 == {NESM\x1a}]} {emit {NES Sound File}
-if {[S 14 x {}]} {emit {\(\"%s\" by}}
-if {[S 46 x {}]} {emit {%s, copyright}}
-if {[S 78 x {}]} {emit {%s\),}}
-if {[N c 5 x {}]} {emit {version %d,}}
-if {[N c 6 x {}]} {emit {%d tracks,}}
-if {[N c 122 == 0x1 &0x2]} {emit {dual PAL/NTSC}}
-switch -- [Nv c 122 &0x1] 1 {emit PAL} 0 {emit NTSC} 
-}
-if {[S 0 == IMPM]} {emit {Impulse Tracker module sound data -}
-if {[S 4 x {}]} {emit {\"%s\"}}
-if {[N s 40 != 0x0]} {emit {compatible w/ITv%x}}
-if {[N s 42 != 0x0]} {emit {created w/ITv%x}}
-}
-if {[S 60 == IM10]} {emit {Imago Orpheus module sound data -}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 0 == IMPS]} {emit {Impulse Tracker Sample}
-if {[N c 18 & 0x2]} {emit {16 bit}}
-if {[N c 18 ^ 0x2]} {emit {8 bit}}
-if {[N c 18 & 0x4]} {emit stereo}
-if {[N c 18 ^ 0x4]} {emit mono}
-}
-if {[S 0 == IMPI]} {emit {Impulse Tracker Instrument}
-if {[N s 28 != 0x0]} {emit ITv%x}
-if {[N c 30 != 0x0]} {emit {%d samples}}
-}
-if {[S 0 == LM8953]} {emit {Yamaha TX Wave}
-switch -- [Nv c 22] 73 {emit looped} -55 {emit non-looped} 
-switch -- [Nv c 23] 1 {emit 33kHz} 2 {emit 50kHz} 3 {emit 16kHz} 
-}
-if {[S 76 == SCRS]} {emit {Scream Tracker Sample}
-switch -- [Nv c 0] 1 {emit sample} 2 {emit {adlib melody}} 
-if {[N c 0 > 0x2]} {emit {adlib drum}}
-if {[N c 31 & 0x2]} {emit stereo}
-if {[N c 31 ^ 0x2]} {emit mono}
-if {[N c 31 & 0x4]} {emit {16bit little endian}}
-if {[N c 31 ^ 0x4]} {emit 8bit}
-switch -- [Nv c 30] 0 {emit unpacked} 1 {emit packed} 
-}
-if {[S 0 == MMD0]} {emit {MED music file, version 0}}
-if {[S 0 == MMD1]} {emit {OctaMED Pro music file, version 1}}
-if {[S 0 == MMD3]} {emit {OctaMED Soundstudio music file, version 3}}
-if {[S 0 == OctaMEDCmpr]} {emit {OctaMED Soundstudio compressed file}}
-if {[S 0 == MED]} {emit MED_Song}
-if {[S 0 == SymM]} {emit {Symphonie SymMOD music file}}
-if {[S 0 == THX]} {emit {AHX version}
-switch -- [Nv c 3] 0 {emit {1 module data}} 1 {emit {2 module data}} 
-}
-if {[S 0 == OKTASONG]} {emit {Oktalyzer module data}}
-if {[S 0 == {DIGI\ Booster\ module\0}]} {emit %s
-if {[N c 20 > 0x0]} {emit %c
-if {[N c 21 > 0x0]} {emit {\b%c}
-if {[N c 22 > 0x0]} {emit {\b%c}
-if {[N c 23 > 0x0]} {emit {\b%c}}
-}
-}
-}
-if {[S 610 x {}]} {emit {\b, \"%s\"}}
-}
-if {[S 0 == DBM0]} {emit {DIGI Booster Pro Module}
-if {[N c 4 > 0x0]} {emit V%X.
-if {[N c 5 x {}]} {emit {\b%02X}}
-}
-if {[S 16 x {}]} {emit {\b, \"%s\"}}
-}
-if {[S 0 == FTMN]} {emit {FaceTheMusic module}
-if {[S 16 > {\0d}]} {emit {\b, \"%s\"}}
-}
-if {[S 0 == {AMShdr\32}]} {emit {Velvet Studio AMS Module v2.2}}
-if {[S 0 == Extreme]} {emit {Extreme Tracker AMS Module v1.3}}
-if {[S 0 == DDMF]} {emit {Xtracker DMF Module}
-if {[N c 4 x {}]} {emit v%i}
-if {[S 13 x {}]} {emit {Title: \"%s\"}}
-if {[S 43 x {}]} {emit {Composer: \"%s\"}}
-}
-if {[S 0 == {DSM\32}]} {emit {Dynamic Studio Module DSM}}
-if {[S 0 == SONG]} {emit {DigiTrekker DTM Module}}
-if {[S 0 == DMDL]} {emit {DigiTrakker MDL Module}}
-if {[S 0 == {PSM\32}]} {emit {Protracker Studio PSM Module}}
-if {[S 44 == PTMF]} {emit {Poly Tracker PTM Module}
-if {[S 0 > {\32}]} {emit {Title: \"%s\"}}
-}
-if {[S 0 == MT20]} {emit {MadTracker 2.0 Module MT2}}
-if {[S 0 == {RAD\40by\40REALiTY!!}]} {emit {RAD Adlib Tracker Module RAD}}
-if {[S 0 == RTMM]} {emit {RTM Module}}
-if {[S 1062 == MaDoKaN96]} {emit {XMS Adlib Module}
-if {[S 0 x {}]} {emit {Composer: \"%s\"}}
-}
-if {[S 0 == AMF]} {emit {AMF Module}
-if {[S 4 x {}]} {emit {Title: \"%s\"}}
-}
-if {[S 0 == MODINFO1]} {emit {Open Cubic Player Module Inforation MDZ}}
-if {[S 0 == {Extended\40Instrument:}]} {emit {Fast Tracker II Instrument}}
-if {[S 0 == {\210NOA\015\012\032}]} {emit {NOA Nancy Codec Movie file}}
-if {[S 0 == MMMD]} {emit {Yamaha SMAF file}}
-if {[S 0 == {\001Sharp\040JisakuMelody}]} {emit {SHARP Cell-Phone ringing Melody}
-if {[S 20 == Ver01.00]} {emit {Ver. 1.00}
-if {[N c 32 x {}]} {emit {, %d tracks}}
-}
-}
-if {[S 0 == fLaC]} {emit {FLAC audio bitstream data}
-if {[N c 4 > 0x0 &0x7f]} {emit {\b, unknown version}}
-if {[N c 4 == 0x0 &0x7f]} {emit {\b}
-switch -- [Nv S 20 &0x1f0] 48 {emit {\b, 4 bit}} 80 {emit {\b, 6 bit}} 112 {emit {\b, 8 bit}} 176 {emit {\b, 12 bit}} 240 {emit {\b, 16 bit}} 368 {emit {\b, 24 bit}} 
-switch -- [Nv c 20 &0xe] 0 {emit {\b, mono}} 2 {emit {\b, stereo}} 4 {emit {\b, 3 channels}} 6 {emit {\b, 4 channels}} 8 {emit {\b, 5 channels}} 10 {emit {\b, 6 channels}} 12 {emit {\b, 7 channels}} 14 {emit {\b, 8 channels}} 
-switch -- [Nv I 17 &0xfffff0] 705600 {emit {\b, 44.1 kHz}} 768000 {emit {\b, 48 kHz}} 512000 {emit {\b, 32 kHz}} 352800 {emit {\b, 22.05 kHz}} 384000 {emit {\b, 24 kHz}} 256000 {emit {\b, 16 kHz}} 176400 {emit {\b, 11.025 kHz}} 192000 {emit {\b, 12 kHz}} 128000 {emit {\b, 8 kHz}} 1536000 {emit {\b, 96 kHz}} 1024000 {emit {\b, 64 kHz}} 
-if {[N c 21 > 0x0 &0xf]} {emit {\b, >4G samples}}
-if {[N c 21 == 0x0 &0xf]} {emit {\b}
-if {[N I 22 > 0x0]} {emit {\b, %u samples}}
-if {[N I 22 == 0x0]} {emit {\b, length unknown}}
-}
-}
-}
-if {[S 0 == VBOX]} {emit {VBOX voice message data}}
-if {[S 8 == RB40]} {emit {RBS Song file}
-if {[S 29 == ReBorn]} {emit {created by ReBorn}}
-if {[S 37 == Propellerhead]} {emit {created by ReBirth}}
-}
-if {[S 0 == {A\#S\#C\#S\#S\#L\#V\#3}]} {emit {Synthesizer Generator or Kimwitu data}}
-if {[S 0 == {A\#S\#C\#S\#S\#L\#HUB}]} {emit {Kimwitu++ data}}
-if {[S 0 == TFMX-SONG]} {emit {TFMX module sound data}}
-if {[S 0 == {MAC\	X/Monkey}]} {emit audio,
-if {[N s 4 > 0x0]} {emit {version %d,}}
-if {[N s 6 > 0x0]} {emit {compression level %d,}}
-if {[N s 8 > 0x0]} {emit {flags %x,}}
-if {[N s 10 > 0x0]} {emit {channels %d,}}
-if {[N i 12 > 0x0]} {emit {samplerate %d,}}
-if {[N i 24 > 0x0]} {emit {frames %d}}
-}
-if {[S 0 == bFLT]} {emit {BFLT executable}
-if {[N I 4 x {}]} {emit {- version %ld}}
-if {[N I 4 == 0x4]} {if {[N I 36 == 0x1 &0x1]} {emit ram}
-if {[N I 36 == 0x2 &0x2]} {emit gotpic}
-if {[N I 36 == 0x4 &0x4]} {emit gzip}
-if {[N I 36 == 0x8 &0x8]} {emit gzdata}
-}
-}
-if {[S 0 == BLENDER]} {emit Blender3D,
-if {[S 7 == _]} {emit {saved as 32-bits}}
-if {[S 7 == -]} {emit {saved as 64-bits}}
-if {[S 8 == v]} {emit {little endian}}
-if {[S 8 == V]} {emit {big endian}}
-if {[N c 9 x {}]} {emit {with version %c.}}
-if {[N c 10 x {}]} {emit {\b%c}}
-if {[N c 11 x {}]} {emit {\b%c}}
-}
-if {[S 0 == !<bout>]} {emit {b.out archive}
-if {[S 8 == __.SYMDEF]} {emit {random library}}
-}
-switch -- [Nv I 0 &077777777] 196875 {emit {sparc demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x1000]} {emit {shared library}}
-if {[N I 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-if {[N I 36 == 0xb4100001]} {emit {\(uses shared libs\)}}
-} 196872 {emit {sparc pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-if {[N I 36 == 0xb4100001]} {emit {\(uses shared libs\)}}
-} 196871 {emit sparc
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-if {[N I 36 == 0xb4100001]} {emit {\(uses shared libs\)}}
-} 196875 {emit {sparc demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x1000]} {emit {shared library}}
-if {[N I 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 196872 {emit {sparc pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 196871 {emit sparc
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 131339 {emit {mc68020 demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x1000]} {emit {shared library}}
-if {[N I 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 131336 {emit {mc68020 pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 131335 {emit mc68020
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 65803 {emit {mc68010 demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x1000]} {emit {shared library}}
-if {[N I 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 65800 {emit {mc68010 pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 65799 {emit mc68010
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 
-if {[S 0 == cscope]} {emit {cscope reference data}
-if {[S 7 x {}]} {emit {version %.2s}}
-if {[S 7 > 14]} {emit 218 1}
-}
-switch -- [Nv I 91392] 302072064 {emit {D64 Image}} 302072192 {emit {D71 Image}} 
-if {[N I 399360 == 0x28034400]} {emit {D81 Image}}
-if {[S 0 == {C64\40CARTRIDGE}]} {emit {CCS C64 Emultar Cartridge Image}}
-if {[S 0 == GCR-1541]} {emit {GCR Image}
-if {[N c 8 x {}]} {emit {version: $i}}
-if {[N c 9 x {}]} {emit {tracks: %i}}
-}
-if {[S 9 == PSUR]} {emit {ARC archive \(c64\)}}
-if {[S 2 == -LH1-]} {emit {LHA archive \(c64\)}}
-if {[S 0 == C64File]} {emit {PC64 Emulator file}
-if {[S 8 x {}]} {emit {\"%s\"}}
-}
-if {[S 0 == C64Image]} {emit {PC64 Freezer Image}}
-if {[S 0 == {CBM\144\0\0}]} {emit {Power 64 C64 Emulator Snapshot}}
-if {[S 0 == {\101\103\061\060\061}]} {emit AutoCAD
-if {[S 5 == {\062\000\000\000\000}]} {emit {DWG ver. R13}}
-if {[S 5 == {\064\000\000\000\000}]} {emit {DWG ver. R14}}
-}
-if {[S 0 == {\010\011\376}]} {emit Microstation
-if {[S 3 == {\002}]} {if {[S 30 == {\372\104}]} {emit {DGN File}}
-if {[S 30 == {\172\104}]} {emit {DGN File}}
-if {[S 30 == {\026\105}]} {emit {DGN File}}
-}
-if {[S 4 == {\030\000\000}]} {emit {CIT File}}
-}
-if {[S 0 == AC1012]} {emit {AutoCad \(release 12\)}}
-if {[S 0 == AC1014]} {emit {AutoCad \(release 14\)}}
-if {[S 0 == {\#\040xmcd} b]} {emit {CDDB\(tm\) format CD text data}}
-if {[S 0 == {\\1cw\ }]} {emit {ChiWriter file}
-if {[S 5 x {}]} {emit {version %s}}
-}
-if {[S 0 == {\\1cw}]} {emit {ChiWriter file}}
-if {[S 0 == {\{title}]} {emit {Chord text file}}
-if {[S 0 == RuneCT]} {emit {Citrus locale declaration for LC_CTYPE}}
-if {[S 514 == {\377\377\377\377\000}]} {emit {Claris clip art?}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0}]} {emit yes.}
-}
-if {[S 514 == {\377\377\377\377\001}]} {emit {Claris clip art?}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0}]} {emit yes.}
-}
-if {[S 0 == {\002\000\210\003\102\117\102\117\000\001\206}]} {emit {Claris works document}}
-if {[S 0 == {\020\341\000\000\010\010}]} {emit {Claris Works pallete files .plt}}
-if {[S 0 == {\002\271\262\000\040\002\000\164}]} {emit {Claris works dictionary}}
-if {[S 0 == GRG]} {emit {Gringotts data file}
-if {[S 3 == 1]} {emit {v.1, MCRYPT S2K, SERPENT crypt, SHA-256 hash, ZLib lvl.9}}
-if {[S 3 == 2]} {emit {v.2, MCRYPT S2K,}
-switch -- [Nv c 8 &0x70] 0 {emit {RIJNDAEL-128 crypt,}} 16 {emit {SERPENT crypt,}} 32 {emit {TWOFISH crypt,}} 48 {emit {CAST-256 crypt,}} 64 {emit {SAFER+ crypt,}} 80 {emit {LOKI97 crypt,}} 96 {emit {3DES crypt,}} 112 {emit {RIJNDAEL-256 crypt,}} 
-switch -- [Nv c 8 &0x08] 0 {emit {SHA1 hash,}} 8 {emit {RIPEMD-160 hash,}} 
-switch -- [Nv c 8 &0x04] 0 {emit ZLib} 4 {emit BZip2} 
-switch -- [Nv c 8 &0x03] 0 {emit lvl.0} 1 {emit lvl.3} 2 {emit lvl.6} 3 {emit lvl.9} 
-}
-if {[S 3 == 3]} {emit {v.3, OpenPGP S2K,}
-switch -- [Nv c 8 &0x70] 0 {emit {RIJNDAEL-128 crypt,}} 16 {emit {SERPENT crypt,}} 32 {emit {TWOFISH crypt,}} 48 {emit {CAST-256 crypt,}} 64 {emit {SAFER+ crypt,}} 80 {emit {LOKI97 crypt,}} 96 {emit {3DES crypt,}} 112 {emit {RIJNDAEL-256 crypt,}} 
-switch -- [Nv c 8 &0x08] 0 {emit {SHA1 hash,}} 8 {emit {RIPEMD-160 hash,}} 
-switch -- [Nv c 8 &0x04] 0 {emit ZLib} 4 {emit BZip2} 
-switch -- [Nv c 8 &0x03] 0 {emit lvl.0} 1 {emit lvl.3} 2 {emit lvl.6} 3 {emit lvl.9} 
-}
-if {[S 3 > 3]} {emit {v.%.1s \(unknown details\)}}
-}
-if {[S 0 == :]} {emit {shell archive or script for antique kernel text}}
-if {[S 0 == {\#!\ /bin/sh} b]} {emit {Bourne shell script text executable}}
-if {[S 0 == {\#!\ /bin/csh} b]} {emit {C shell script text executable}}
-if {[S 0 == {\#!\ /bin/ksh} b]} {emit {Korn shell script text executable}}
-if {[S 0 == {\#!\ /bin/tcsh} b]} {emit {Tenex C shell script text executable}}
-if {[S 0 == {\#!\ /usr/local/tcsh} b]} {emit {Tenex C shell script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/tcsh} b]} {emit {Tenex C shell script text executable}}
-if {[S 0 == {\#!\ /bin/zsh} b]} {emit {Paul Falstad's zsh script text executable}}
-if {[S 0 == {\#!\ /usr/bin/zsh} b]} {emit {Paul Falstad's zsh script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/zsh} b]} {emit {Paul Falstad's zsh script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/ash} b]} {emit {Neil Brown's ash script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/ae} b]} {emit {Neil Brown's ae script text executable}}
-if {[S 0 == {\#!\ /bin/nawk} b]} {emit {new awk script text executable}}
-if {[S 0 == {\#!\ /usr/bin/nawk} b]} {emit {new awk script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/nawk} b]} {emit {new awk script text executable}}
-if {[S 0 == {\#!\ /bin/gawk} b]} {emit {GNU awk script text executable}}
-if {[S 0 == {\#!\ /usr/bin/gawk} b]} {emit {GNU awk script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/gawk} b]} {emit {GNU awk script text executable}}
-if {[S 0 == {\#!\ /bin/awk} b]} {emit {awk script text executable}}
-if {[S 0 == {\#!\ /usr/bin/awk} b]} {emit {awk script text executable}}
-if {[S 0 == BEGIN]} {emit {awk script text}}
-if {[S 0 == {\#!\ /bin/rc} b]} {emit {Plan 9 rc shell script text executable}}
-if {[S 0 == {\#!\ /bin/bash} b]} {emit {Bourne-Again shell script text executable}}
-if {[S 0 == {\#!\ /usr/local/bin/bash} b]} {emit {Bourne-Again shell script text executable}}
-if {[S 0 == {\#!/usr/bin/env}]} {emit a
-if {[S 15 x {}]} {emit {%s script text executable}}
-}
-if {[S 0 == {\#!\ /usr/bin/env}]} {emit a
-if {[S 16 x {}]} {emit {%s script text executable}}
-}
-if {[S 0 == <?php c]} {emit {PHP script text}}
-if {[S 0 == {<?\n}]} {emit {PHP script text}}
-if {[S 0 == {<?\r}]} {emit {PHP script text}}
-if {[S 0 == {\#!\ /usr/local/bin/php} b]} {emit {PHP script text executable}}
-if {[S 0 == {\#!\ /usr/bin/php} b]} {emit {PHP script text executable}}
-if {[S 0 == {Zend\x00}]} {emit {PHP script Zend Optimizer data}}
-if {[Sx 1 0 == {$Suite}]} {emit {TTCN Abstract Test Suite}
-if {[Sx 2 [R 1] == {$SuiteId}]} {if {[S [R 1] > {\n}]} {emit %s}
-}
-L 1;if {[Sx 2 [R 2] == {$SuiteId}]} {if {[S [R 1] > {\n}]} {emit %s}
-}
-L 1;if {[Sx 2 [R 3] == {$SuiteId}]} {if {[S [R 1] > {\n}]} {emit %s}
-}
-}
-if {[S 0 == mscdocument]} {emit {Message Sequence Chart \(document\)}}
-if {[S 0 == msc]} {emit {Message Sequence Chart \(chart\)}}
-if {[S 0 == submsc]} {emit {Message Sequence Chart \(subchart\)}}
-if {[S 0 == {\037\235}]} {emit {compress'd data}
-if {[N c 2 > 0x0 &0x80]} {emit {block compressed}}
-if {[N c 2 x {} &0x1f]} {emit {%d bits}}
-}
-if {[S 0 == {\037\213}]} {emit {gzip compressed data}
-if {[N c 2 < 0x8]} {emit {\b, reserved method}}
-if {[N c 2 > 0x8]} {emit {\b, unknown method}}
-if {[N c 3 & 0x1]} {emit {\b, ASCII}}
-if {[N c 3 & 0x2]} {emit {\b, continuation}}
-if {[N c 3 & 0x4]} {emit {\b, extra field}}
-if {[N c 3 == 0x8 &0xC]} {if {[S 10 x {}]} {emit {\b, was \"%s\"}}
-}
-switch -- [Nv c 9] 0 {emit {\b, from MS-DOS}} 1 {emit {\b, from Amiga}} 2 {emit {\b, from VMS}} 3 {emit {\b, from Unix}} 5 {emit {\b, from Atari}} 6 {emit {\b, from OS/2}} 7 {emit {\b, from MacOS}} 10 {emit {\b, from Tops/20}} 11 {emit {\b, from Win/32}} 
-if {[N c 3 & 0x10]} {emit {\b, comment}}
-if {[N c 3 & 0x20]} {emit {\b, encrypted}}
-switch -- [Nv c 8] 2 {emit {\b, max compression}} 4 {emit {\b, max speed}} 
-}
-if {[S 0 == {\037\036}]} {emit {packed data}
-if {[N I 2 > 0x1]} {emit {\b, %d characters originally}}
-if {[N I 2 == 0x1]} {emit {\b, %d character originally}}
-}
-if {[S 0 == {\377\037}]} {emit {compacted data}}
-if {[S 0 == BZh]} {emit {bzip2 compressed data}
-if {[N c 3 > 0x2f]} {emit {\b, block size = %c00k}}
-}
-if {[S 0 == {\037\237}]} {emit {frozen file 2.1}}
-if {[S 0 == {\037\236}]} {emit {frozen file 1.0 \(or gzip 0.5\)}}
-if {[S 0 == {\037\240}]} {emit {SCO compress -H \(LZH\) data}}
-if {[S 0 == BZ]} {emit {bzip compressed data}
-if {[N c 2 x {}]} {emit {\b, version: %c}}
-if {[S 3 == 1]} {emit {\b, compression block size 100k}}
-if {[S 3 == 2]} {emit {\b, compression block size 200k}}
-if {[S 3 == 3]} {emit {\b, compression block size 300k}}
-if {[S 3 == 4]} {emit {\b, compression block size 400k}}
-if {[S 3 == 5]} {emit {\b, compression block size 500k}}
-if {[S 3 == 6]} {emit {\b, compression block size 600k}}
-if {[S 3 == 7]} {emit {\b, compression block size 700k}}
-if {[S 3 == 8]} {emit {\b, compression block size 800k}}
-if {[S 3 == 9]} {emit {\b, compression block size 900k}}
-}
-if {[S 0 == {\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a}]} {emit {lzop compressed data}
-if {[N S 9 < 0x940]} {if {[N c 9 == 0x0 &0xf0]} {emit {- version 0.}}
-if {[N S 9 x {} &0x0fff]} {emit {\b%03x,}}
-switch -- [Nv c 13] 1 {emit LZO1X-1,} 2 {emit {LZO1X-1\(15\),}} 3 {emit LZO1X-999,} 
-switch -- [Nv c 14] 0 {emit {os: MS-DOS}} 1 {emit {os: Amiga}} 2 {emit {os: VMS}} 3 {emit {os: Unix}} 5 {emit {os: Atari}} 6 {emit {os: OS/2}} 7 {emit {os: MacOS}} 10 {emit {os: Tops/20}} 11 {emit {os: WinNT}} 14 {emit {os: Win32}} 
-}
-if {[N S 9 > 0x939]} {switch -- [Nv c 9 &0xf0] 0 {emit {- version 0.}} 16 {emit {- version 1.}} 32 {emit {- version 2.}} 
-if {[N S 9 x {} &0x0fff]} {emit {\b%03x,}}
-switch -- [Nv c 15] 1 {emit LZO1X-1,} 2 {emit {LZO1X-1\(15\),}} 3 {emit LZO1X-999,} 
-switch -- [Nv c 17] 0 {emit {os: MS-DOS}} 1 {emit {os: Amiga}} 2 {emit {os: VMS}} 3 {emit {os: Unix}} 5 {emit {os: Atari}} 6 {emit {os: OS/2}} 7 {emit {os: MacOS}} 10 {emit {os: Tops/20}} 11 {emit {os: WinNT}} 14 {emit {os: Win32}} 
-}
-}
-if {[S 0 == {\037\241}]} {emit {Quasijarus strong compressed data}}
-if {[S 0 == XPKF]} {emit {Amiga xpkf.library compressed data}}
-if {[S 0 == PP11]} {emit {Power Packer 1.1 compressed data}}
-if {[S 0 == PP20]} {emit {Power Packer 2.0 compressed data,}
-switch -- [Nv I 4] 151587081 {emit {fast compression}} 151652874 {emit {mediocre compression}} 151653131 {emit {good compression}} 151653388 {emit {very good compression}} 151653389 {emit {best compression}} 
-}
-if {[S 0 == {7z\274\257\047\034}]} {emit {7z archive data,}
-if {[N c 6 x {}]} {emit {version %d}}
-if {[N c 7 x {}]} {emit {\b.%d}}
-}
-if {[S 2 == -afx-]} {emit {AFX compressed file data}}
-if {[S 0 == {NES\032}]} {emit {iNES ROM dump,}
-if {[N c 4 x {}]} {emit {%dx16k PRG}}
-if {[N c 5 x {}]} {emit {\b, %dx8k CHR}}
-switch -- [Nv c 6 &0x01] 1 {emit {\b, [Vert.]}} 0 {emit {\b, [Horiz.]}} 
-if {[N c 6 == 0x2 &0x02]} {emit {\b, [SRAM]}}
-switch -- [Nv c 6 &0x04] 4 {emit {\b, [Trainer]}} 8 {emit {\b, [4-Scr]}} 
-}
-if {[N I 260 == 0xceed6666]} {emit {Gameboy ROM:}
-if {[S 308 x {}]} {emit {\"%.16s\"}}
-if {[N c 326 == 0x3]} {emit {\b,[SGB]}}
-switch -- [Nv c 327] 0 {emit {\b, [ROM ONLY]}} 1 {emit {\b, [ROM+MBC1]}} 2 {emit {\b, [ROM+MBC1+RAM]}} 3 {emit {\b, [ROM+MBC1+RAM+BATT]}} 5 {emit {\b, [ROM+MBC2]}} 6 {emit {\b, [ROM+MBC2+BATTERY]}} 8 {emit {\b, [ROM+RAM]}} 9 {emit {\b, [ROM+RAM+BATTERY]}} 11 {emit {\b, [ROM+MMM01]}} 12 {emit {\b, [ROM+MMM01+SRAM]}} 13 {emit {\b, [ROM+MMM01+SRAM+BATT]}} 15 {emit {\b, [ROM+MBC3+TIMER+BATT]}} 16 {emit {\b, [ROM+MBC3+TIMER+RAM+BATT]}} 17 {emit {\b, [ROM+MBC3]}} 18 {emit {\b, [ROM+MBC3+RAM]}} 19 {emit {\b, [ROM+MBC3+RAM+BATT]}} 25 {emit {\b, [ROM+MBC5]}} 26 {emit {\b, [ROM+MBC5+RAM]}} 27 {emit {\b, [ROM+MBC5+RAM+BATT]}} 28 {emit {\b, [ROM+MBC5+RUMBLE]}} 29 {emit {\b, [ROM+MBC5+RUMBLE+SRAM]}} 30 {emit {\b, [ROM+MBC5+RUMBLE+SRAM+BATT]}} 31 {emit {\b, [Pocket Camera]}} -3 {emit {\b, [Bandai TAMA5]}} -2 {emit {\b, [Hudson HuC-3]}} -1 {emit {\b, [Hudson HuC-1]}} 
-switch -- [Nv c 328] 0 {emit {\b, ROM: 256Kbit}} 1 {emit {\b, ROM: 512Kbit}} 2 {emit {\b, ROM: 1Mbit}} 3 {emit {\b, ROM: 2Mbit}} 4 {emit {\b, ROM: 4Mbit}} 5 {emit {\b, ROM: 8Mbit}} 6 {emit {\b, ROM: 16Mbit}} 82 {emit {\b, ROM: 9Mbit}} 83 {emit {\b, ROM: 10Mbit}} 84 {emit {\b, ROM: 12Mbit}} 
-switch -- [Nv c 329] 1 {emit {\b, RAM: 16Kbit}} 2 {emit {\b, RAM: 64Kbit}} 3 {emit {\b, RAM: 128Kbit}} 4 {emit {\b, RAM: 1Mbit}} 
-}
-if {[S 256 == SEGA]} {emit {Sega MegaDrive/Genesis raw ROM dump}
-if {[S 288 x {}]} {emit {Name: \"%.16s\"}}
-if {[S 272 x {}]} {emit %.16s}
-if {[S 432 == RA]} {emit {with SRAM}}
-}
-if {[S 640 == EAGN]} {emit {Super MagicDrive ROM dump}
-if {[N c 0 x {}]} {emit {%dx16k blocks}}
-if {[N c 2 == 0x0]} {emit {\b, last in series or standalone}}
-if {[N c 2 > 0x0]} {emit {\b, split ROM}}
-if {[N c 8 == 0xaa]} {emit 298 3}
-if {[N c 9 == 0xbb]} {emit 298 4}
-}
-if {[S 640 == EAMG]} {emit {Super MagicDrive ROM dump}
-if {[N c 0 x {}]} {emit {%dx16k blocks}}
-if {[N c 2 x {}]} {emit {\b, last in series or standalone}}
-if {[N c 8 == 0xaa]} {emit 299 2}
-if {[N c 9 == 0xbb]} {emit 299 3}
-}
-if {[S 0 == LCDi]} {emit {Dream Animator file}}
-if {[S 0 == {PS-X\ EXE}]} {emit {Sony Playstation executable}
-if {[S 113 x {}]} {emit {\(%s\)}}
-}
-if {[S 0 == XBEH]} {emit {XBE, Microsoft Xbox executable}
-if {[Nx 2 i 4 == 0x0]} {if {[Nx 3 i [R 2] == 0x0]} {if {[N i [R 2] == 0x0]} {emit {\b, not signed}}
-}
-}
-if {[Nx 2 i 4 > 0x0]} {if {[Nx 3 i [R 2] > 0x0]} {if {[N i [R 2] > 0x0]} {emit {\b, signed}}
-}
-}
-if {[N i 260 == 0x10000]} {if {[N i [I 280 Q -65376] == 0x80000007 &0x80000007]} {emit {\b, all regions}}
-if {[N i [I 280 Q -65376] != 0x80000007 &0x80000007]} {if {[N i [I 280 Q -65376] > 0x0]} {emit {\(regions:}
-if {[N i [I 280 Q -65376] & 0x1]} {emit NA}
-if {[N i [I 280 Q -65376] & 0x2]} {emit Japan}
-if {[N i [I 280 Q -65376] & 0x4]} {emit Rest_of_World}
-if {[N i [I 280 Q -65376] & 0x80000000]} {emit Manufacturer}
-}
-if {[N i [I 280 Q -65376] > 0x0]} {emit {\b\)}}
-}
-}
-}
-if {[S 0 == XIP0]} {emit {XIP, Microsoft Xbox data}}
-if {[S 0 == XTF0]} {emit {XTF, Microsoft Xbox data}}
-if {[S 0 == Glul]} {emit {Glulx game data}
-if {[S 8 == IFRS]} {emit {\b, Blorb Interactive Fiction}
-if {[S 24 == Exec]} {emit {with executable chunk}}
-}
-if {[S 8 == IFZS]} {emit {\b, Z-machine or Glulx saved game file \(Quetzal\)}}
-}
-switch -- [Nv I 24] 60011 {emit {dump format, 4.1 BSD or earlier}} 60012 {emit {dump format, 4.2 or 4.3 BSD without IDC}} 60013 {emit {dump format, 4.2 or 4.3 BSD \(IDC compatible\)}} 60014 {emit {dump format, Convex Storage Manager by-reference dump}} 60012 {emit {new-fs dump file \(big endian\),}
-if {[N S 4 x {}]} {emit {Previous dump %s,}}
-if {[N S 8 x {}]} {emit {This dump %s,}}
-if {[N I 12 > 0x0]} {emit {Volume %ld,}}
-if {[N I 692 == 0x0]} {emit {Level zero, type:}}
-if {[N I 692 > 0x0]} {emit {Level %d, type:}}
-switch -- [Nv I 0] 1 {emit {tape header,}} 2 {emit {beginning of file record,}} 3 {emit {map of inodes on tape,}} 4 {emit {continuation of file record,}} 5 {emit {end of volume,}} 6 {emit {map of inodes deleted,}} 7 {emit {end of medium \(for floppy\),}} 
-if {[S 676 x {}]} {emit {Label %s,}}
-if {[S 696 x {}]} {emit {Filesystem %s,}}
-if {[S 760 x {}]} {emit {Device %s,}}
-if {[S 824 x {}]} {emit {Host %s,}}
-if {[N I 888 > 0x0]} {emit {Flags %x}}
-} 60011 {emit {old-fs dump file \(big endian\),}
-if {[N I 12 > 0x0]} {emit {Volume %ld,}}
-if {[N I 692 == 0x0]} {emit {Level zero, type:}}
-if {[N I 692 > 0x0]} {emit {Level %d, type:}}
-switch -- [Nv I 0] 1 {emit {tape header,}} 2 {emit {beginning of file record,}} 3 {emit {map of inodes on tape,}} 4 {emit {continuation of file record,}} 5 {emit {end of volume,}} 6 {emit {map of inodes deleted,}} 7 {emit {end of medium \(for floppy\),}} 
-if {[S 676 x {}]} {emit {Label %s,}}
-if {[S 696 x {}]} {emit {Filesystem %s,}}
-if {[S 760 x {}]} {emit {Device %s,}}
-if {[S 824 x {}]} {emit {Host %s,}}
-if {[N I 888 > 0x0]} {emit {Flags %x}}
-} 
-if {[S 0 == !_TAG]} {emit {Exuberant Ctags tag file text}}
-if {[S 0 == GDBM]} {emit {GNU dbm 2.x database}}
-switch -- [Nv Q 12] 398689 {emit {Berkeley DB}
-if {[N Q 16 > 0x0]} {emit {\(Hash, version %d, native byte-order\)}}
-} 340322 {emit {Berkeley DB}
-if {[N Q 16 > 0x0]} {emit {\(Btree, version %d, native byte-order\)}}
-} 270931 {emit {Berkeley DB}
-if {[N Q 16 > 0x0]} {emit {\(Queue, version %d, native byte-order\)}}
-} 264584 {emit {Berkeley DB}
-if {[N Q 16 > 0x0]} {emit {\(Log, version %d, native byte-order\)}}
-} 
-switch -- [Nv I 12] 398689 {emit {Berkeley DB}
-if {[N I 16 > 0x0]} {emit {\(Hash, version %d, big-endian\)}}
-} 340322 {emit {Berkeley DB}
-if {[N I 16 > 0x0]} {emit {\(Btree, version %d, big-endian\)}}
-} 270931 {emit {Berkeley DB}
-if {[N I 16 > 0x0]} {emit {\(Queue, version %d, big-endian\)}}
-} 264584 {emit {Berkeley DB}
-if {[N I 16 > 0x0]} {emit {\(Log, version %d, big-endian\)}}
-} 
-switch -- [Nv i 12] 398689 {emit {Berkeley DB}
-if {[N i 16 > 0x0]} {emit {\(Hash, version %d, little-endian\)}}
-} 340322 {emit {Berkeley DB}
-if {[N i 16 > 0x0]} {emit {\(Btree, version %d, little-endian\)}}
-} 270931 {emit {Berkeley DB}
-if {[N i 16 > 0x0]} {emit {\(Queue, version %d, little-endian\)}}
-} 264584 {emit {Berkeley DB}
-if {[N i 16 > 0x0]} {emit {\(Log, version %d, little-endian\)}}
-} 
-if {[S 0 == RRD]} {emit {RRDTool DB}
-if {[S 4 x {}]} {emit {version %s}}
-}
-if {[S 0 == {root\0}]} {emit {ROOT file}
-if {[N I 4 x {}]} {emit {Version %d}}
-if {[N I 33 x {}]} {emit {\(Compression: %d\)}}
-}
-if {[S 4 == {Standard\ Jet\ DB}]} {emit {Microsoft Access Database}}
-if {[S 0 == {TDB\ file}]} {emit {TDB database}
-if {[N i 32 == 0x2601196d]} {emit {version 6, little-endian}
-if {[N i 36 x {}]} {emit {hash size %d bytes}}
-}
-}
-if {[S 2 == ICE]} {emit {ICE authority data}}
-if {[S 10 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 11 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 12 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 13 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 14 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 15 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 16 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 17 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 18 == MIT-MAGIC-COOKIE-1]} {emit {X11 Xauthority data}}
-if {[S 0 == {<list>\n<protocol\ bbn-m}]} {emit {Diamond Multimedia Document}}
-if {[S 0 == {diff\ }]} {emit {'diff' output text}}
-if {[S 0 == {***\ }]} {emit {'diff' output text}}
-if {[S 0 == {Only\ in\ }]} {emit {'diff' output text}}
-if {[S 0 == {Common\ subdirectories:\ }]} {emit {'diff' output text}}
-if {[S 0 == {!<arch>\n________64E}]} {emit {Alpha archive}
-if {[S 22 == X]} {emit {-- out of date}}
-}
-if {[S 0 == {\377\377\177}]} {emit ddis/ddif}
-if {[S 0 == {\377\377\174}]} {emit {ddis/dots archive}}
-if {[S 0 == {\377\377\176}]} {emit {ddis/dtif table data}}
-if {[S 0 == {\033c\033}]} {emit {LN03 output}}
-if {[S 0 == {!<PDF>!\n}]} {emit {profiling data file}}
-switch -- [Nv i 24] 60012 {emit {new-fs dump file \(little endian\),}
-if {[N s 4 x {}]} {emit {This dump %s,}}
-if {[N s 8 x {}]} {emit {Previous dump %s,}}
-if {[N i 12 > 0x0]} {emit {Volume %ld,}}
-if {[N i 692 == 0x0]} {emit {Level zero, type:}}
-if {[N i 692 > 0x0]} {emit {Level %d, type:}}
-switch -- [Nv i 0] 1 {emit {tape header,}} 2 {emit {beginning of file record,}} 3 {emit {map of inodes on tape,}} 4 {emit {continuation of file record,}} 5 {emit {end of volume,}} 6 {emit {map of inodes deleted,}} 7 {emit {end of medium \(for floppy\),}} 
-if {[S 676 x {}]} {emit {Label %s,}}
-if {[S 696 x {}]} {emit {Filesystem %s,}}
-if {[S 760 x {}]} {emit {Device %s,}}
-if {[S 824 x {}]} {emit {Host %s,}}
-if {[N i 888 > 0x0]} {emit {Flags %x}}
-} 60011 {emit {old-fs dump file \(little endian\),}
-if {[N i 12 > 0x0]} {emit {Volume %ld,}}
-if {[N i 692 == 0x0]} {emit {Level zero, type:}}
-if {[N i 692 > 0x0]} {emit {Level %d, type:}}
-switch -- [Nv i 0] 1 {emit {tape header,}} 2 {emit {beginning of file record,}} 3 {emit {map of inodes on tape,}} 4 {emit {continuation of file record,}} 5 {emit {end of volume,}} 6 {emit {map of inodes deleted,}} 7 {emit {end of medium \(for floppy\),}} 
-if {[S 676 x {}]} {emit {Label %s,}}
-if {[S 696 x {}]} {emit {Filesystem %s,}}
-if {[S 760 x {}]} {emit {Device %s,}}
-if {[S 824 x {}]} {emit {Host %s,}}
-if {[N i 888 > 0x0]} {emit {Flags %x}}
-} 
-switch -- [Nv c 0] -86 {emit {}
-if {[N c 1 < 0x4]} {emit {Dyalog APL}
-switch -- [Nv c 1] 0 {emit {incomplete workspace}} 1 {emit {component file}} 2 {emit {external variable}} 3 {emit workspace} 
-if {[N c 2 x {}]} {emit {version %d}}
-if {[N c 3 x {}]} {emit .%d}
-}
-} 3 {emit {DBase 3 data file}
-if {[N i 4 == 0x0]} {emit {\(no records\)}}
-if {[N i 4 > 0x0]} {emit {\(%ld records\)}}
-} -125 {emit {DBase 3 data file with memo\(s\)}
-if {[N i 4 == 0x0]} {emit {\(no records\)}}
-if {[N i 4 > 0x0]} {emit {\(%ld records\)}}
-} 38 {emit {Sendmail frozen configuration}
-if {[S 16 x {}]} {emit {- version %s}}
-} -16 {emit {SysEx File -}
-switch -- [Nv c 1] 1 {emit Sequential} 2 {emit IDP} 3 {emit OctavePlateau} 4 {emit Moog} 5 {emit Passport} 6 {emit Lexicon} 7 {emit Kurzweil} 8 {emit Fender} 9 {emit Gulbransen} 10 {emit AKG} 11 {emit Voyce} 12 {emit Waveframe} 13 {emit ADA} 14 {emit Garfield} 15 {emit Ensoniq} 16 {emit Oberheim} 17 {emit Apple} 18 {emit GreyMatter} 20 {emit PalmTree} 21 {emit JLCooper} 22 {emit Lowrey} 23 {emit AdamsSmith} 24 {emit E-mu} 25 {emit Harmony} 26 {emit ART} 27 {emit Baldwin} 28 {emit Eventide} 29 {emit Inventronics} 31 {emit Clarity} 33 {emit SIEL} 34 {emit Synthaxe} 36 {emit Hohner} 37 {emit Twister} 38 {emit Solton} 39 {emit Jellinghaus} 40 {emit Southworth} 41 {emit PPG} 42 {emit JEN} 43 {emit SSL} 44 {emit AudioVertrieb} 47 {emit ELKA
-if {[N c 3 == 0x9]} {emit EK-44}
-} 48 {emit Dynacord} 51 {emit Clavia} 57 {emit Soundcraft} 62 {emit Waldorf
-if {[N c 3 == 0x7f]} {emit {Microwave I}}
-} 64 {emit Kawai
-switch -- [Nv c 3] 32 {emit K1} 34 {emit K4} 
-} 65 {emit Roland
-switch -- [Nv c 3] 20 {emit D-50} 43 {emit U-220} 2 {emit TR-707} 
-} 66 {emit Korg
-if {[N c 3 == 0x19]} {emit M1}
-} 67 {emit Yamaha} 68 {emit Casio} 70 {emit Kamiya} 71 {emit Akai} 72 {emit Victor} 73 {emit Mesosha} 75 {emit Fujitsu} 76 {emit Sony} 78 {emit Teac} 80 {emit Matsushita} 81 {emit Fostex} 82 {emit Zoom} 84 {emit Matsushita} 87 {emit {Acoustic tech. lab.}} 
-switch -- [Nv I 1 &0xffffff00] 29696 {emit {Ta Horng}} 29952 {emit e-Tek} 30208 {emit E-Voice} 30464 {emit Midisoft} 30720 {emit Q-Sound} 30976 {emit Westrex} 31232 {emit Nvidia*} 31488 {emit ESS} 31744 {emit Mediatrix} 32000 {emit Brooktree} 32256 {emit Otari} 32512 {emit {Key Electronics}} 65536 {emit Shure} 65792 {emit AuraSound} 66048 {emit Crystal} 66304 {emit Rockwell} 66560 {emit {Silicon Graphics}} 66816 {emit Midiman} 67072 {emit PreSonus} 67584 {emit Topaz} 67840 {emit {Cast Lightning}} 68096 {emit Microsoft} 68352 {emit {Sonic Foundry}} 68608 {emit {Line 6}} 68864 {emit {Beatnik Inc.}} 69120 {emit {Van Koerving}} 69376 {emit {Altech Systems}} 69632 {emit {S & S Research}} 69888 {emit {VLSI Technology}} 70144 {emit Chromatic} 70400 {emit Sapphire} 70656 {emit IDRC} 70912 {emit {Justonic Tuning}} 71168 {emit TorComp} 71424 {emit {Newtek Inc.}} 71680 {emit {Sound Sculpture}} 71936 {emit {Walker Technical}} 72192 {emit {Digital Harmony}} 72448 {emit InVision} 72704 {emit T-Square} 72960 {emit Nemesys} 73216 {emit DBX} 73472 {emit Syndyne} 73728 {emit {Bitheadz	}} 73984 {emit Cakewalk} 74240 {emit Staccato} 74496 {emit {National Semicon.}} 74752 {emit {Boom Theory}} 75008 {emit {Virtual DSP Corp}} 75264 {emit Antares} 75520 {emit {Angel Software}} 75776 {emit {St Louis Music}} 76032 {emit {Lyrrus dba G-VOX}} 76288 {emit {Ashley Audio}} 76544 {emit Vari-Lite} 76800 {emit {Summit Audio}} 77056 {emit {Aureal Semicon.}} 77312 {emit SeaSound} 77568 {emit {U.S. Robotics}} 77824 {emit Aurisis} 78080 {emit {Nearfield Multimedia}} 78336 {emit {FM7 Inc.}} 78592 {emit {Swivel Systems}} 78848 {emit Hyperactive} 79104 {emit MidiLite} 79360 {emit Radical} 79616 {emit {Roger Linn}} 79872 {emit Helicon} 80128 {emit Event} 80384 {emit {Sonic Network}} 80640 {emit {Realtime Music}} 80896 {emit {Apogee Digital}} 2108160 {emit {Medeli Electronics}} 2108416 {emit {Charlie Lab}} 2108672 {emit {Blue Chip Music}} 2108928 {emit {BEE OH Corp}} 2109184 {emit {LG Semicon America}} 2109440 {emit TESI} 2109696 {emit EMAGIC} 2109952 {emit Behringer} 2110208 {emit {Access Music}} 2110464 {emit Synoptic} 2110720 {emit {Hanmesoft Corp}} 2110976 {emit Terratec} 2111232 {emit {Proel SpA}} 2111488 {emit {IBK MIDI}} 2111744 {emit IRCAM} 2112000 {emit {Propellerhead Software}} 2112256 {emit {Red Sound Systems}} 2112512 {emit {Electron ESI AB}} 2112768 {emit {Sintefex Audio}} 2113024 {emit {Music and More}} 2113280 {emit Amsaro} 2113536 {emit {CDS Advanced Technology}} 2113792 {emit {Touched by Sound}} 2114048 {emit {DSP Arts}} 2114304 {emit {Phil Rees Music}} 2114560 {emit {Stamer Musikanlagen GmbH}} 2114816 {emit Soundart} 2115072 {emit {C-Mexx Software}} 2115328 {emit {Klavis Tech.}} 2115584 {emit {Noteheads AB}} 
-} -128 {emit {8086 relocatable \(Microsoft\)}} 
-if {[S 0 == {@CT\ }]} {emit {T602 document data,}
-if {[S 4 == 0]} {emit Kamenicky}
-if {[S 4 == 1]} {emit {CP 852}}
-if {[S 4 == 2]} {emit KOI8-CS}
-if {[S 4 > 2]} {emit {unknown encoding}}
-}
-if {[S 0 == VimCrypt~]} {emit {Vim encrypted file data}}
-if {[S 0 == {\177ELF}]} {emit ELF
-switch -- [Nv c 4] 0 {emit {invalid class}} 1 {emit 32-bit
-switch -- [Nv s 18] 8 {emit {}
-if {[N i 36 & 0x20]} {emit N32}
-} 10 {emit {}
-if {[N i 36 & 0x20]} {emit N32}
-} 
-switch -- [Nv S 18] 8 {emit {}
-if {[N I 36 & 0x20]} {emit N32}
-} 10 {emit {}
-if {[N I 36 & 0x20]} {emit N32}
-} 
-} 2 {emit 64-bit} 
-switch -- [Nv c 5] 0 {emit {invalid byte order}} 1 {emit LSB
-switch -- [Nv s 18] 8 {emit {}
-switch -- [Nv c 4] 1 {emit {}
-switch -- [Nv i 36 &0xf0000000] 0 {emit MIPS-I} 268435456 {emit MIPS-II} 536870912 {emit MIPS-III} 805306368 {emit MIPS-IV} 1073741824 {emit MIPS-V} 1610612736 {emit MIPS32} 1879048192 {emit MIPS64} -2147483648 {emit {MIPS32 rel2}} -1879048192 {emit {MIPS64 rel2}} 
-} 2 {emit {}
-switch -- [Nv i 48 &0xf0000000] 0 {emit MIPS-I} 268435456 {emit MIPS-II} 536870912 {emit MIPS-III} 805306368 {emit MIPS-IV} 1073741824 {emit MIPS-V} 1610612736 {emit MIPS32} 1879048192 {emit MIPS64} -2147483648 {emit {MIPS32 rel2}} -1879048192 {emit {MIPS64 rel2}} 
-} 
-} 0 {emit {no machine,}} 1 {emit {AT&T WE32100 - invalid byte order,}} 2 {emit {SPARC - invalid byte order,}} 3 {emit {Intel 80386,}} 4 {emit Motorola
-if {[N i 36 & 0x1000000]} {emit {68000 - invalid byte order,}}
-if {[N i 36 & 0x810000]} {emit {CPU32 - invalid byte order,}}
-if {[N i 36 == 0x0]} {emit {68020 - invalid byte order,}}
-} 5 {emit {Motorola 88000 - invalid byte order,}} 6 {emit {Intel 80486,}} 7 {emit {Intel 80860,}} 8 {emit MIPS,} 9 {emit {Amdahl - invalid byte order,}} 10 {emit {MIPS \(deprecated\),}} 11 {emit {RS6000 - invalid byte order,}} 15 {emit {PA-RISC - invalid byte order,}
-if {[N s 50 == 0x214]} {emit 2.0}
-if {[N s 48 & 0x8]} {emit {\(LP64\),}}
-} 16 {emit nCUBE,} 17 {emit {Fujitsu VPP500,}} 18 {emit SPARC32PLUS,} 20 {emit PowerPC,} 22 {emit {IBM S/390,}} 36 {emit {NEC V800,}} 37 {emit {Fujitsu FR20,}} 38 {emit {TRW RH-32,}} 39 {emit {Motorola RCE,}} 40 {emit ARM,} 41 {emit Alpha,} -23664 {emit {IBM S/390 \(obsolete\),}} 42 {emit {Hitachi SH,}} 43 {emit {SPARC V9 - invalid byte order,}} 44 {emit {Siemens Tricore Embedded Processor,}} 45 {emit {Argonaut RISC Core, Argonaut Technologies Inc.,}} 46 {emit {Hitachi H8/300,}} 47 {emit {Hitachi H8/300H,}} 48 {emit {Hitachi H8S,}} 49 {emit {Hitachi H8/500,}} 50 {emit {IA-64 \(Intel 64 bit architecture\)}} 51 {emit {Stanford MIPS-X,}} 52 {emit {Motorola Coldfire,}} 53 {emit {Motorola M68HC12,}} 62 {emit {AMD x86-64,}} 75 {emit {Digital VAX,}} 88 {emit {Renesas M32R,}} 97 {emit {NatSemi 32k,}} -28634 {emit {Alpha \(unofficial\),}} 
-switch -- [Nv s 16] 0 {emit {no file type,}} 1 {emit relocatable,} 2 {emit executable,} 3 {emit {shared object,}} 4 {emit {core file}} 
-if {[N s 16 & 0xff00]} {emit processor-specific,}
-switch -- [Nv i 20] 0 {emit {invalid version}} 1 {emit {version 1}} 
-if {[N i 36 == 0x1]} {emit {MathCoPro/FPU/MAU Required}}
-} 2 {emit MSB
-switch -- [Nv S 18] 8 {emit {}
-switch -- [Nv c 4] 1 {emit {}
-switch -- [Nv I 36 &0xf0000000] 0 {emit MIPS-I} 268435456 {emit MIPS-II} 536870912 {emit MIPS-III} 805306368 {emit MIPS-IV} 1073741824 {emit MIPS-V} 1610612736 {emit MIPS32} 1879048192 {emit MIPS64} -2147483648 {emit {MIPS32 rel2}} -1879048192 {emit {MIPS64 rel2}} 
-} 2 {emit {}
-switch -- [Nv I 48 &0xf0000000] 0 {emit MIPS-I} 268435456 {emit MIPS-II} 536870912 {emit MIPS-III} 805306368 {emit MIPS-IV} 1073741824 {emit MIPS-V} 1610612736 {emit MIPS32} 1879048192 {emit MIPS64} -2147483648 {emit {MIPS32 rel2}} -1879048192 {emit {MIPS64 rel2}} 
-} 
-} 0 {emit {no machine,}} 1 {emit {AT&T WE32100,}} 2 {emit SPARC,} 3 {emit {Intel 80386 - invalid byte order,}} 4 {emit Motorola
-if {[N I 36 & 0x1000000]} {emit 68000,}
-if {[N I 36 & 0x810000]} {emit CPU32,}
-if {[N I 36 == 0x0]} {emit 68020,}
-} 5 {emit {Motorola 88000,}} 6 {emit {Intel 80486 - invalid byte order,}} 7 {emit {Intel 80860,}} 8 {emit MIPS,} 9 {emit Amdahl,} 10 {emit {MIPS \(deprecated\),}} 11 {emit RS6000,} 15 {emit PA-RISC
-if {[N S 50 == 0x214]} {emit 2.0}
-if {[N S 48 & 0x8]} {emit {\(LP64\)}}
-} 16 {emit nCUBE,} 17 {emit {Fujitsu VPP500,}} 18 {emit SPARC32PLUS,
-if {[N I 36 & 0x100 &0xffff00]} {emit {V8+ Required,}}
-if {[N I 36 & 0x200 &0xffff00]} {emit {Sun UltraSPARC1 Extensions Required,}}
-if {[N I 36 & 0x400 &0xffff00]} {emit {HaL R1 Extensions Required,}}
-if {[N I 36 & 0x800 &0xffff00]} {emit {Sun UltraSPARC3 Extensions Required,}}
-} 20 {emit {PowerPC or cisco 4500,}} 21 {emit {cisco 7500,}} 22 {emit {IBM S/390,}} 24 {emit {cisco SVIP,}} 25 {emit {cisco 7200,}} 36 {emit {NEC V800 or cisco 12000,}} 37 {emit {Fujitsu FR20,}} 38 {emit {TRW RH-32,}} 39 {emit {Motorola RCE,}} 40 {emit ARM,} 41 {emit Alpha,} 42 {emit {Hitachi SH,}} 43 {emit {SPARC V9,}} 44 {emit {Siemens Tricore Embedded Processor,}} 45 {emit {Argonaut RISC Core, Argonaut Technologies Inc.,}} 46 {emit {Hitachi H8/300,}} 47 {emit {Hitachi H8/300H,}} 48 {emit {Hitachi H8S,}} 49 {emit {Hitachi H8/500,}} 50 {emit {Intel Merced Processor,}} 51 {emit {Stanford MIPS-X,}} 52 {emit {Motorola Coldfire,}} 53 {emit {Motorola M68HC12,}} 73 {emit {Cray NV1,}} 75 {emit {Digital VAX,}} 88 {emit {Renesas M32R,}} 97 {emit {NatSemi 32k,}} -28634 {emit {Alpha \(unofficial\),}} -23664 {emit {IBM S/390 \(obsolete\),}} 
-switch -- [Nv S 16] 0 {emit {no file type,}} 1 {emit relocatable,} 2 {emit executable,} 3 {emit {shared object,}} 4 {emit {core file,}} 
-if {[N S 16 & 0xff00]} {emit processor-specific,}
-switch -- [Nv I 20] 0 {emit {invalid version}} 1 {emit {version 1}} 
-if {[N I 36 == 0x1]} {emit {MathCoPro/FPU/MAU Required}}
-} 
-if {[N c 4 < 0x80]} {if {[S 8 x {}]} {emit {\(%s\)}}
-}
-if {[S 8 == {\0}]} {switch -- [Nv c 7] 0 {emit {\(SYSV\)}} 1 {emit {\(HP-UX\)}} 2 {emit {\(NetBSD\)}} 3 {emit {\(GNU/Linux\)}} 4 {emit {\(GNU/Hurd\)}} 5 {emit {\(86Open\)}} 6 {emit {\(Solaris\)}} 7 {emit {\(Monterey\)}} 8 {emit {\(IRIX\)}} 9 {emit {\(FreeBSD\)}} 10 {emit {\(Tru64\)}} 11 {emit {\(Novell Modesto\)}} 12 {emit {\(OpenBSD\)}} 97 {emit {\(ARM\)}} -1 {emit {\(embedded\)}} 
-}
-}
-if {[N i 4 == 0x1000006d]} {emit {{7 lelong {} == 8 0x1000007f Word} {8 lelong {} == 8 0x10000088 Sheet} {9 lelong {} == 8 0x1000007d Sketch} {10 lelong {} == 8 0x10000085 TextEd}}}
-if {[S 0 == FCS1.0]} {emit {Flow Cytometry Standard \(FCS\) data, version 1.0}}
-if {[S 0 == FCS2.0]} {emit {Flow Cytometry Standard \(FCS\) data, version 2.0}}
-if {[S 0 == FCS3.0]} {emit {Flow Cytometry Standard \(FCS\) data, version 3.0}}
-if {[S 0 == {\366\366\366\366}]} {emit {PC formatted floppy with no filesystem}}
-if {[N S 508 == 0xdabe]} {emit {Sun disk label}
-if {[S 0 x {}]} {emit '%s
-if {[S 31 x {}]} {emit {\b%s}
-if {[S 63 x {}]} {emit {\b%s}
-if {[S 95 x {}]} {emit {\b%s}}
-}
-}
-}
-if {[S 0 x {}]} {emit {\b'}}
-if {[N Y 476 > 0x0]} {emit {%d rpm,}}
-if {[N Y 478 > 0x0]} {emit {%d phys cys,}}
-if {[N Y 480 > 0x0]} {emit {%d alts/cyl,}}
-if {[N Y 486 > 0x0]} {emit {%d interleave,}}
-if {[N Y 488 > 0x0]} {emit {%d data cyls,}}
-if {[N Y 490 > 0x0]} {emit {%d alt cyls,}}
-if {[N Y 492 > 0x0]} {emit {%d heads/partition,}}
-if {[N Y 494 > 0x0]} {emit {%d sectors/track,}}
-if {[N Q 500 > 0x0]} {emit {start cyl %ld,}}
-if {[N Q 504 x {}]} {emit {%ld blocks}}
-if {[N I 512 == 0x30107 &077777777]} {emit {\b, boot block present}}
-}
-if {[S 0 == {DOSEMU\0}]} {if {[N s 638 == 0xaa55]} {emit {DOS Emulator image}}
-}
-if {[N s 510 == 0xaa55]} {emit {x86 boot sector}
-if {[S 2 == OSBS]} {emit {\b, OS/BS MBR}}
-if {[S 140 == {Invalid\ partition\ table}]} {emit {\b, MS-DOS MBR}}
-if {[S 157 == {Invalid\ partition\ table$}]} {if {[S 181 == {No\ Operating\ System$}]} {if {[S 201 == {Operating\ System\ load\ error$}]} {emit {\b, DR-DOS MBR, Version 7.01 to 7.03}}
-}
-}
-if {[S 157 == {Invalid\ partition\ table$}]} {if {[S 181 == {No\ operating\ system$}]} {if {[S 201 == {Operating\ system\ load\ error$}]} {emit {\b, DR-DOS MBR, Version 7.01 to 7.03}}
-}
-}
-if {[S 342 == {Invalid\ partition\ table$}]} {if {[S 366 == {No\ operating\ system$}]} {if {[S 386 == {Operating\ system\ load\ error$}]} {emit {\b, DR-DOS MBR, version 7.01 to 7.03}}
-}
-}
-if {[S 295 == {NEWLDR\0}]} {if {[S 302 == {Bad\ PT\ $}]} {if {[S 310 == {No\ OS\ $}]} {if {[S 317 == {OS\ load\ err$}]} {if {[S 329 == {Moved\ or\ missing\ IBMBIO.LDR\n\r}]} {if {[S 358 == {Press\ any\ key\ to\ continue.\n\r$}]} {if {[S 387 == {Copyright\ (c)\ 1984,1998}]} {if {[S 411 == {Caldera\ Inc.\0}]} {emit {\b, DR-DOS MBR \(IBMBIO.LDR\)}}
-}
-}
-}
-}
-}
-}
-}
-if {[S 271 == {Ung\201ltige\ Partitionstabelle}]} {emit {\b, MS-DOS MBR, german version 4.10.1998, 4.10.2222}}
-if {[S 139 == {Ung\201ltige\ Partitionstabelle}]} {emit {\b, MS-DOS MBR, german version 5.00 to 4.00.950}}
-if {[S 300 == {Invalid\ partition\ table\0}]} {if {[S 324 == {Error\ loading\ operating\ system\0}]} {if {[S 355 == {Missing\ operating\ system\0}]} {emit {\b, Microsoft Windows XP MBR}}
-}
-}
-if {[S 300 == {Ung\201ltige\ Partitionstabelle}]} {if {[S 328 == {Fehler\ beim\ Laden\ }]} {if {[S 346 == {des\ Betriebssystems}]} {if {[S 366 == {Betriebssystem\ nicht\ vorhanden}]} {emit {\b, Microsoft Windows XP MBR \(german\)}}
-}
-}
-}
-if {[S 325 == {Default:\ F}]} {emit {\b, FREE-DOS MBR}}
-if {[S 64 == {no\ active\ partition\ found}]} {if {[S 96 == {read\ error\ while\ reading\ drive}]} {emit {\b, FREE-DOS Beta9 MBR}}
-}
-if {[S 43 == {SMART\ BTMGRFAT12\ \ \ }]} {if {[S 430 == {SBMK\ Bad!\r}]} {if {[S 3 == SBM]} {emit {\b, Smart Boot Manager}
-if {[S 6 x {}]} {emit {\b, version %s}}
-}
-}
-}
-if {[S 382 == XOSLLOADXCF]} {emit {\b, EXtended Operating System Loader}}
-if {[S 6 == LILO]} {emit {\b, LInux i386 boot LOader}
-if {[S 120 == LILO]} {emit {\b, version 22.3.4 SuSe}}
-if {[S 172 == LILO]} {emit {\b, version 22.5.8 Debian}}
-}
-if {[S 402 == {Geom\0Hard\ Disk\0Read\0\ Error\0}]} {if {[S 394 == stage1]} {emit {\b, GRand Unified Bootloader \(0.5.95\)}}
-}
-if {[S 380 == {Geom\0Hard\ Disk\0Read\0\ Error\0}]} {if {[S 374 == {GRUB\ \0}]} {emit {\b, GRand Unified Bootloader}}
-}
-if {[S 382 == {Geom\0Hard\ Disk\0Read\0\ Error\0}]} {if {[S 376 == {GRUB\ \0}]} {emit {\b, GRand Unified Bootloader \(0.93\)}}
-}
-if {[S 383 == {Geom\0Hard\ Disk\0Read\0\ Error\0}]} {if {[S 377 == {GRUB\ \0}]} {emit {\b, GRand Unified Bootloader \(0.94\)}}
-}
-if {[S 480 == {Boot\ failed\r}]} {if {[S 495 == {LDLINUX\ SYS}]} {emit {\b, SYSLINUX bootloader \(2.06\)}}
-}
-if {[S 395 == {chksum\0\ ERROR!\0}]} {emit {\b, Gujin bootloader}}
-if {[S 185 == {FDBOOT\ Version\ }]} {if {[S 204 == {\rNo\ Systemdisk.\ }]} {if {[S 220 == {Booting\ from\ harddisk.\n\r}]} {emit 349 21 0 0}
-if {[S 245 == {Cannot\ load\ from\ harddisk.\n\r}]} {if {[S 273 == {Insert\ Systemdisk\ }]} {if {[S 291 == {and\ press\ any\ key.\n\r}]} {emit {\b, FDBOOT harddisk Bootloader}
-if {[S 200 x {}]} {emit {\b, version %-3s}}
-}
-}
-}
-}
-}
-if {[S 242 == {Bootsector\ from\ C.H.\ Hochst\204}]} {if {[S 278 == {No\ Systemdisk.\ }]} {if {[S 293 == {Booting\ from\ harddisk.\n\r}]} {emit 349 22 0 0}
-if {[S 441 == {Cannot\ load\ from\ harddisk.\n\r}]} {if {[S 469 == {Insert\ Systemdisk\ }]} {if {[S 487 == {and\ press\ any\ key.\n\r}]} {emit {\b, WinImage harddisk Bootloader}
-if {[S 209 x {}]} {emit {\b, version %-4.4s}}
-}
-}
-}
-}
-}
-if {[N c [I 1 c 2] == 0xe]} {if {[N c [I 1 c 3] == 0x1f]} {if {[N c [I 1 c 4] == 0xbe]} {if {[N c [I 1 c 5] == 0x77]} {emit 349 23 0 0 0}
-if {[N c [I 1 c 6] == 0x7c]} {if {[N c [I 1 c 7] == 0xac]} {if {[N c [I 1 c 8] == 0x22]} {if {[N c [I 1 c 9] == 0xc0]} {if {[N c [I 1 c 10] == 0x74]} {if {[N c [I 1 c 11] == 0xb]} {if {[N c [I 1 c 12] == 0x56]} {emit 349 23 0 0 1 0 0 0 0 0 0}
-if {[N c [I 1 c 13] == 0xb4]} {emit {\b, mkdosfs boot message display}}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-if {[S 430 == {NTLDR\ is\ missing\xFF\r\n}]} {if {[S 449 == {Disk\ error\xFF\r\n}]} {if {[S 462 == {Press\ any\ key\ to\ restart\r}]} {emit {\b, Microsoft Windows XP Bootloader}
-if {[N c 417 < 0x7e]} {if {[S 417 > {\ }]} {emit %-.5s
-if {[N c 422 < 0x7e]} {if {[S 422 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 425 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-if {[N c 368 < 0x7e]} {if {[S 368 > {\ }]} {emit %-.5s
-if {[N c 373 < 0x7e]} {if {[S 373 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 376 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-}
-}
-}
-if {[S 430 == {NTLDR\ nicht\ gefunden\xFF\r\n}]} {if {[S 453 == {Datentr\204gerfehler\xFF\r\n}]} {if {[S 473 == {Neustart\ mit\ beliebiger\ Taste\r}]} {emit {\b, Microsoft Windows XP Bootloader \(german\)}
-if {[N c 417 < 0x7e]} {if {[S 417 > {\ }]} {emit %-.5s
-if {[N c 422 < 0x7e]} {if {[S 422 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 425 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-if {[N c 368 < 0x7e]} {if {[S 368 > {\ }]} {emit %-.5s
-if {[N c 373 < 0x7e]} {if {[S 373 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 376 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-}
-}
-}
-if {[S 430 == {NTLDR\ fehlt\xFF\r\n}]} {if {[S 444 == {Datentr\204gerfehler\xFF\r\n}]} {if {[S 464 == {Neustart\ mit\ beliebiger\ Taste\r}]} {emit {\b, Microsoft Windows XP Bootloader \(2.german\)}
-if {[N c 417 < 0x7e]} {if {[S 417 > {\ }]} {emit %-.5s
-if {[N c 422 < 0x7e]} {if {[S 422 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 425 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-}
-}
-}
-if {[S 430 == {NTLDR\ fehlt\xFF\r\n}]} {if {[S 444 == {Medienfehler\xFF\r\n}]} {if {[S 459 == {Neustart:\ Taste\ dr\201cken\r}]} {emit {\b, Microsoft Windows XP Bootloader \(3.german\)}
-if {[N c 368 < 0x7e]} {if {[S 368 > {\ }]} {emit %-.5s
-if {[N c 373 < 0x7e]} {if {[S 373 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 376 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-if {[N c 417 < 0x7e]} {if {[S 417 > {\ }]} {emit %-.5s
-if {[N c 422 < 0x7e]} {if {[S 422 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 425 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-}
-}
-}
-if {[S 430 == {Datentr\204ger\ entfernen\xFF\r\n}]} {if {[S 454 == {Medienfehler\xFF\r\n}]} {if {[S 469 == {Neustart:\ Taste\ dr\201cken\r}]} {emit {\b, Microsoft Windows XP Bootloader \(4.german\)}
-if {[N c 368 < 0x7e]} {if {[S 368 > {\ }]} {emit %-.5s
-if {[N c 373 < 0x7e]} {if {[S 373 > {\ }]} {emit {\b%-.3s}}
-}
-if {[S 376 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-}
-}
-}
-if {[S 389 == {Fehler\ beim\ Lesen\ }]} {if {[S 407 == {des\ Datentr\204gers}]} {if {[S 426 == {NTLDR\ fehlt}]} {if {[S 440 == {NTLDR\ ist\ komprimiert}]} {if {[S 464 == {Neustart\ mit\ Strg+Alt+Entf\r}]} {emit {\b, Microsoft Windows XP Bootloader NTFS \(german\)}}
-}
-}
-}
-}
-if {[S 313 == {A\ disk\ read\ error\ occurred.\r}]} {if {[S 345 == {A\ kernel\ file\ is\ missing\ }]} {if {[S 370 == {from\ the\ disk.\r}]} {if {[S 484 == {NTLDR\ is\ compressed}]} {if {[S 429 == {Insert\ a\ system\ diskette\ }]} {if {[S 454 == {and\ restart\r\nthe\ system.\r}]} {emit {\b, Microsoft Windows XP Bootloader NTFS}}
-}
-}
-}
-}
-}
-if {[S 472 == {IO\ \ \ \ \ \ SYSMSDOS\ \ \ SYS}]} {if {[S 497 == {WINBOOT\ SYS}]} {emit 349 31 0}
-if {[S 389 == {Invalid\ system\ disk\xFF\r\n}]} {if {[S 411 == {Disk\ I/O\ error}]} {if {[S 428 == {Replace\ the\ disk,\ and\ }]} {if {[S 455 == {press\ any\ key}]} {emit {\b, Microsoft Windows 98 Bootloader}}
-}
-}
-}
-if {[S 390 == {Invalid\ system\ disk\xFF\r\n}]} {if {[S 412 == {Disk\ I/O\ error\xFF\r\n}]} {if {[S 429 == {Replace\ the\ disk,\ and\ }]} {if {[S 451 == {then\ press\ any\ key\r}]} {emit {\b, Microsoft Windows 98 Bootloader}}
-}
-}
-}
-if {[S 388 == {Ungueltiges\ System\ \xFF\r\n}]} {if {[S 410 == {E/A-Fehler\ \ \ \ \xFF\r\n}]} {if {[S 427 == {Datentraeger\ wechseln\ und\ }]} {if {[S 453 == {Taste\ druecken\r}]} {emit {\b, Microsoft Windows 95/98/ME Bootloader \(german\)}}
-}
-}
-}
-if {[S 390 == {Ungueltiges\ System\ \xFF\r\n}]} {if {[S 412 == {E/A-Fehler\ \ \ \ \xFF\r\n}]} {if {[S 429 == {Datentraeger\ wechseln\ und\ }]} {if {[S 455 == {Taste\ druecken\r}]} {emit {\b, Microsoft Windows 95/98/ME Bootloader \(German\)}}
-}
-}
-}
-if {[S 389 == {Ungueltiges\ System\ \xFF\r\n}]} {if {[S 411 == {E/A-Fehler\ \ \ \ \xFF\r\n}]} {if {[S 428 == {Datentraeger\ wechseln\ und\ }]} {if {[S 454 == {Taste\ druecken\r}]} {emit {\b, Microsoft Windows 95/98/ME Bootloader \(GERMAN\)}}
-}
-}
-}
-}
-if {[S 479 == {IO\ \ \ \ \ \ SYSMSDOS\ \ \ SYS}]} {if {[S 416 == {Kein\ System\ oder\ }]} {if {[S 433 == Laufwerksfehler]} {if {[S 450 == {Wechseln\ und\ Taste\ dr\201cken}]} {emit {\b, Microsoft DOS Bootloader \(german\)}}
-}
-}
-}
-if {[S 486 == {IO\ \ \ \ \ \ SYSMSDOS\ \ \ SYS}]} {if {[S 416 == {Non-System\ disk\ or\ }]} {if {[S 435 == {disk\ error\r}]} {if {[S 447 == {Replace\ and\ press\ any\ key\ }]} {if {[S 473 == {when\ ready\r}]} {emit {\b, Microsoft DOS Bootloader}}
-}
-}
-}
-}
-if {[S 480 == {IO\ \ \ \ \ \ SYSMSDOS\ \ \ SYS}]} {if {[S 393 == {Non-System\ disk\ or\ }]} {if {[S 412 == {disk\ error\r}]} {if {[S 424 == {Replace\ and\ press\ any\ key\ }]} {if {[S 450 == {when\ ready\r}]} {emit {\b, Microsoft DOS bootloader}}
-}
-}
-}
-}
-if {[S 54 == SYS]} {if {[S 324 == VASKK]} {if {[S 495 == {NEWLDR\0}]} {emit {\b, DR-DOS Bootloader \(LOADER.SYS\)}}
-}
-}
-if {[S 70 == {IBMBIO\ \ COM}]} {if {[S 472 == {Cannot\ load\ DOS!\ }]} {if {[S 489 == {Any\ key\ to\ retry}]} {emit {\b, DR-DOS Bootloader}}
-}
-if {[S 471 == {Cannot\ load\ DOS\ }]} {emit 349 36 1}
-if {[S 487 == {press\ key\ to\ retry}]} {emit {\b, Open-DOS Bootloader}}
-}
-if {[S 444 == {KERNEL\ \ SYS}]} {if {[S 314 == {BOOT\ error!}]} {emit {\b, FREE-DOS Bootloader}}
-}
-if {[S 499 == {KERNEL\ \ SYS}]} {if {[S 305 == {BOOT\ err!\0}]} {emit {\b, Free-DOS Bootloader}}
-}
-if {[S 449 == {KERNEL\ \ SYS}]} {if {[S 319 == {BOOT\ error!}]} {emit {\b, FREE-DOS 5.0 Bootloader}}
-}
-if {[S 124 == {FreeDOS\0}]} {if {[S 331 == {\ err\0}]} {emit {\b, FREE-DOS BETa 9 Bootloader}
-if {[S 497 > {\ }]} {emit %-.6s
-if {[S 503 > {\ }]} {emit {\b%-.1s}}
-if {[S 504 > {\ }]} {emit {\b%-.1s}}
-}
-if {[S 505 > {\ }]} {emit {\b.%-.3s}}
-}
-if {[S 333 == {\ err\0}]} {emit {\b, FREE-DOS BEta 9 Bootloader}
-if {[S 497 > {\ }]} {emit %-.6s
-if {[S 503 > {\ }]} {emit {\b%-.1s}}
-if {[S 504 > {\ }]} {emit {\b%-.1s}}
-}
-if {[S 505 > {\ }]} {emit {\b.%-.3s}}
-}
-if {[S 334 == {\ err\0}]} {emit {\b, FREE-DOS Beta 9 Bootloader}
-if {[S 497 > {\ }]} {emit %-.6s
-if {[S 503 > {\ }]} {emit {\b%-.1s}}
-if {[S 504 > {\ }]} {emit {\b%-.1s}}
-}
-if {[S 505 > {\ }]} {emit {\b.%-.3s}}
-}
-}
-if {[S 0 == {\0\0\0\0}]} {emit {\b, extended partition table}}
-if {[N i 0 == 0x9000eb &0x009000EB]} {emit 349 42}
-if {[N i 0 == 0xe9 &0x000000E9]} {if {[N c 1 > 0x25]} {emit {\b, code offset 0x%x}
-if {[N s 11 < 0x801]} {if {[N s 11 > 0x1f]} {if {[S 3 x {}]} {emit {\b, OEM-ID \"%8.8s\"}}
-if {[N s 11 > 0x200]} {emit {\b, Bytes/sector %u}}
-if {[N s 11 < 0x200]} {emit {\b, Bytes/sector %u}}
-if {[N c 13 > 0x1]} {emit {\b, sectors/cluster %u}}
-if {[N s 14 > 0x20]} {emit {\b, reserved sectors %u}}
-if {[N s 14 < 0x1]} {emit {\b, reserved sectors %u}}
-if {[N c 16 > 0x2]} {emit {\b, FATs %u}}
-if {[N c 16 == 0x1]} {emit {\b, FAT  %u}}
-if {[N c 16 > 0x0]} {emit 349 43 0 0 0 8}
-if {[N s 17 > 0x0]} {emit {\b, root entries %u}}
-if {[N s 19 > 0x0]} {emit {\b, sectors %u \(volumes <=32 MB\)}}
-if {[N c 21 > 0xf0]} {emit {\b, Media descriptor 0x%x}}
-if {[N c 21 < 0xf0]} {emit {\b, Media descriptor 0x%x}}
-if {[N s 22 > 0x0]} {emit {\b, sectors/FAT %u}}
-if {[N c 26 > 0x2]} {emit {\b, heads %u}}
-if {[N c 26 == 0x1]} {emit {\b, heads %u}}
-if {[N i 28 > 0x0]} {emit {\b, hidden sectors %u}}
-if {[N i 32 > 0x0]} {emit {\b, sectors %u \(volumes > 32 MB\)}}
-if {[N i 82 > 0x0 &0xCCABBEB9]} {if {[N c 36 > 0x80]} {emit {\b, physical drive 0x%x}}
-if {[N c 36 > 0x0 &0x7F]} {emit {\b, physical drive 0x%x}}
-if {[N c 37 > 0x0]} {emit {\b, reserved 0x%x}}
-if {[N c 38 > 0x29]} {emit {\b, dos < 4.0 BootSector \(0x%x\)}}
-if {[N c 38 < 0x29]} {emit {\b, dos < 4.0 BootSector \(0x%x\)}}
-if {[N c 38 == 0x29]} {if {[N i 39 x {}]} {emit {\b, serial number 0x%x}}
-if {[S 43 < {NO\ NAME}]} {emit {\b, label: \"%11.11s\"}}
-if {[S 43 > {NO\ NAME}]} {emit {\b, label: \"%11.11s\"}}
-if {[S 43 == {NO\ NAME}]} {emit {\b, unlabeled}}
-}
-if {[S 54 == FAT1]} {emit {\b, FAT}
-if {[S 54 == FAT12]} {emit {\b \(12 bit\)}}
-if {[S 54 == FAT16]} {emit {\b \(16 bit\)}}
-}
-}
-if {[S 82 == FAT32]} {emit {\b, FAT \(32 bit\)}
-if {[N i 36 x {}]} {emit {\b, sectors/FAT %u}}
-if {[N s 40 > 0x0]} {emit {\b, extension flags %u}}
-if {[N s 42 > 0x0]} {emit {\b, fsVersion %u}}
-if {[N i 44 > 0x2]} {emit {\b, rootdir cluster %u}}
-if {[N s 48 > 0x1]} {emit {\b, infoSector %u}}
-if {[N s 48 < 0x1]} {emit {\b, infoSector %u}}
-if {[N s 50 > 0x6]} {emit {\b, Backup boot sector %u}}
-if {[N s 50 < 0x6]} {emit {\b, Backup boot sector %u}}
-if {[N i 54 > 0x0]} {emit {\b, reserved1 0x%x}}
-if {[N i 58 > 0x0]} {emit {\b, reserved2 0x%x}}
-if {[N i 62 > 0x0]} {emit {\b, reserved3 0x%x}}
-if {[N c 64 > 0x80]} {emit {\b, physical drive 0x%x}}
-if {[N c 64 > 0x0 &0x7F]} {emit {\b, physical drive 0x%x}}
-if {[N c 65 > 0x0]} {emit {\b, reserved 0x%x}}
-if {[N c 66 > 0x29]} {emit {\b, dos < 4.0 BootSector \(0x%x\)}}
-if {[N c 66 < 0x29]} {emit {\b, dos < 4.0 BootSector \(0x%x\)}}
-if {[N c 66 == 0x29]} {if {[N i 67 x {}]} {emit {\b, serial number 0x%x}}
-if {[S 71 < {NO\ NAME}]} {emit {\b, label: \"%11.11s\"}}
-}
-if {[S 71 > {NO\ NAME}]} {emit {\b, label: \"%11.11s\"}}
-if {[S 71 == {NO\ NAME}]} {emit {\b, unlabeled}}
-}
-}
-}
-}
-}
-if {[N i 512 == 0x82564557]} {emit {\b, BSD disklabel}}
-}
-if {[S 0 == FATX]} {emit {FATX filesystem data}}
-switch -- [Nv s 1040] 4991 {emit {Minix filesystem}} 5007 {emit {Minix filesystem, 30 char names}} 9320 {emit {Minix filesystem, version 2}} 9336 {emit {Minix filesystem, version 2, 30 char names}} 
-if {[N S 1040 == 0x137f]} {emit {Minix filesystem \(big endian\),}
-if {[N S 1026 != 0x0]} {emit {\b, %d zones}}
-if {[S 30 == minix]} {emit {\b, bootable}}
-}
-if {[S 0 == {-rom1fs-\0}]} {emit {romfs filesystem, version 1}
-if {[N I 8 x {}]} {emit {%d bytes,}}
-if {[S 16 x {}]} {emit {named %s.}}
-}
-if {[S 395 == OS/2]} {emit {OS/2 Boot Manager}}
-if {[N i 9564 == 0x11954]} {emit {Unix Fast File system \(little-endian\),}
-if {[S 8404 x {}]} {emit {last mounted on %s,}}
-if {[N s 8224 x {}]} {emit {last written at %s,}}
-if {[N c 8401 x {}]} {emit {clean flag %d,}}
-if {[N i 8228 x {}]} {emit {number of blocks %d,}}
-if {[N i 8232 x {}]} {emit {number of data blocks %d,}}
-if {[N i 8236 x {}]} {emit {number of cylinder groups %d,}}
-if {[N i 8240 x {}]} {emit {block size %d,}}
-if {[N i 8244 x {}]} {emit {fragment size %d,}}
-if {[N i 8252 x {}]} {emit {minimum percentage of free blocks %d,}}
-if {[N i 8256 x {}]} {emit {rotational delay %dms,}}
-if {[N i 8260 x {}]} {emit {disk rotational speed %drps,}}
-switch -- [Nv i 8320] 0 {emit {TIME optimization}} 1 {emit {SPACE optimization}} 
-}
-if {[N I 9564 == 0x11954]} {emit {Unix Fast File system \(big-endian\),}
-if {[N Q 7168 == 0x4c41424c]} {emit {Apple UFS Volume}
-if {[S 7186 x {}]} {emit {named %s,}}
-if {[N I 7176 x {}]} {emit {volume label version %d,}}
-if {[N S 7180 x {}]} {emit {created on %s,}}
-}
-if {[S 8404 x {}]} {emit {last mounted on %s,}}
-if {[N S 8224 x {}]} {emit {last written at %s,}}
-if {[N c 8401 x {}]} {emit {clean flag %d,}}
-if {[N I 8228 x {}]} {emit {number of blocks %d,}}
-if {[N I 8232 x {}]} {emit {number of data blocks %d,}}
-if {[N I 8236 x {}]} {emit {number of cylinder groups %d,}}
-if {[N I 8240 x {}]} {emit {block size %d,}}
-if {[N I 8244 x {}]} {emit {fragment size %d,}}
-if {[N I 8252 x {}]} {emit {minimum percentage of free blocks %d,}}
-if {[N I 8256 x {}]} {emit {rotational delay %dms,}}
-if {[N I 8260 x {}]} {emit {disk rotational speed %drps,}}
-switch -- [Nv I 8320] 0 {emit {TIME optimization}} 1 {emit {SPACE optimization}} 
-}
-if {[N s 1080 == 0xef53]} {emit Linux
-if {[N i 1100 x {}]} {emit {rev %d}}
-if {[N s 1086 x {}]} {emit {\b.%d}}
-if {[N i 1116 ^ 0x4]} {emit {ext2 filesystem data}
-if {[N s 1082 ^ 0x1]} {emit {\(mounted or unclean\)}}
-}
-if {[N i 1116 & 0x4]} {emit {ext3 filesystem data}
-if {[N i 1120 & 0x4]} {emit {\(needs journal recovery\)}}
-}
-if {[N s 1082 & 0x2]} {emit {\(errors\)}}
-if {[N i 1120 & 0x1]} {emit {\(compressed\)}}
-if {[N i 1124 & 0x2]} {emit {\(large files\)}}
-}
-if {[N I 2048 == 0x46fc2700]} {emit {Atari-ST Minix kernel image}
-if {[S 19 == {\240\5\371\5\0\011\0\2\0}]} {emit {\b, 720k floppy}}
-if {[S 19 == {\320\2\370\5\0\011\0\1\0}]} {emit {\b, 360k floppy}}
-}
-if {[S 19 == {\320\2\360\3\0\011\0\1\0}]} {emit {DOS floppy 360k}
-if {[N s 510 == 0xaa55]} {emit {\b, x86 hard disk boot sector}}
-}
-if {[S 19 == {\240\5\371\3\0\011\0\2\0}]} {emit {DOS floppy 720k}
-if {[N s 510 == 0xaa55]} {emit {\b, x86 hard disk boot sector}}
-}
-if {[S 19 == {\100\013\360\011\0\022\0\2\0}]} {emit {DOS floppy 1440k}
-if {[N s 510 == 0xaa55]} {emit {\b, x86 hard disk boot sector}}
-}
-if {[S 19 == {\240\5\371\5\0\011\0\2\0}]} {emit {DOS floppy 720k, IBM}
-if {[N s 510 == 0xaa55]} {emit {\b, x86 hard disk boot sector}}
-}
-if {[S 19 == {\100\013\371\5\0\011\0\2\0}]} {emit {DOS floppy 1440k, mkdosfs}
-if {[N s 510 == 0xaa55]} {emit {\b, x86 hard disk boot sector}}
-}
-if {[S 19 == {\320\2\370\5\0\011\0\1\0}]} {emit {Atari-ST floppy 360k}}
-if {[S 19 == {\240\5\371\5\0\011\0\2\0}]} {emit {Atari-ST floppy 720k}}
-if {[S 32769 == CD001]} {emit {ISO 9660 CD-ROM filesystem data}
-if {[S 32808 x {}]} {emit '%s'}
-if {[S 34816 == {\000CD001\001EL\ TORITO\ SPECIFICATION}]} {emit {\(bootable\)}}
-}
-if {[S 37633 == CD001]} {emit {ISO 9660 CD-ROM filesystem data \(raw 2352 byte sectors\)}}
-if {[S 32776 == CDROM]} {emit {High Sierra CD-ROM filesystem data}}
-if {[S 65588 == ReIsErFs]} {emit {ReiserFS V3.5}}
-if {[S 65588 == ReIsEr2Fs]} {emit {ReiserFS V3.6}
-if {[N s 65580 x {}]} {emit {block size %d}}
-if {[N s 65586 & 0x2]} {emit {\(mounted or unclean\)}}
-if {[N i 65536 x {}]} {emit {num blocks %d}}
-switch -- [Nv i 65600] 1 {emit {tea hash}} 2 {emit {yura hash}} 3 {emit {r5 hash}} 
-}
-if {[S 0 == ESTFBINR]} {emit {EST flat binary}}
-if {[S 0 == {VoIP\ Startup\ and}]} {emit {Aculab VoIP firmware}
-if {[S 35 x {}]} {emit {format %s}}
-}
-if {[S 0 == sqsh]} {emit {Squashfs filesystem, big endian,}
-if {[N S 28 x {}]} {emit {version %d.}}
-if {[N S 30 x {}]} {emit {\b%d,}}
-if {[N I 8 x {}]} {emit {%d bytes,}}
-if {[N I 4 x {}]} {emit {%d inodes,}}
-if {[N S 28 < 0x2]} {if {[N S 32 x {}]} {emit {blocksize: %d bytes,}}
-}
-if {[N S 28 > 0x1]} {if {[N I 51 x {}]} {emit {blocksize: %d bytes,}}
-}
-if {[N S 39 x {}]} {emit {created: %s}}
-}
-if {[S 0 == hsqs]} {emit {Squashfs filesystem, little endian,}
-if {[N s 28 x {}]} {emit {version %d.}}
-if {[N s 30 x {}]} {emit {\b%d,}}
-if {[N i 8 x {}]} {emit {%d bytes,}}
-if {[N i 4 x {}]} {emit {%d inodes,}}
-if {[N s 28 < 0x2]} {if {[N s 32 x {}]} {emit {blocksize: %d bytes,}}
-}
-if {[N s 28 > 0x1]} {if {[N i 51 x {}]} {emit {blocksize: %d bytes,}}
-}
-if {[N s 39 x {}]} {emit {created: %s}}
-}
-if {[S 0 == FWS]} {emit {Macromedia Flash data,}
-if {[N c 3 x {}]} {emit {version %d}}
-}
-if {[S 0 == CWS]} {emit {Macromedia Flash data \(compressed\),}
-if {[N c 3 x {}]} {emit {version %d}}
-}
-if {[S 0 == {AGD4\xbe\xb8\xbb\xcb\x00}]} {emit {Macromedia Freehand 9 Document}}
-if {[S 0 == FONT]} {emit {ASCII vfont text}}
-if {[S 0 == %!PS-AdobeFont-1.]} {emit {PostScript Type 1 font text}
-if {[S 20 x {}]} {emit {\(%s\)}}
-}
-if {[S 6 == %!PS-AdobeFont-1.]} {emit {PostScript Type 1 font program data}}
-if {[S 0 == {STARTFONT\040}]} {emit {X11 BDF font text}}
-if {[S 0 == {\001fcp}]} {emit {X11 Portable Compiled Font data}
-switch -- [Nv c 12] 2 {emit {\b, LSB first}} 10 {emit {\b, MSB first}} 
-}
-if {[S 0 == {D1.0\015}]} {emit {X11 Speedo font data}}
-if {[S 0 == flf]} {emit {FIGlet font}
-if {[S 3 > 2a]} {emit {version %-2.2s}}
-}
-if {[S 0 == flc]} {emit {FIGlet controlfile}
-if {[S 3 > 2a]} {emit {version %-2.2s}}
-}
-switch -- [Nv I 7] 4540225 {emit {DOS code page font data}} 5654852 {emit {DOS code page font data \(from Linux?\)}} 
-if {[S 4098 == DOSFONT]} {emit {DOSFONT2 encrypted font data}}
-if {[S 0 == PFR1]} {emit {PFR1 font}
-if {[S 102 > 0]} {emit {\b: %s}}
-}
-if {[S 0 == {\000\001\000\000\000}]} {emit {TrueType font data}}
-if {[S 0 == {\007\001\001\000Copyright\ (c)\ 199}]} {emit {Adobe Multiple Master font}}
-if {[S 0 == {\012\001\001\000Copyright\ (c)\ 199}]} {emit {Adobe Multiple Master font}}
-if {[S 0 == OTTO]} {emit {OpenType font data}}
-if {[S 0 == <MakerFile]} {emit {FrameMaker document}
-if {[S 11 == 5.5]} {emit {\(5.5}}
-if {[S 11 == 5.0]} {emit {\(5.0}}
-if {[S 11 == 4.0]} {emit {\(4.0}}
-if {[S 11 == 3.0]} {emit {\(3.0}}
-if {[S 11 == 2.0]} {emit {\(2.0}}
-if {[S 11 == 1.0]} {emit {\(1.0}}
-if {[N c 14 x {}]} {emit {%c\)}}
-}
-if {[S 0 == <MIFFile]} {emit {FrameMaker MIF \(ASCII\) file}
-if {[S 9 == 4.0]} {emit {\(4.0\)}}
-if {[S 9 == 3.0]} {emit {\(3.0\)}}
-if {[S 9 == 2.0]} {emit {\(2.0\)}}
-if {[S 9 == 1.0]} {emit {\(1.x\)}}
-}
-if {[S 0 == <MakerDictionary]} {emit {FrameMaker Dictionary text}
-if {[S 17 == 3.0]} {emit {\(3.0\)}}
-if {[S 17 == 2.0]} {emit {\(2.0\)}}
-if {[S 17 == 1.0]} {emit {\(1.x\)}}
-}
-if {[S 0 == <MakerScreenFont]} {emit {FrameMaker Font file}
-if {[S 17 == 1.01]} {emit {\(%s\)}}
-}
-if {[S 0 == <MML]} {emit {FrameMaker MML file}}
-if {[S 0 == <BookFile]} {emit {FrameMaker Book file}
-if {[S 10 == 3.0]} {emit {\(3.0}}
-if {[S 10 == 2.0]} {emit {\(2.0}}
-if {[S 10 == 1.0]} {emit {\(1.0}}
-if {[N c 13 x {}]} {emit {%c\)}}
-}
-if {[S 0 == <Maker]} {emit {Intermediate Print File	FrameMaker IPL file}}
-switch -- [Nv i 0 &0377777777] 8782087 {emit FreeBSD/i386
-if {[N i 20 < 0x1000]} {if {[N c 3 & 0x80 &0xC0]} {emit {shared library}}
-switch -- [Nv c 3 &0xC0] 64 {emit {PIC object}} 0 {emit object} 
-}
-if {[N i 20 > 0xfff]} {switch -- [Nv c 3 &0x80] -128 {emit {dynamically linked executable}} 0 {emit executable} 
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782088 {emit {FreeBSD/i386 pure}
-if {[N i 20 < 0x1000]} {if {[N c 3 & 0x80 &0xC0]} {emit {shared library}}
-switch -- [Nv c 3 &0xC0] 64 {emit {PIC object}} 0 {emit object} 
-}
-if {[N i 20 > 0xfff]} {switch -- [Nv c 3 &0x80] -128 {emit {dynamically linked executable}} 0 {emit executable} 
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782091 {emit {FreeBSD/i386 demand paged}
-if {[N i 20 < 0x1000]} {if {[N c 3 & 0x80 &0xC0]} {emit {shared library}}
-switch -- [Nv c 3 &0xC0] 64 {emit {PIC object}} 0 {emit object} 
-}
-if {[N i 20 > 0xfff]} {switch -- [Nv c 3 &0x80] -128 {emit {dynamically linked executable}} 0 {emit executable} 
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782028 {emit {FreeBSD/i386 compact demand paged}
-if {[N i 20 < 0x1000]} {if {[N c 3 & 0x80 &0xC0]} {emit {shared library}}
-switch -- [Nv c 3 &0xC0] 64 {emit {PIC object}} 0 {emit object} 
-}
-if {[N i 20 > 0xfff]} {switch -- [Nv c 3 &0x80] -128 {emit {dynamically linked executable}} 0 {emit executable} 
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 
-if {[S 7 == {\357\020\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0}]} {emit {FreeBSD/i386 a.out core file}
-if {[S 1039 x {}]} {emit {from '%s'}}
-}
-if {[S 0 == SCRSHOT_]} {emit {scrshot\(1\) screenshot,}
-if {[N c 8 x {}]} {emit {version %d,}}
-if {[N c 9 == 0x2]} {emit {%d bytes in header,}
-if {[N c 10 x {}]} {emit {%d chars wide by}}
-if {[N c 11 x {}]} {emit {%d chars high}}
-}
-}
-if {[S 1 == WAD]} {emit {DOOM data,}
-if {[S 0 == I]} {emit {main wad}}
-if {[S 0 == P]} {emit {patch wad}}
-if {[N c 0 x {}]} {emit {unknown junk}}
-}
-if {[S 0 == IDP2]} {emit {Quake II 3D Model file,}
-if {[N Q 20 x {}]} {emit {%lu skin\(s\),}}
-if {[N Q 8 x {}]} {emit {\(%lu x}}
-if {[N Q 12 x {}]} {emit {%lu\),}}
-if {[N Q 40 x {}]} {emit {%lu frame\(s\),}}
-if {[N Q 16 x {}]} {emit {Frame size %lu bytes,}}
-if {[N Q 24 x {}]} {emit {%lu vertices/frame,}}
-if {[N Q 28 x {}]} {emit {%lu texture coordinates,}}
-if {[N Q 32 x {}]} {emit {%lu triangles/frame}}
-}
-if {[S 0 == IBSP]} {emit Quake
-switch -- [Nv Q 4] 38 {emit {II Map file \(BSP\)}} 46 {emit {III Map file \(BSP\)}} 
-}
-if {[S 0 == IDS2]} {emit {Quake II SP2 sprite file}}
-if {[S 0 == IWAD]} {emit {DOOM or DOOM ][ world}}
-if {[S 0 == PWAD]} {emit {DOOM or DOOM ][ extension world}}
-if {[S 0 == {\xcb\x1dBoom\xe6\xff\x03\x01}]} {emit {Boom or linuxdoom demo}}
-if {[S 24 == {LxD\ 203}]} {emit {Linuxdoom save}
-if {[S 0 x {}]} {emit {, name=%s}}
-if {[S 44 x {}]} {emit {, world=%s}}
-}
-if {[S 0 == PACK]} {emit {Quake I or II world or extension}}
-if {[S 0 == {5\x0aIntroduction}]} {emit {Quake I save: start Introduction}}
-if {[S 0 == {5\x0athe_Slipgate_Complex}]} {emit {Quake I save: e1m1 The slipgate complex}}
-if {[S 0 == {5\x0aCastle_of_the_Damned}]} {emit {Quake I save: e1m2 Castle of the damned}}
-if {[S 0 == {5\x0athe_Necropolis}]} {emit {Quake I save: e1m3 The necropolis}}
-if {[S 0 == {5\x0athe_Grisly_Grotto}]} {emit {Quake I save: e1m4 The grisly grotto}}
-if {[S 0 == {5\x0aZiggurat_Vertigo}]} {emit {Quake I save: e1m8 Ziggurat vertigo \(secret\)}}
-if {[S 0 == {5\x0aGloom_Keep}]} {emit {Quake I save: e1m5 Gloom keep}}
-if {[S 0 == {5\x0aThe_Door_To_Chthon}]} {emit {Quake I save: e1m6 The door to Chthon}}
-if {[S 0 == {5\x0aThe_House_of_Chthon}]} {emit {Quake I save: e1m7 The house of Chthon}}
-if {[S 0 == {5\x0athe_Installation}]} {emit {Quake I save: e2m1 The installation}}
-if {[S 0 == {5\x0athe_Ogre_Citadel}]} {emit {Quake I save: e2m2 The ogre citadel}}
-if {[S 0 == {5\x0athe_Crypt_of_Decay}]} {emit {Quake I save: e2m3 The crypt of decay \(dopefish lives!\)}}
-if {[S 0 == {5\x0aUnderearth}]} {emit {Quake I save: e2m7 Underearth \(secret\)}}
-if {[S 0 == {5\x0athe_Ebon_Fortress}]} {emit {Quake I save: e2m4 The ebon fortress}}
-if {[S 0 == {5\x0athe_Wizard's_Manse}]} {emit {Quake I save: e2m5 The wizard's manse}}
-if {[S 0 == {5\x0athe_Dismal_Oubliette}]} {emit {Quake I save: e2m6 The dismal oubliette}}
-if {[S 0 == {5\x0aTermination_Central}]} {emit {Quake I save: e3m1 Termination central}}
-if {[S 0 == {5\x0aVaults_of_Zin}]} {emit {Quake I save: e3m2 Vaults of Zin}}
-if {[S 0 == {5\x0athe_Tomb_of_Terror}]} {emit {Quake I save: e3m3 The tomb of terror}}
-if {[S 0 == {5\x0aSatan's_Dark_Delight}]} {emit {Quake I save: e3m4 Satan's dark delight}}
-if {[S 0 == {5\x0athe_Haunted_Halls}]} {emit {Quake I save: e3m7 The haunted halls \(secret\)}}
-if {[S 0 == {5\x0aWind_Tunnels}]} {emit {Quake I save: e3m5 Wind tunnels}}
-if {[S 0 == {5\x0aChambers_of_Torment}]} {emit {Quake I save: e3m6 Chambers of torment}}
-if {[S 0 == {5\x0athe_Sewage_System}]} {emit {Quake I save: e4m1 The sewage system}}
-if {[S 0 == {5\x0aThe_Tower_of_Despair}]} {emit {Quake I save: e4m2 The tower of despair}}
-if {[S 0 == {5\x0aThe_Elder_God_Shrine}]} {emit {Quake I save: e4m3 The elder god shrine}}
-if {[S 0 == {5\x0athe_Palace_of_Hate}]} {emit {Quake I save: e4m4 The palace of hate}}
-if {[S 0 == {5\x0aHell's_Atrium}]} {emit {Quake I save: e4m5 Hell's atrium}}
-if {[S 0 == {5\x0athe_Nameless_City}]} {emit {Quake I save: e4m8 The nameless city \(secret\)}}
-if {[S 0 == {5\x0aThe_Pain_Maze}]} {emit {Quake I save: e4m6 The pain maze}}
-if {[S 0 == {5\x0aAzure_Agony}]} {emit {Quake I save: e4m7 Azure agony}}
-if {[S 0 == {5\x0aShub-Niggurath's_Pit}]} {emit {Quake I save: end Shub-Niggurath's pit}}
-if {[S 0 == {5\x0aPlace_of_Two_Deaths}]} {emit {Quake I save: dm1 Place of two deaths}}
-if {[S 0 == {5\x0aClaustrophobopolis}]} {emit {Quake I save: dm2 Claustrophobopolis}}
-if {[S 0 == {5\x0aThe_Abandoned_Base}]} {emit {Quake I save: dm3 The abandoned base}}
-if {[S 0 == {5\x0aThe_Bad_Place}]} {emit {Quake I save: dm4 The bad place}}
-if {[S 0 == {5\x0aThe_Cistern}]} {emit {Quake I save: dm5 The cistern}}
-if {[S 0 == {5\x0aThe_Dark_Zone}]} {emit {Quake I save: dm6 The dark zone}}
-if {[S 0 == {5\x0aCommand_HQ}]} {emit {Quake I save: start Command HQ}}
-if {[S 0 == {5\x0aThe_Pumping_Station}]} {emit {Quake I save: hip1m1 The pumping station}}
-if {[S 0 == {5\x0aStorage_Facility}]} {emit {Quake I save: hip1m2 Storage facility}}
-if {[S 0 == {5\x0aMilitary_Complex}]} {emit {Quake I save: hip1m5 Military complex \(secret\)}}
-if {[S 0 == {5\x0athe_Lost_Mine}]} {emit {Quake I save: hip1m3 The lost mine}}
-if {[S 0 == {5\x0aResearch_Facility}]} {emit {Quake I save: hip1m4 Research facility}}
-if {[S 0 == {5\x0aAncient_Realms}]} {emit {Quake I save: hip2m1 Ancient realms}}
-if {[S 0 == {5\x0aThe_Gremlin's_Domain}]} {emit {Quake I save: hip2m6 The gremlin's domain \(secret\)}}
-if {[S 0 == {5\x0aThe_Black_Cathedral}]} {emit {Quake I save: hip2m2 The black cathedral}}
-if {[S 0 == {5\x0aThe_Catacombs}]} {emit {Quake I save: hip2m3 The catacombs}}
-if {[S 0 == {5\x0athe_Crypt__}]} {emit {Quake I save: hip2m4 The crypt}}
-if {[S 0 == {5\x0aMortum's_Keep}]} {emit {Quake I save: hip2m5 Mortum's keep}}
-if {[S 0 == {5\x0aTur_Torment}]} {emit {Quake I save: hip3m1 Tur torment}}
-if {[S 0 == {5\x0aPandemonium}]} {emit {Quake I save: hip3m2 Pandemonium}}
-if {[S 0 == {5\x0aLimbo}]} {emit {Quake I save: hip3m3 Limbo}}
-if {[S 0 == {5\x0athe_Edge_of_Oblivion}]} {emit {Quake I save: hipdm1 The edge of oblivion \(secret\)}}
-if {[S 0 == {5\x0aThe_Gauntlet}]} {emit {Quake I save: hip3m4 The gauntlet}}
-if {[S 0 == {5\x0aArmagon's_Lair}]} {emit {Quake I save: hipend Armagon's lair}}
-if {[S 0 == {5\x0aThe_Academy}]} {emit {Quake I save: start The academy}}
-if {[S 0 == {5\x0aThe_Lab}]} {emit {Quake I save: d1 The lab}}
-if {[S 0 == {5\x0aArea_33}]} {emit {Quake I save: d1b Area 33}}
-if {[S 0 == {5\x0aSECRET_MISSIONS}]} {emit {Quake I save: d3b Secret missions}}
-if {[S 0 == {5\x0aThe_Hospital}]} {emit {Quake I save: d10 The hospital \(secret\)}}
-if {[S 0 == {5\x0aThe_Genetics_Lab}]} {emit {Quake I save: d11 The genetics lab \(secret\)}}
-if {[S 0 == {5\x0aBACK_2_MALICE}]} {emit {Quake I save: d4b Back to Malice}}
-if {[S 0 == {5\x0aArea44}]} {emit {Quake I save: d1c Area 44}}
-if {[S 0 == {5\x0aTakahiro_Towers}]} {emit {Quake I save: d2 Takahiro towers}}
-if {[S 0 == {5\x0aA_Rat's_Life}]} {emit {Quake I save: d3 A rat's life}}
-if {[S 0 == {5\x0aInto_The_Flood}]} {emit {Quake I save: d4 Into the flood}}
-if {[S 0 == {5\x0aThe_Flood}]} {emit {Quake I save: d5 The flood}}
-if {[S 0 == {5\x0aNuclear_Plant}]} {emit {Quake I save: d6 Nuclear plant}}
-if {[S 0 == {5\x0aThe_Incinerator_Plant}]} {emit {Quake I save: d7 The incinerator plant}}
-if {[S 0 == {5\x0aThe_Foundry}]} {emit {Quake I save: d7b The foundry}}
-if {[S 0 == {5\x0aThe_Underwater_Base}]} {emit {Quake I save: d8 The underwater base}}
-if {[S 0 == {5\x0aTakahiro_Base}]} {emit {Quake I save: d9 Takahiro base}}
-if {[S 0 == {5\x0aTakahiro_Laboratories}]} {emit {Quake I save: d12 Takahiro laboratories}}
-if {[S 0 == {5\x0aStayin'_Alive}]} {emit {Quake I save: d13 Stayin' alive}}
-if {[S 0 == {5\x0aB.O.S.S._HQ}]} {emit {Quake I save: d14 B.O.S.S. HQ}}
-if {[S 0 == {5\x0aSHOWDOWN!}]} {emit {Quake I save: d15 Showdown!}}
-if {[S 0 == {5\x0aThe_Seventh_Precinct}]} {emit {Quake I save: ddm1 The seventh precinct}}
-if {[S 0 == {5\x0aSub_Station}]} {emit {Quake I save: ddm2 Sub station}}
-if {[S 0 == {5\x0aCrazy_Eights!}]} {emit {Quake I save: ddm3 Crazy eights!}}
-if {[S 0 == {5\x0aEast_Side_Invertationa}]} {emit {Quake I save: ddm4 East side invertationa}}
-if {[S 0 == {5\x0aSlaughterhouse}]} {emit {Quake I save: ddm5 Slaughterhouse}}
-if {[S 0 == {5\x0aDOMINO}]} {emit {Quake I save: ddm6 Domino}}
-if {[S 0 == {5\x0aSANDRA'S_LADDER}]} {emit {Quake I save: ddm7 Sandra's ladder}}
-if {[S 0 == MComprHD]} {emit {MAME CHD compressed hard disk image,}
-if {[N I 12 x {}]} {emit {version %lu}}
-}
-if {[S 0 == gpch]} {emit {GCC precompiled header}
-if {[N c 5 x {}]} {emit {\(version %c}}
-if {[N c 6 x {}]} {emit {\b%c}}
-if {[N c 7 x {}]} {emit {\b%c\)}}
-switch -- [Nv c 4] 67 {emit {for C}} 111 {emit {for Objective C}} 43 {emit {for C++}} 79 {emit {for Objective C++}} 
-}
-if {[S 0 == {GIMP\ Gradient}]} {emit {GIMP gradient data}}
-if {[S 0 == {gimp\ xcf}]} {emit {GIMP XCF image data,}
-if {[S 9 == file]} {emit {version 0,}}
-if {[S 9 == v]} {emit version
-if {[S 10 x {}]} {emit %s,}
-}
-if {[N I 14 x {}]} {emit {%lu x}}
-if {[N I 18 x {}]} {emit %lu,}
-switch -- [Nv I 22] 0 {emit {RGB Color}} 1 {emit Greyscale} 2 {emit {Indexed Color}} 
-if {[N I 22 > 0x2]} {emit {Unknown Image Type.}}
-}
-if {[S 20 == GPAT]} {emit {GIMP pattern data,}
-if {[S 24 x {}]} {emit %s}
-}
-if {[S 20 == GIMP]} {emit {GIMP brush data}}
-if {[S 0 == {\336\22\4\225}]} {emit {GNU message catalog \(little endian\),}
-if {[N i 4 x {}]} {emit {revision %d,}}
-if {[N i 8 x {}]} {emit {%d messages}}
-}
-if {[S 0 == {\225\4\22\336}]} {emit {GNU message catalog \(big endian\),}
-if {[N I 4 x {}]} {emit {revision %d,}}
-if {[N I 8 x {}]} {emit {%d messages}}
-}
-if {[S 0 == *nazgul*]} {emit {Nazgul style compiled message catalog}
-if {[N i 8 > 0x0]} {emit {\b, version %ld}}
-}
-if {[S 0 == {\001gpg}]} {emit {GPG key trust database}
-if {[N c 4 x {}]} {emit {version %d}}
-}
-if {[S 39 == <gmr:Workbook]} {emit {Gnumeric spreadsheet}}
-if {[S 0 == {\0LOCATE}]} {emit {GNU findutils locate database data}
-if {[S 7 x {}]} {emit {\b, format %s}}
-if {[S 7 == 02]} {emit {\b \(frcode\)}}
-}
-if {[S 0 == {\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003}]} {emit {old ACE/gr binary file}
-if {[N c 39 > 0x0]} {emit {- version %c}}
-}
-if {[S 0 == {\#\ xvgr\ parameter\ file}]} {emit {ACE/gr ascii file}}
-if {[S 0 == {\#\ xmgr\ parameter\ file}]} {emit {ACE/gr ascii file}}
-if {[S 0 == {\#\ ACE/gr\ parameter\ file}]} {emit {ACE/gr ascii file}}
-if {[S 0 == {\#\ Grace\ project\ file}]} {emit {Grace project file}
-if {[S 23 == {@version\ }]} {emit {\(version}
-if {[N c 32 > 0x0]} {emit %c}
-if {[S 33 x {}]} {emit {\b.%.2s}}
-if {[S 35 x {}]} {emit {\b.%.2s\)}}
-}
-}
-if {[S 0 == {\#\ ACE/gr\ fit\ description\ }]} {emit {ACE/gr fit description file}}
-if {[S 0 == {\211HDF\r\n\032}]} {emit {Hierarchical Data Format \(version 5\) data}}
-if {[S 0 == Bitmapfile]} {emit {HP Bitmapfile}}
-if {[S 0 == IMGfile]} {emit {CIS 	compimg HP Bitmapfile}}
-if {[S 0 == msgcat01]} {emit {HP NLS message catalog,}
-if {[N Q 8 > 0x0]} {emit {%d messages}}
-}
-if {[S 0 == HPHP48-]} {emit {HP48 binary}
-if {[N c 7 > 0x0]} {emit {- Rev %c}}
-switch -- [Nv S 8] 4393 {emit {\(ADR\)}} 13097 {emit {\(REAL\)}} 21801 {emit {\(LREAL\)}} 30505 {emit {\(COMPLX\)}} -25303 {emit {\(LCOMPLX\)}} -16599 {emit {\(CHAR\)}} -6103 {emit {\(ARRAY\)}} 2602 {emit {\(LNKARRAY\)}} 11306 {emit {\(STRING\)}} 20010 {emit {\(HXS\)}} 29738 {emit {\(LIST\)}} -27094 {emit {\(DIR\)}} -18390 {emit {\(ALG\)}} -9686 {emit {\(UNIT\)}} -982 {emit {\(TAGGED\)}} 7723 {emit {\(GROB\)}} 16427 {emit {\(LIB\)}} 25131 {emit {\(BACKUP\)}} -30677 {emit {\(LIBDATA\)}} -25299 {emit {\(PROG\)}} -13267 {emit {\(CODE\)}} 18478 {emit {\(GNAME\)}} 27950 {emit {\(LNAME\)}} -28114 {emit {\(XLIB\)}} 
-}
-if {[S 0 == %%HP:]} {emit {HP48 text}
-if {[S 6 == T(0)]} {emit {- T\(0\)}}
-if {[S 6 == T(1)]} {emit {- T\(1\)}}
-if {[S 6 == T(2)]} {emit {- T\(2\)}}
-if {[S 6 == T(3)]} {emit {- T\(3\)}}
-if {[S 10 == A(D)]} {emit {A\(D\)}}
-if {[S 10 == A(R)]} {emit {A\(R\)}}
-if {[S 10 == A(G)]} {emit {A\(G\)}}
-if {[S 14 == F(.)]} {emit {F\(.\);}}
-if {[S 14 == F(,)]} {emit {F\(,\);}}
-}
-if {[S 16 == HP-UX]} {if {[N I 0 == 0x2]} {if {[N I 12 == 0x3c]} {switch -- [Nv I 76] 256 {emit {}
-if {[N I 88 == 0x44]} {if {[N I 160 == 0x1]} {if {[N I 172 == 0x4]} {if {[N I 176 == 0x1]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 144 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-} 1 {emit {}
-if {[N I 88 == 0x4]} {if {[N I 92 == 0x1]} {if {[N I 96 == 0x100]} {if {[N I 108 == 0x44]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 164 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-} 
-}
-}
-}
-if {[S 36 == HP-UX]} {if {[N I 0 == 0x1]} {if {[N I 12 == 0x4]} {if {[N I 16 == 0x1]} {if {[N I 20 == 0x2]} {if {[N I 32 == 0x3c]} {if {[N I 96 == 0x100]} {if {[N I 108 == 0x44]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 164 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-}
-}
-}
-}
-if {[S 100 == HP-UX]} {if {[N I 0 == 0x100]} {if {[N I 12 == 0x44]} {if {[N I 84 == 0x2]} {if {[N I 96 == 0x3c]} {if {[N I 160 == 0x1]} {if {[N I 172 == 0x4]} {if {[N I 176 == 0x1]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 68 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-}
-}
-}
-}
-if {[S 120 == HP-UX]} {switch -- [Nv I 0] 1 {emit {}
-if {[N I 12 == 0x4]} {if {[N I 16 == 0x1]} {if {[N I 20 == 0x100]} {if {[N I 32 == 0x44]} {if {[N I 104 == 0x2]} {if {[N I 116 == 0x3c]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 88 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-}
-}
-} 256 {emit {}
-if {[N I 12 == 0x44]} {if {[N I 84 == 0x1]} {if {[N I 96 == 0x4]} {if {[N I 100 == 0x1]} {if {[N I 104 == 0x2]} {if {[N I 116 == 0x2c]} {if {[N I 180 == 0x4]} {emit {core file}
-if {[S 68 x {}]} {emit {from '%s'}}
-switch -- [Nv I 196] 3 {emit {- received SIGQUIT}} 4 {emit {- received SIGILL}} 5 {emit {- received SIGTRAP}} 6 {emit {- received SIGABRT}} 7 {emit {- received SIGEMT}} 8 {emit {- received SIGFPE}} 10 {emit {- received SIGBUS}} 11 {emit {- received SIGSEGV}} 12 {emit {- received SIGSYS}} 33 {emit {- received SIGXCPU}} 34 {emit {- received SIGXFSZ}} 
-}
-}
-}
-}
-}
-}
-}
-} 
-}
-if {[S 0 == HPHP49-]} {emit {HP49 binary}}
-if {[S 0 == 0xabcdef]} {emit {AIX message catalog}}
-if {[S 0 == <aiaff>]} {emit archive}
-if {[S 0 == <bigaf>]} {emit {archive \(big format\)}}
-if {[S 0 == FORM]} {emit {IFF data}
-if {[S 8 == AIFF]} {emit {\b, AIFF audio}}
-if {[S 8 == AIFC]} {emit {\b, AIFF-C compressed audio}}
-if {[S 8 == 8SVX]} {emit {\b, 8SVX 8-bit sampled sound voice}}
-if {[S 8 == SAMP]} {emit {\b, SAMP sampled audio}}
-if {[S 8 == DTYP]} {emit {\b, DTYP datatype description}}
-if {[S 8 == PTCH]} {emit {\b, PTCH binary patch}}
-if {[S 8 == ILBMBMHD]} {emit {\b, ILBM interleaved image}
-if {[N S 20 x {}]} {emit {\b, %d x}}
-if {[N S 22 x {}]} {emit %d}
-}
-if {[S 8 == RGBN]} {emit {\b, RGBN 12-bit RGB image}}
-if {[S 8 == RGB8]} {emit {\b, RGB8 24-bit RGB image}}
-if {[S 8 == DR2D]} {emit {\b, DR2D 2-D object}}
-if {[S 8 == TDDD]} {emit {\b, TDDD 3-D rendering}}
-if {[S 8 == FTXT]} {emit {\b, FTXT formatted text}}
-if {[S 8 == CTLG]} {emit {\b, CTLG message catalog}}
-if {[S 8 == PREF]} {emit {\b, PREF preferences}}
-}
-switch -- [Nv I 1 &0xfff7ffff] 16842752 {emit {Targa image data - Map}
-if {[N c 2 == 0x8 &8]} {emit {- RLE}}
-if {[N s 12 > 0x0]} {emit {%hd x}}
-if {[N s 14 > 0x0]} {emit %hd}
-} 131072 {emit {Targa image data - RGB}
-if {[N c 2 == 0x8 &8]} {emit {- RLE}}
-if {[N s 12 > 0x0]} {emit {%hd x}}
-if {[N s 14 > 0x0]} {emit %hd}
-} 196608 {emit {Targa image data - Mono}
-if {[N c 2 == 0x8 &8]} {emit {- RLE}}
-if {[N s 12 > 0x0]} {emit {%hd x}}
-if {[N s 14 > 0x0]} {emit %hd}
-} 
-if {[S 0 == P1]} {emit {Netpbm PBM image text}}
-if {[S 0 == P2]} {emit {Netpbm PGM image text}}
-if {[S 0 == P3]} {emit {Netpbm PPM image text}}
-if {[S 0 == P4]} {emit {Netpbm PBM \"rawbits\" image data}}
-if {[S 0 == P5]} {emit {Netpbm PGM \"rawbits\" image data}}
-if {[S 0 == P6]} {emit {Netpbm PPM \"rawbits\" image data}}
-if {[S 0 == P7]} {emit {Netpbm PAM image file}}
-if {[S 0 == {\117\072}]} {emit {Solitaire Image Recorder format}
-if {[S 4 == {\013}]} {emit {MGI Type 11}}
-if {[S 4 == {\021}]} {emit {MGI Type 17}}
-}
-if {[S 0 == .MDA]} {emit {MicroDesign data}
-switch -- [Nv c 21] 48 {emit {version 2}} 51 {emit {version 3}} 
-}
-if {[S 0 == .MDP]} {emit {MicroDesign page data}
-switch -- [Nv c 21] 48 {emit {version 2}} 51 {emit {version 3}} 
-}
-if {[S 0 == IIN1]} {emit {NIFF image data}}
-if {[S 0 == {MM\x00\x2a}]} {emit {TIFF image data, big-endian}}
-if {[S 0 == {II\x2a\x00}]} {emit {TIFF image data, little-endian}}
-if {[S 0 == {\x89PNG}]} {emit {PNG image data,}
-if {[N I 4 != 0xd0a1a0a]} {emit CORRUPTED,}
-if {[N I 4 == 0xd0a1a0a]} {if {[N I 16 x {}]} {emit {%ld x}}
-if {[N I 20 x {}]} {emit %ld,}
-if {[N c 24 x {}]} {emit %d-bit}
-switch -- [Nv c 25] 0 {emit grayscale,} 2 {emit {\b/color RGB,}} 3 {emit colormap,} 4 {emit gray+alpha,} 6 {emit {\b/color RGBA,}} 
-switch -- [Nv c 28] 0 {emit non-interlaced} 1 {emit interlaced} 
-}
-}
-if {[S 1 == PNG]} {emit {PNG image data, CORRUPTED}}
-if {[S 0 == GIF8]} {emit {GIF image data}
-if {[S 4 == 7a]} {emit {\b, version 8%s,}}
-if {[S 4 == 9a]} {emit {\b, version 8%s,}}
-if {[N s 6 > 0x0]} {emit {%hd x}}
-if {[N s 8 > 0x0]} {emit %hd}
-}
-if {[S 0 == {\361\0\100\273}]} {emit {CMU window manager raster image data}
-if {[N i 4 > 0x0]} {emit {%d x}}
-if {[N i 8 > 0x0]} {emit %d,}
-if {[N i 12 > 0x0]} {emit %d-bit}
-}
-if {[S 0 == id=ImageMagick]} {emit {MIFF image data}}
-if {[S 0 == {\#FIG}]} {emit {FIG image text}
-if {[S 5 x {}]} {emit {\b, version %.3s}}
-}
-if {[S 0 == ARF_BEGARF]} {emit {PHIGS clear text archive}}
-if {[S 0 == {@(\#)SunPHIGS}]} {emit SunPHIGS
-if {[S 40 == SunBin]} {emit binary}
-if {[S 32 == archive]} {emit archive}
-}
-if {[S 0 == GKSM]} {emit {GKS Metafile}
-if {[S 24 == SunGKS]} {emit {\b, SunGKS}}
-}
-if {[S 0 == BEGMF]} {emit {clear text Computer Graphics Metafile}}
-if {[N S 0 == 0x20 &0xffe0]} {emit {binary Computer Graphics Metafile}}
-if {[S 0 == yz]} {emit {MGR bitmap, modern format, 8-bit aligned}}
-if {[S 0 == zz]} {emit {MGR bitmap, old format, 1-bit deep, 16-bit aligned}}
-if {[S 0 == xz]} {emit {MGR bitmap, old format, 1-bit deep, 32-bit aligned}}
-if {[S 0 == yx]} {emit {MGR bitmap, modern format, squeezed}}
-if {[S 0 == {%bitmap\0}]} {emit {FBM image data}
-switch -- [Nv Q 30] 49 {emit {\b, mono}} 51 {emit {\b, color}} 
-}
-if {[S 1 == {PC\ Research,\ Inc}]} {emit {group 3 fax data}
-switch -- [Nv c 29] 0 {emit {\b, normal resolution \(204x98 DPI\)}} 1 {emit {\b, fine resolution \(204x196 DPI\)}} 
-}
-if {[S 0 == Sfff]} {emit {structured fax file}}
-if {[S 0 == BM]} {emit {PC bitmap data}
-switch -- [Nv s 14] 12 {emit {\b, OS/2 1.x format}
-if {[N s 18 x {}]} {emit {\b, %d x}}
-if {[N s 20 x {}]} {emit %d}
-} 64 {emit {\b, OS/2 2.x format}
-if {[N s 18 x {}]} {emit {\b, %d x}}
-if {[N s 20 x {}]} {emit %d}
-} 40 {emit {\b, Windows 3.x format}
-if {[N i 18 x {}]} {emit {\b, %d x}}
-if {[N i 22 x {}]} {emit {%d x}}
-if {[N s 28 x {}]} {emit %d}
-} 
-}
-if {[S 0 == {/*\ XPM\ */}]} {emit {X pixmap image text}}
-if {[S 0 == {Imagefile\ version-}]} {emit {iff image data}
-if {[S 10 x {}]} {emit %s}
-}
-if {[S 0 == IT01]} {emit {FIT image data}
-if {[N I 4 x {}]} {emit {\b, %d x}}
-if {[N I 8 x {}]} {emit {%d x}}
-if {[N I 12 x {}]} {emit %d}
-}
-if {[S 0 == IT02]} {emit {FIT image data}
-if {[N I 4 x {}]} {emit {\b, %d x}}
-if {[N I 8 x {}]} {emit {%d x}}
-if {[N I 12 x {}]} {emit %d}
-}
-if {[S 2048 == PCD_IPI]} {emit {Kodak Photo CD image pack file}
-switch -- [Nv c 3586 &0x03] 0 {emit {, landscape mode}} 1 {emit {, portrait mode}} 2 {emit {, landscape mode}} 3 {emit {, portrait mode}} 
-}
-if {[S 0 == PCD_OPA]} {emit {Kodak Photo CD overview pack file}}
-if {[S 0 == {SIMPLE\ \ =}]} {emit {FITS image data}
-if {[S 109 == 8]} {emit {\b, 8-bit, character or unsigned binary integer}}
-if {[S 108 == 16]} {emit {\b, 16-bit, two's complement binary integer}}
-if {[S 107 == {\ 32}]} {emit {\b, 32-bit, two's complement binary integer}}
-if {[S 107 == -32]} {emit {\b, 32-bit, floating point, single precision}}
-if {[S 107 == -64]} {emit {\b, 64-bit, floating point, double precision}}
-}
-if {[S 0 == {This\ is\ a\ BitMap\ file}]} {emit {Lisp Machine bit-array-file}}
-if {[S 0 == !!]} {emit {Bennet Yee's \"face\" format}}
-if {[S 1536 == {Visio\ (TM)\ Drawing}]} {emit %s}
-if {[S 0 == {\%TGIF\ x}]} {emit {Tgif file version %s}}
-if {[S 128 == DICM]} {emit {DICOM medical imaging data}}
-switch -- [Nv I 4] 7 {emit {XWD X Window Dump image data}
-if {[S 100 x {}]} {emit {\b, \"%s\"}}
-if {[N I 16 x {}]} {emit {\b, %dx}}
-if {[N I 20 x {}]} {emit {\b%dx}}
-if {[N I 12 x {}]} {emit {\b%d}}
-} 2097152000 {emit GLF_BINARY_LSB_FIRST} 125 {emit GLF_BINARY_MSB_FIRST} 268435456 {emit GLS_BINARY_LSB_FIRST} 16 {emit GLS_BINARY_MSB_FIRST} 19195 {emit {QDOS executable}
-if {[S 9 x {} p]} {emit '%s'}
-} 
-if {[S 0 == NJPL1I00]} {emit {PDS \(JPL\) image data}}
-if {[S 2 == NJPL1I]} {emit {PDS \(JPL\) image data}}
-if {[S 0 == CCSD3ZF]} {emit {PDS \(CCSD\) image data}}
-if {[S 2 == CCSD3Z]} {emit {PDS \(CCSD\) image data}}
-if {[S 0 == PDS_]} {emit {PDS image data}}
-if {[S 0 == LBLSIZE=]} {emit {PDS \(VICAR\) image data}}
-if {[S 0 == pM85]} {emit {Atari ST STAD bitmap image data \(hor\)}
-switch -- [Nv c 5] 0 {emit {\(white background\)}} -1 {emit {\(black background\)}} 
-}
-if {[S 0 == pM86]} {emit {Atari ST STAD bitmap image data \(vert\)}
-switch -- [Nv c 5] 0 {emit {\(white background\)}} -1 {emit {\(black background\)}} 
-}
-if {[S 0 == {\x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47}]} {emit {EPOC MBM image file}}
-if {[S 0 == 8BPS]} {emit {Adobe Photoshop Image}}
-if {[S 0 == {P7\ 332}]} {emit {XV thumbnail image data}}
-if {[S 0 == NITF]} {emit {National Imagery Transmission Format}
-if {[S 25 x {}]} {emit {dated %.14s}}
-}
-if {[S 0 == {\0\nSMJPEG}]} {emit SMJPEG
-if {[N I 8 x {}]} {emit {%d.x data}}
-if {[S 16 == _SND]} {emit {\b,}
-if {[N S 24 > 0x0]} {emit {%d Hz}}
-switch -- [Nv c 26] 8 {emit 8-bit} 16 {emit 16-bit} 
-if {[S 28 == NONE]} {emit uncompressed}
-if {[N c 27 == 0x1]} {emit mono}
-if {[N c 28 == 0x2]} {emit stereo}
-if {[S 32 == _VID]} {emit {\b,}
-if {[N I 40 > 0x0]} {emit {%d frames}}
-if {[N S 44 > 0x0]} {emit {\(%d x}}
-if {[N S 46 > 0x0]} {emit {%d\)}}
-}
-}
-if {[S 16 == _VID]} {emit {\b,}
-if {[N I 24 > 0x0]} {emit {%d frames}}
-if {[N S 28 > 0x0]} {emit {\(%d x}}
-if {[N S 30 > 0x0]} {emit {%d\)}}
-}
-}
-if {[S 0 == {Paint\ Shop\ Pro\ Image\ File}]} {emit {Paint Shop Pro Image File}}
-if {[S 0 == {P7\ 332}]} {emit {XV \"thumbnail file\" \(icon\) data}}
-if {[S 0 == KiSS]} {emit KISS/GS
-switch -- [Nv c 4] 16 {emit color
-if {[N c 5 x {}]} {emit {%d bit}}
-if {[N s 8 x {}]} {emit {%d colors}}
-if {[N s 10 x {}]} {emit {%d groups}}
-} 32 {emit cell
-if {[N c 5 x {}]} {emit {%d bit}}
-if {[N s 8 x {}]} {emit {%d x}}
-if {[N s 10 x {}]} {emit %d}
-if {[N s 12 x {}]} {emit +%d}
-if {[N s 14 x {}]} {emit +%d}
-} 
-}
-if {[S 0 == {C\253\221g\230\0\0\0}]} {emit {Webshots Desktop .wbz file}}
-if {[S 0 == CKD_P370]} {emit {Hercules CKD DASD image file}
-if {[N Q 8 x {}]} {emit {\b, %d heads per cylinder}}
-if {[N Q 12 x {}]} {emit {\b, track size %d bytes}}
-if {[N c 16 x {}]} {emit {\b, device type 33%2.2X}}
-}
-if {[S 0 == CKD_C370]} {emit {Hercules compressed CKD DASD image file}
-if {[N Q 8 x {}]} {emit {\b, %d heads per cylinder}}
-if {[N Q 12 x {}]} {emit {\b, track size %d bytes}}
-if {[N c 16 x {}]} {emit {\b, device type 33%2.2X}}
-}
-if {[S 0 == CKD_S370]} {emit {Hercules CKD DASD shadow file}
-if {[N Q 8 x {}]} {emit {\b, %d heads per cylinder}}
-if {[N Q 12 x {}]} {emit {\b, track size %d bytes}}
-if {[N c 16 x {}]} {emit {\b, device type 33%2.2X}}
-}
-if {[S 0 == {\146\031\0\0}]} {emit {Squeak image data}}
-if {[S 0 == {'From\040Squeak}]} {emit {Squeak program text}}
-if {[S 0 == PaRtImAgE-VoLuMe]} {emit PartImage
-if {[S 32 == 0.6.1]} {emit {file version %s}
-if {[N i 96 > 0xffffffff]} {emit {volume %ld}}
-if {[S 512 x {}]} {emit {type %s}}
-if {[S 5120 x {}]} {emit {device %s,}}
-if {[S 5632 x {}]} {emit {original filename %s,}}
-switch -- [Nv i 10052] 0 {emit {not compressed}} 1 {emit {gzip compressed}} 2 {emit {bzip2 compressed}} 
-if {[N i 10052 > 0x2]} {emit {compressed with unknown algorithm}}
-}
-if {[S 32 > 0.6.1]} {emit {file version %s}}
-if {[S 32 < 0.6.1]} {emit {file version %s}}
-}
-if {[N s 54 == 0x3039]} {emit {Bio-Rad .PIC Image File}
-if {[N s 0 > 0x0]} {emit {%hd x}}
-if {[N s 2 > 0x0]} {emit %hd,}
-if {[N s 4 == 0x1]} {emit {1 image in file}}
-if {[N s 4 > 0x1]} {emit {%hd images in file}}
-}
-if {[S 0 == {\000MRM}]} {emit {Minolta Dimage camera raw image data}}
-if {[S 0 == AT&TFORM]} {emit {DjVu Image file}}
-if {[S 0 == {CDF\001}]} {emit {NetCDF Data Format data}}
-if {[S 0 == {\211HDF\r\n\032}]} {emit {Hierarchical Data Format \(version 5\) data}}
-if {[S 0 == {\210OPS}]} {emit {Interleaf saved data}}
-if {[S 0 == <!OPS]} {emit {Interleaf document text}
-if {[S 5 == {,\ Version\ =}]} {emit {\b, version}
-if {[S 17 x {}]} {emit %.3s}
-}
-}
-if {[S 4 == pgscriptver]} {emit {IslandWrite document}}
-if {[S 13 == DrawFile]} {emit {IslandDraw document}}
-if {[N s 0 == 0x9600 &0xFFFC]} {emit {little endian ispell}
-switch -- [Nv c 0] 0 {emit {hash file \(?\),}} 1 {emit {3.0 hash file,}} 2 {emit {3.1 hash file,}} 3 {emit {hash file \(?\),}} 
-switch -- [Nv s 2] 0 {emit {8-bit, no capitalization, 26 flags}} 1 {emit {7-bit, no capitalization, 26 flags}} 2 {emit {8-bit, capitalization, 26 flags}} 3 {emit {7-bit, capitalization, 26 flags}} 4 {emit {8-bit, no capitalization, 52 flags}} 5 {emit {7-bit, no capitalization, 52 flags}} 6 {emit {8-bit, capitalization, 52 flags}} 7 {emit {7-bit, capitalization, 52 flags}} 8 {emit {8-bit, no capitalization, 128 flags}} 9 {emit {7-bit, no capitalization, 128 flags}} 10 {emit {8-bit, capitalization, 128 flags}} 11 {emit {7-bit, capitalization, 128 flags}} 12 {emit {8-bit, no capitalization, 256 flags}} 13 {emit {7-bit, no capitalization, 256 flags}} 14 {emit {8-bit, capitalization, 256 flags}} 15 {emit {7-bit, capitalization, 256 flags}} 
-if {[N s 4 > 0x0]} {emit {and %d string characters}}
-}
-if {[N S 0 == 0x9600 &0xFFFC]} {emit {big endian ispell}
-switch -- [Nv c 1] 0 {emit {hash file \(?\),}} 1 {emit {3.0 hash file,}} 2 {emit {3.1 hash file,}} 3 {emit {hash file \(?\),}} 
-switch -- [Nv S 2] 0 {emit {8-bit, no capitalization, 26 flags}} 1 {emit {7-bit, no capitalization, 26 flags}} 2 {emit {8-bit, capitalization, 26 flags}} 3 {emit {7-bit, capitalization, 26 flags}} 4 {emit {8-bit, no capitalization, 52 flags}} 5 {emit {7-bit, no capitalization, 52 flags}} 6 {emit {8-bit, capitalization, 52 flags}} 7 {emit {7-bit, capitalization, 52 flags}} 8 {emit {8-bit, no capitalization, 128 flags}} 9 {emit {7-bit, no capitalization, 128 flags}} 10 {emit {8-bit, capitalization, 128 flags}} 11 {emit {7-bit, capitalization, 128 flags}} 12 {emit {8-bit, no capitalization, 256 flags}} 13 {emit {7-bit, no capitalization, 256 flags}} 14 {emit {8-bit, capitalization, 256 flags}} 15 {emit {7-bit, capitalization, 256 flags}} 
-if {[N S 4 > 0x0]} {emit {and %d string characters}}
-}
-if {[S 0 == ISPL]} {emit ispell
-if {[N Q 4 x {}]} {emit {hash file version %d,}}
-if {[N Q 8 x {}]} {emit {lexletters %d,}}
-if {[N Q 12 x {}]} {emit {lexsize %d,}}
-if {[N Q 16 x {}]} {emit {hashsize %d,}}
-if {[N Q 20 x {}]} {emit {stblsize %d}}
-}
-if {[S 0 == hsi1]} {emit {JPEG image data, HSI proprietary}}
-if {[S 0 == {\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A}]} {emit {JPEG 2000 image data}}
-if {[S 0 == KarmaRHD]} {emit {Version	Karma Data Structure Version}
-if {[N I 16 x {}]} {emit %lu}
-}
-if {[S 0 == lect]} {emit {DEC SRC Virtual Paper Lectern file}}
-if {[S 53 == yyprevious]} {emit {C program text \(from lex\)}
-if {[S 3 x {}]} {emit {for %s}}
-}
-if {[S 21 == {generated\ by\ flex}]} {emit {C program text \(from flex\)}}
-if {[S 0 == {%\{}]} {emit {lex description text}}
-if {[S 0 == {\007\001\000}]} {emit {Linux/i386 object file}
-if {[N i 20 > 0x1020]} {emit {\b, DLL library}}
-}
-if {[S 0 == {\01\03\020\04}]} {emit {Linux-8086 impure executable}
-if {[N Q 28 != 0x0]} {emit {not stripped}}
-}
-if {[S 0 == {\01\03\040\04}]} {emit {Linux-8086 executable}
-if {[N Q 28 != 0x0]} {emit {not stripped}}
-}
-if {[S 0 == {\243\206\001\0}]} {emit {Linux-8086 object file}}
-if {[S 0 == {\01\03\020\20}]} {emit {Minix-386 impure executable}
-if {[N Q 28 != 0x0]} {emit {not stripped}}
-}
-if {[S 0 == {\01\03\040\20}]} {emit {Minix-386 executable}
-if {[N Q 28 != 0x0]} {emit {not stripped}}
-}
-if {[N i 216 == 0x111]} {emit {Linux/i386 core file}
-if {[S 220 x {}]} {emit {of '%s'}}
-if {[N i 200 > 0x0]} {emit {\(signal %d\)}}
-}
-if {[S 2 == LILO]} {emit {Linux/i386 LILO boot/chain loader}}
-if {[S 4086 == SWAP-SPACE]} {emit {Linux/i386 swap file}}
-if {[S 4086 == SWAPSPACE2]} {emit {Linux/i386 swap file \(new style\)}
-if {[N Q 1024 x {}]} {emit {%d \(4K pages\)}}
-if {[N Q 1028 x {}]} {emit {size %d pages}}
-}
-if {[S 514 == HdrS]} {emit {Linux kernel}
-if {[N s 510 == 0xaa55]} {emit {x86 boot executable}
-if {[N c 529 == 0x0]} {emit zImage,
-if {[N c 529 == 0x1]} {emit bzImage,}
-if {[S [I 526 s 512] x {}]} {emit {version %s,}}
-}
-switch -- [Nv s 498] 1 {emit RO-rootFS,} 0 {emit RW-rootFS,} 
-if {[N s 508 > 0x0]} {emit {root_dev 0x%X,}}
-if {[N s 502 > 0x0]} {emit {swap_dev 0x%X,}}
-if {[N s 504 > 0x0]} {emit {RAMdisksize %u KB,}}
-switch -- [Nv s 506] -1 {emit {Normal VGA}} -2 {emit {Extended VGA}} -3 {emit {Prompt for Videomode}} 
-if {[N s 506 > 0x0]} {emit {Video mode %d}}
-}
-}
-if {[S 8 == {\ A\ _text}]} {emit {Linux kernel symbol map text}}
-if {[S 0 == Begin3]} {emit {Linux Software Map entry text}}
-if {[S 0 == Begin4]} {emit {Linux Software Map entry text \(new format\)}}
-if {[S 0 == {\xb8\xc0\x07\x8e\xd8\xb8\x00\x90}]} {emit Linux
-if {[N s 497 == 0x0]} {emit {x86 boot sector}
-switch -- [Nv I 514] 142 {emit {of a kernel from the dawn of time!}} -1869686604 {emit {version 0.99-1.1.42}} -1869686600 {emit {for memtest86}} 
-}
-if {[N s 497 != 0x0]} {emit {x86 kernel}
-if {[N s 504 > 0x0]} {emit {RAMdisksize=%u KB}}
-if {[N s 502 > 0x0]} {emit swap=0x%X}
-if {[N s 508 > 0x0]} {emit root=0x%X
-switch -- [Nv s 498] 1 {emit {\b-ro}} 0 {emit {\b-rw}} 
-}
-switch -- [Nv s 506] -1 {emit vga=normal} -2 {emit vga=extended} -3 {emit vga=ask} 
-if {[N s 506 > 0x0]} {emit vga=%d}
-switch -- [Nv I 514] -1869686655 {emit {version 1.1.43-1.1.45}} 364020173 {emit {}
-if {[N I 2702 == 0x55aa5a5a]} {emit {version 1.1.46-1.2.13,1.3.0}}
-if {[N I 2713 == 0x55aa5a5a]} {emit {version 1.3.1,2}}
-if {[N I 2723 == 0x55aa5a5a]} {emit {version 1.3.3-1.3.30}}
-if {[N I 2726 == 0x55aa5a5a]} {emit {version 1.3.31-1.3.41}}
-if {[N I 2859 == 0x55aa5a5a]} {emit {version 1.3.42-1.3.45}}
-if {[N I 2807 == 0x55aa5a5a]} {emit {version 1.3.46-1.3.72}}
-} 
-if {[S 514 == HdrS]} {if {[N s 518 > 0x1ff]} {switch -- [Nv c 529] 0 {emit {\b, zImage}} 1 {emit {\b, bzImage}} 
-if {[S [I 526 s 512] x {}]} {emit {\b, version %s}}
-}
-}
-}
-}
-if {[N i 0 == 0xc30000e9 &0xFF0000FF]} {emit {Linux-Dev86 executable, headerless}
-if {[S 5 == .]} {if {[S 4 x {}]} {emit {\b, libc version %s}}
-}
-}
-if {[N i 0 == 0x4000301 &0xFF00FFFF]} {emit {Linux-8086 executable}
-if {[N c 2 != 0x0 &0x01]} {emit {\b, unmapped zero page}}
-if {[N c 2 == 0x0 &0x20]} {emit {\b, impure}}
-if {[N c 2 != 0x0 &0x20]} {if {[N c 2 != 0x0 &0x10]} {emit {\b, A_EXEC}}
-}
-if {[N c 2 != 0x0 &0x02]} {emit {\b, A_PAL}}
-if {[N c 2 != 0x0 &0x04]} {emit {\b, A_NSYM}}
-if {[N c 2 != 0x0 &0x08]} {emit {\b, A_STAND}}
-if {[N c 2 != 0x0 &0x40]} {emit {\b, A_PURE}}
-if {[N c 2 != 0x0 &0x80]} {emit {\b, A_TOVLY}}
-if {[N Q 28 != 0x0]} {emit {\b, not stripped}}
-if {[S 37 == .]} {if {[S 36 x {}]} {emit {\b, libc version %s}}
-}
-}
-if {[S 0 == {;;}]} {emit {Lisp/Scheme program text}}
-if {[S 0 == {\012(}]} {emit {Emacs v18 byte-compiled Lisp data}}
-if {[S 0 == {;ELC}]} {if {[N c 4 > 0x13]} {emit 636 0}
-if {[N c 4 < 0x20]} {emit {Emacs/XEmacs v%d byte-compiled Lisp data}}
-}
-if {[S 0 == {(SYSTEM::VERSION\040'}]} {emit {CLISP byte-compiled Lisp program text}}
-if {[S 0 == {\372\372\372\372}]} {emit {MIT scheme \(library?\)}}
-if {[S 0 == <TeXmacs|]} {emit {TeXmacs document text}}
-if {[S 11 == {must\ be\ converted\ with\ BinHex}]} {emit {BinHex binary text}
-if {[S 41 x {}]} {emit {\b, version %.3s}}
-}
-if {[S 0 == SIT!]} {emit {StuffIt Archive \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == SITD]} {emit {StuffIt Deluxe \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == Seg]} {emit {StuffIt Deluxe Segment \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == StuffIt]} {emit {StuffIt Archive}}
-if {[S 0 == APPL]} {emit {Macintosh Application \(data\)}
-if {[S 2 x {}]} {emit {\b: %s}}
-}
-if {[S 0 == zsys]} {emit {Macintosh System File \(data\)}}
-if {[S 0 == FNDR]} {emit {Macintosh Finder \(data\)}}
-if {[S 0 == libr]} {emit {Macintosh Library \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == shlb]} {emit {Macintosh Shared Library \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == cdev]} {emit {Macintosh Control Panel \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == INIT]} {emit {Macintosh Extension \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == FFIL]} {emit {Macintosh Truetype Font \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == LWFN]} {emit {Macintosh Postscript Font \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == PACT]} {emit {Macintosh Compact Pro Archive \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == ttro]} {emit {Macintosh TeachText File \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == TEXT]} {emit {Macintosh TeachText File \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 0 == PDF]} {emit {Macintosh PDF File \(data\)}
-if {[S 2 x {}]} {emit {: %s}}
-}
-if {[S 102 == mBIN]} {emit {MacBinary III data with surprising version number}}
-if {[S 0 == SAS]} {emit SAS
-if {[S 24 == DATA]} {emit {data file}}
-if {[S 24 == CATALOG]} {emit catalog}
-if {[S 24 == INDEX]} {emit {data file index}}
-if {[S 24 == VIEW]} {emit {data view}}
-}
-if {[S 84 == SAS]} {emit {SAS 7+}
-if {[S 156 == DATA]} {emit {data file}}
-if {[S 156 == CATALOG]} {emit catalog}
-if {[S 156 == INDEX]} {emit {data file index}}
-if {[S 156 == VIEW]} {emit {data view}}
-}
-if {[S 0 == {$FL2}]} {emit {SPSS System File}
-if {[S 24 x {}]} {emit %s}
-}
-switch -- [Nvx 1 S 1024] -11561 {emit {Macintosh MFS data}
-if {[N S 0 == 0x4c4b]} {emit {\(bootable\)}}
-if {[N S 1034 & 0x8000]} {emit {\(locked\)}}
-if {[N I 1026 x {} -0x7C25B080]} {emit {created: %s,}}
-if {[N I 1030 > 0x0 -0x7C25B080]} {emit {last backup: %s,}}
-if {[N I 1044 x {}]} {emit {block size: %d,}}
-if {[N S 1042 x {}]} {emit {number of blocks: %d,}}
-if {[S 1060 x {} p]} {emit {volume name: %s}}
-} 18475 {emit {Macintosh HFS Extended}
-if {[N S [R 0] x {}]} {emit {version %d data}}
-if {[N S 0 == 0x4c4b]} {emit {\(bootable\)}}
-if {[N I 1028 ^ 0x100]} {emit {\(mounted\)}}
-if {[N I [R 2] & 0x200]} {emit {\(spared blocks\)}}
-if {[N I [R 2] & 0x800]} {emit {\(unclean\)}}
-if {[N I [R 2] & 0x8000]} {emit {\(locked\)}}
-if {[S [R 6] x {}]} {emit {last mounted by: '%.4s',}}
-if {[N I [R 14] x {} -0x7C25B080]} {emit {created: %s,}}
-if {[N S [R 18] x {} -0x7C25B080]} {emit {last modified: %s,}}
-if {[N S [R 22] > 0x0 -0x7C25B080]} {emit {last backup: %s,}}
-if {[N S [R 26] > 0x0 -0x7C25B080]} {emit {last checked: %s,}}
-if {[N I [R 38] x {}]} {emit {block size: %d,}}
-if {[N I [R 42] x {}]} {emit {number of blocks: %d,}}
-if {[N I [R 46] x {}]} {emit {free blocks: %d}}
-} 
-switch -- [Nv S 512] 20557 {emit {Apple Partition data}
-if {[N S 2 x {}]} {emit {block size: %d,}}
-if {[S 560 x {}]} {emit {first type: %s,}}
-if {[S 528 x {}]} {emit {name: %s,}}
-if {[N I 596 x {}]} {emit {number of blocks: %d,}}
-if {[N S 1024 == 0x504d]} {if {[S 1072 x {}]} {emit {second type: %s,}}
-if {[S 1040 x {}]} {emit {name: %s,}}
-if {[N I 1108 x {}]} {emit {number of blocks: %d,}}
-if {[N S 2048 == 0x504d]} {if {[S 2096 x {}]} {emit {third type: %s,}}
-if {[S 2064 x {}]} {emit {name: %s,}}
-if {[N I 2132 x {}]} {emit {number of blocks: %d,}}
-if {[N S 2560 == 0x504d]} {if {[S 2608 x {}]} {emit {fourth type: %s,}}
-if {[S 2576 x {}]} {emit {name: %s,}}
-if {[N I 2644 x {}]} {emit {number of blocks: %d}}
-}
-}
-}
-} 21587 {emit {Apple Old Partition data}
-if {[N S 2 x {}]} {emit {block size: %d,}}
-if {[S 560 x {}]} {emit {first type: %s,}}
-if {[S 528 x {}]} {emit {name: %s,}}
-if {[N I 596 x {}]} {emit {number of blocks: %d,}}
-if {[N S 1024 == 0x504d]} {if {[S 1072 x {}]} {emit {second type: %s,}}
-if {[S 1040 x {}]} {emit {name: %s,}}
-if {[N I 1108 x {}]} {emit {number of blocks: %d,}}
-if {[N S 2048 == 0x504d]} {if {[S 2096 x {}]} {emit {third type: %s,}}
-if {[S 2064 x {}]} {emit {name: %s,}}
-if {[N I 2132 x {}]} {emit {number of blocks: %d,}}
-if {[N S 2560 == 0x504d]} {if {[S 2608 x {}]} {emit {fourth type: %s,}}
-if {[S 2576 x {}]} {emit {name: %s,}}
-if {[N I 2644 x {}]} {emit {number of blocks: %d}}
-}
-}
-}
-} 
-if {[S 0 == BOMStore]} {emit {Mac OS X bill of materials \(BOM\) fil}}
-if {[S 0 == {\#\ Magic}]} {emit {magic text file for file\(1\) cmd}}
-if {[S 0 == Relay-Version:]} {emit {old news text}}
-if {[S 0 == {\#!\ rnews}]} {emit {batched news text}}
-if {[S 0 == {N\#!\ rnews}]} {emit {mailed, batched news text}}
-if {[S 0 == {Forward\ to}]} {emit {mail forwarding text}}
-if {[S 0 == {Pipe\ to}]} {emit {mail piping text}}
-if {[S 0 == Return-Path:]} {emit {smtp mail text}}
-if {[S 0 == Path:]} {emit {news text}}
-if {[S 0 == Xref:]} {emit {news text}}
-if {[S 0 == From:]} {emit {news or mail text}}
-if {[S 0 == Article]} {emit {saved news text}}
-if {[S 0 == BABYL]} {emit {Emacs RMAIL text}}
-if {[S 0 == Received:]} {emit {RFC 822 mail text}}
-if {[S 0 == MIME-Version:]} {emit {MIME entity text}}
-if {[S 0 == *mbx*]} {emit {MBX mail folder}}
-if {[S 0 == {\241\002\213\015skiplist\ file\0\0\0}]} {emit {Cyrus skiplist DB}}
-if {[S 0 == {JAM\0}]} {emit {JAM message area header file}
-if {[N s 12 > 0x0]} {emit {\(%d messages\)}}
-}
-if {[S 0 == {\000MVR4\nI}]} {emit {MapleVr4 library}}
-if {[S 0 == {\000\004\000\000}]} {emit {Maple help database}}
-if {[S 0 == <PACKAGE=]} {emit {Maple help file}}
-if {[S 0 == {<HELP\ NAME=}]} {emit {Maple help file}}
-if {[S 0 == {\n\<HELP\ NAME=}]} {emit {Maple help file with extra carriage return at start \(yuck\)}}
-if {[S 0 == {\#\ daub}]} {emit {Maple help file, old style}}
-if {[S 0 == {\000\000\001\044\000\221}]} {emit {Maple worksheet}}
-if {[S 0 == {WriteNow\000\002\000\001\000\000\000\000\100\000\000\000\000\000}]} {emit {Maple worksheet, but weird}}
-if {[S 0 == {\{VERSION\ }]} {emit {Maple worksheet}
-if {[S 9 x {}]} {emit {version %.1s. {36 string {} x 11 {} %.1s}}}
-}
-if {[S 0 == {\0\0\001$}]} {emit {Maple something}
-if {[S 4 == {\000\105}]} {emit {An old revision}}
-if {[S 4 == {\001\122}]} {emit {The latest save}}
-}
-if {[S 0 == {\#\n\#\#\ <SHAREFILE=}]} {emit {Maple something}}
-if {[S 0 == {\n\#\n\#\#\ <SHAREFILE=}]} {emit {Maple something}}
-if {[S 0 == {\#\#\ <SHAREFILE=}]} {emit {Maple something}}
-if {[S 0 == {\#\r\#\#\ <SHAREFILE=}]} {emit {Maple something}}
-if {[S 0 == {\r\#\r\#\#\ <SHAREFILE=}]} {emit {Maple something}}
-if {[S 0 == {\#\ \r\#\#\ <DESCRIBE>}]} {emit {Maple something anomalous.}}
-if {[S 0 == {\064\024\012\000\035\000\000\000}]} {emit {Mathematica version 2 notebook}}
-if {[S 0 == {\064\024\011\000\035\000\000\000}]} {emit {Mathematica version 2 notebook}}
-if {[S 0 == {(*^\n\n::[\011frontEndVersion\ =\ }]} {emit {Mathematica notebook}}
-if {[S 0 == {(*^\r\r::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {\(\*\^\r\n\r\n\:\:\[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\015}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\n\r\n\r::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\r::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\r\n::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\n\n::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*^\n::[\011}]} {emit {Mathematica notebook version 2.x}}
-if {[S 0 == {(*This\ is\ a\ Mathematica\ binary\ }]} {emit {Mathematica binary file}
-if {[S 88 x {}]} {emit {from %s}}
-}
-if {[S 0 == {MMAPBF\000\001\000\000\000\203\000\001\000}]} {emit {Mathematica PBF \(fonts I think\)}}
-if {[S 4 == {\ A~}]} {emit {MAthematica .ml file}}
-if {[S 0 == (***********************]} {emit {Mathematica 3.0 notebook}}
-if {[S 0 == (*]} {emit {Mathematica, or Pascal,  Modula-2 or 3 code text}}
-if {[S 0 == MATLAB]} {emit {Matlab v5 mat-file}
-switch -- [Nv Y 126] 18765 {emit {\(big endian\)}
-if {[N S 124 x {}]} {emit {version 0x%04x}}
-} 19785 {emit {\(little endian\)}
-if {[N s 124 x {}]} {emit {version 0x%04x}}
-} 
-}
-if {[S 0 == {\0m\3}]} {emit {mcrypt 2.5 encrypted data,}
-if {[Sx 2 4 x {}]} {emit {algorithm: %s,}
-if {[Nx 3 s [R 1] > 0x0]} {emit {keysize: %d bytes,}
-if {[S [R 0] x {}]} {emit {mode: %s,}}
-}
-}
-}
-if {[S 0 == {\0m\2}]} {emit {mcrypt 2.2 encrypted data,}
-switch -- [Nv c 3] 0 {emit {algorithm: blowfish-448,}} 1 {emit {algorithm: DES,}} 2 {emit {algorithm: 3DES,}} 3 {emit {algorithm: 3-WAY,}} 4 {emit {algorithm: GOST,}} 6 {emit {algorithm: SAFER-SK64,}} 7 {emit {algorithm: SAFER-SK128,}} 8 {emit {algorithm: CAST-128,}} 9 {emit {algorithm: xTEA,}} 10 {emit {algorithm: TWOFISH-128,}} 11 {emit {algorithm: RC2,}} 12 {emit {algorithm: TWOFISH-192,}} 13 {emit {algorithm: TWOFISH-256,}} 14 {emit {algorithm: blowfish-128,}} 15 {emit {algorithm: blowfish-192,}} 16 {emit {algorithm: blowfish-256,}} 100 {emit {algorithm: RC6,}} 101 {emit {algorithm: IDEA,}} 
-switch -- [Nv c 4] 0 {emit {mode: CBC,}} 1 {emit {mode: ECB,}} 2 {emit {mode: CFB,}} 3 {emit {mode: OFB,}} 4 {emit {mode: nOFB,}} 
-switch -- [Nv c 5] 0 {emit {keymode: 8bit}} 1 {emit {keymode: 4bit}} 2 {emit {keymode: SHA-1 hash}} 3 {emit {keymode: MD5 hash}} 
-}
-if {[S 0 == {Content-Type:\ }]} {if {[S 14 x {}]} {emit %s}
-}
-if {[S 0 == Content-Type:]} {if {[S 13 x {}]} {emit %s}
-}
-if {[S 0 == kbd!map]} {emit {kbd map file}
-if {[N c 8 > 0x0]} {emit {Ver %d:}}
-if {[N Y 10 > 0x0]} {emit {with %d table\(s\)}}
-}
-if {[S 0 == {\x43\x72\x73\x68\x44\x75\x6d\x70}]} {emit {IRIX vmcore dump of}
-if {[S 36 x {}]} {emit '%s'}
-}
-if {[S 0 == SGIAUDIT]} {emit {SGI Audit file}
-if {[N c 8 x {}]} {emit {- version %d}}
-if {[N c 9 x {}]} {emit .%ld}
-}
-if {[S 0 == WNGZWZSC]} {emit {Wingz compiled script}}
-if {[S 0 == WNGZWZSS]} {emit {Wingz spreadsheet}}
-if {[S 0 == WNGZWZHP]} {emit {Wingz help file}}
-if {[S 0 == {\\#Inventor}]} {emit {V	IRIS Inventor 1.0 file}}
-if {[S 0 == {\\#Inventor}]} {emit {V2	Open Inventor 2.0 file}}
-if {[S 0 == {glfHeadMagic();}]} {emit GLF_TEXT}
-if {[S 0 == glsBeginGLS(]} {emit GLS_TEXT}
-if {[S 0 == %%!!]} {emit {X-Post-It-Note text}}
-if {[S 0 == BEGIN:VCALENDAR]} {emit {vCalendar calendar file}}
-if {[S 0 == {\311\304}]} {emit {ID tags data}
-if {[N Y 2 > 0x0]} {emit {version %d}}
-}
-if {[S 0 == {\001\001\001\001}]} {emit {MMDF mailbox}}
-if {[S 4 == Research,]} {emit Digifax-G3-File
-switch -- [Nv c 29] 1 {emit {, fine resolution}} 0 {emit {, normal resolution}} 
-}
-if {[S 0 == RMD1]} {emit {raw modem data}
-if {[S 4 x {}]} {emit {\(%s /}}
-if {[N Y 20 > 0x0]} {emit {compression type 0x%04x\)}}
-}
-if {[S 0 == {PVF1\n}]} {emit {portable voice format}
-if {[S 5 x {}]} {emit {\(binary %s\)}}
-}
-if {[S 0 == {PVF2\n}]} {emit {portable voice format}
-if {[S 5 x {}]} {emit {\(ascii %s\)}}
-}
-if {[S 0 == S0]} {emit {Motorola S-Record; binary data in text format}}
-switch -- [Nv I 0 &0xFFFFFFF0] 1612316672 {emit {Atari ST M68K contiguous executable}
-if {[N I 2 x {}]} {emit {\(txt=%ld,}}
-if {[N I 6 x {}]} {emit dat=%ld,}
-if {[N I 10 x {}]} {emit bss=%ld,}
-if {[N I 14 x {}]} {emit {sym=%ld\)}}
-} 1612382208 {emit {Atari ST M68K non-contig executable}
-if {[N I 2 x {}]} {emit {\(txt=%ld,}}
-if {[N I 6 x {}]} {emit dat=%ld,}
-if {[N I 10 x {}]} {emit bss=%ld,}
-if {[N I 14 x {}]} {emit {sym=%ld\)}}
-} 
-if {[S 0 == {@echo\ off} c]} {emit {MS-DOS batch file text}}
-if {[S 128 == {PE\0\0}]} {emit {MS Windows PE}
-if {[N s 150 > 0x0 &0x0100]} {emit 32-bit}
-switch -- [Nv s 132] 0 {emit {unknown processor}} 332 {emit {Intel 80386}} 358 {emit {MIPS R4000}} 388 {emit Alpha} 616 {emit {Motorola 68000}} 496 {emit PowerPC} 656 {emit PA-RISC} 
-if {[N s 148 > 0x1b]} {switch -- [Nv s 220] 0 {emit {unknown subsystem}} 1 {emit native} 2 {emit GUI} 3 {emit console} 7 {emit POSIX} 
-}
-if {[N s 150 == 0x0 &0x2000]} {emit executable
-if {[N s 150 > 0x0 &0x0001]} {emit {not relocatable}}
-if {[N s 150 > 0x0 &0x1000]} {emit {system file}}
-}
-if {[N s 150 > 0x0 &0x2000]} {emit DLL
-if {[N s 150 > 0x0 &0x0001]} {emit {not relocatable}}
-if {[N s 150 > 0x0 &0x1000]} {emit {system file}}
-}
-}
-if {[S 0 == MZ]} {emit {MS-DOS executable \(EXE\)}
-if {[S 24 == @]} {emit {\b, OS/2 or MS Windows}
-if {[S 231 == {LH/2\ Self-Extract}]} {emit {\b, %s}}
-if {[S 233 == PKSFX2]} {emit {\b, %s}}
-if {[S 122 == {Windows\ self-extracting\ ZIP}]} {emit {\b, %s}}
-}
-if {[S 28 == {RJSX\xff\xff}]} {emit {\b, ARJ SFX}}
-if {[S 28 == {diet\xf9\x9c}]} {emit {\b, diet compressed}}
-if {[S 28 == LZ09]} {emit {\b, LZEXE v0.90 compressed}}
-if {[S 28 == LZ91]} {emit {\b, LZEXE v0.91 compressed}}
-if {[S 30 == {Copyright\ 1989-1990\ PKWARE\ Inc.}]} {emit {\b, PKSFX}}
-if {[S 30 == {PKLITE\ Copr.}]} {emit {\b, %.6s compressed}}
-if {[S 36 == {LHa's\ SFX}]} {emit {\b, %.15s}}
-if {[S 36 == {LHA's\ SFX}]} {emit {\b, %.15s}}
-if {[S 1638 == -lh5-]} {emit {\b, LHa SFX archive v2.13S}}
-if {[S 7195 == Rar!]} {emit {\b, RAR self-extracting archive}}
-if {[S 11696 == {PK\003\004}]} {emit {\b, PKZIP SFX archive v1.1}}
-if {[S 13297 == {PK\003\004}]} {emit {\b, PKZIP SFX archive v1.93a}}
-if {[S 15588 == {PK\003\004}]} {emit {\b, PKZIP2 SFX archive v1.09}}
-if {[S 15770 == {PK\003\004}]} {emit {\b, PKZIP SFX archive v2.04g}}
-if {[S 28374 == {PK\003\004}]} {emit {\b, PKZIP2 SFX archive v1.02}}
-if {[S 25115 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12}}
-if {[S 26331 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12 w/decryption}}
-if {[S 47031 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12}}
-if {[S 49845 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12 w/decryption}}
-if {[S 69120 == {PK\003\004}]} {emit {\b, Info-ZIP NT SFX archive v5.12 w/decryption}}
-if {[S 49801 == {\x79\xff\x80\xff\x76\xff}]} {emit {\b, CODEC archive v3.21}
-if {[N s 49824 == 0x1]} {emit {\b, 1 file}}
-if {[N s 49824 > 0x1]} {emit {\b, %u files}}
-}
-}
-if {[S 0 == LZ]} {emit {MS-DOS executable \(built-in\)}}
-if {[S 0 == regf]} {emit {Windows NT registry file}}
-if {[S 0 == CREG]} {emit {Windows 95 registry file}}
-if {[S 0 == {\320\317\021\340\241\261\032\341AAFB\015\000OM\006\016\053\064\001\001\001\377}]} {emit {AAF legacy file using MS Structured Storage}
-switch -- [Nv c 30] 9 {emit {\(512B sectors\)}} 12 {emit {\(4kB sectors\)}} 
-}
-if {[S 0 == {\320\317\021\340\241\261\032\341\001\002\001\015\000\002\000\000\006\016\053\064\003\002\001\001}]} {emit {AAF file using MS Structured Storage}
-switch -- [Nv c 30] 9 {emit {\(512B sectors\)}} 12 {emit {\(4kB sectors\)}} 
-}
-if {[S 2080 == {Microsoft\ Word\ 6.0\ Document}]} {emit %s}
-if {[S 2080 == {Documento\ Microsoft\ Word\ 6}]} {emit {Spanish Microsoft Word 6 document data}}
-if {[S 2112 == MSWordDoc]} {emit {Microsoft Word document data}}
-if {[S 0 == PO^Q`]} {emit {Microsoft Word 6.0 Document}}
-if {[S 0 == {\376\067\0\043}]} {emit {Microsoft Office Document}}
-if {[S 0 == {\320\317\021\340\241\261\032\341}]} {emit {Microsoft Office Document}}
-if {[S 0 == {\333\245-\0\0\0}]} {emit {Microsoft Office Document}}
-if {[S 2080 == {Microsoft\ Excel\ 5.0\ Worksheet}]} {emit %s}
-if {[S 2080 == {Foglio\ di\ lavoro\ Microsoft\ Exce}]} {emit %s}
-if {[S 2114 == Biff5]} {emit {Microsoft Excel 5.0 Worksheet}}
-if {[S 2121 == Biff5]} {emit {Microsoft Excel 5.0 Worksheet}}
-if {[S 0 == {\x09\x04\x06\x00\x00\x00\x10\x00}]} {emit {Microsoft Excel Worksheet}}
-if {[S 0 == {?_\3\0}]} {emit {MS Windows Help Data}}
-if {[S 0 == {\161\250\000\000\001\002}]} {emit {DeIsL1.isu whatever that is}}
-if {[S 0 == {Nullsoft\ AVS\ Preset\ }]} {emit {Winamp plug in}}
-if {[S 0 == {HyperTerminal\ }]} {emit hyperterm
-if {[S 15 == {1.0\ --\ HyperTerminal\ data\ file}]} {emit {MS-windows Hyperterminal}}
-}
-if {[S 0 == {\327\315\306\232\000\000\000\000\000\000}]} {emit {ms-windows metafont .wmf}}
-if {[S 0 == {\003\001\001\004\070\001\000\000}]} {emit {tz3 ms-works file}}
-if {[S 0 == {\003\002\001\004\070\001\000\000}]} {emit {tz3 ms-works file}}
-if {[S 0 == {\003\003\001\004\070\001\000\000}]} {emit {tz3 ms-works file}}
-if {[S 0 == {\211\000\077\003\005\000\063\237\127\065\027\266\151\064\005\045\101\233\021\002}]} {emit {PGP sig}}
-if {[S 0 == {\211\000\077\003\005\000\063\237\127\066\027\266\151\064\005\045\101\233\021\002}]} {emit {PGP sig}}
-if {[S 0 == {\211\000\077\003\005\000\063\237\127\067\027\266\151\064\005\045\101\233\021\002}]} {emit {PGP sig}}
-if {[S 0 == {\211\000\077\003\005\000\063\237\127\070\027\266\151\064\005\045\101\233\021\002}]} {emit {PGP sig}}
-if {[S 0 == {\211\000\077\003\005\000\063\237\127\071\027\266\151\064\005\045\101\233\021\002}]} {emit {PGP sig}}
-if {[S 0 == {\211\000\225\003\005\000\062\122\207\304\100\345\042}]} {emit {PGP sig}}
-if {[S 0 == {MDIF\032\000\010\000\000\000\372\046\100\175\001\000\001\036\001\000}]} {emit {Ms-windows special zipped file}}
-if {[S 0 == {\164\146\115\122\012\000\000\000\001\000\000\000}]} {emit {ms-windows help cache}}
-if {[S 0 == {\120\115\103\103}]} {emit {Ms-windows 3.1 group files}}
-if {[S 0 == {\114\000\000\000\001\024\002\000\000\000\000\000\300\000\000\000\000\000\000\106}]} {emit {ms-Windows shortcut}}
-if {[S 0 == {\102\101\050\000\000\000\056\000\000\000\000\000\000\000}]} {emit {Icon for ms-windows}}
-if {[S 0 == {\000\000\001\000}]} {emit {ms-windows icon resource}
-if {[N c 4 == 0x1]} {emit {- 1 icon}}
-if {[N c 4 > 0x1]} {emit {- %d icons}
-if {[N c 6 > 0x0]} {emit {\b, %dx}
-if {[N c 7 > 0x0]} {emit {\b%d}}
-}
-if {[N c 8 == 0x0]} {emit {\b, 256-colors}}
-if {[N c 8 > 0x0]} {emit {\b, %d-colors}}
-}
-}
-if {[S 0 == {PK\010\010BGI}]} {emit {Borland font}
-if {[S 4 x {}]} {emit %s}
-}
-if {[S 0 == {pk\010\010BGI}]} {emit {Borland device}
-if {[S 4 x {}]} {emit %s}
-}
-if {[S 9 == {\000\000\000\030\001\000\000\000}]} {emit {ms-windows recycled bin info}}
-if {[S 9 == GERBILDOC]} {emit {First Choice document}}
-if {[S 9 == GERBILDB]} {emit {First Choice database}}
-if {[S 9 == GERBILCLIP]} {emit {First Choice database}}
-if {[S 0 == GERBIL]} {emit {First Choice device file}}
-if {[S 9 == RABBITGRAPH]} {emit {RabbitGraph file}}
-if {[S 0 == DCU1]} {emit {Borland Delphi .DCU file}}
-if {[S 0 == !<spell>]} {emit {MKS Spell hash list \(old format\)}}
-if {[S 0 == !<spell2>]} {emit {MKS Spell hash list}}
-if {[S 0 == PMCC]} {emit {Windows 3.x .GRP file}}
-if {[S 1 == RDC-meg]} {emit MegaDots
-if {[N c 8 > 0x2f]} {emit {version %c}}
-if {[N c 9 > 0x2f]} {emit {\b.%c file}}
-}
-if {[S 0 == {ITSF\003\000\000\000\x60\000\000\000\001\000\000\000}]} {emit {MS Windows HtmlHelp Data}}
-if {[S 2 == GFA-BASIC3]} {emit {GFA-BASIC 3 data}}
-if {[S 512 == go32stub]} {emit {DOS-executable compiled w/DJGPP}
-if {[S 524 > 0]} {emit {\(stub v%.4s\)}
-if {[Sx 3 2226 == djp]} {emit {[compressed w/%s}
-if {[S [R 1] x {}]} {emit %.4s\]}
-}
-if {[Sx 3 2221 == UPX]} {emit {[compressed w/%s}
-if {[S [R 1] x {}]} {emit %.4s\]}
-}
-if {[S 28 == pmodedj]} {emit {stubbed with %s}}
-}
-}
-if {[S 0 == {MSCF\0\0\0\0}]} {emit {Microsoft Cabinet file}
-if {[N i 8 x {}]} {emit {\b, %u bytes}}
-if {[N s 28 == 0x1]} {emit {\b, 1 file}}
-if {[N s 28 > 0x1]} {emit {\b, %u files}}
-}
-if {[S 0 == ISc(]} {emit {InstallShield Cabinet file}
-if {[N c 5 == 0x60 &0xf0]} {emit {version 6,}}
-if {[N c 5 != 0x60 &0xf0]} {emit {version 4/5,}}
-if {[N i [I 12 i 40] x {}]} {emit {%u files}}
-}
-if {[S 0 == {MSCE\0\0\0\0}]} {emit {Microsoft WinCE install header}
-switch -- [Nv i 20] 0 {emit {\b, architecture-independent}} 103 {emit {\b, Hitachi SH3}} 104 {emit {\b, Hitachi SH4}} 2577 {emit {\b, StrongARM}} 4000 {emit {\b, MIPS R4000}} 10003 {emit {\b, Hitachi SH3}} 10004 {emit {\b, Hitachi SH3E}} 10005 {emit {\b, Hitachi SH4}} 70001 {emit {\b, ARM 7TDMI}} 
-if {[N s 52 == 0x1]} {emit {\b, 1 file}}
-if {[N s 52 > 0x1]} {emit {\b, %u files}}
-if {[N s 56 == 0x1]} {emit {\b, 1 registry entry}}
-if {[N s 56 > 0x1]} {emit {\b, %u registry entries}}
-}
-if {[S 0 == {Client\ UrlCache\ MMF}]} {emit {Microsoft Internet Explorer Cache File}
-if {[S 20 x {}]} {emit {Version %s}}
-}
-if {[S 0 == {\xCF\xAD\x12\xFE}]} {emit {Microsoft Outlook Express DBX File}
-switch -- [Nv c 4] -59 {emit {Message database}} -58 {emit {Folder database}} -57 {emit {Accounts informations}} 48 {emit {Offline database}} 
-}
-if {[N i 40 == 0x464d4520]} {emit {Windows Enhanced Metafile \(EMF\) image data}
-if {[N i 44 x {}]} {emit {version 0x%x.}}
-if {[N i 64 > 0x0]} {emit {Description available at offset 0x%x}
-if {[N i 60 > 0x0]} {emit {\(length 0x%x\)}}
-}
-}
-if {[S 0 == {HWB\000\377\001\000\000\000}]} {emit {Microsoft Visual C .APS file}}
-if {[S 0 == {\102\157\162\154\141\156\144\040\103\053\053\040\120\162\157}]} {emit {MSVC .ide}}
-if {[S 0 == {\000\000\000\000\040\000\000\000\377}]} {emit {MSVC .res}}
-if {[S 0 == {\377\003\000\377\001\000\020\020\350}]} {emit {MSVC .res}}
-if {[S 0 == {\377\003\000\377\001\000\060\020\350}]} {emit {MSVC .res}}
-if {[S 0 == {\360\015\000\000}]} {emit {Microsoft Visual C library}}
-if {[S 0 == {\360\075\000\000}]} {emit {Microsoft Visual C library}}
-if {[S 0 == {\360\175\000\000}]} {emit {Microsoft Visual C library}}
-if {[S 0 == {DTJPCH0\000\022\103\006\200}]} {emit {Microsoft Visual C .pch}}
-if {[S 0 == {Microsoft\ C/C++\ }]} {emit {MSVC program database}
-if {[S 18 == {program\ database\ }]} {emit 810 0}
-if {[S 33 x {}]} {emit {ver %s}}
-}
-if {[S 0 == {\000\002\000\007\000}]} {emit {MSVC .sbr}
-if {[S 5 x {}]} {emit %s}
-}
-if {[S 0 == {\002\000\002\001}]} {emit {MSVC .bsc}}
-if {[S 0 == {1.00\ .0000.0000\000\003}]} {emit {MSVC .wsp version 1.0000.0000}}
-if {[S 0 == RSRC]} {emit {National Instruments,}
-if {[S 8 == LV]} {emit {LabVIEW File,}
-if {[S 10 == SB]} {emit {Code Resource File, data}}
-if {[S 10 == IN]} {emit {Virtual Instrument Program, data}}
-if {[S 10 == AR]} {emit {VI Library, data}}
-}
-if {[S 8 == LMNULBVW]} {emit {Portable File Names, data}}
-if {[S 8 == rsc]} {emit {Resources File, data}}
-}
-if {[S 0 == VMAP]} {emit {National Instruments, VXI File, data}}
-switch -- [Nv I 0 &0377777777] 8782091 {emit {a.out NetBSD/i386 demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782088 {emit {a.out NetBSD/i386 pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782087 {emit {a.out NetBSD/i386}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8782151 {emit {a.out NetBSD/i386 core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 8847627 {emit {a.out NetBSD/m68k demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x2000]} {emit {shared library}}
-if {[N I 20 == 0x2000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x2000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8847624 {emit {a.out NetBSD/m68k pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8847623 {emit {a.out NetBSD/m68k}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N I 20 != 0x0]} {emit executable}
-if {[N I 20 == 0x0]} {emit {object file}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8847687 {emit {a.out NetBSD/m68k core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N I 32 != 0x0]} {emit {\(signal %d\)}}
-} 8913163 {emit {a.out NetBSD/m68k4k demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x1000]} {emit {shared library}}
-if {[N I 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8913160 {emit {a.out NetBSD/m68k4k pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8913159 {emit {a.out NetBSD/m68k4k}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N I 20 != 0x0]} {emit executable}
-if {[N I 20 == 0x0]} {emit {object file}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 8913223 {emit {a.out NetBSD/m68k4k core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N I 32 != 0x0]} {emit {\(signal %d\)}}
-} 8978699 {emit {a.out NetBSD/ns32532 demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8978696 {emit {a.out NetBSD/ns32532 pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8978695 {emit {a.out NetBSD/ns32532}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 8978759 {emit {a.out NetBSD/ns32532 core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 9765191 {emit {a.out NetBSD/powerpc core}
-if {[S 12 x {}]} {emit {from '%s'}}
-} 9044235 {emit {a.out NetBSD/sparc demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x2000]} {emit {shared library}}
-if {[N I 20 == 0x2000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x2000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9044232 {emit {a.out NetBSD/sparc pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9044231 {emit {a.out NetBSD/sparc}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N I 20 != 0x0]} {emit executable}
-if {[N I 20 == 0x0]} {emit {object file}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9044295 {emit {a.out NetBSD/sparc core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N I 32 != 0x0]} {emit {\(signal %d\)}}
-} 9109771 {emit {a.out NetBSD/pmax demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9109768 {emit {a.out NetBSD/pmax pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9109767 {emit {a.out NetBSD/pmax}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9109831 {emit {a.out NetBSD/pmax core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 9175307 {emit {a.out NetBSD/vax 1k demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9175304 {emit {a.out NetBSD/vax 1k pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9175303 {emit {a.out NetBSD/vax 1k}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9175367 {emit {a.out NetBSD/vax 1k core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 9830667 {emit {a.out NetBSD/vax 4k demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9830664 {emit {a.out NetBSD/vax 4k pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9830663 {emit {a.out NetBSD/vax 4k}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9830727 {emit {a.out NetBSD/vax 4k core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 9240903 {emit {a.out NetBSD/alpha core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 9306379 {emit {a.out NetBSD/mips demand paged}
-if {[N c 0 & 0x80]} {if {[N I 20 < 0x2000]} {emit {shared library}}
-if {[N I 20 == 0x2000]} {emit {dynamically linked executable}}
-if {[N I 20 > 0x2000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9306376 {emit {a.out NetBSD/mips pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9306375 {emit {a.out NetBSD/mips}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N I 20 != 0x0]} {emit executable}
-if {[N I 20 == 0x0]} {emit {object file}}
-}
-if {[N I 16 > 0x0]} {emit {not stripped}}
-} 9306439 {emit {a.out NetBSD/mips core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N I 32 != 0x0]} {emit {\(signal %d\)}}
-} 9371915 {emit {a.out NetBSD/arm32 demand paged}
-if {[N c 0 & 0x80]} {if {[N i 20 < 0x1000]} {emit {shared library}}
-if {[N i 20 == 0x1000]} {emit {dynamically linked executable}}
-if {[N i 20 > 0x1000]} {emit {dynamically linked executable}}
-}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9371912 {emit {a.out NetBSD/arm32 pure}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {emit executable}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9371911 {emit {a.out NetBSD/arm32}
-if {[N c 0 & 0x80]} {emit {dynamically linked executable}}
-if {[N c 0 ^ 0x80]} {if {[N c 0 & 0x40]} {emit {position independent}}
-if {[N i 20 != 0x0]} {emit executable}
-if {[N i 20 == 0x0]} {emit {object file}}
-}
-if {[N i 16 > 0x0]} {emit {not stripped}}
-} 9371975 {emit {a.out NetBSD/arm core}
-if {[S 12 x {}]} {emit {from '%s'}}
-if {[N i 32 != 0x0]} {emit {\(signal %d\)}}
-} 
-if {[S 0 == {\000\017\102\104\000\000\000\000\000\000\001\000\000\000\000\002\000\000\000\002\000\000\004\000}]} {emit {Netscape Address book}}
-if {[S 0 == {\000\017\102\111}]} {emit {Netscape Communicator address book}}
-if {[S 0 == {\#\ Netscape\ folder\ cache}]} {emit {Netscape folder cache}}
-if {[S 0 == {\000\036\204\220\000}]} {emit {Netscape folder cache}}
-if {[S 0 == SX961999]} {emit Net2phone}
-if {[S 0 == {JG\004\016\0\0\0\0}]} {emit ART}
-if {[S 0 == StartFontMetrics]} {emit {ASCII font metrics}}
-if {[S 0 == StartFont]} {emit {ASCII font bits}}
-switch -- [Nv I 8] 326773573 {emit {X11/NeWS bitmap font}} 326773576 {emit {X11/NeWS font family}} 
-if {[S 0 == NPFF]} {emit {NItpicker Flow File}
-if {[N c 4 x {}]} {emit V%d.}
-if {[N c 5 x {}]} {emit %d}
-if {[N S 6 x {}]} {emit {started: %s}}
-if {[N S 10 x {}]} {emit {stopped: %s}}
-if {[N I 14 x {}]} {emit {Bytes: %u}}
-if {[N I 18 x {}]} {emit {Bytes1: %u}}
-if {[N I 22 x {}]} {emit {Flows: %u}}
-if {[N I 26 x {}]} {emit {Pkts: %u}}
-}
-if {[S 0 == Caml1999]} {emit {Objective caml}
-if {[S 8 == X]} {emit {exec file}}
-if {[S 8 == I]} {emit {interface file \(.cmi\)}}
-if {[S 8 == O]} {emit {object file \(.cmo\)}}
-if {[S 8 == A]} {emit {library file \(.cma\)}}
-if {[S 8 == Y]} {emit {native object file \(.cmx\)}}
-if {[S 8 == Z]} {emit {native library file \(.cmxa\)}}
-if {[S 8 == M]} {emit {abstract syntax tree implementation file}}
-if {[S 8 == N]} {emit {abstract syntax tree interface file}}
-if {[S 9 x {}]} {emit {\(Version %3.3s\).}}
-}
-if {[S 0 == Octave-1-L]} {emit {Octave binary data \(little endian\)}}
-if {[S 0 == Octave-1-B]} {emit {Octave binary data \(big endian\)}}
-if {[S 0 == {\177OLF}]} {emit OLF
-switch -- [Nv c 4] 0 {emit {invalid class}} 1 {emit 32-bit} 2 {emit 64-bit} 
-switch -- [Nv c 7] 0 {emit {invalid os}} 1 {emit OpenBSD} 2 {emit NetBSD} 3 {emit FreeBSD} 4 {emit 4.4BSD} 5 {emit Linux} 6 {emit SVR4} 7 {emit esix} 8 {emit Solaris} 9 {emit Irix} 10 {emit SCO} 11 {emit Dell} 12 {emit NCR} 
-switch -- [Nv c 5] 0 {emit {invalid byte order}} 1 {emit LSB
-switch -- [Nv s 16] 0 {emit {no file type,}} 1 {emit relocatable,} 2 {emit executable,} 3 {emit {shared object,}} 4 {emit {core file}
-if {[S [I 56 Q 204] x {}]} {emit {of '%s'}}
-if {[N i [I 56 Q 16] > 0x0]} {emit {\(signal %d\),}}
-} 
-if {[N s 16 & 0xff00]} {emit processor-specific,}
-switch -- [Nv s 18] 0 {emit {no machine,}} 1 {emit {AT&T WE32100 - invalid byte order,}} 2 {emit {SPARC - invalid byte order,}} 3 {emit {Intel 80386,}} 4 {emit {Motorola 68000 - invalid byte order,}} 5 {emit {Motorola 88000 - invalid byte order,}} 6 {emit {Intel 80486,}} 7 {emit {Intel 80860,}} 8 {emit {MIPS R3000_BE - invalid byte order,}} 9 {emit {Amdahl - invalid byte order,}} 10 {emit {MIPS R3000_LE,}} 11 {emit {RS6000 - invalid byte order,}} 15 {emit {PA-RISC - invalid byte order,}} 16 {emit nCUBE,} 17 {emit VPP500,} 18 {emit SPARC32PLUS,} 20 {emit PowerPC,} -28634 {emit Alpha,} 
-switch -- [Nv i 20] 0 {emit {invalid version}} 1 {emit {version 1}} 
-if {[N i 36 == 0x1]} {emit {MathCoPro/FPU/MAU Required}}
-} 2 {emit MSB
-switch -- [Nv S 16] 0 {emit {no file type,}} 1 {emit relocatable,} 2 {emit executable,} 3 {emit {shared object,}} 4 {emit {core file,}
-if {[S [I 56 Q 204] x {}]} {emit {of '%s'}}
-if {[N I [I 56 Q 16] > 0x0]} {emit {\(signal %d\),}}
-} 
-if {[N S 16 & 0xff00]} {emit processor-specific,}
-switch -- [Nv S 18] 0 {emit {no machine,}} 1 {emit {AT&T WE32100,}} 2 {emit SPARC,} 3 {emit {Intel 80386 - invalid byte order,}} 4 {emit {Motorola 68000,}} 5 {emit {Motorola 88000,}} 6 {emit {Intel 80486 - invalid byte order,}} 7 {emit {Intel 80860,}} 8 {emit {MIPS R3000_BE,}} 9 {emit Amdahl,} 10 {emit {MIPS R3000_LE - invalid byte order,}} 11 {emit RS6000,} 15 {emit PA-RISC,} 16 {emit nCUBE,} 17 {emit VPP500,} 18 {emit SPARC32PLUS,} 20 {emit {PowerPC or cisco 4500,}} 21 {emit {cisco 7500,}} 24 {emit {cisco SVIP,}} 25 {emit {cisco 7200,}} 36 {emit {cisco 12000,}} -28634 {emit Alpha,} 
-switch -- [Nv I 20] 0 {emit {invalid version}} 1 {emit {version 1}} 
-if {[N I 36 == 0x1]} {emit {MathCoPro/FPU/MAU Required}}
-} 
-if {[S 8 x {}]} {emit {\(%s\)}}
-}
-if {[S 1 == InternetShortcut]} {emit {MS Windows 95 Internet shortcut text}
-if {[S 24 > {\	}]} {emit {\(URL=<%s>\)}}
-}
-if {[S 0 == {HSP\x01\x9b\x00}]} {emit {OS/2 INF}
-if {[S 107 > 0]} {emit {\(%s\)}}
-}
-if {[S 0 == {HSP\x10\x9b\x00}]} {emit {OS/2 HLP}
-if {[S 107 > 0]} {emit {\(%s\)}}
-}
-if {[S 0 == {\xff\xff\xff\xff\x14\0\0\0}]} {emit {OS/2 INI}}
-switch -- [Nv I 60] 1634758764 {emit {PalmOS application}
-if {[S 0 x {}]} {emit {\"%s\"}}
-} 1413830772 {emit {AportisDoc file}
-if {[S 0 x {}]} {emit {\"%s\"}}
-} 1212236619 {emit {HackMaster hack}
-if {[S 0 x {}]} {emit {\"%s\"}}
-} 
-if {[S 60 == BVokBDIC]} {emit {BDicty PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DB99DBOS]} {emit {DB PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == vIMGView]} {emit {FireViewer/ImageViewer PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == PmDBPmDB]} {emit {HanDBase PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == InfoINDB]} {emit {InfoView PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == ToGoToGo]} {emit {iSilo PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == JfDbJBas]} {emit {JFile PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == JfDbJFil]} {emit {JFile Pro PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DATALSdb]} {emit {List PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == Mdb1Mdb1]} {emit {MobileDB PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == PNRdPPrs]} {emit {PeanutPress PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DataPlkr]} {emit {Plucker PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DataSprd]} {emit {QuickSheet PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == SM01SMem]} {emit {SuperMemo PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DataTlPt]} {emit {TealDoc PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == InfoTlIf]} {emit {TealInfo PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DataTlMl]} {emit {TealMeal PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == DataTlPt]} {emit {TealPaint PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == dataTDBP]} {emit {ThinkDB PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == TdatTide]} {emit {Tides PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == ToRaTRPW]} {emit {TomeRaider PalmOS document}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == zTXT]} {emit {A GutenPalm zTXT e-book}
-if {[S 0 x {}]} {emit {\"%s\"}}
-switch -- [Nv c [I 78 I 0]] 0 {emit {}
-if {[N c [I 78 I 1] x {}]} {emit {\(v0.%02d\)}}
-} 1 {emit {}
-if {[N c [I 78 I 1] x {}]} {emit {\(v1.%02d\)}
-if {[N S [I 78 I 10] > 0x0]} {if {[N S [I 78 I 10] < 0x2]} {emit {- 1 bookmark}}
-if {[N S [I 78 I 10] > 0x1]} {emit {- %d bookmarks}}
-}
-if {[N S [I 78 I 14] > 0x0]} {if {[N S [I 78 I 14] < 0x2]} {emit {- 1 annotation}}
-if {[N S [I 78 I 14] > 0x1]} {emit {- %d annotations}}
-}
-}
-} 
-if {[N c [I 78 I 0] > 0x1]} {emit {\(v%d.}
-if {[N c [I 78 I 1] x {}]} {emit {%02d\)}}
-}
-}
-if {[S 60 == libr]} {emit {Palm OS dynamic library data}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == ptch]} {emit {Palm OS operating system patch data}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[S 60 == BOOKMOBI]} {emit {Mobipocket E-book}
-if {[S 0 x {}]} {emit {\"%s\"}}
-}
-if {[N S 0 == 0xace &0xfff]} {emit PARIX
-switch -- [Nv c 0 &0xf0] -128 {emit T800} -112 {emit T9000} 
-switch -- [Nv c 19 &0x02] 2 {emit executable} 0 {emit object} 
-if {[N c 19 == 0x0 &0x0c]} {emit {not stripped}}
-}
-if {[S 0 == %PDF-]} {emit {PDF document}
-if {[N c 5 x {}]} {emit {\b, version %c}}
-if {[N c 7 x {}]} {emit {\b.%c}}
-}
-if {[S 0 == {\#!\ /bin/perl} b]} {emit {perl script text executable}}
-if {[S 0 == {eval\ \"exec\ /bin/perl}]} {emit {perl script text}}
-if {[S 0 == {\#!\ /usr/bin/perl} b]} {emit {perl script text executable}}
-if {[S 0 == {eval\ \"exec\ /usr/bin/perl}]} {emit {perl script text}}
-if {[S 0 == {\#!\ /usr/local/bin/perl} b]} {emit {perl script text}}
-if {[S 0 == {eval\ \"exec\ /usr/local/bin/perl}]} {emit {perl script text executable}}
-if {[S 0 == {eval\ '(exit\ $?0)'\ &&\ eval\ 'exec}]} {emit {perl script text}}
-if {[S 0 == package]} {emit {Perl5 module source text}}
-if {[S 0 == perl-store]} {emit {perl Storable\(v0.6\) data}
-if {[N c 4 > 0x0]} {emit {\(net-order %d\)}
-if {[N c 4 & 0x1]} {emit {\(network-ordered\)}}
-switch -- [Nv c 4] 3 {emit {\(major 1\)}} 2 {emit {\(major 1\)}} 
-}
-}
-if {[S 0 == pst0]} {emit {perl Storable\(v0.7\) data}
-if {[N c 4 > 0x0]} {if {[N c 4 & 0x1]} {emit {\(network-ordered\)}}
-switch -- [Nv c 4] 5 {emit {\(major 2\)}} 4 {emit {\(major 2\)}} 
-if {[N c 5 > 0x0]} {emit {\(minor %d\)}}
-}
-}
-if {[S 0 == {-----BEGIN\040PGP}]} {emit {PGP armored data}
-if {[S 15 == {PUBLIC\040KEY\040BLOCK-}]} {emit {public key block}}
-if {[S 15 == MESSAGE-]} {emit message}
-if {[S 15 == {SIGNED\040MESSAGE-}]} {emit {signed message}}
-if {[S 15 == {PGP\040SIGNATURE-}]} {emit signature}
-}
-if {[S 0 == {\#\ PaCkAgE\ DaTaStReAm}]} {emit {pkg Datastream \(SVR4\)}}
-if {[S 0 == %!]} {emit {PostScript document text}
-if {[S 2 == PS-Adobe-]} {emit conforming
-if {[S 11 x {}]} {emit {at level %.3s}
-if {[S 15 == EPS]} {emit {- type %s}}
-if {[S 15 == Query]} {emit {- type %s}}
-if {[S 15 == ExitServer]} {emit {- type %s}}
-}
-}
-}
-if {[S 0 == {\004%!}]} {emit {PostScript document text}
-if {[S 3 == PS-Adobe-]} {emit conforming
-if {[S 12 x {}]} {emit {at level %.3s}
-if {[S 16 == EPS]} {emit {- type %s}}
-if {[S 16 == Query]} {emit {- type %s}}
-if {[S 16 == ExitServer]} {emit {- type %s}}
-}
-}
-}
-if {[S 0 == {\033%-12345X%!PS}]} {emit {PostScript document}}
-if {[S 0 == *PPD-Adobe:]} {emit {PPD file}
-if {[S 13 x {}]} {emit {\b, ve}}
-}
-if {[S 0 == {\033%-12345X@PJL}]} {emit {HP Printer Job Language data}}
-if {[Sx 1 0 == {\033%-12345X@PJL}]} {emit {HP Printer Job Language data}
-if {[Sx 2 [R 0] x {}]} {emit {%s			}
-if {[Sx 3 [R 0] x {}]} {emit {%s			}
-if {[Sx 4 [R 0] x {}]} {emit {%s		}
-if {[S [R 0] x {}]} {emit {%s		}}
-}
-}
-}
-}
-if {[S 0 == {\033E\033}]} {emit {HP PCL printer data}
-if {[S 3 == {\&l0A}]} {emit {- default page size}}
-if {[S 3 == {\&l1A}]} {emit {- US executive page size}}
-if {[S 3 == {\&l2A}]} {emit {- US letter page size}}
-if {[S 3 == {\&l3A}]} {emit {- US legal page size}}
-if {[S 3 == {\&l26A}]} {emit {- A4 page size}}
-if {[S 3 == {\&l80A}]} {emit {- Monarch envelope size}}
-if {[S 3 == {\&l81A}]} {emit {- No. 10 envelope size}}
-if {[S 3 == {\&l90A}]} {emit {- Intl. DL envelope size}}
-if {[S 3 == {\&l91A}]} {emit {- Intl. C5 envelope size}}
-if {[S 3 == {\&l100A}]} {emit {- Intl. B5 envelope size}}
-if {[S 3 == {\&l-81A}]} {emit {- No. 10 envelope size \(landscape\)}}
-if {[S 3 == {\&l-90A}]} {emit {- Intl. DL envelope size \(landscape\)}}
-}
-if {[S 0 == @document(]} {emit {Imagen printer}
-if {[S 10 == {language\ impress}]} {emit {\(imPRESS data\)}}
-if {[S 10 == {language\ daisy}]} {emit {\(daisywheel text\)}}
-if {[S 10 == {language\ diablo}]} {emit {\(daisywheel text\)}}
-if {[S 10 == {language\ printer}]} {emit {\(line printer emulation\)}}
-if {[S 10 == {language\ tektronix}]} {emit {\(Tektronix 4014 emulation\)}}
-}
-if {[S 0 == Rast]} {emit {RST-format raster font data}
-if {[S 45 > 0]} {emit {face %s}}
-}
-if {[S 0 == {\033[K\002\0\0\017\033(a\001\0\001\033(g}]} {emit {Canon Bubble Jet BJC formatted data}}
-if {[S 0 == {\x1B\x40\x1B\x28\x52\x08\x00\x00REMOTE1P}]} {emit {Epson Stylus Color 460 data}}
-if {[S 0 == JZJZ]} {if {[S 18 == ZZ]} {emit {Zenographics ZjStream printer data \(big-endian\)}}
-}
-if {[S 0 == ZJZJ]} {if {[S 18 == ZZ]} {emit {Zenographics ZjStream printer data \(little-endian\)}}
-}
-if {[S 0 == OAK]} {if {[N c 7 == 0x0]} {emit 888 0}
-if {[N c 11 == 0x0]} {emit {Oak Technologies printer stream}}
-}
-if {[S 0 == %!VMF]} {emit {SunClock's Vector Map Format data}}
-if {[S 0 == {\xbe\xefABCDEFGH}]} {emit {HP LaserJet 1000 series downloadable firmware}}
-if {[S 0 == {\x1b\x01@EJL}]} {emit {Epson ESC/Page language printer data}}
-if {[S 0 == {FTNCHEK_\ P}]} {emit {project file for ftnchek}
-if {[S 10 == 1]} {emit {version 2.7}}
-if {[S 10 == 2]} {emit {version 2.8 to 2.10}}
-if {[S 10 == 3]} {emit {version 2.11 or later}}
-}
-if {[N I 0 == 0x56000000 &0xff00ffff]} {emit {ps database}
-if {[S 1 x {}]} {emit {version %s}}
-if {[S 4 x {}]} {emit {from kernel %s}}
-}
-if {[S 0 == {\"\"\"}]} {emit {a python script text executable}}
-if {[S 0 == {/1\ :pserver:}]} {emit {cvs password text file}}
-if {[S 0 == RIFF]} {emit {RIFF \(little-endian\) data}
-if {[S 8 == PAL]} {emit {\b, palette}
-if {[N s 16 x {}]} {emit {\b, version %d}}
-if {[N s 18 x {}]} {emit {\b, %d entries}}
-}
-if {[S 8 == RDIB]} {emit {\b, device-independent bitmap}
-if {[S 16 == BM]} {switch -- [Nv s 30] 12 {emit {\b, OS/2 1.x format}
-if {[N s 34 x {}]} {emit {\b, %d x}}
-if {[N s 36 x {}]} {emit %d}
-} 64 {emit {\b, OS/2 2.x format}
-if {[N s 34 x {}]} {emit {\b, %d x}}
-if {[N s 36 x {}]} {emit %d}
-} 40 {emit {\b, Windows 3.x format}
-if {[N i 34 x {}]} {emit {\b, %d x}}
-if {[N i 38 x {}]} {emit {%d x}}
-if {[N s 44 x {}]} {emit %d}
-} 
-}
-}
-if {[S 8 == RMID]} {emit {\b, MIDI}}
-if {[S 8 == RMMP]} {emit {\b, multimedia movie}}
-if {[S 8 == WAVE]} {emit {\b, WAVE audio}
-switch -- [Nv s 20] 1 {emit {\b, Microsoft PCM}
-if {[N s 34 > 0x0]} {emit {\b, %d bit}}
-} 2 {emit {\b, Microsoft ADPCM}} 6 {emit {\b, ITU G.711 A-law}} 7 {emit {\b, ITU G.711 mu-law}} 17 {emit {\b, IMA ADPCM}} 20 {emit {\b, ITU G.723 ADPCM \(Yamaha\)}} 49 {emit {\b, GSM 6.10}} 64 {emit {\b, ITU G.721 ADPCM}} 80 {emit {\b, MPEG}} 85 {emit {\b, MPEG Layer 3}} 
-switch -- [Nv s 22] 1 {emit {\b, mono}} 2 {emit {\b, stereo}} 
-if {[N s 22 > 0x2]} {emit {\b, %d channels}}
-if {[N i 24 > 0x0]} {emit {%d Hz}}
-}
-if {[S 8 == CDRA]} {emit {\b, Corel Draw Picture}}
-if {[S 8 == {AVI\040}]} {emit {\b, AVI}
-if {[S 12 == LIST]} {if {[Sx 4 20 == hdrlavih]} {if {[N i [R 36] x {}]} {emit {\b, %lu x}}
-if {[N i [R 40] x {}]} {emit %lu,}
-if {[N i [R 4] > 0xf4240]} {emit {<1 fps,}}
-switch -- [Nvx 5 i [R 4]] 1000000 {emit {1.00 fps,}} 500000 {emit {2.00 fps,}} 333333 {emit {3.00 fps,}} 250000 {emit {4.00 fps,}} 200000 {emit {5.00 fps,}} 166667 {emit {6.00 fps,}} 142857 {emit {7.00 fps,}} 125000 {emit {8.00 fps,}} 111111 {emit {9.00 fps,}} 100000 {emit {10.00 fps,}} 83333 {emit {12.00 fps,}} 66667 {emit {15.00 fps,}} 50000 {emit {20.00 fps,}} 41708 {emit {23.98 fps,}} 41667 {emit {24.00 fps,}} 40000 {emit {25.00 fps,}} 33367 {emit {29.97 fps,}} 33333 {emit {30.00 fps,}} 
-L 4;if {[Nx 5 i [R 4] < 0x18a92]} {if {[Nx 6 i [R -4] > 0x182c2]} {if {[N i [R -4] != 0x186a0]} {emit {~10 fps,}}
-}
-}
-L 4;if {[Nx 5 i [R 4] < 0x14842]} {if {[Nx 6 i [R -4] > 0x142d5]} {if {[N i [R -4] != 0x14585]} {emit {~12 fps,}}
-}
-}
-L 4;if {[Nx 5 i [R 4] < 0x1062a]} {if {[Nx 6 i [R -4] > 0x102b1]} {if {[N i [R -4] != 0x1046b]} {emit {~15 fps,}}
-}
-}
-L 4;if {[Nx 5 i [R 4] < 0xa371]} {if {[Nx 6 i [R -4] > 0xa216]} {if {[Nx 7 i [R -4] != 0xa2ec]} {if {[N i [R -4] != 0xa2c3]} {emit {~24 fps,}}
-}
-}
-}
-L 4;if {[Nx 5 i [R 4] < 0x9ce1]} {if {[Nx 6 i [R -4] > 0x9ba1]} {if {[N i [R -4] != 0x9c40]} {emit {~25 fps,}}
-}
-}
-L 4;if {[Nx 5 i [R 4] < 0x82a5]} {if {[Nx 6 i [R -4] > 0x81c7]} {if {[Nx 7 i [R -4] != 0x8257]} {if {[N i [R -4] != 0x8235]} {emit {~30 fps,}}
-}
-}
-}
-L 4;if {[N i [R 4] < 0x7de0]} {emit {>30 fps,}}
-}
-if {[S 88 == LIST]} {if {[S 96 == strlstrh]} {if {[Sx 6 108 == vids]} {emit video:
-if {[N i [R 0] == 0x0]} {emit uncompressed}
-if {[S [I 104 i 108] == strf]} {switch -- [Nv i [I 104 i 132]] 1 {emit {RLE 8bpp}} 0 {emit {}} 
-if {[S [I 104 i 132] == cvid c]} {emit Cinepak}
-if {[S [I 104 i 132] == i263 c]} {emit {Intel I.263}}
-if {[S [I 104 i 132] == iv32 c]} {emit {Indeo 3.2}}
-if {[S [I 104 i 132] == iv41 c]} {emit {Indeo 4.1}}
-if {[S [I 104 i 132] == iv50 c]} {emit {Indeo 5.0}}
-if {[S [I 104 i 132] == mp42 c]} {emit {Microsoft MPEG-4 v2}}
-if {[S [I 104 i 132] == mp43 c]} {emit {Microsoft MPEG-4 v3}}
-if {[S [I 104 i 132] == mjpg c]} {emit {Motion JPEG}}
-if {[S [I 104 i 132] == div3 c]} {emit {DivX 3}
-if {[S 112 == div3 c]} {emit Low-Motion}
-if {[S 112 == div4 c]} {emit Fast-Motion}
-}
-if {[S [I 104 i 132] == divx c]} {emit {DivX 4}}
-if {[S [I 104 i 132] == dx50 c]} {emit {DivX 5}}
-if {[S [I 104 i 132] == xvid c]} {emit XviD}
-}
-}
-}
-if {[S [I 92 i 96] == LIST]} {if {[S [I 92 i 104] == strlstrh]} {if {[S [I 92 i 116] == auds]} {emit {\b, audio:}
-if {[S [I 92 i 172] == strf]} {switch -- [Nv s [I 92 i 180]] 1 {emit {uncompressed PCM}} 2 {emit ADPCM} 85 {emit {MPEG-1 Layer 3}} 8192 {emit {Dolby AC3}} 353 {emit DivX} 
-switch -- [Nv s [I 92 i 182]] 1 {emit {\(mono,}} 2 {emit {\(stereo,}} 
-if {[N s [I 92 i 182] > 0x2]} {emit {\(%d channels,}}
-if {[N i [I 92 i 184] x {}]} {emit {%d Hz\)}}
-}
-if {[S [I 92 i 180] == strf]} {switch -- [Nv s [I 92 i 188]] 1 {emit {uncompressed PCM}} 2 {emit ADPCM} 85 {emit {MPEG-1 Layer 3}} 8192 {emit {Dolby AC3}} 353 {emit DivX} 
-switch -- [Nv s [I 92 i 190]] 1 {emit {\(mono,}} 2 {emit {\(stereo,}} 
-if {[N s [I 92 i 190] > 0x2]} {emit {\(%d channels,}}
-if {[N i [I 92 i 192] x {}]} {emit {%d Hz\)}}
-}
-}
-}
-}
-}
-}
-}
-if {[S 8 == ACON]} {emit {\b, animated cursor}}
-if {[S 8 == sfbk]} {emit SoundFont/Bank}
-if {[S 8 == CDXA]} {emit {\b, wrapped MPEG-1 \(CDXA\)}}
-if {[S 8 == 4XMV]} {emit {\b, 4X Movie file}}
-}
-if {[S 0 == RIFX]} {emit {RIFF \(big-endian\) data}
-if {[S 8 == PAL]} {emit {\b, palette}
-if {[N S 16 x {}]} {emit {\b, version %d}}
-if {[N S 18 x {}]} {emit {\b, %d entries}}
-}
-if {[S 8 == RDIB]} {emit {\b, device-independent bitmap}
-if {[S 16 == BM]} {switch -- [Nv S 30] 12 {emit {\b, OS/2 1.x format}
-if {[N S 34 x {}]} {emit {\b, %d x}}
-if {[N S 36 x {}]} {emit %d}
-} 64 {emit {\b, OS/2 2.x format}
-if {[N S 34 x {}]} {emit {\b, %d x}}
-if {[N S 36 x {}]} {emit %d}
-} 40 {emit {\b, Windows 3.x format}
-if {[N I 34 x {}]} {emit {\b, %d x}}
-if {[N I 38 x {}]} {emit {%d x}}
-if {[N S 44 x {}]} {emit %d}
-} 
-}
-}
-if {[S 8 == RMID]} {emit {\b, MIDI}}
-if {[S 8 == RMMP]} {emit {\b, multimedia movie}}
-if {[S 8 == WAVE]} {emit {\b, WAVE audio}
-if {[N s 20 == 0x1]} {emit {\b, Microsoft PCM}
-if {[N s 34 > 0x0]} {emit {\b, %d bit}}
-}
-switch -- [Nv S 22] 1 {emit {\b, mono}} 2 {emit {\b, stereo}} 
-if {[N S 22 > 0x2]} {emit {\b, %d channels}}
-if {[N I 24 > 0x0]} {emit {%d Hz}}
-}
-if {[S 8 == CDRA]} {emit {\b, Corel Draw Picture}}
-if {[S 8 == {AVI\040}]} {emit {\b, AVI}}
-if {[S 8 == ACON]} {emit {\b, animated cursor}}
-if {[S 8 == NIFF]} {emit {\b, Notation Interchange File Format}}
-if {[S 8 == sfbk]} {emit SoundFont/Bank}
-}
-if {[S 0 == {\{\\rtf}]} {emit {Rich Text Format data,}
-if {[N c 5 x {}]} {emit {version %c,}}
-if {[S 6 == {\\ansi}]} {emit ANSI}
-if {[S 6 == {\\mac}]} {emit {Apple Macintosh}}
-if {[S 6 == {\\pc}]} {emit {IBM PC, code page 437}}
-if {[S 6 == {\\pca}]} {emit {IBM PS/2, code page 850}}
-}
-if {[S 38 == Spreadsheet]} {emit {sc spreadsheet file}}
-if {[S 8 == {\001s\ }]} {emit {SCCS archive data}}
-if {[S 0 == {divert(-1)\n}]} {emit {sendmail m4 text file}}
-if {[S 0 == PmNs]} {emit {PCP compiled namespace \(V.0\)}}
-if {[S 0 == PmN]} {emit {PCP compiled namespace}
-if {[S 3 x {}]} {emit {\(V.%1.1s\)}}
-}
-if {[N i 3 == 0x84500526]} {emit {PCP archive}
-if {[N c 7 x {}]} {emit {\(V.%d\)}}
-switch -- [Nv i 20] -2 {emit {temporal index}} -1 {emit metadata} 0 {emit {log volume \#0}} 
-if {[N i 20 > 0x0]} {emit {log volume \#%ld}}
-if {[S 24 x {}]} {emit {host: %s}}
-}
-if {[S 0 == PCPFolio]} {emit PCP
-if {[S 9 == Version:]} {emit {Archive Folio}}
-if {[S 18 x {}]} {emit {\(V.%s\)}}
-}
-if {[S 0 == {\#pmchart}]} {emit {PCP pmchart view}
-if {[S 9 == Version]} {emit 906 0}
-if {[S 17 x {}]} {emit {\(V%-3.3s\)}}
-}
-if {[S 0 == pmview]} {emit {PCP pmview config}
-if {[S 7 == Version]} {emit 907 0}
-if {[S 15 x {}]} {emit {\(V%-3.3s\)}}
-}
-if {[S 0 == {\#pmlogger}]} {emit {PCP pmlogger config}
-if {[S 10 == Version]} {emit 908 0}
-if {[S 18 x {}]} {emit {\(V%1.1s\)}}
-}
-if {[S 0 == PcPh]} {emit {PCP Help}
-if {[S 4 == 1]} {emit Index}
-if {[S 4 == 2]} {emit Text}
-if {[S 5 x {}]} {emit {\(V.%1.1s\)}}
-}
-if {[S 0 == {\#pmieconf-rules}]} {emit {PCP pmieconf rules}
-if {[S 16 x {}]} {emit {\(V.%1.1s\)}}
-}
-if {[S 3 == pmieconf-pmie]} {emit {PCP pmie config}
-if {[S 17 x {}]} {emit {\(V.%1.1s\)}}
-}
-if {[S 0 == mdbm]} {emit {mdbm file,}
-if {[N c 5 x {}]} {emit {version %d,}}
-if {[N c 6 x {}]} {emit {2^%d pages,}}
-if {[N c 7 x {}]} {emit {pagesize 2^%d,}}
-if {[N c 17 x {}]} {emit {hash %d,}}
-if {[N c 11 x {}]} {emit {dataformat %d}}
-}
-if {[S 0 == //Maya]} {emit {ASCII	Alias|Wavefront Maya Ascii File,}
-if {[S 13 x {}]} {emit {version %s}}
-}
-if {[S 8 == MAYAFOR4]} {emit {Alias|Wavefront Maya Binary File,}
-if {[S 32 x {}]} {emit {version %s scene}}
-}
-if {[S 8 == MayaFOR4]} {emit {Alias|Wavefront Maya Binary File,}
-if {[S 32 x {}]} {emit {version %s scene}}
-}
-if {[S 8 == CIMG]} {emit {Alias|Wavefront Maya Image File}}
-if {[S 8 == DEEP]} {emit {Alias|Wavefront Maya Image File}}
-if {[S 0 == {<!DOCTYPE\ html} cB]} {emit {HTML document text}}
-if {[S 0 == <head cb]} {emit {HTML document text}}
-if {[S 0 == <title cb]} {emit {HTML document text}}
-if {[S 0 == <html cb]} {emit {HTML document text}}
-if {[S 0 == <?xml cb]} {emit {XML document text}}
-if {[S 0 == {<?xml\ version}]} {emit {\"	XML}}
-if {[S 0 == {<?xml\ version=\"}]} {emit XML
-if {[S 15 x {}]} {emit {%.3s document text}
-if {[S 23 == <xsl:stylesheet]} {emit {\(XSL stylesheet\)}}
-if {[S 24 == <xsl:stylesheet]} {emit {\(XSL stylesheet\)}}
-}
-}
-if {[S 0 == <?xml b]} {emit {XML document text}}
-if {[S 0 == <?xml cb]} {emit {broken XML document text}}
-if {[S 0 == <!doctype cb]} {emit {exported SGML document text}}
-if {[S 0 == <!subdoc cb]} {emit {exported SGML subdocument text}}
-if {[S 0 == <!-- cb]} {emit {exported SGML document text}}
-if {[S 0 == {\#\ HTTP\ Cookie\ File}]} {emit {Web browser cookie text}}
-if {[S 0 == {\#\ Netscape\ HTTP\ Cookie\ File}]} {emit {Netscape cookie text}}
-if {[S 0 == {\#\ KDE\ Cookie\ File}]} {emit {Konqueror cookie text}}
-if {[S 0 == Draw]} {emit {RiscOS Drawfile}}
-if {[S 0 == PACK]} {emit {RiscOS PackdDir archive}}
-if {[S 0 == !]} {emit {Assembler source}}
-if {[S 0 == Analog]} {emit {ADi asm listing file}}
-if {[S 0 == .SYSTEM]} {emit {SHARC architecture file}}
-if {[S 0 == .system]} {emit {SHARC architecture file}}
-if {[S 0 == QL5]} {emit {QL disk dump data,}
-if {[S 3 == A]} {emit {720 KB,}}
-if {[S 3 == B]} {emit {1.44 MB,}}
-if {[S 3 == C]} {emit {3.2 MB,}}
-if {[S 4 x {}]} {emit label:%.10s}
-}
-if {[S 0 == {NqNqNq`\004}]} {emit {QL firmware executable \(BCPL\)}}
-if {[S 0 == {\#\#Sketch}]} {emit {Sketch document text}}
-if {[S 0 == {GSTIm\0\0}]} {emit {GNU SmallTalk}
-switch -- [Nv c 7 &1] 0 {emit {LE image version}
-if {[N c 10 x {}]} {emit %d.}
-if {[N c 9 x {}]} {emit {\b%d.}}
-if {[N c 8 x {}]} {emit {\b%d}}
-} 1 {emit {BE image version}
-if {[N c 8 x {}]} {emit %d.}
-if {[N c 9 x {}]} {emit {\b%d.}}
-if {[N c 10 x {}]} {emit {\b%d}}
-} 
-}
-if {[S 0 == RTSS]} {emit {NetMon capture file}
-if {[N c 5 x {}]} {emit {- version %d}}
-if {[N c 4 x {}]} {emit {\b.%d}}
-switch -- [Nv s 6] 0 {emit {\(Unknown\)}} 1 {emit {\(Ethernet\)}} 2 {emit {\(Token Ring\)}} 3 {emit {\(FDDI\)}} 4 {emit {\(ATM\)}} 
-}
-if {[S 0 == GMBU]} {emit {NetMon capture file}
-if {[N c 5 x {}]} {emit {- version %d}}
-if {[N c 4 x {}]} {emit {\b.%d}}
-switch -- [Nv s 6] 0 {emit {\(Unknown\)}} 1 {emit {\(Ethernet\)}} 2 {emit {\(Token Ring\)}} 3 {emit {\(FDDI\)}} 4 {emit {\(ATM\)}} 
-}
-if {[S 0 == {TRSNIFF\ data\ \ \ \ \032}]} {emit {Sniffer capture file}
-if {[N c 33 == 0x2]} {emit {\(compressed\)}}
-if {[N s 23 x {}]} {emit {- version %d}}
-if {[N s 25 x {}]} {emit {\b.%d}}
-switch -- [Nv c 32] 0 {emit {\(Token Ring\)}} 1 {emit {\(Ethernet\)}} 2 {emit {\(ARCNET\)}} 3 {emit {\(StarLAN\)}} 4 {emit {\(PC Network broadband\)}} 5 {emit {\(LocalTalk\)}} 6 {emit {\(Znet\)}} 7 {emit {\(Internetwork Analyzer\)}} 9 {emit {\(FDDI\)}} 10 {emit {\(ATM\)}} 
-}
-if {[S 0 == {XCP\0}]} {emit {NetXRay capture file}
-if {[S 4 x {}]} {emit {- version %s}}
-switch -- [Nv s 44] 0 {emit {\(Ethernet\)}} 1 {emit {\(Token Ring\)}} 2 {emit {\(FDDI\)}} 3 {emit {\(WAN\)}} 8 {emit {\(ATM\)}} 9 {emit {\(802.11\)}} 
-}
-if {[S 0 == {iptrace\ 1.0}]} {emit {\"iptrace\" capture file}}
-if {[S 0 == {iptrace\ 2.0}]} {emit {\"iptrace\" capture file}}
-if {[S 0 == {\x54\x52\x00\x64\x00}]} {emit {\"nettl\" capture file}}
-if {[S 0 == {\x42\xd2\x00\x34\x12\x66\x22\x88}]} {emit {RADCOM WAN/LAN Analyzer capture file}}
-if {[S 0 == NetS]} {emit {NetStumbler log file}
-if {[N i 8 x {}]} {emit {\b, %d stations found}}
-}
-if {[S 0 == {\177ver}]} {emit {EtherPeek/AiroPeek capture file}}
-if {[S 0 == {\x05VNF}]} {emit {Visual Networks traffic capture file}}
-if {[S 0 == ObserverPktBuffe]} {emit {Network Instruments Observer capture file}}
-if {[S 0 == {\xaa\xaa\xaa\xaa}]} {emit {5View capture file}}
-if {[S 0 == {<!SQ\ DTD>}]} {emit {Compiled SGML rules file}
-if {[S 9 x {}]} {emit {Type %s}}
-}
-if {[S 0 == {<!SQ\ A/E>}]} {emit {A/E SGML Document binary}
-if {[S 9 x {}]} {emit {Type %s}}
-}
-if {[S 0 == {<!SQ\ STS>}]} {emit {A/E SGML binary styles file}
-if {[S 9 x {}]} {emit {Type %s}}
-}
-if {[S 0 == {SQ\ BITMAP1}]} {emit {SoftQuad Raster Format text}}
-if {[S 0 == {X\ }]} {emit {SoftQuad troff Context intermediate}
-if {[S 2 == 495]} {emit {for AT&T 495 laser printer}}
-if {[S 2 == hp]} {emit {for Hewlett-Packard LaserJet}}
-if {[S 2 == impr]} {emit {for IMAGEN imPRESS}}
-if {[S 2 == ps]} {emit {for PostScript}}
-}
-if {[S 0 == spec]} {emit SPEC
-if {[S 4 == .cpu]} {emit CPU
-if {[S 8 < :]} {emit {\b%.4s}}
-if {[S 12 == .]} {emit {raw result text}}
-}
-}
-if {[S 17 == version=SPECjbb]} {emit SPECjbb
-if {[S 32 < :]} {emit {\b%.4s}
-if {[S 37 < :]} {emit {v%.4s raw result text}}
-}
-}
-if {[S 0 == {BEGIN\040SPECWEB}]} {emit SPECweb
-if {[S 13 < :]} {emit {\b%.2s}
-if {[S 15 == _SSL]} {emit {\b_SSL}
-if {[S 20 < :]} {emit {v%.4s raw result text}}
-}
-if {[S 16 < :]} {emit {v%.4s raw result text}}
-}
-}
-if {[S 0 == {PLUS3DOS\032}]} {emit {Spectrum +3 data}
-switch -- [Nv c 15] 0 {emit {- BASIC program}} 1 {emit {- number array}} 2 {emit {- character array}} 3 {emit {- memory block}
-if {[N I 16 == 0x1b0040]} {emit {\(screen\)}}
-} 4 {emit {- Tasword document}} 
-if {[S 15 == TAPEFILE]} {emit {- ZXT tapefile}}
-}
-if {[S 0 == {\023\000\000}]} {emit {Spectrum .TAP data}
-if {[S 4 x {}]} {emit {\"%-10.10s\"}}
-switch -- [Nv c 3] 0 {emit {- BASIC program}} 1 {emit {- number array}} 2 {emit {- character array}} 3 {emit {- memory block}
-if {[N I 14 == 0x1b0040]} {emit {\(screen\)}}
-} 
-}
-if {[S 0 == {ZXTape!\x1a}]} {emit {Spectrum .TZX data}
-if {[N c 8 x {}]} {emit {version %d}}
-if {[N c 9 x {}]} {emit .%d}
-}
-if {[S 0 == RZX!]} {emit {Spectrum .RZX data}
-if {[N c 4 x {}]} {emit {version %d}}
-if {[N c 5 x {}]} {emit .%d}
-}
-if {[S 0 == {MV\ -\ CPCEMU\ Disk-Fil}]} {emit {Amstrad/Spectrum .DSK data}}
-if {[S 0 == {MV\ -\ CPC\ format\ Dis}]} {emit {Amstrad/Spectrum DU54 .DSK data}}
-if {[S 0 == {EXTENDED\ CPC\ DSK\ Fil}]} {emit {Amstrad/Spectrum Extended .DSK data}}
-if {[S 0 == {\376bin}]} {emit {MySQL replication log}}
-if {[S 0 == {\#SUNPC_CONFIG}]} {emit {SunPC 4.0 Properties Values}}
-if {[S 0 == snoop]} {emit {Snoop capture file}
-if {[N I 8 > 0x0]} {emit {- version %ld}}
-switch -- [Nv I 12] 0 {emit {\(IEEE 802.3\)}} 1 {emit {\(IEEE 802.4\)}} 2 {emit {\(IEEE 802.5\)}} 3 {emit {\(IEEE 802.6\)}} 4 {emit {\(Ethernet\)}} 5 {emit {\(HDLC\)}} 6 {emit {\(Character synchronous\)}} 7 {emit {\(IBM channel-to-channel adapter\)}} 8 {emit {\(FDDI\)}} 9 {emit {\(Unknown\)}} 
-}
-if {[S 36 == acspMSFT]} {emit {Microsoft ICM Color Profile}}
-if {[S 36 == acsp]} {emit {Kodak Color Management System, ICC Profile}}
-if {[S 0 == {Cobalt\ Networks\ Inc.\nFirmware\ v}]} {emit {Paged COBALT boot rom}
-if {[S 38 x {}]} {emit V%.4s}
-}
-if {[S 0 == CRfs]} {emit {COBALT boot rom data \(Flat boot rom or file system\)}}
-if {[S 0 == T707]} {emit {Roland TR-707 Data}}
-if {[S 0 == {\#!teapot\012xdr}]} {emit {teapot work sheet \(XDR format\)}}
-if {[S 0 == {\032\001}]} {emit {Compiled terminfo entry}}
-if {[S 0 == {\367\002}]} {emit {TeX DVI file}
-if {[S 16 x {}]} {emit {\(%s\)}}
-}
-if {[S 0 == {\367\203}]} {emit {TeX generic font data}}
-if {[S 0 == {\367\131}]} {emit {TeX packed font data}
-if {[S 3 x {}]} {emit {\(%s\)}}
-}
-if {[S 0 == {\367\312}]} {emit {TeX virtual font data}}
-if {[S 0 == {This\ is\ TeX,}]} {emit {TeX transcript text}}
-if {[S 0 == {This\ is\ METAFONT,}]} {emit {METAFONT transcript text}}
-if {[S 2 == {\000\021}]} {emit {TeX font metric data}
-if {[S 33 x {}]} {emit {\(%s\)}}
-}
-if {[S 2 == {\000\022}]} {emit {TeX font metric data}
-if {[S 33 x {}]} {emit {\(%s\)}}
-}
-if {[S 0 == {\\input\ texinfo}]} {emit {Texinfo source text}}
-if {[S 0 == {This\ is\ Info\ file}]} {emit {GNU Info text}}
-if {[S 0 == {\\input}]} {emit {TeX document text}}
-if {[S 0 == {\\section}]} {emit {LaTeX document text}}
-if {[S 0 == {\\setlength}]} {emit {LaTeX document text}}
-if {[S 0 == {\\documentstyle}]} {emit {LaTeX document text}}
-if {[S 0 == {\\chapter}]} {emit {LaTeX document text}}
-if {[S 0 == {\\documentclass}]} {emit {LaTeX 2e document text}}
-if {[S 0 == {\\relax}]} {emit {LaTeX auxiliary file}}
-if {[S 0 == {\\contentsline}]} {emit {LaTeX  table of contents}}
-if {[S 0 == {%\ -*-latex-*-}]} {emit {LaTeX document text}}
-if {[S 0 == {\\ifx}]} {emit {TeX document text}}
-if {[S 0 == {\\indexentry}]} {emit {LaTeX raw index file}}
-if {[S 0 == {\\begin\{theindex\}}]} {emit {LaTeX sorted index}}
-if {[S 0 == {\\glossaryentry}]} {emit {LaTeX raw glossary}}
-if {[S 0 == {\\begin\{theglossary\}}]} {emit {LaTeX sorted glossary}}
-if {[S 0 == {This\ is\ makeindex}]} {emit {Makeindex log file}}
-if {[S 0 == {@article\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@book\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@inbook\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@incollection\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@inproceedings\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@manual\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@misc\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@preamble\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@phdthesis\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@techreport\{} c]} {emit {BibTeX text file}}
-if {[S 0 == {@unpublished\{} c]} {emit {BibTeX text file}}
-if {[S 73 == {%%%\ \ BibTeX-file\{}]} {emit {BibTex text file \(with full header\)}}
-if {[S 73 == {%%%\ \ @BibTeX-style-file\{}]} {emit {BibTeX style text file \(with full header\)}}
-if {[S 0 == {%\ BibTeX\ standard\ bibliography\ }]} {emit {BibTeX standard bibliography style text file}}
-if {[S 0 == {%\ BibTeX\ `}]} {emit {BibTeX custom bibliography style text file}}
-if {[S 0 == {@c\ @mapfile\{}]} {emit {TeX font aliases text file}}
-if {[S 0 == {%TGIF\ 4}]} {emit {tgif version 4 object file}}
-if {[S 0 == **TI80**]} {emit {TI-80 Graphing Calculator File.}}
-if {[S 0 == **TI81**]} {emit {TI-81 Graphing Calculator File.}}
-if {[S 0 == **TI73**]} {emit {TI-73 Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real number\)}} 1 {emit {\(list\)}} 2 {emit {\(matrix\)}} 3 {emit {\(equation\)}} 4 {emit {\(string\)}} 5 {emit {\(program\)}} 6 {emit {\(assembly program\)}} 7 {emit {\(picture\)}} 8 {emit {\(gdb\)}} 12 {emit {\(complex number\)}} 15 {emit {\(window settings\)}} 16 {emit {\(zoom\)}} 17 {emit {\(table setup\)}} 19 {emit {\(backup\)}} 
-}
-if {[S 0 == **TI82**]} {emit {TI-82 Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real\)}} 1 {emit {\(list\)}} 2 {emit {\(matrix\)}} 3 {emit {\(Y-variable\)}} 5 {emit {\(program\)}} 6 {emit {\(protected prgm\)}} 7 {emit {\(picture\)}} 8 {emit {\(gdb\)}} 11 {emit {\(window settings\)}} 12 {emit {\(window settings\)}} 13 {emit {\(table setup\)}} 14 {emit {\(screenshot\)}} 15 {emit {\(backup\)}} 
-}
-if {[S 0 == **TI83**]} {emit {TI-83 Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real\)}} 1 {emit {\(list\)}} 2 {emit {\(matrix\)}} 3 {emit {\(Y-variable\)}} 4 {emit {\(string\)}} 5 {emit {\(program\)}} 6 {emit {\(protected prgm\)}} 7 {emit {\(picture\)}} 8 {emit {\(gdb\)}} 11 {emit {\(window settings\)}} 12 {emit {\(window settings\)}} 13 {emit {\(table setup\)}} 14 {emit {\(screenshot\)}} 19 {emit {\(backup\)}} 
-}
-if {[S 0 == **TI83F*]} {emit {TI-83+ Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real number\)}} 1 {emit {\(list\)}} 2 {emit {\(matrix\)}} 3 {emit {\(equation\)}} 4 {emit {\(string\)}} 5 {emit {\(program\)}} 6 {emit {\(assembly program\)}} 7 {emit {\(picture\)}} 8 {emit {\(gdb\)}} 12 {emit {\(complex number\)}} 15 {emit {\(window settings\)}} 16 {emit {\(zoom\)}} 17 {emit {\(table setup\)}} 19 {emit {\(backup\)}} 21 {emit {\(application variable\)}} 23 {emit {\(group of variable\)}} 
-}
-if {[S 0 == **TI85**]} {emit {TI-85 Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real number\)}} 1 {emit {\(complex number\)}} 2 {emit {\(real vector\)}} 3 {emit {\(complex vector\)}} 4 {emit {\(real list\)}} 5 {emit {\(complex list\)}} 6 {emit {\(real matrix\)}} 7 {emit {\(complex matrix\)}} 8 {emit {\(real constant\)}} 9 {emit {\(complex constant\)}} 10 {emit {\(equation\)}} 12 {emit {\(string\)}} 13 {emit {\(function GDB\)}} 14 {emit {\(polar GDB\)}} 15 {emit {\(parametric GDB\)}} 16 {emit {\(diffeq GDB\)}} 17 {emit {\(picture\)}} 18 {emit {\(program\)}} 19 {emit {\(range\)}} 23 {emit {\(window settings\)}} 24 {emit {\(window settings\)}} 25 {emit {\(window settings\)}} 26 {emit {\(window settings\)}} 27 {emit {\(zoom\)}} 29 {emit {\(backup\)}} 30 {emit {\(unknown\)}} 42 {emit {\(equation\)}} 
-if {[S 50 == ZS4]} {emit {- ZShell Version 4 File.}}
-if {[S 50 == ZS3]} {emit {- ZShell Version 3 File.}}
-}
-if {[S 0 == **TI86**]} {emit {TI-86 Graphing Calculator}
-switch -- [Nv c 59] 0 {emit {\(real number\)}} 1 {emit {\(complex number\)}} 2 {emit {\(real vector\)}} 3 {emit {\(complex vector\)}} 4 {emit {\(real list\)}} 5 {emit {\(complex list\)}} 6 {emit {\(real matrix\)}} 7 {emit {\(complex matrix\)}} 8 {emit {\(real constant\)}} 9 {emit {\(complex constant\)}} 10 {emit {\(equation\)}} 12 {emit {\(string\)}} 13 {emit {\(function GDB\)}} 14 {emit {\(polar GDB\)}} 15 {emit {\(parametric GDB\)}} 16 {emit {\(diffeq GDB\)}} 17 {emit {\(picture\)}} 18 {emit {\(program\)}} 19 {emit {\(range\)}} 23 {emit {\(window settings\)}} 24 {emit {\(window settings\)}} 25 {emit {\(window settings\)}} 26 {emit {\(window settings\)}} 27 {emit {\(zoom\)}} 29 {emit {\(backup\)}} 30 {emit {\(unknown\)}} 42 {emit {\(equation\)}} 
-}
-if {[S 0 == **TI89**]} {emit {TI-89 Graphing Calculator}
-switch -- [Nv c 72] 0 {emit {\(expression\)}} 4 {emit {\(list\)}} 6 {emit {\(matrix\)}} 10 {emit {\(data\)}} 11 {emit {\(text\)}} 12 {emit {\(string\)}} 13 {emit {\(graphic data base\)}} 14 {emit {\(figure\)}} 16 {emit {\(picture\)}} 18 {emit {\(program\)}} 19 {emit {\(function\)}} 20 {emit {\(macro\)}} 28 {emit {\(zipped\)}} 33 {emit {\(assembler\)}} 
-}
-if {[S 0 == **TI92**]} {emit {TI-92 Graphing Calculator}
-switch -- [Nv c 72] 0 {emit {\(expression\)}} 4 {emit {\(list\)}} 6 {emit {\(matrix\)}} 10 {emit {\(data\)}} 11 {emit {\(text\)}} 12 {emit {\(string\)}} 13 {emit {\(graphic data base\)}} 14 {emit {\(figure\)}} 16 {emit {\(picture\)}} 18 {emit {\(program\)}} 19 {emit {\(function\)}} 20 {emit {\(macro\)}} 29 {emit {\(backup\)}} 
-}
-if {[S 0 == **TI92P*]} {emit {TI-92+/V200 Graphing Calculator}
-switch -- [Nv c 72] 0 {emit {\(expression\)}} 4 {emit {\(list\)}} 6 {emit {\(matrix\)}} 10 {emit {\(data\)}} 11 {emit {\(text\)}} 12 {emit {\(string\)}} 13 {emit {\(graphic data base\)}} 14 {emit {\(figure\)}} 16 {emit {\(picture\)}} 18 {emit {\(program\)}} 19 {emit {\(function\)}} 20 {emit {\(macro\)}} 28 {emit {\(zipped\)}} 33 {emit {\(assembler\)}} 
-}
-if {[S 22 == Advanced]} {emit {TI-XX Graphing Calculator \(FLASH\)}}
-if {[S 0 == **TIFL**]} {emit {TI-XX Graphing Calculator \(FLASH\)}
-if {[N c 8 > 0x0]} {emit {- Revision %d}
-if {[N c 9 x {}]} {emit {\b.%d,}}
-}
-if {[N c 12 > 0x0]} {emit {Revision date %02x}
-if {[N c 13 x {}]} {emit {\b/%02x}}
-if {[N S 14 x {}]} {emit {\b/%04x,}}
-}
-if {[S 17 > /0]} {emit {name: '%s',}}
-switch -- [Nv c 48] 116 {emit {device: TI-73,}} 115 {emit {device: TI-83+,}} -104 {emit {device: TI-89,}} -120 {emit {device: TI-92+,}} 
-switch -- [Nv c 49] 35 {emit {type: OS upgrade,}} 36 {emit {type: application,}} 37 {emit {type: certificate,}} 62 {emit {type: license,}} 
-if {[N i 74 > 0x0]} {emit {size: %ld bytes}}
-}
-if {[S 0 == VTI]} {emit {Virtual TI skin}
-if {[S 3 == v]} {emit {- Version}
-if {[N c 4 > 0x0]} {emit {\b %c}}
-if {[N c 6 x {}]} {emit {\b.%c}}
-}
-}
-if {[S 0 == TiEmu]} {emit {TiEmu skin}
-if {[S 6 == v]} {emit {- Version}
-if {[N c 7 > 0x0]} {emit {\b %c}}
-if {[N c 9 x {}]} {emit {\b.%c}}
-if {[N c 10 x {}]} {emit {\b%c}}
-}
-}
-if {[S 0 == TZif]} {emit {timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0}]} {emit {old timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0}]} {emit {old timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0}]} {emit {old timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0}]} {emit {old timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0}]} {emit {old timezone data}}
-if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0}]} {emit {old timezone data}}
-if {[S 0 == {.\\\"}]} {emit {troff or preprocessor input text}}
-if {[S 0 == {'\\\"}]} {emit {troff or preprocessor input text}}
-if {[S 0 == {'.\\\"}]} {emit {troff or preprocessor input text}}
-if {[S 0 == {\\\"}]} {emit {troff or preprocessor input text}}
-if {[S 0 == ''']} {emit {troff or preprocessor input text}}
-if {[S 0 == {x\ T}]} {emit {ditroff output text}
-if {[S 4 == cat]} {emit {for the C/A/T phototypesetter}}
-if {[S 4 == ps]} {emit {for PostScript}}
-if {[S 4 == dvi]} {emit {for DVI}}
-if {[S 4 == ascii]} {emit {for ASCII}}
-if {[S 4 == lj4]} {emit {for LaserJet 4}}
-if {[S 4 == latin1]} {emit {for ISO 8859-1 \(Latin 1\)}}
-if {[S 4 == X75]} {emit {for xditview at 75dpi}
-if {[S 7 == -12]} {emit {\(12pt\)}}
-}
-if {[S 4 == X100]} {emit {for xditview at 100dpi}
-if {[S 8 == -12]} {emit {\(12pt\)}}
-}
-}
-if {[S 0 == {\100\357}]} {emit {very old \(C/A/T\) troff output data}}
-if {[S 0 == {\0\0\1\236\0\0\0\0\0\0\0\0\0\0\0\0}]} {emit {BEA TUXEDO DES mask data}}
-if {[S 0 == Interpress/Xerox]} {emit {Xerox InterPress data}
-if {[S 16 == /]} {emit {\(version}
-if {[S 17 x {}]} {emit {%s\)}}
-}
-}
-if {[S 0 == {begin\040}]} {emit {uuencoded or xxencoded text}}
-if {[S 0 == {xbtoa\ Begin}]} {emit {btoa'd text}}
-if {[S 0 == {$\012ship}]} {emit {ship'd binary text}}
-if {[S 0 == {Decode\ the\ following\ with\ bdeco}]} {emit {bencoded News text}}
-if {[S 11 == {must\ be\ converted\ with\ BinHex}]} {emit {BinHex binary text}
-if {[S 41 x {}]} {emit {\b, version %.3s}}
-}
-if {[N S 6 == 0x107]} {emit {unicos \(cray\) executable}}
-if {[S 596 == {\130\337\377\377}]} {emit {Ultrix core file}
-if {[S 600 x {}]} {emit {from '%s'}}
-}
-if {[S 0 == Joy!peffpwpc]} {emit {header for PowerPC PEF executable}}
-if {[S 0 == avaobj]} {emit {AVR assembler object code}
-if {[S 7 x {}]} {emit {version '%s'}}
-}
-if {[S 0 == gmon]} {emit {GNU prof performance data}
-if {[N Q 4 x {}]} {emit {- version %ld}}
-}
-if {[S 0 == {\xc0HRB}]} {emit {Harbour HRB file}
-if {[N Y 4 x {}]} {emit {version %d}}
-}
-if {[S 0 == {\#!\ /}]} {emit a
-if {[S 3 x {}]} {emit {%s script text executable}}
-}
-if {[S 0 == {\#!\	/}]} {emit a
-if {[S 3 x {}]} {emit {%s script text executable}}
-}
-if {[S 0 == {\#!/}]} {emit a
-if {[S 2 x {}]} {emit {%s script text executable}}
-}
-if {[S 0 == {\#!\ }]} {emit {script text executable}
-if {[S 3 x {}]} {emit {for %s}}
-}
-if {[S 0 == LBLSIZE=]} {emit {VICAR image data}
-if {[S 32 == BYTE]} {emit {\b, 8 bits  = VAX byte}}
-if {[S 32 == HALF]} {emit {\b, 16 bits = VAX word     = Fortran INTEGER*2}}
-if {[S 32 == FULL]} {emit {\b, 32 bits = VAX longword = Fortran INTEGER*4}}
-if {[S 32 == REAL]} {emit {\b, 32 bits = VAX longword = Fortran REAL*4}}
-if {[S 32 == DOUB]} {emit {\b, 64 bits = VAX quadword = Fortran REAL*8}}
-if {[S 32 == COMPLEX]} {emit {\b, 64 bits = VAX quadword = Fortran COMPLEX*8}}
-}
-if {[S 43 == SFDU_LABEL]} {emit {VICAR label file}}
-if {[S 0 == {\211\277\036\203}]} {emit {Virtutech CRAFF}
-if {[N I 4 x {}]} {emit v%d}
-switch -- [Nv I 20] 0 {emit uncompressed} 1 {emit bzipp2ed} 2 {emit gzipped} 
-if {[N I 24 == 0x0]} {emit {not clean}}
-}
-if {[S 0 == {\xb0\0\x30\0}]} {emit {VMS VAX executable}
-if {[S 44032 == {PK\003\004}]} {emit {\b, Info-ZIP SFX archive v5.12 w/decryption}}
-}
-if {[S 0 == OggS]} {emit {Ogg data}
-if {[N c 4 != 0x0]} {emit {UNKNOWN REVISION %u}}
-if {[N c 4 == 0x0]} {if {[S 28 == fLaC]} {emit {\b, FLAC audio}}
-if {[S 28 == {\x80theora}]} {emit {\b, Theora video}}
-if {[S 28 == {Speex\ \ \ }]} {emit {\b, Speex audio}}
-if {[S 28 == {\x01video\0\0\0}]} {emit {\b, OGM video}
-if {[S 37 == div3 c]} {emit {\(DivX 3\)}}
-if {[S 37 == divx c]} {emit {\(DivX 4\)}}
-if {[S 37 == dx50 c]} {emit {\(DivX 5\)}}
-if {[S 37 == xvid c]} {emit {\(XviD\)}}
-}
-if {[S 28 == {\x01vorbis}]} {emit {\b, Vorbis audio,}
-if {[N i 35 != 0x0]} {emit {UNKNOWN VERSION %lu,}}
-if {[N i 35 == 0x0]} {switch -- [Nv c 39] 1 {emit mono,} 2 {emit stereo,} 
-if {[N c 39 > 0x2]} {emit {%u channels,}}
-if {[N i 40 x {}]} {emit {%lu Hz}}
-if {[S 48 < {\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff}]} {emit {\b,}
-if {[N i 52 != 0xffffffff]} {if {[N i 52 != 0x0]} {if {[N i 52 != 0xfffffc18]} {if {[N i 52 x {}]} {emit <%lu}
-}
-}
-}
-if {[N i 48 != 0xffffffff]} {if {[N i 48 x {}]} {emit ~%lu}
-}
-if {[N i 44 != 0xffffffff]} {if {[N i 44 != 0xfffffc18]} {if {[N i 44 != 0x0]} {if {[N i 44 x {}]} {emit >%lu}
-}
-}
-}
-if {[S 48 < {\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff}]} {emit bps}
-}
-}
-if {[S [I 84 c 85] == {\x03vorbis}]} {if {[S [I 84 c 96] == {Xiphophorus\ libVorbis\ I} c]} {emit {\b, created by: Xiphophorus libVorbis I}
-if {[S [I 84 c 120] > 00000000]} {if {[S [I 84 c 120] < 20000508]} {emit {\(<beta1, prepublic\)}}
-if {[S [I 84 c 120] == 20000508]} {emit {\(1.0 beta 1 or beta 2\)}}
-if {[S [I 84 c 120] > 20000508]} {if {[S [I 84 c 120] < 20001031]} {emit {\(beta2-3\)}}
-}
-if {[S [I 84 c 120] == 20001031]} {emit {\(1.0 beta 3\)}}
-if {[S [I 84 c 120] > 20001031]} {if {[S [I 84 c 120] < 20010225]} {emit {\(beta3-4\)}}
-}
-if {[S [I 84 c 120] == 20010225]} {emit {\(1.0 beta 4\)}}
-if {[S [I 84 c 120] > 20010225]} {if {[S [I 84 c 120] < 20010615]} {emit {\(beta4-RC1\)}}
-}
-if {[S [I 84 c 120] == 20010615]} {emit {\(1.0 RC1\)}}
-if {[S [I 84 c 120] == 20010813]} {emit {\(1.0 RC2\)}}
-if {[S [I 84 c 120] == 20010816]} {emit {\(RC2 - Garf tuned v1\)}}
-if {[S [I 84 c 120] == 20011014]} {emit {\(RC2 - Garf tuned v2\)}}
-if {[S [I 84 c 120] == 20011217]} {emit {\(1.0 RC3\)}}
-if {[S [I 84 c 120] == 20011231]} {emit {\(1.0 RC3\)}}
-if {[S [I 84 c 120] > 20011231]} {emit {\(pre-1.0 CVS\)}}
-}
-}
-if {[S [I 84 c 96] == {Xiph.Org\ libVorbis\ I} c]} {emit {\b, created by: Xiph.Org libVorbis I}
-if {[S [I 84 c 117] > 00000000]} {if {[S [I 84 c 117] < 20020717]} {emit {\(pre-1.0 CVS\)}}
-if {[S [I 84 c 117] == 20020717]} {emit {\(1.0\)}}
-if {[S [I 84 c 117] == 20030909]} {emit {\(1.0.1\)}}
-if {[S [I 84 c 117] == 20040629]} {emit {\(1.1.0 RC1\)}}
-}
-}
-}
-}
-}
-}
-if {[N i 2 == 0x472b2c4e]} {emit {VXL data file,}
-if {[N s 0 > 0x0]} {emit {schema version no %d}}
-}
-if {[S 2 == {\040\040\040\040\040\040\040\040\040\040\040ML4D\040\'92}]} {emit {Smith Corona PWP}
-switch -- [Nv c 24] 2 {emit {\b, single spaced}} 3 {emit {\b, 1.5 spaced}} 4 {emit {\b, double spaced}} 
-switch -- [Nv c 25] 66 {emit {\b, letter}} 84 {emit {\b, legal}} 
-if {[N c 26 == 0x46]} {emit {\b, A4}}
-}
-if {[S 0 == {\377WPC\020\000\000\000\022\012\001\001\000\000\000\000}]} {emit {\(WP\) loadable text}
-switch -- [Nv c 15] 0 {emit {Optimized for Intel}} 1 {emit {Optimized for Non-Intel}} 
-}
-if {[S 1 == WPC]} {emit {\(Corel/WP\)}
-switch -- [Nv Y 8] 257 {emit {WordPerfect macro}} 258 {emit {WordPerfect help file}} 259 {emit {WordPerfect keyboard file}} 266 {emit {WordPerfect document}} 267 {emit {WordPerfect dictionary}} 268 {emit {WordPerfect thesaurus}} 269 {emit {WordPerfect block}} 270 {emit {WordPerfect rectangular block}} 271 {emit {WordPerfect column block}} 272 {emit {WordPerfect printer data}} 275 {emit {WordPerfect printer data}} 276 {emit {WordPerfect driver resource data}} 279 {emit {WordPerfect hyphenation code}} 280 {emit {WordPerfect hyphenation data}} 281 {emit {WordPerfect macro resource data}} 283 {emit {WordPerfect hyphenation lex}} 285 {emit {WordPerfect wordlist}} 286 {emit {WordPerfect equation resource data}} 289 {emit {WordPerfect spell rules}} 290 {emit {WordPerfect dictionary rules}} 295 {emit {WordPerfect spell rules \(Microlytics\)}} 299 {emit {WordPerfect settings file}} 301 {emit {WordPerfect 4.2 document}} 325 {emit {WordPerfect dialog file}} 332 {emit {WordPerfect button bar}} 513 {emit {Shell macro}} 522 {emit {Shell definition}} 769 {emit {Notebook macro}} 770 {emit {Notebook help file}} 771 {emit {Notebook keyboard file}} 778 {emit {Notebook definition}} 1026 {emit {Calculator help file}} 1538 {emit {Calendar help file}} 1546 {emit {Calendar data file}} 1793 {emit {Editor macro}} 1794 {emit {Editor help file}} 1795 {emit {Editor keyboard file}} 1817 {emit {Editor macro resource file}} 2049 {emit {Macro editor macro}} 2050 {emit {Macro editor help file}} 2051 {emit {Macro editor keyboard file}} 2305 {emit {PlanPerfect macro}} 2306 {emit {PlanPerfect help file}} 2307 {emit {PlanPerfect keyboard file}} 2314 {emit {PlanPerfect worksheet}} 2319 {emit {PlanPerfect printer definition}} 2322 {emit {PlanPerfect graphic definition}} 2323 {emit {PlanPerfect data}} 2324 {emit {PlanPerfect temporary printer}} 2329 {emit {PlanPerfect macro resource data}} 2818 {emit {help file}} 2821 {emit {distribution list}} 2826 {emit {out box}} 2827 {emit {in box}} 2836 {emit {users archived mailbox}} 2837 {emit {archived message database}} 2838 {emit {archived attachments}} 3083 {emit {Printer temporary file}} 3330 {emit {Scheduler help file}} 3338 {emit {Scheduler in file}} 3339 {emit {Scheduler out file}} 3594 {emit {GroupWise settings file}} 3601 {emit {GroupWise directory services}} 3627 {emit {GroupWise settings file}} 4362 {emit {Terminal resource data}} 4363 {emit {Terminal resource data}} 4395 {emit {Terminal resource data}} 4619 {emit {GUI loadable text}} 4620 {emit {graphics resource data}} 4621 {emit {printer settings file}} 4622 {emit {port definition file}} 4623 {emit {print queue parameters}} 4624 {emit {compressed file}} 5130 {emit {Network service msg file}} 5131 {emit {Network service msg file}} 5132 {emit {Async gateway login msg}} 5134 {emit {GroupWise message file}} 7956 {emit {GroupWise admin domain database}} 7957 {emit {GroupWise admin host database}} 7959 {emit {GroupWise admin remote host database}} 7960 {emit {GroupWise admin ADS deferment data file}} 8458 {emit {IntelliTAG \(SGML\) compiled DTD}} 
-if {[N c 8 == 0xb]} {emit Mail}
-switch -- [Nv Q 8] 18219264 {emit {WordPerfect graphic image \(1.0\)}} 18219520 {emit {WordPerfect graphic image \(2.0\)}} 
-}
-if {[S 0 == {HWP\ Document\ File}]} {emit {Hangul \(Korean\) Word Processor File}}
-if {[S 0 == CSBK]} {emit {Ted Neslson's CosmicBook hypertext file}}
-if {[S 0 == %XDELTA%]} {emit {XDelta binary patch file 0.14}}
-if {[S 0 == %XDZ000%]} {emit {XDelta binary patch file 0.18}}
-if {[S 0 == %XDZ001%]} {emit {XDelta binary patch file 0.20}}
-if {[S 0 == %XDZ002%]} {emit {XDelta binary patch file 1.0}}
-if {[S 0 == %XDZ003%]} {emit {XDelta binary patch file 1.0.4}}
-if {[S 0 == %XDZ004%]} {emit {XDelta binary patch file 1.1}}
-if {[S 0 == core]} {emit {core file \(Xenix\)}}
-if {[S 0 == {\x55\x7A\x6E\x61}]} {emit {xo65 object,}
-if {[N s 4 x {}]} {emit {version %d,}}
-switch -- [Nv s 6 &0x0001] 1 {emit {with debug info}} 0 {emit {no debug info}} 
-}
-if {[S 0 == {\x6E\x61\x55\x7A}]} {emit {xo65 library,}
-if {[N s 4 x {}]} {emit {version %d}}
-}
-if {[S 0 == {\x01\x00\x6F\x36\x35}]} {emit o65
-switch -- [Nv s 6 &0x1000] 0 {emit executable,} 4096 {emit object,} 
-if {[N c 5 x {}]} {emit {version %d,}}
-switch -- [Nv s 6 &0x8000] -32768 {emit 65816,} 0 {emit 6502,} 
-switch -- [Nv s 6 &0x2000] 8192 {emit {32 bit,}} 0 {emit {16 bit,}} 
-switch -- [Nv s 6 &0x4000] 16384 {emit {page reloc,}} 0 {emit {byte reloc,}} 
-switch -- [Nv s 6 &0x0003] 0 {emit {alignment 1}} 1 {emit {alignment 2}} 2 {emit {alignment 4}} 3 {emit {alignment 256}} 
-}
-if {[S 1 == mkx]} {emit {Compiled XKB Keymap: lsb,}
-if {[N c 0 > 0x0]} {emit {version %d}}
-if {[N c 0 == 0x0]} {emit obsolete}
-}
-if {[S 0 == xkm]} {emit {Compiled XKB Keymap: msb,}
-if {[N c 3 > 0x0]} {emit {version %d}}
-if {[N c 0 == 0x0]} {emit obsolete}
-}
-if {[S 0 == xFSdump0]} {emit {xfsdump archive}
-if {[N Q 8 x {}]} {emit {\(version %d\)}}
-}
-if {[S 0 == {ZyXEL\002}]} {emit {ZyXEL voice data}
-if {[N c 10 == 0x0]} {emit {- CELP encoding}}
-switch -- [Nv c 10 &0x0B] 1 {emit {- ADPCM2 encoding}} 2 {emit {- ADPCM3 encoding}} 3 {emit {- ADPCM4 encoding}} 8 {emit {- New ADPCM3 encoding}} 
-if {[N c 10 == 0x4 &0x04]} {emit {with resync}}
-}
-
-result
-
-return {}
-}
-
-## -- ** END GENERATED CODE ** --
-## -- Do not edit before this line !
-##
-
-# ### ### ### ######### ######### #########
-## Ready for use.
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/mimetypes.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/mimetypes.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,583 +1,0 @@
-# mimetypes.tcl --
-#
-#	Tcl based file type recognizer using the runtime core and
-#	generated from /usr/share/misc/magic.mime. Limited output,
-#	but only mime-types, i.e. standardized.
-#
-# Copyright (c) 2004-2005 Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005-2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: mimetypes.tcl,v 1.8 2006/09/27 21:19:35 andreas_kupries Exp $
-
-#####
-#
-# "mime type discriminator"
-# http://wiki.tcl.tk/12537
-#
-# Tcl code harvested on:  10 Feb 2005, 04:16 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# ### ### ### ######### ######### #########
-## Requirements.
-
-package require Tcl 8.4
-package require fileutil::magic::rt    ; # We need the runtime core.
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::fileutil::magic {}
-
-proc ::fileutil::magic::mimetype {file} {
-    if {![file exists $file]} {
-        return -code error "file not found: \"$file\""
-    }
-    if {[file isdirectory $file]} {
-	return application/x-directory
-    }
-
-    rt::open $file
-    mimetype::run
-    rt::close
-    set types [rt::resultv]
-
-    if {[llength $types]} {
-	# We postprocess the data if needed, as the low-level
-	# recognizer can return duplicate information.
-
-	array set _ {}
-	set utypes  {}
-	foreach t $types {
-	    if {[info exists _($t)]} continue
-	    lappend utypes $t
-	    set _($t) .
-	    set types $utypes
-	}
-    }
-    return $types
-}
-
-package provide fileutil::magic::mimetype 1.0.2
-# The actual recognizer is the command below.
-
-##
-## -- Do not edit after this line !
-## -- ** BEGIN GENERATED CODE ** --
-
-package require fileutil::magic::rt
-namespace eval ::fileutil::magic::mimetype {
-    namespace import ::fileutil::magic::rt::*
-}
-
-proc ::fileutil::magic::mimetype::run {} {
-    switch -- [Nv s 0 ] 1538 {emit application/x-alan-adventure-game} 387 {emit application/x-executable-file} -147 {emit application/data} -155 {emit application/data} -5536 {emit application/x-arj} -138 {emit application/data} -394 {emit application/data} -650 {emit application/x-lzh} 387 {emit application/x-executable-file} 392 {emit application/x-executable-file} 399 {emit application/x-object-file} -13230 {emit {RLE image data,}} 322 {emit {basic-16 executable}} 323 {emit {basic-16 executable \(TV\)}} 328 {emit application/x-executable-file} 329 {emit application/x-executable-file} 330 {emit application/x-executable-file} 338 {emit application/x-executable-file} 332 {emit application/x-executable-file} 1078 {emit font/linux-psf} 387 {emit {ECOFF alpha}} 332 {emit {MS Windows COFF Intel 80386 object file}} 358 {emit {MS Windows COFF MIPS R4000 object file}} 388 {emit {MS Windows COFF Alpha object file}} 616 {emit {MS Windows COFF Motorola 68000 object file}} 496 {emit {MS Windows COFF PowerPC object file}} 656 {emit {MS Windows COFF PA-RISC object file}} 263 {emit {PDP-11 executable}} 257 {emit {PDP-11 UNIX/RT ldp}} 261 {emit {PDP-11 old overlay}} 264 {emit {PDP-11 pure executable}} 265 {emit {PDP-11 separate I&D executable}} 287 {emit {PDP-11 kernel overlay}} 4843 {emit {SYMMETRY i386 .o}} 8939 {emit {SYMMETRY i386 executable \(0 @ 0\)}} 13035 {emit {SYMMETRY i386 executable \(invalid @ 0\)}} 17131 {emit {SYMMETRY i386 standalone executable}} 376 {emit {VAX COFF executable}} 381 {emit {VAX COFF pure executable}} -155 {emit x.out} 518 {emit {Microsoft a.out}} 320 {emit {old Microsoft 8086 x.out}} 1408 {emit {XENIX 8086 relocatable or 80286 small model}}
-    if {[S 0 == TADS ]} {emit application/x-tads-game}
-    switch -- [Nv S 0 ] 272 {emit application/x-executable-file} 273 {emit application/x-executable-file} 29127 {emit application/x-cpio} -14479 {emit application/x-bcpio} -147 {emit application/data} -155 {emit application/data} 368 {emit application/x-executable-file} 369 {emit application/x-executable-file} 1793 {emit application/x-executable-file} 262 {emit application/x-executable-file} 1537 {emit application/x-executable-file} 381 {emit application/x-executable-file} 383 {emit application/x-executable-file} 7967 {emit application/data} 8191 {emit application/data} -13563 {emit application/data} 1281 {emit application/x-locale} 340 {emit application/data} 341 {emit application/x-executable-file} 286 {emit font/x-vfont} 7681 {emit font/x-vfont} 407 {emit application/x-executable-file} 404 {emit application/x-executable-file} 200 {emit {hp200 \(68010\) BSD}} 300 {emit {hp300 \(68020+68881\) BSD}} 351 {emit {370 XA sysV executable}} 346 {emit {370 XA sysV pure executable}} 22529 {emit {370 sysV pure executable}} 23041 {emit {370 XA sysV pure executable}} 23809 {emit {370 sysV executable}} 24321 {emit {370 XA sysV executable}} 345 {emit {SVR2 executable \(Amdahl-UTS\)}} 348 {emit {SVR2 pure executable \(Amdahl-UTS\)}} 344 {emit {SVR2 pure executable \(USS/370\)}} 349 {emit {SVR2 executable \(USS/370\)}} 479 {emit {executable \(RISC System/6000 V3.1\) or obj module}} 260 {emit {shared library}} 261 {emit {ctab data}} -508 {emit {structured file}} 12320 {emit {character Computer Graphics Metafile}} -40 {emit image/jpeg} 474 {emit x/x-image-sgi} 4112 {emit {PEX Binary Archive}} -21267 {emit {Java serialization data}} -32768 {emit {lif file}} 256 {emit {raw G3 data, byte-padded}} 5120 {emit {raw G3 data}} 336 {emit {mc68k COFF}} 337 {emit {mc68k executable \(shared\)}} 338 {emit {mc68k executable \(shared demand paged\)}} 364 {emit {68K BCS executable}} 365 {emit {88K BCS executable}} 392 {emit {Tower/XP rel 2 object}} 397 {emit {Tower/XP rel 2 object}} 400 {emit {Tower/XP rel 3 object}} 405 {emit {Tower/XP rel 3 object}} 408 {emit {Tower32/600/400 68020 object}} 416 {emit {Tower32/800 68020}} 421 {emit {Tower32/800 68010}} -30771 {emit {OS9/6809 module:}} 19196 {emit {OS9/68K module:}} 373 {emit {i386 COFF object}} 10775 {emit {\"compact bitmap\" format \(Poskanzer\)}} -26368 {emit {PGP key public ring}} -27391 {emit {PGP key security ring}} -27392 {emit {PGP key security ring}} -23040 {emit {PGP encrypted data}} 601 {emit {mumps avl global}} 602 {emit {mumps blt global}} -4693 {emit {}} 10012 {emit {Sendmail frozen configuration}} -30875 {emit {disk quotas file}} 1286 {emit {IRIS Showcase file}} 550 {emit {IRIS Showcase template}} 352 {emit {MIPSEB COFF executable}} 354 {emit {MIPSEL COFF executable}} 24577 {emit {MIPSEB-LE COFF executable}} 25089 {emit {MIPSEL-LE COFF executable}} 355 {emit {MIPSEB MIPS-II COFF executable}} 358 {emit {MIPSEL MIPS-II COFF executable}} 25345 {emit {MIPSEB-LE MIPS-II COFF executable}} 26113 {emit {MIPSEL-LE MIPS-II COFF executable}} 320 {emit {MIPSEB MIPS-III COFF executable}} 322 {emit {MIPSEL MIPS-III COFF executable}} 16385 {emit {MIPSEB-LE MIPS-III COFF executable}} 16897 {emit {MIPSEL-LE MIPS-III COFF executable}} 384 {emit {MIPSEB Ucode}} 386 {emit {MIPSEL Ucode}} -16162 {emit {Compiled PSI \(v1\) data}} -16166 {emit {Compiled PSI \(v2\) data}} -21846 {emit {SoftQuad DESC or font file binary}} 283 {emit {Curses screen image}} 284 {emit {Curses screen image}} 263 {emit {unknown machine executable}} 264 {emit {unknown pure executable}} 265 {emit {PDP-11 separate I&D}} 267 {emit {unknown pure executable}} 392 {emit {Perkin-Elmer executable}} 378 {emit {amd 29k coff noprebar executable}} 890 {emit {amd 29k coff prebar executable}} -8185 {emit {amd 29k coff archive}} 21845 {emit {VISX image file}}
-    if {[S 0 == {Core\001} ]} {emit application/x-executable-file}
-    if {[S 0 == {AMANDA:\ TAPESTART\ DATE} ]} {emit application/x-amanda-header}
-    switch -- [Nv I 0 ] 1011 {emit application/x-executable-file} 999 {emit application/x-library-file} 435 {emit video/mpeg} 442 {emit video/mpeg} 33132 {emit application/x-apl-workspace} 333312 {emit application/data} 333319 {emit application/data} 65389 {emit application/x-ar} 65381 {emit application/data} 33132 {emit application/x-apl-workspace} 1711210496 {emit application/x-ar} 1013019198 {emit application/x-ar} 557605234 {emit application/x-ar} 1314148939 {emit audio/x-multitrack} 779248125 {emit audio/x-pn-realaudio} 262 {emit application/x-executable-file} 327 {emit application/x-object-file} 331 {emit application/x-executable-file} 333 {emit application/x-executable-file} 335 {emit application/x-executable-file} 70231 {emit application/core} 385 {emit application/x-object-file} 391 {emit application/data} 324508366 {emit application/x-gdbm} 398689 {emit application/x-db} 340322 {emit application/x-db} 1234567 {emit image/x11} 4 {emit font/x-snf} 335698201 {emit font/x-libgrx} -12169394 {emit font/x-dos} 168757262 {emit application/data} 252317192 {emit application/data} 135137807 {emit application/data} 235409162 {emit application/data} 34603270 {emit application/x-object-file} 34603271 {emit application/x-executable-file} 34603272 {emit application/x-executable-file} 34603275 {emit application/x-executable-file} 34603278 {emit application/x-library-file} 34603277 {emit application/x-library-file} 34865414 {emit application/x-object-file} 34865415 {emit application/x-executable-file} 34865416 {emit application/x-executable-file} 34865419 {emit application/x-executable-file} 34865422 {emit application/x-library-file} 34865421 {emit application/x-object-file} 34275590 {emit application/x-object-file} 34275591 {emit application/x-executable-file} 34275592 {emit application/x-executable-file} 34275595 {emit application/x-executable-file} 34275598 {emit application/x-library-file} 34275597 {emit application/x-library-file} 557605234 {emit application/x-ar} 34078982 {emit application/x-executable-file} 34078983 {emit application/x-executable-file} 34078984 {emit application/x-executable-file} 34341128 {emit application/x-executable-file} 34341127 {emit application/x-executable-file} 34341131 {emit application/x-executable-file} 34341126 {emit application/x-executable-file} 34210056 {emit application/x-executable-file} 34210055 {emit application/x-executable-file} 34341134 {emit application/x-library-file} 34341133 {emit application/x-library-file} 65381 {emit application/x-library-file} 34275173 {emit application/x-library-file} 34406245 {emit application/x-library-file} 34144101 {emit application/x-library-file} 22552998 {emit application/core} 1302851304 {emit font/x-hp-windows} 34341132 {emit application/x-lisp} 505 {emit {AIX compiled message catalog}} 1123028772 {emit {Artisan image data}} 1504078485 {emit x/x-image-sun-raster} -889275714 {emit {compiled Java class data,}} -1195374706 {emit {Linux kernel}} 1886817234 {emit {CLISP memory image data}} -762612112 {emit {CLISP memory image data, other endian}} -569244523 {emit {GNU-format message catalog data}} -1794895138 {emit {GNU-format message catalog data}} -889275714 {emit {mach-o fat file}} -17958194 {emit mach-o} 31415 {emit {Mirage Assembler m.out executable}} 834535424 {emit text/vnd.ms-word} 6656 {emit {Lotus 1-2-3}} 512 {emit {Lotus 1-2-3}} 263 {emit {NetBSD big-endian object file}} 326773060 {emit font/x-sunos-news} 326773063 {emit font/x-sunos-news} 326773072 {emit font/x-sunos-news} 326773073 {emit font/x-sunos-news} 61374 {emit {OSF/Rose object}} -976170042 {emit {DOS EPS Binary File}} 1351614727 {emit {Pyramid 90x family executable}} 1351614728 {emit {Pyramid 90x family pure executable}} 1351614731 {emit {Pyramid 90x family demand paged pure executable}} 263 {emit {old SGI 68020 executable}} 264 {emit {old SGI 68020 pure executable}} 1396917837 {emit {IRIS Showcase file}} 1413695053 {emit {IRIS Showcase template}} -559039810 {emit {IRIX Parallel Arena}} -559043152 {emit {IRIX core dump}} -559043264 {emit {IRIX 64-bit core dump}} -1161903941 {emit {IRIX N32 core dump}} -1582119980 {emit {tcpdump capture file \(big-endian\)}} 263 {emit {old sun-2 executable}} 264 {emit {old sun-2 pure executable}} 267 {emit {old sun-2 demand paged executable}} 525398 {emit {SunOS core file}} -97271666 {emit {SunPC 4.0 Hard Disk}} 268 {emit {unknown demand paged pure executable}} 269 {emit {unknown demand paged pure executable}} 270 {emit {unknown readable demand paged pure executable}} 50331648 {emit {VMS Alpha executable}} 59399 {emit {object file \(z8000 a.out\)}} 59400 {emit {pure object file \(z8000 a.out\)}} 59401 {emit {separate object file \(z8000 a.out\)}} 59397 {emit {overlay object file \(z8000 a.out\)}}
-    if {[N S 0 == 0xfff0 &0xfff0]} {emit audio/mpeg}
-    switch -- [Nv s 4 ] -20719 {emit video/fli} -20718 {emit video/flc}
-    if {[S 8 == {AVI\	} ]} {emit video/x-msvideo}
-    if {[S 0 == MOVI ]} {emit video/x-sgi-movie}
-    if {[S 4 == moov ]} {emit video/quicktime}
-    if {[S 4 == mdat ]} {emit video/quicktime}
-    if {[S 0 == FiLeStArTfIlEsTaRt ]} {emit text/x-apple-binscii}
-    if {[S 0 == {\x0aGL} ]} {emit application/data}
-    if {[S 0 == {\x76\xff} ]} {emit application/data}
-    if {[S 0 == NuFile ]} {emit application/data}
-    if {[S 0 == {N\xf5F\xe9l\xe5} ]} {emit application/data}
-    if {[S 257 == {ustar\0} ]} {emit application/x-tar}
-    if {[S 257 == {ustar\040\040\0} ]} {emit application/x-gtar}
-    if {[S 0 == 070707 ]} {emit application/x-cpio}
-    if {[S 0 == 070701 ]} {emit application/x-cpio}
-    if {[S 0 == 070702 ]} {emit application/x-cpio}
-    if {[S 0 == {!<arch>\ndebian} ]} {emit application/x-dpkg}
-    if {[S 0 == <ar> ]} {emit application/x-ar}
-    if {[S 0 == {!<arch>\n__________E} ]} {emit application/x-ar}
-    if {[S 0 == -h- ]} {emit application/data}
-    if {[S 0 == !<arch> ]} {emit application/x-ar}
-    if {[S 0 == <ar> ]} {emit application/x-ar}
-    if {[S 0 == <ar> ]} {emit application/x-ar}
-    switch -- [Nv i 0 ] 65389 {emit application/data} 65381 {emit application/data} 236525 {emit application/data} 236526 {emit application/data} 6583086 {emit audio/basic} 204 {emit application/x-executable-file} 324508366 {emit application/x-gdbm} 453186358 {emit application/x-bootable} 4 {emit font/x-snf} 1279543401 {emit application/data} 6553863 {emit {Linux/i386 impure executable \(OMAGIC\)}} 6553864 {emit {Linux/i386 pure executable \(NMAGIC\)}} 6553867 {emit {Linux/i386 demand-paged executable \(ZMAGIC\)}} 6553804 {emit {Linux/i386 demand-paged executable \(QMAGIC\)}} 263 {emit {NetBSD little-endian object file}} 459141 {emit {ECOFF NetBSD/alpha binary}} 33645 {emit {PDP-11 single precision APL workspace}} 33644 {emit {PDP-11 double precision APL workspace}} 234 {emit {BALANCE NS32000 .o}} 4330 {emit {BALANCE NS32000 executable \(0 @ 0\)}} 8426 {emit {BALANCE NS32000 executable \(invalid @ 0\)}} 12522 {emit {BALANCE NS32000 standalone executable}} -1582119980 {emit {tcpdump capture file \(little-endian\)}} 33647 {emit {VAX single precision APL workspace}} 33646 {emit {VAX double precision APL workspace}} 263 {emit {VAX executable}} 264 {emit {VAX pure executable}} 267 {emit {VAX demand paged pure executable}} 518 {emit b.out}
-    switch -- [Nv i 0 &0x8080ffff] 2074 {emit application/x-arc} 2330 {emit application/x-arc} 538 {emit application/x-arc} 794 {emit application/x-arc} 1050 {emit application/x-arc} 1562 {emit application/x-arc}
-    if {[S 0 == {\032archive} ]} {emit application/data}
-    if {[S 0 == HPAK ]} {emit application/data}
-    if {[S 0 == {\351,\001JAM\	} ]} {emit application/data}
-    if {[S 2 == -lh0- ]} {emit application/x-lha}
-    if {[S 2 == -lh1- ]} {emit application/x-lha}
-    if {[S 2 == -lz4- ]} {emit application/x-lha}
-    if {[S 2 == -lz5- ]} {emit application/x-lha}
-    if {[S 2 == -lzs- ]} {emit application/x-lha}
-    if {[S 2 == {-lh\40-} ]} {emit application/x-lha}
-    if {[S 2 == -lhd- ]} {emit application/x-lha}
-    if {[S 2 == -lh2- ]} {emit application/x-lha}
-    if {[S 2 == -lh3- ]} {emit application/x-lha}
-    if {[S 2 == -lh4- ]} {emit application/x-lha}
-    if {[S 2 == -lh5- ]} {emit application/x-lha}
-    if {[S 0 == Rar! ]} {emit application/x-rar}
-    if {[S 0 == SQSH ]} {emit application/data}
-    if {[S 0 == {UC2\x1a} ]} {emit application/data}
-    if {[S 0 == {PK\003\004} ]} {emit application/zip}
-    if {[N i 20 == 0xfdc4a7dc ]} {emit application/x-zoo}
-    if {[S 10 == {\#\ This\ is\ a\ shell\ archive} ]} {emit application/x-shar}
-    if {[S 0 == *STA ]} {emit application/data}
-    if {[S 0 == 2278 ]} {emit application/data}
-    if {[S 0 == {\000\004\036\212\200} ]} {emit application/core}
-    if {[S 0 == .snd ]} {emit audio/basic}
-    if {[S 0 == MThd ]} {emit audio/midi}
-    if {[S 0 == CTMF ]} {emit audio/x-cmf}
-    if {[S 0 == SBI ]} {emit audio/x-sbi}
-    if {[S 0 == {Creative\ Voice\ File} ]} {emit audio/x-voc}
-    if {[S 0 == RIFF ]} {emit audio/x-wav}
-    if {[S 8 == AIFC ]} {emit audio/x-aifc}
-    if {[S 8 == AIFF ]} {emit audio/x-aiff}
-    if {[S 0 == {.ra\375} ]} {emit audio/x-real-audio}
-    if {[S 8 == WAVE ]} {emit audio/x-wav}
-    if {[S 8 == {WAV\	} ]} {emit audio/x-wav}
-    if {[S 0 == RIFF ]} {emit audio/x-riff}
-    if {[S 0 == EMOD ]} {emit audio/x-emod}
-    if {[S 0 == MTM ]} {emit audio/x-multitrack}
-    if {[S 0 == if ]} {emit audio/x-669-mod}
-    if {[S 0 == FAR ]} {emit audio/mod}
-    if {[S 0 == MAS_U ]} {emit audio/x-multimate-mod}
-    if {[S 44 == SCRM ]} {emit audio/x-st3-mod}
-    if {[S 0 == {GF1PATCH110\0ID\#000002\0} ]} {emit audio/x-gus-patch}
-    if {[S 0 == {GF1PATCH100\0ID\#000002\0} ]} {emit audio/x-gus-patch}
-    if {[S 0 == JN ]} {emit audio/x-669-mod}
-    if {[S 0 == UN05 ]} {emit audio/x-mikmod-uni}
-    if {[S 0 == {Extended\ Module:} ]} {emit audio/x-ft2-mod}
-    if {[S 21 == !SCREAM! ]} {emit audio/x-st2-mod}
-    if {[S 1080 == M.K. ]} {emit audio/x-protracker-mod}
-    if {[S 1080 == M!K! ]} {emit audio/x-protracker-mod}
-    if {[S 1080 == FLT4 ]} {emit audio/x-startracker-mod}
-    if {[S 1080 == 4CHN ]} {emit audio/x-fasttracker-mod}
-    if {[S 1080 == 6CHN ]} {emit audio/x-fasttracker-mod}
-    if {[S 1080 == 8CHN ]} {emit audio/x-fasttracker-mod}
-    if {[S 1080 == CD81 ]} {emit audio/x-oktalyzer-mod}
-    if {[S 1080 == OKTA ]} {emit audio/x-oktalyzer-mod}
-    if {[S 1080 == 16CN ]} {emit audio/x-taketracker-mod}
-    if {[S 1080 == 32CN ]} {emit audio/x-taketracker-mod}
-    if {[S 0 == TOC ]} {emit audio/x-toc}
-    if {[S 0 == // ]} {emit text/cpp}
-    if {[S 0 == {\\1cw\ } ]} {emit application/data}
-    if {[S 0 == {\\1cw} ]} {emit application/data}
-    switch -- [Nv I 0 &0xffffff00] -2063526912 {emit application/data} -2063480064 {emit application/data}
-    if {[S 4 == pipe ]} {emit application/data}
-    if {[S 4 == prof ]} {emit application/data}
-    if {[S 0 == {:\ shell} ]} {emit application/data}
-    if {[S 0 == {\#!/bin/sh} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\ /bin/sh} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\	/bin/sh} ]} {emit application/x-sh}
-    if {[S 0 == {\#!/bin/csh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\ /bin/csh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\	/bin/csh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!/bin/ksh} ]} {emit application/x-ksh}
-    if {[S 0 == {\#!\ /bin/ksh} ]} {emit application/x-ksh}
-    if {[S 0 == {\#!\	/bin/ksh} ]} {emit application/x-ksh}
-    if {[S 0 == {\#!/bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\ /bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\	/bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!/usr/local/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\ /usr/local/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!/usr/local/bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\ /usr/local/bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!\	/usr/local/bin/tcsh} ]} {emit application/x-csh}
-    if {[S 0 == {\#!/usr/local/bin/zsh} ]} {emit application/x-zsh}
-    if {[S 0 == {\#!\ /usr/local/bin/zsh} ]} {emit application/x-zsh}
-    if {[S 0 == {\#!\	/usr/local/bin/zsh} ]} {emit application/x-zsh}
-    if {[S 0 == {\#!/usr/local/bin/ash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\ /usr/local/bin/ash} ]} {emit application/x-zsh}
-    if {[S 0 == {\#!\	/usr/local/bin/ash} ]} {emit application/x-zsh}
-    if {[S 0 == {\#!/usr/local/bin/ae} ]} {emit text/script}
-    if {[S 0 == {\#!\ /usr/local/bin/ae} ]} {emit text/script}
-    if {[S 0 == {\#!\	/usr/local/bin/ae} ]} {emit text/script}
-    if {[S 0 == {\#!/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/usr/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /usr/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/usr/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/usr/local/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /usr/local/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/usr/local/bin/nawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/usr/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /usr/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/usr/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/usr/local/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /usr/local/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/usr/local/bin/gawk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!/usr/bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\ /usr/bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == {\#!\	/usr/bin/awk} ]} {emit application/x-awk}
-    if {[S 0 == BEGIN ]} {emit application/x-awk}
-    if {[S 0 == {\#!/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\ /bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\	/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {eval\ \"exec\ /bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!/usr/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\ /usr/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\	/usr/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {eval\ \"exec\ /usr/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!/usr/local/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\ /usr/local/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!\	/usr/local/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {eval\ \"exec\ /usr/local/bin/perl} ]} {emit application/x-perl}
-    if {[S 0 == {\#!/bin/rc} ]} {emit text/script}
-    if {[S 0 == {\#!\ /bin/rc} ]} {emit text/script}
-    if {[S 0 == {\#!\	/bin/rc} ]} {emit text/script}
-    if {[S 0 == {\#!/bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\ /bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\	/bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!/usr/local/bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\ /usr/local/bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\	/usr/local/bin/bash} ]} {emit application/x-sh}
-    if {[S 0 == {\#!\ /} ]} {emit text/script}
-    if {[S 0 == {\#!\	/} ]} {emit text/script}
-    if {[S 0 == {\#!/} ]} {emit text/script}
-    if {[S 0 == {\#!\ } ]} {emit text/script}
-    if {[S 0 == {\037\235} ]} {emit application/compress}
-    if {[S 0 == {\037\213} ]} {emit application/x-gzip}
-    if {[S 0 == {\037\036} ]} {emit application/data}
-    if {[S 0 == {\377\037} ]} {emit application/data}
-    if {[S 0 == BZh ]} {emit application/x-bzip2}
-    if {[S 0 == {\037\237} ]} {emit application/data}
-    if {[S 0 == {\037\236} ]} {emit application/data}
-    if {[S 0 == {\037\240} ]} {emit application/data}
-    if {[S 0 == BZ ]} {emit application/x-bzip}
-    if {[S 0 == {\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a} ]} {emit application/data}
-    switch -- [Nv I 24 ] 60011 {emit application/data} 60012 {emit application/data} 60013 {emit application/data} 60014 {emit application/data} 60012 {emit application/x-dump} 60011 {emit application/x-dump}
-    if {[S 0 == GDBM ]} {emit application/x-gdbm}
-    if {[S 0 == {<list>\n<protocol\ bbn-m} ]} {emit application/data}
-    if {[S 0 == {diff\ } ]} {emit text/x-patch}
-    if {[S 0 == {***\ } ]} {emit text/x-patch}
-    if {[S 0 == {Only\ in\ } ]} {emit text/x-patch}
-    if {[S 0 == {Common\ subdirectories:\ } ]} {emit text/x-patch}
-    if {[S 0 == {!<arch>\n________64E} ]} {emit application/data}
-    if {[S 0 == {\377\377\177} ]} {emit application/data}
-    if {[S 0 == {\377\377\174} ]} {emit application/data}
-    if {[S 0 == {\377\377\176} ]} {emit application/data}
-    if {[S 0 == {\033c\033} ]} {emit application/data}
-    if {[S 0 == {!<PDF>!\n} ]} {emit application/x-prof}
-    switch -- [Nv i 24 ] 60012 {emit application/x-dump} 60011 {emit application/x-dump}
-    if {[S 0 == {\177ELF} ]} {emit application/x-executable-file}
-    if {[N s 1080 == 0xef53 ]} {emit application/x-linux-ext2fs}
-    if {[S 0 == {\366\366\366\366} ]} {emit application/x-pc-floppy}
-    if {[N S 508 == 0xdabe ]} {emit application/data}
-    if {[N s 510 == 0xaa55 ]} {emit application/data}
-    switch -- [Nv s 1040 ] 4991 {emit application/x-filesystem} 5007 {emit application/x-filesystem} 9320 {emit application/x-filesystem} 9336 {emit application/x-filesystem}
-    if {[S 0 == {-rom1fs-\0} ]} {emit application/x-filesystem}
-    if {[S 395 == OS/2 ]} {emit application/x-bootable}
-    if {[S 0 == FONT ]} {emit font/x-vfont}
-    if {[S 0 == %!PS-AdobeFont-1.0 ]} {emit font/type1}
-    if {[S 6 == %!PS-AdobeFont-1.0 ]} {emit font/type1}
-    if {[S 0 == {STARTFONT\040} ]} {emit font/x-bdf}
-    if {[S 0 == {\001fcp} ]} {emit font/x-pcf}
-    if {[S 0 == {D1.0\015} ]} {emit font/x-speedo}
-    if {[S 0 == flf ]} {emit font/x-figlet}
-    if {[S 0 == flc ]} {emit application/x-font}
-    switch -- [Nv I 7 ] 4540225 {emit font/x-dos} 5654852 {emit font/x-dos}
-    if {[S 4098 == DOSFONT ]} {emit font/x-dos}
-    if {[S 0 == <MakerFile ]} {emit application/x-framemaker}
-    if {[S 0 == <MIFFile ]} {emit application/x-framemaker}
-    if {[S 0 == <MakerDictionary ]} {emit application/x-framemaker}
-    if {[S 0 == <MakerScreenFont ]} {emit font/x-framemaker}
-    if {[S 0 == <MML ]} {emit application/x-framemaker}
-    if {[S 0 == <BookFile ]} {emit application/x-framemaker}
-    if {[S 0 == <Maker ]} {emit application/x-framemaker}
-    switch -- [Nv i 0 &0377777777] 8782087 {emit application/x-executable-file} 8782088 {emit application/x-executable-file} 8782091 {emit application/x-executable-file} 8782028 {emit application/x-executable-file}
-    if {[S 7 == {\357\020\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0} ]} {emit application/core}
-    if {[S 0 == {GIMP\ Gradient} ]} {emit application/x-gimp-gradient}
-    if {[S 0 == {gimp\ xcf} ]} {emit application/x-gimp-image}
-    if {[S 20 == GPAT ]} {emit application/x-gimp-pattern}
-    if {[S 20 == GIMP ]} {emit application/x-gimp-brush}
-    if {[S 0 == {\336\22\4\225} ]} {emit application/x-locale}
-    if {[S 0 == {\225\4\22\336} ]} {emit application/x-locale}
-    if {[S 0 == {\000\001\000\000\000} ]} {emit font/ttf}
-    if {[S 0 == Bitmapfile ]} {emit image/unknown}
-    if {[S 0 == IMGfile ]} {emit {CIS 	image/unknown}}
-    if {[S 0 == msgcat01 ]} {emit application/x-locale}
-    if {[S 0 == HPHP48- ]} {emit {HP48 binary}}
-    if {[S 0 == %%HP: ]} {emit {HP48 text}}
-    if {[S 0 == 0xabcdef ]} {emit {AIX message catalog}}
-    if {[S 0 == <aiaff> ]} {emit archive}
-    if {[S 0 == FORM ]} {emit {IFF data}}
-    if {[S 0 == P1 ]} {emit image/x-portable-bitmap}
-    if {[S 0 == P2 ]} {emit image/x-portable-graymap}
-    if {[S 0 == P3 ]} {emit image/x-portable-pixmap}
-    if {[S 0 == P4 ]} {emit image/x-portable-bitmap}
-    if {[S 0 == P5 ]} {emit image/x-portable-graymap}
-    if {[S 0 == P6 ]} {emit image/x-portable-pixmap}
-    if {[S 0 == IIN1 ]} {emit image/tiff}
-    if {[S 0 == {MM\x00\x2a} ]} {emit image/tiff}
-    if {[S 0 == {II\x2a\x00} ]} {emit image/tiff}
-    if {[S 0 == {\x89PNG} ]} {emit image/x-png}
-    if {[S 1 == PNG ]} {emit image/x-png}
-    if {[S 0 == GIF8 ]} {emit image/gif}
-    if {[S 0 == {\361\0\100\273} ]} {emit image/x-cmu-raster}
-    if {[S 0 == id=ImageMagick ]} {emit {MIFF image data}}
-    if {[S 0 == {\#FIG} ]} {emit {FIG image text}}
-    if {[S 0 == ARF_BEGARF ]} {emit {PHIGS clear text archive}}
-    if {[S 0 == {@(\#)SunPHIGS} ]} {emit SunPHIGS}
-    if {[S 0 == GKSM ]} {emit {GKS Metafile}}
-    if {[S 0 == BEGMF ]} {emit {clear text Computer Graphics Metafile}}
-    if {[N S 0 == 0x20 &0xffe0]} {emit {binary Computer Graphics Metafile}}
-    if {[S 0 == yz ]} {emit {MGR bitmap, modern format, 8-bit aligned}}
-    if {[S 0 == zz ]} {emit {MGR bitmap, old format, 1-bit deep, 16-bit aligned}}
-    if {[S 0 == xz ]} {emit {MGR bitmap, old format, 1-bit deep, 32-bit aligned}}
-    if {[S 0 == yx ]} {emit {MGR bitmap, modern format, squeezed}}
-    if {[S 0 == {%bitmap\0} ]} {emit {FBM image data}}
-    if {[S 1 == {PC\ Research,\ Inc} ]} {emit {group 3 fax data}}
-    if {[S 0 == hsi1 ]} {emit image/x-jpeg-proprietary}
-    if {[S 0 == BM ]} {emit image/x-bmp}
-    if {[S 0 == IC ]} {emit image/x-ico}
-    if {[S 0 == PI ]} {emit {PC pointer image data}}
-    if {[S 0 == CI ]} {emit {PC color icon data}}
-    if {[S 0 == CP ]} {emit {PC color pointer image data}}
-    if {[S 0 == {/*\ XPM\ */} ]} {emit {X pixmap image text}}
-    if {[S 0 == {Imagefile\ version-} ]} {emit {iff image data}}
-    if {[S 0 == IT01 ]} {emit {FIT image data}}
-    if {[S 0 == IT02 ]} {emit {FIT image data}}
-    if {[S 2048 == PCD_IPI ]} {emit x/x-photo-cd-pack-file}
-    if {[S 0 == PCD_OPA ]} {emit x/x-photo-cd-overfiew-file}
-    if {[S 0 == {SIMPLE\ \ =} ]} {emit {FITS image data}}
-    if {[S 0 == {This\ is\ a\ BitMap\ file} ]} {emit {Lisp Machine bit-array-file}}
-    if {[S 0 == !! ]} {emit {Bennet Yee's \"face\" format}}
-    if {[S 1536 == {Visio\ (TM)\ Drawing} ]} {emit %s}
-    if {[S 0 == {\210OPS} ]} {emit {Interleaf saved data}}
-    if {[S 0 == <!OPS ]} {emit {Interleaf document text}}
-    if {[S 4 == pgscriptver ]} {emit {IslandWrite document}}
-    if {[S 13 == DrawFile ]} {emit {IslandDraw document}}
-    if {[N s 0 == 0x9600 &0xFFFC]} {emit {little endian ispell}}
-    if {[N S 0 == 0x9600 &0xFFFC]} {emit {big endian ispell}}
-    if {[S 0 == KarmaRHD ]} {emit {Version	Karma Data Structure Version}}
-    if {[S 0 == lect ]} {emit {DEC SRC Virtual Paper Lectern file}}
-    if {[S 53 == yyprevious ]} {emit {C program text \(from lex\)}}
-    if {[S 21 == {generated\ by\ flex} ]} {emit {C program text \(from flex\)}}
-    if {[S 0 == {%\{} ]} {emit {lex description text}}
-    if {[S 0 == {\007\001\000} ]} {emit {Linux/i386 object file}}
-    if {[S 0 == {\01\03\020\04} ]} {emit {Linux-8086 impure executable}}
-    if {[S 0 == {\01\03\040\04} ]} {emit {Linux-8086 executable}}
-    if {[S 0 == {\243\206\001\0} ]} {emit {Linux-8086 object file}}
-    if {[S 0 == {\01\03\020\20} ]} {emit {Minix-386 impure executable}}
-    if {[S 0 == {\01\03\040\20} ]} {emit {Minix-386 executable}}
-    if {[S 0 == *nazgul* ]} {emit {Linux compiled message catalog}}
-    if {[N i 216 == 0x111 ]} {emit {Linux/i386 core file}}
-    if {[S 2 == LILO ]} {emit {Linux/i386 LILO boot/chain loader}}
-    if {[S 0 == 0.9 ]} {emit 300}
-    if {[S 4086 == SWAP-SPACE ]} {emit {Linux/i386 swap file}}
-    if {[S 514 == HdrS ]} {emit {Linux kernel}}
-    if {[S 0 == Begin3 ]} {emit {Linux Software Map entry text}}
-    if {[S 0 == {;;} ]} {emit {Lisp/Scheme program text}}
-    if {[S 0 == {\012(} ]} {emit {byte-compiled Emacs-Lisp program data}}
-    if {[S 0 == {;ELC\023\000\000\000} ]} {emit {byte-compiled Emacs-Lisp program data}}
-    if {[S 0 == {(SYSTEM::VERSION\040'} ]} {emit {CLISP byte-compiled Lisp program text}}
-    if {[S 11 == {must\ be\ converted\ with\ BinHex} ]} {emit {BinHex binary text}}
-    if {[S 0 == SIT! ]} {emit {StuffIt Archive \(data\)}}
-    if {[S 65 == SIT! ]} {emit {StuffIt Archive \(rsrc + data\)}}
-    if {[S 0 == SITD ]} {emit {StuffIt Deluxe \(data\)}}
-    if {[S 65 == SITD ]} {emit {StuffIt Deluxe \(rsrc + data\)}}
-    if {[S 0 == Seg ]} {emit {StuffIt Deluxe Segment \(data\)}}
-    if {[S 65 == Seg ]} {emit {StuffIt Deluxe Segment \(rsrc + data\)}}
-    if {[S 0 == APPL ]} {emit {Macintosh Application \(data\)}}
-    if {[S 65 == APPL ]} {emit {Macintosh Application \(rsrc + data\)}}
-    if {[S 0 == zsys ]} {emit {Macintosh System File \(data\)}}
-    if {[S 65 == zsys ]} {emit {Macintosh System File\(rsrc + data\)}}
-    if {[S 0 == FNDR ]} {emit {Macintosh Finder \(data\)}}
-    if {[S 65 == FNDR ]} {emit {Macintosh Finder\(rsrc + data\)}}
-    if {[S 0 == libr ]} {emit {Macintosh Library \(data\)}}
-    if {[S 65 == libr ]} {emit {Macintosh Library\(rsrc + data\)}}
-    if {[S 0 == shlb ]} {emit {Macintosh Shared Library \(data\)}}
-    if {[S 65 == shlb ]} {emit {Macintosh Shared Library\(rsrc + data\)}}
-    if {[S 0 == cdev ]} {emit {Macintosh Control Panel \(data\)}}
-    if {[S 65 == cdev ]} {emit {Macintosh Control Panel\(rsrc + data\)}}
-    if {[S 0 == INIT ]} {emit {Macintosh Extension \(data\)}}
-    if {[S 65 == INIT ]} {emit {Macintosh Extension\(rsrc + data\)}}
-    if {[S 0 == FFIL ]} {emit font/ttf}
-    if {[S 65 == FFIL ]} {emit font/ttf}
-    if {[S 0 == LWFN ]} {emit font/type1}
-    if {[S 65 == LWFN ]} {emit font/type1}
-    if {[S 0 == PACT ]} {emit {Macintosh Compact Pro Archive \(data\)}}
-    if {[S 65 == PACT ]} {emit {Macintosh Compact Pro Archive\(rsrc + data\)}}
-    if {[S 0 == ttro ]} {emit {Macintosh TeachText File \(data\)}}
-    if {[S 65 == ttro ]} {emit {Macintosh TeachText File\(rsrc + data\)}}
-    if {[S 0 == TEXT ]} {emit {Macintosh TeachText File \(data\)}}
-    if {[S 65 == TEXT ]} {emit {Macintosh TeachText File\(rsrc + data\)}}
-    if {[S 0 == PDF ]} {emit {Macintosh PDF File \(data\)}}
-    if {[S 65 == PDF ]} {emit {Macintosh PDF File\(rsrc + data\)}}
-    if {[S 0 == {\#\ Magic} ]} {emit {magic text file for file\(1\) cmd}}
-    if {[S 0 == Relay-Version: ]} {emit {old news text}}
-    if {[S 0 == {\#!\ rnews} ]} {emit {batched news text}}
-    if {[S 0 == {N\#!\ rnews} ]} {emit {mailed, batched news text}}
-    if {[S 0 == {Forward\ to} ]} {emit {mail forwarding text}}
-    if {[S 0 == {Pipe\ to} ]} {emit {mail piping text}}
-    if {[S 0 == Return-Path: ]} {emit message/rfc822}
-    if {[S 0 == Path: ]} {emit message/news}
-    if {[S 0 == Xref: ]} {emit message/news}
-    if {[S 0 == From: ]} {emit message/rfc822}
-    if {[S 0 == Article ]} {emit message/news}
-    if {[S 0 == BABYL ]} {emit message/x-gnu-rmail}
-    if {[S 0 == Received: ]} {emit message/rfc822}
-    if {[S 0 == MIME-Version: ]} {emit {MIME entity text}}
-    if {[S 0 == {Content-Type:\ } ]} {emit 355}
-    if {[S 0 == Content-Type: ]} {emit 356}
-    if {[S 0 == {\311\304} ]} {emit {ID tags data}}
-    if {[S 0 == {\001\001\001\001} ]} {emit {MMDF mailbox}}
-    if {[S 4 == Research, ]} {emit Digifax-G3-File}
-    if {[S 0 == RMD1 ]} {emit {raw modem data}}
-    if {[S 0 == {PVF1\n} ]} {emit {portable voice format}}
-    if {[S 0 == {PVF2\n} ]} {emit {portable voice format}}
-    if {[S 0 == S0 ]} {emit {Motorola S-Record; binary data in text format}}
-    if {[S 0 == {@echo\ off} ]} {emit {MS-DOS batch file text}}
-    if {[S 128 == {PE\0\0} ]} {emit {MS Windows PE}}
-    if {[S 0 == MZ ]} {emit application/x-ms-dos-executable}
-    if {[S 0 == LZ ]} {emit {MS-DOS executable \(built-in\)}}
-    if {[S 0 == regf ]} {emit {Windows NT Registry file}}
-    if {[S 2080 == {Microsoft\ Word\ 6.0\ Document} ]} {emit text/vnd.ms-word}
-    if {[S 2080 == {Documento\ Microsoft\ Word\ 6} ]} {emit text/vnd.ms-word}
-    if {[S 2112 == MSWordDoc ]} {emit text/vnd.ms-word}
-    if {[S 0 == PO^Q` ]} {emit text/vnd.ms-word}
-    if {[S 2080 == {Microsoft\ Excel\ 5.0\ Worksheet} ]} {emit application/vnd.ms-excel}
-    if {[S 2114 == Biff5 ]} {emit application/vnd.ms-excel}
-    if {[S 1 == WPC ]} {emit text/vnd.wordperfect}
-    switch -- [Nv I 0 &0377777777] 8782091 {emit {NetBSD/i386 demand paged}} 8782088 {emit {NetBSD/i386 pure}} 8782087 {emit NetBSD/i386} 8782151 {emit {NetBSD/i386 core}} 8847627 {emit {NetBSD/m68k demand paged}} 8847624 {emit {NetBSD/m68k pure}} 8847623 {emit NetBSD/m68k} 8847687 {emit {NetBSD/m68k core}} 8913163 {emit {NetBSD/m68k4k demand paged}} 8913160 {emit {NetBSD/m68k4k pure}} 8913159 {emit NetBSD/m68k4k} 8913223 {emit {NetBSD/m68k4k core}} 8978699 {emit {NetBSD/ns32532 demand paged}} 8978696 {emit {NetBSD/ns32532 pure}} 8978695 {emit NetBSD/ns32532} 8978759 {emit {NetBSD/ns32532 core}} 9044235 {emit {NetBSD/sparc demand paged}} 9044232 {emit {NetBSD/sparc pure}} 9044231 {emit NetBSD/sparc} 9044295 {emit {NetBSD/sparc core}} 9109771 {emit {NetBSD/pmax demand paged}} 9109768 {emit {NetBSD/pmax pure}} 9109767 {emit NetBSD/pmax} 9109831 {emit {NetBSD/pmax core}} 9175307 {emit {NetBSD/vax demand paged}} 9175304 {emit {NetBSD/vax pure}} 9175303 {emit NetBSD/vax} 9175367 {emit {NetBSD/vax core}} 9240903 {emit {NetBSD/alpha core}} 9306379 {emit {NetBSD/mips demand paged}} 9306376 {emit {NetBSD/mips pure}} 9306375 {emit NetBSD/mips} 9306439 {emit {NetBSD/mips core}} 9371915 {emit {NetBSD/arm32 demand paged}} 9371912 {emit {NetBSD/arm32 pure}} 9371911 {emit NetBSD/arm32} 9371975 {emit {NetBSD/arm32 core}}
-    if {[S 0 == StartFontMetrics ]} {emit font/x-sunos-news}
-    if {[S 0 == StartFont ]} {emit font/x-sunos-news}
-    switch -- [Nv I 8 ] 326773573 {emit font/x-sunos-news} 326773576 {emit font/x-sunos-news}
-    if {[S 0 == Octave-1-L ]} {emit {Octave binary data \(little endian\)}}
-    if {[S 0 == Octave-1-B ]} {emit {Octave binary data \(big endian\)}}
-    if {[S 0 == {\177OLF} ]} {emit OLF}
-    if {[S 0 == %PDF- ]} {emit {PDF document}}
-    if {[S 0 == {-----BEGIN\040PGP} ]} {emit {PGP armored data}}
-    if {[S 0 == {\#\ PaCkAgE\ DaTaStReAm} ]} {emit {pkg Datastream \(SVR4\)}}
-    if {[S 0 == %! ]} {emit application/postscript}
-    if {[S 0 == {\004%!} ]} {emit application/postscript}
-    if {[S 0 == *PPD-Adobe: ]} {emit {PPD file}}
-    if {[S 0 == {\033%-12345X@PJL} ]} {emit {HP Printer Job Language data}}
-    if {[S 0 == {\033%-12345X@PJL} ]} {emit {HP Printer Job Language data}}
-    if {[S 0 == {\033E\033} ]} {emit image/x-pcl-hp}
-    if {[S 0 == @document( ]} {emit {Imagen printer}}
-    if {[S 0 == Rast ]} {emit {RST-format raster font data}}
-    if {[N I 0 == 0x56000000 &0xff00ffff]} {emit {ps database}}
-    if {[S 0 == {\{\\rtf} ]} {emit {Rich Text Format data,}}
-    if {[S 38 == Spreadsheet ]} {emit {sc spreadsheet file}}
-    if {[S 8 == {\001s\ } ]} {emit {SCCS archive data}}
-    switch -- [Nv c 0 ] 38 {emit {Sendmail frozen configuration}} -128 {emit {8086 relocatable \(Microsoft\)}}
-    if {[S 0 == kbd!map ]} {emit {kbd map file}}
-    if {[S 0 == {\x43\x72\x73\x68\x44\x75\x6d\x70} ]} {emit {IRIX vmcore dump of}}
-    if {[S 0 == SGIAUDIT ]} {emit {SGI Audit file}}
-    if {[S 0 == WNGZWZSC ]} {emit {Wingz compiled script}}
-    if {[S 0 == WNGZWZSS ]} {emit {Wingz spreadsheet}}
-    if {[S 0 == WNGZWZHP ]} {emit {Wingz help file}}
-    if {[S 0 == {\\#Inventor} ]} {emit {V	IRIS Inventor 1.0 file}}
-    if {[S 0 == {\\#Inventor} ]} {emit {V2	Open Inventor 2.0 file}}
-    if {[S 0 == {glfHeadMagic();} ]} {emit GLF_TEXT}
-    switch -- [Nv I 4 ] 1090584576 {emit GLF_BINARY_LSB_FIRST} 321 {emit GLF_BINARY_MSB_FIRST}
-    if {[S 0 == {<!DOCTYPE\ HTML} ]} {emit text/html}
-    if {[S 0 == {<!doctype\ html} ]} {emit text/html}
-    if {[S 0 == <HEAD ]} {emit text/html}
-    if {[S 0 == <head ]} {emit text/html}
-    if {[S 0 == <TITLE ]} {emit text/html}
-    if {[S 0 == <title ]} {emit text/html}
-    if {[S 0 == <html ]} {emit text/html}
-    if {[S 0 == <HTML ]} {emit text/html}
-    if {[S 0 == <!DOCTYPE ]} {emit {exported SGML document text}}
-    if {[S 0 == <!doctype ]} {emit {exported SGML document text}}
-    if {[S 0 == <!SUBDOC ]} {emit {exported SGML subdocument text}}
-    if {[S 0 == <!subdoc ]} {emit {exported SGML subdocument text}}
-    if {[S 0 == <!-- ]} {emit {exported SGML document text}}
-    if {[S 0 == RTSS ]} {emit {NetMon capture file}}
-    if {[S 0 == {TRSNIFF\ data\ \ \ \ \032} ]} {emit {Sniffer capture file}}
-    if {[S 0 == {XCP\0} ]} {emit {NetXRay capture file}}
-    if {[S 0 == {<!SQ\ DTD>} ]} {emit {Compiled SGML rules file}}
-    if {[S 0 == {<!SQ\ A/E>} ]} {emit {A/E SGML Document binary}}
-    if {[S 0 == {<!SQ\ STS>} ]} {emit {A/E SGML binary styles file}}
-    if {[S 0 == {SQ\ BITMAP1} ]} {emit {SoftQuad Raster Format text}}
-    if {[S 0 == {X\ } ]} {emit {SoftQuad troff Context intermediate}}
-    switch -- [Nv I 0 &077777777] 196875 {emit {sparc demand paged}} 196872 {emit {sparc pure}} 196871 {emit sparc} 131339 {emit {mc68020 demand paged}} 131336 {emit {mc68020 pure}} 131335 {emit mc68020} 65803 {emit {mc68010 demand paged}} 65800 {emit {mc68010 pure}} 65799 {emit mc68010}
-    if {[S 0 == {\#SUNPC_CONFIG} ]} {emit {SunPC 4.0 Properties Values}}
-    if {[S 0 == snoop ]} {emit {Snoop capture file}}
-    if {[S 36 == acsp ]} {emit {Kodak Color Management System, ICC Profile}}
-    if {[S 0 == {\#!teapot\012xdr} ]} {emit {teapot work sheet \(XDR format\)}}
-    if {[S 0 == {\032\001} ]} {emit {Compiled terminfo entry}}
-    if {[S 0 == {\367\002} ]} {emit {TeX DVI file}}
-    if {[S 0 == {\367\203} ]} {emit font/x-tex}
-    if {[S 0 == {\367\131} ]} {emit font/x-tex}
-    if {[S 0 == {\367\312} ]} {emit font/x-tex}
-    if {[S 0 == {This\ is\ TeX,} ]} {emit {TeX transcript text}}
-    if {[S 0 == {This\ is\ METAFONT,} ]} {emit {METAFONT transcript text}}
-    if {[S 2 == {\000\021} ]} {emit font/x-tex-tfm}
-    if {[S 2 == {\000\022} ]} {emit font/x-tex-tfm}
-    if {[S 0 == {\\input\ texinfo} ]} {emit {Texinfo source text}}
-    if {[S 0 == {This\ is\ Info\ file} ]} {emit {GNU Info text}}
-    if {[S 0 == {\\input} ]} {emit {TeX document text}}
-    if {[S 0 == {\\section} ]} {emit {LaTeX document text}}
-    if {[S 0 == {\\setlength} ]} {emit {LaTeX document text}}
-    if {[S 0 == {\\documentstyle} ]} {emit {LaTeX document text}}
-    if {[S 0 == {\\chapter} ]} {emit {LaTeX document text}}
-    if {[S 0 == {\\documentclass} ]} {emit {LaTeX 2e document text}}
-    if {[S 0 == {\\relax} ]} {emit {LaTeX auxiliary file}}
-    if {[S 0 == {\\contentsline} ]} {emit {LaTeX  table of contents}}
-    if {[S 0 == {\\indexentry} ]} {emit {LaTeX raw index file}}
-    if {[S 0 == {\\begin\{theindex\}} ]} {emit {LaTeX sorted index}}
-    if {[S 0 == {\\glossaryentry} ]} {emit {LaTeX raw glossary}}
-    if {[S 0 == {\\begin\{theglossary\}} ]} {emit {LaTeX sorted glossary}}
-    if {[S 0 == {This\ is\ makeindex} ]} {emit {Makeindex log file}}
-    if {[S 0 == **TI82** ]} {emit {TI-82 Graphing Calculator}}
-    if {[S 0 == **TI83** ]} {emit {TI-83 Graphing Calculator}}
-    if {[S 0 == **TI85** ]} {emit {TI-85 Graphing Calculator}}
-    if {[S 0 == **TI92** ]} {emit {TI-92 Graphing Calculator}}
-    if {[S 0 == **TI80** ]} {emit {TI-80 Graphing Calculator File.}}
-    if {[S 0 == **TI81** ]} {emit {TI-81 Graphing Calculator File.}}
-    if {[S 0 == TZif ]} {emit {timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0} ]} {emit {old timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0} ]} {emit {old timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0} ]} {emit {old timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0} ]} {emit {old timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0} ]} {emit {old timezone data}}
-    if {[S 0 == {\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0} ]} {emit {old timezone data}}
-    if {[S 0 == {.\\\"} ]} {emit {troff or preprocessor input text}}
-    if {[S 0 == {'\\\"} ]} {emit {troff or preprocessor input text}}
-    if {[S 0 == {'.\\\"} ]} {emit {troff or preprocessor input text}}
-    if {[S 0 == {\\\"} ]} {emit {troff or preprocessor input text}}
-    if {[S 0 == {x\ T} ]} {emit {ditroff text}}
-    if {[S 0 == {\100\357} ]} {emit {very old \(C/A/T\) troff output data}}
-    if {[S 0 == Interpress/Xerox ]} {emit {Xerox InterPress data}}
-    if {[S 0 == {begin\040} ]} {emit {uuencoded or xxencoded text}}
-    if {[S 0 == {xbtoa\ Begin} ]} {emit {btoa'd text}}
-    if {[S 0 == {$\012ship} ]} {emit {ship'd binary text}}
-    if {[S 0 == {Decode\ the\ following\ with\ bdeco} ]} {emit {bencoded News text}}
-    if {[S 11 == {must\ be\ converted\ with\ BinHex} ]} {emit {BinHex binary text}}
-    if {[N S 6 == 0x107 ]} {emit {unicos \(cray\) executable}}
-    if {[S 596 == {\130\337\377\377} ]} {emit {Ultrix core file}}
-    if {[S 0 == Joy!peffpwpc ]} {emit {header for PowerPC PEF executable}}
-    if {[S 0 == LBLSIZE= ]} {emit {VICAR image data}}
-    if {[S 43 == SFDU_LABEL ]} {emit {VICAR label file}}
-    if {[S 0 == {\xb0\0\x30\0} ]} {emit {VMS VAX executable}}
-    if {[S 1 == WPC ]} {emit {\(Corel/WP\)}}
-    if {[S 0 == core ]} {emit {core file \(Xenix\)}}
-    if {[S 0 == {ZyXEL\002} ]} {emit {ZyXEL voice data}}
-
-    result
-
-    return {}
-}
-
-## -- ** END GENERATED CODE ** --
-## -- Do not edit before this line !
-##
-
-# ### ### ### ######### ######### #########
-## Ready for use.
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,15 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-
-# Recognizers
-package ifneeded fileutil::magic::filetype 1.0.2 [list source [file join $dir filetypes.tcl]]
-package ifneeded fileutil::magic::mimetype 1.0.2 [list source [file join $dir mimetypes.tcl]]
-
-# Runtime
-package ifneeded fileutil::magic::rt 1.0 [list source [file join $dir rtcore.tcl]]
-
-# Compiler packages
-package ifneeded fileutil::magic::cgen   1.0 [list source [file join $dir cgen.tcl]]
-package ifneeded fileutil::magic::cfront 1.0 [list source [file join $dir cfront.tcl]]
-
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/rtcore.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/fumagic/rtcore.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,500 +1,0 @@
-# rtcore.tcl --
-#
-#	Runtime core for file type recognition engines written in pure Tcl.
-#
-# Copyright (c) 2004-2005 Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005      Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: rtcore.tcl,v 1.5 2005/09/28 04:51:19 andreas_kupries Exp $
-
-#####
-#
-# "mime type recognition in pure tcl"
-# http://wiki.tcl.tk/12526
-#
-# Tcl code harvested on:  10 Feb 2005, 04:06 GMT
-# Wiki page last updated: ???
-#
-#####
-
-# TODO - Required Functionality:
-
-# implement full offset language
-# implement pstring (pascal string, blerk)
-# implement regex form (blerk!)
-# implement string qualifiers
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::fileutil::magic::rt {
-    # Configuration flag. (De)activate debugging output.
-    # This is done during initialization.
-    # Changes at runtime have no effect.
-
-    variable debug 0
-
-    # Runtime state.
-
-    variable fd     {}     ; # Channel to file under scrutiny
-    variable strbuf {}     ; # Input cache [*].
-    variable cache         ; # Cache of fetched and decoded numeric
-    array set cache {}	   ; # values.
-    variable result {}     ; # Accumulated recognition result.
-    variable string {}     ; # Last recognized string | For substitution
-    variable numeric -9999 ; # Last recognized number | into the message
-
-    variable  last         ; # Behind last fetch locations,
-    array set last {}      ; # per nesting level.
-
-    # [*] The vast majority of magic strings are in the first 4k of the file.
-
-    # Export APIs (full public, recognizer public)
-    namespace export open close file_start result
-    namespace export emit offset Nv N S Nvx Nx Sx L R I
-}
-
-# ### ### ### ######### ######### #########
-## Public API, general use.
-
-# open the file to be scanned
-proc ::fileutil::magic::rt::open {file} {
-    variable result {}
-    variable string {}
-    variable numeric -9999
-    variable strbuf
-    variable fd
-    variable cache
-
-    set fd [::open $file]
-    ::fconfigure $fd -translation binary
-
-    # fill the string cache
-    set strbuf [::read $fd 4096]
-
-    # clear the fetch cache
-    catch {unset cache}
-    array set cache {}
-
-    return $fd
-}
-
-proc ::fileutil::magic::rt::close {} {
-    variable fd
-    ::close $fd
-    return
-}
-
-# mark the start of a magic file in debugging
-proc ::fileutil::magic::rt::file_start {name} {
-    ::fileutil::magic::rt::Debug {puts stderr "File: $name"}
-}
-
-# return the emitted result
-proc ::fileutil::magic::rt::result {{msg ""}} {
-    variable result
-    if {$msg ne ""} {emit $msg}
-    return -code return $result
-}
-
-proc ::fileutil::magic::rt::resultv {{msg ""}} {
-    variable result
-    if {$msg ne ""} {emit $msg}
-    return $result
-}
-
-# ### ### ### ######### ######### #########
-## Public API, for use by a recognizer.
-
-# emit a message
-proc ::fileutil::magic::rt::emit {msg} {
-    variable string
-    variable numeric
-    variable result
-
-    set map [list \
-	    \\b "" \
-	    %s  $string \
-	    %ld $numeric \
-	    %d  $numeric \
-	    ]
-
-    lappend result [::string map $map $msg]
-    return
-}
-
-# handle complex offsets - TODO
-proc ::fileutil::magic::rt::offset {where} {
-    ::fileutil::magic::rt::Debug {puts stderr "OFFSET: $where"}
-    return 0
-}
-
-proc ::fileutil::magic::rt::Nv {type offset {qual ""}} {
-    variable typemap
-    variable numeric
-
-    # unpack the type characteristics
-    foreach {size scan} $typemap($type) break
-
-    # fetch the numeric field from the file
-    set numeric [Fetch $offset $size $scan]
-
-    if {$qual ne ""} {
-	# there's a mask to be applied
-	set numeric [expr $numeric $qual]
-    }
-
-    ::fileutil::magic::rt::Debug {puts stderr "NV $type $offset $qual: $numeric"}
-    return $numeric
-}
-
-# Numeric - get bytes of $type at $offset and $compare to $val
-# qual might be a mask
-proc ::fileutil::magic::rt::N {type offset comp val {qual ""}} {
-    variable typemap
-    variable numeric
-
-    # unpack the type characteristics
-    foreach {size scan} $typemap($type) break
-
-    # fetch the numeric field
-    set numeric [Fetch $offset $size $scan]
-
-    # Would moving this before the fetch an optimisation ? The
-    # tradeoff is that we give up filling the cache, and it is unclear
-    # how often that value would be used. -- Profile!
-    if {$comp eq "x"} {
-	# anything matches - don't care
-	return 1
-    }
-
-    # get value in binary form, then back to numeric
-    # this avoids problems with sign, as both values are
-    # [binary scan]-converted identically
-    binary scan [binary format $scan $val] $scan val
-
-    if {$qual ne ""} {
-	# there's a mask to be applied
-	set numeric [expr $numeric $qual]
-    }
-
-    # perform comparison
-    set c [expr $val $comp $numeric]
-
-    ::fileutil::magic::rt::Debug {puts stderr "numeric $type: $val $comp $numeric / $qual - $c"}
-    return $c
-}
-
-proc ::fileutil::magic::rt::S {offset comp val {qual ""}} {
-    variable fd
-    variable string
-
-    # convert any backslashes
-    set val [subst -nocommands -novariables $val]
-
-    if {$comp eq "x"} {
-	# match anything - don't care, just get the value
-	set string ""
-
-	# Query: Can we use GetString here ?
-	# Or at least the strbuf cache ?
-
-	# move to the offset
-	::seek $fd $offset
-	while {
-	    ([::string length $string] < 100) &&
-	    [::string is print [set c [::read $fd 1]]]
-	} {
-	    if {[::string is space $c]} {
-		break
-	    }
-	    append string $c
-	}
-
-	return 1
-    }
-
-    # get the string and compare it
-    set string [GetString $offset [::string length $val]]
-    set cmp    [::string compare $val $string]
-    set c      [expr $cmp $comp 0]
-
-    ::fileutil::magic::rt::Debug {
-	puts "String '$val' $comp '$string' - $c"
-	if {$c} {
-	    puts "offset $offset - $string"
-	}
-    }
-    return $c
-}
-
-proc ::fileutil::magic::rt::Nvx {atlevel type offset {qual ""}} {
-    variable typemap
-    variable numeric
-    variable last
-
-    upvar 1 level l
-    set  l $atlevel
-
-    # unpack the type characteristics
-    foreach {size scan} $typemap($type) break
-
-    # fetch the numeric field from the file
-    set numeric [Fetch $offset $size $scan]
-
-    set last($atlevel) [expr {$offset + $size}]
-
-    if {$qual ne ""} {
-	# there's a mask to be applied
-	set numeric [expr $numeric $qual]
-    }
-
-    ::fileutil::magic::rt::Debug {puts stderr "NV $type $offset $qual: $numeric"}
-    return $numeric
-}
-
-# Numeric - get bytes of $type at $offset and $compare to $val
-# qual might be a mask
-proc ::fileutil::magic::rt::Nx {atlevel type offset comp val {qual ""}} {
-    variable typemap
-    variable numeric
-    variable last
-
-    upvar 1 level l
-    set  l $atlevel
-
-    # unpack the type characteristics
-    foreach {size scan} $typemap($type) break
-
-    set last($atlevel) [expr {$offset + $size}]
-
-    # fetch the numeric field
-    set numeric [Fetch $offset $size $scan]
-
-    if {$comp eq "x"} {
-	# anything matches - don't care
-	return 1
-    }
-
-    # get value in binary form, then back to numeric
-    # this avoids problems with sign, as both values are
-    # [binary scan]-converted identically
-    binary scan [binary format $scan $val] $scan val
-
-    if {$qual ne ""} {
-	# there's a mask to be applied
-	set numeric [expr $numeric $qual]
-    }
-
-    # perform comparison
-    set c [expr $val $comp $numeric]
-
-    ::fileutil::magic::rt::Debug {puts stderr "numeric $type: $val $comp $numeric / $qual - $c"}
-    return $c
-}
-
-proc ::fileutil::magic::rt::Sx {atlevel offset comp val {qual ""}} {
-    variable fd
-    variable string
-    variable last
-
-    upvar 1 level l
-    set  l $atlevel
-
-    # convert any backslashes
-    set val [subst -nocommands -novariables $val]
-
-    if {$comp eq "x"} {
-	# match anything - don't care, just get the value
-	set string ""
-
-	# Query: Can we use GetString here ?
-	# Or at least the strbuf cache ?
-
-	# move to the offset
-	::seek $fd $offset
-	while {
-	    ([::string length $string] < 100) &&
-	    [::string is print [set c [::read $fd 1]]]
-	} {
-	    if {[::string is space $c]} {
-		break
-	    }
-	    append string $c
-	}
-
-	set last($atlevel) [expr {$offset + [string length $string]}]
-
-	return 1
-    }
-
-    set len [::string length $val]
-    set last($atlevel) [expr {$offset + $len}]
-
-    # get the string and compare it
-    set string [GetString $offset $len]
-    set cmp    [::string compare $val $string]
-    set c      [expr $cmp $comp 0]
-
-    ::fileutil::magic::rt::Debug {
-	puts "String '$val' $comp '$string' - $c"
-	if {$c} {
-	    puts "offset $offset - $string"
-	}
-    }
-    return $c
-}
-proc ::fileutil::magic::rt::L {newlevel} {
-    # Regenerate level information in the calling context.
-    upvar 1 level l ; set l $newlevel
-    return
-}
-
-proc ::fileutil::magic::rt::I {base type delta} {
-    # Handling of base locations specified indirectly through the
-    # contents of the inspected file.
-
-    variable typemap
-    foreach {size scan} $typemap($type) break
-    return [expr {[Fetch $base $size $scan] + $delta}]
-}
-
-proc ::fileutil::magic::rt::R {base} {
-    # Handling of base locations specified relative to the end of the
-    # last field one level above.
-
-    variable last   ; # Remembered locations.
-    upvar 1 level l ; # The level to get data from.
-    return [expr {$last($l) + $base}]
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Retrieval of the data used in comparisons.
-
-# fetch and cache a numeric value from the file
-proc ::fileutil::magic::rt::Fetch {where what scan} {
-    variable cache
-    variable numeric
-    variable fd
-
-    if {![info exists cache($where,$what,$scan)]} {
-	::seek $fd $where
-	binary scan [::read $fd $what] $scan numeric
-	set cache($where,$what,$scan) $numeric
-
-	# Optimization: If we got 4 bytes, i.e. long we implicitly
-	# know the short and byte data as well. Should put them into
-	# the cache. -- Profile: How often does such an overlap truly
-	# happen ?
-
-    } else {
-	set numeric $cache($where,$what,$scan)
-    }
-    return $numeric
-}
-
-proc ::fileutil::magic::rt::GetString {offset len} {
-    # We have the first 1k of the file cached
-    variable string
-    variable strbuf
-    variable fd
-
-    set end [expr {$offset + $len - 1}]
-    if {$end < 4096} {
-	# in the string cache, copy the requested part.
-	set string [::string range $strbuf $offset $end]
-    } else {
-	# an unusual one, move to the offset and read directly from
-	# the file.
-	::seek $fd $offset
-	set string [::read $fd $len]
-    }
-    return $string
-}
-
-# ### ### ### ######### ######### #########
-## Internal, debugging.
-
-if {!$::fileutil::magic::rt::debug} {
-    # This procedure definition is optimized out of using code by the
-    # core bcc. It knows that neither argument checks are required,
-    # nor is anything done. So neither results, nor errors are
-    # possible, a true no-operation.
-    proc ::fileutil::magic::rt::Debug {args} {}
-
-} else {
-    proc ::fileutil::magic::rt::Debug {script} {
-	# Run the commands in the debug script. This usually generates
-	# some output. The uplevel is required to ensure the proper
-	# resolution of all variables found in the script.
-	uplevel 1 $script
-	return
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Initialize constants
-
-namespace eval ::fileutil::magic::rt {
-    # maps magic typenames to field characteristics: size (#byte),
-    # binary scan format
-
-    variable typemap
-}
-
-proc ::fileutil::magic::rt::Init {} {
-    variable typemap
-    global tcl_platform
-
-    # Set the definitions for all types which have their endianess
-    # explicitly specified n their name.
-
-    array set typemap {
-	byte    {1 c}  ubyte    {1 c}
-	beshort {2 S}  ubeshort {2 S}
-	leshort {2 s}  uleshort {2 s}
-	belong  {4 I}  ubelong  {4 I}
-	lelong  {4 i}  ulelong  {4 i}  
-	bedate  {4 S}  ledate   {4 s}
-	beldate {4 I}  leldate  {4 i}
-
-	long  {4 Q} ulong  {4 Q} date  {4 Q} ldate {4 Q}
-	short {2 Y} ushort {2 Y}
-    }
-
-    # Now set the definitions for the types without explicit
-    # endianess. They assume/use 'native' byteorder. We also put in
-    # special forms for the compiler, so that it can use short names
-    # for the native-endian types as well.
-
-    # generate short form names
-    foreach {n v} [array get typemap] {
-	foreach {len scan} $v break
-	#puts stderr "Adding $scan - [list $len $scan]"
-	set typemap($scan) [list $len $scan]
-    }
-
-    # The special Q and Y short forms are incorrect, correct now to
-    # use the proper native endianess.
-
-    if {$tcl_platform(byteOrder) eq "littleEndian"} {
-	array set typemap {Q {4 i} Y {2 s}}
-    } else {
-	array set typemap {Q {4 I} Y {2 S}}
-    }
-}
-
-::fileutil::magic::rt::Init
-# ### ### ### ######### ######### #########
-## Ready for use.
-
-package provide fileutil::magic::rt 1.0
-# EOF
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/dacceptor.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/dacceptor.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,166 +1,0 @@
-# -*- tcl -*-
-# Grammar / Finite Automatons / Acceptance checker, DFA only
-
-# ### ### ### ######### ######### #########
-## Package description
-
-## A class whose instances take a FA and are able to check strings of
-## symbols for acceptance. This class is restricted to deterministic
-## FAs. The FA can be either a reference to some external FA container
-## object, or a copy of such. The latter makes the acceptor impervious
-## to changes in the original definition.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit        ; # Tcllib | OO system used
-package require struct::set ; # Tcllib | Extended set operations.
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::grammar::fa::dacceptor {
-    # ### ### ### ######### ######### #########
-    ## Type API. 
-
-    # ### ### ### ######### ######### #########
-    ## Instance API.
-
-    #constructor {fa args} {}
-    #destructor  {}
-
-    method accept? {symbolstring} {}
-
-    option -any     {}
-
-    # ### ### ### ######### ######### #########
-    ## Internal data structures.
-
-    ## We take the relevant information from the FA specified during
-    ## construction, i.e. start state, final states, and transition
-    ## table in form for direct indexing and keep it local. No need to
-    ## access or even the full FA. We require a deterministic one, and
-    ## will complete it, if necessary.
-
-    variable start ; # Name of start state.
-    variable final ; # Array, existence = state is final.
-    variable trans ; # Transition array: state x symbol -> state
-    variable sym   ; # Symbol set (as array), for checking existence.
-    variable any   ; # Symbol to map any unknown symbol to. If not
-    #              ; # specified (eq "") then unknown symbols will  cause non-
-    #              ; # acceptance.
-    variable stop  ; # Stop state, causing immediate non-acceptance when entered.
-
-    # ### ### ### ######### ######### #########
-    ## Instance API Implementation.
-
-    constructor {fa args} {
-	set any {}
-	$self configurelist $args
-
-	if {![$fa is deterministic]} {
-	    return -code error "Source FA is not deterministic"
-	}
-	if {($any ne "") && ![$fa symbol exists $any]} {
-	    return -code error "Chosen any symbol \"$any\" does not exist"
-	}
-
-	if {![$fa is complete]} {
-	    set istmp 1
-	    set tmp [grammar::fa ${selfns}::fa = $fa]
-	    set before [$tmp states]
-	    $tmp complete
-	    # Our sink is a stop state.
-	    set stop [struct::set difference [$tmp states] $before]
-	} else {
-	    set istmp 0
-	    set tmp $fa
-	    # We don't know if there is a sink, so no quickstop.
-	    set stop {}
-	}
-
-	set start [lindex [$tmp startstates] 0]
-	foreach s [$tmp finalstates]        {set final($s) .}
-	foreach s [set syms [$tmp symbols]] {set sym($s) .}
-
-	foreach s [$tmp states] {
-	    foreach sy $syms {
-		set trans($s,$sy) [lindex [$tmp next $s $sy] 0]
-	    }
-	}
-
-	if {$istmp} {$tmp destroy}
-	return
-    }
-
-    #destructor {}
-
-    onconfigure -any {value} {
-	set options(-any) $value
-	set any           $value
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method accept? {symbolstring} {
-	set state $start
-
-	## puts "\n====================== ($symbolstring)"
-
-	if {$any eq ""} {
-	    # No any mapping of unknown symbols.
-
-	    foreach sy $symbolstring {
-		if {![info exists sym($sy)]} {
-		    # Bad symbol in input. String is not accepted,
-		    # abort immediately.
-		    ## puts " \[$state\] -- Unknown symbol ($sy)"
-		    return 0
-		}
-
-		## puts " \[$state\] --($sy)--> "
-
-		set state $trans($state,$sy)
-		# state == "" cannot happen, as our FA is complete.
-		if {$state eq $stop} {
-		    # This is a known sink, we can stop processing input now.
-		    ## puts " \[$state\] FULL STOP"
-		    return 0
-		}
-	    }
-
-	} else {
-	    # Mapping of unknown symbols to any.
-
-	    foreach sy $symbolstring {
-		if {![info exists sym($sy)]} {set sy $any}
-		## puts " \[$state\] --($sy)--> "
-		set state $trans($state,$sy)
-		# state == "" cannot happen, as our FA is complete.
-		if {$state eq $stop} {
-		    # This is a known sink, we can stop processing input now.
-		    ## puts " \[$state\] FULL STOP"
-		    return 0
-		}
-	    }
-	}
-
-	## puts " \[$state\][expr {[info exists final($state)] ? " ACCEPT" : ""}]"
-
-	return [info exists final($state)]
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Type API implementation.
-
-    # ### ### ### ######### ######### #########
-    ## Type Internals.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::fa::dacceptor 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/dexec.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/dexec.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,188 +1,0 @@
-# -*- tcl -*-
-# Grammar / Finite Automatons / Executor, DFA only
-
-# ### ### ### ######### ######### #########
-## Package description
-
-## Instances take a DFA, keep a current state and update it in
-## reaction incoming symbols. Notable events are reported via
-## callback. Currently notable: Reset, reached a final state,
-# reached an error.
-
-## From the above description it should be clear that this class is
-## run in a push fashion. If not the last sentence has made this
-## explicit, right ? Right!
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit   ; # Tcllib | OO system used
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::grammar::fa::dexec {
-    # ### ### ### ######### ######### #########
-    ## Type API. 
-
-    # ### ### ### ######### ######### #########
-    ## Instance API.
-
-    #constructor {fa args} {}
-    #destructor  {}
-
-    method reset {} {}
-    method put  {sy} {}
-    method state {} {}
-
-    option -command {}
-    option -any     {}
-
-    # ### ### ### ######### ######### #########
-    ## Internal data structures.
-
-    ## We take the relevant information from the FA specified during
-    ## construction, i.e. start state, final states, and transition
-    ## table in form for direct indexing and keep it local. No need to
-    ## access or even the full FA. We require a deterministic one, and
-    ## will complete it, if necessary.
-
-    variable start ; # Name of start state.
-    variable final ; # Array, existence = state is final.
-    variable trans ; # Transition array: state x symbol -> state
-    variable sym   ; # Symbol set (as array), for checking existence.
-    variable cmd   ; # Command to call for various events. Required.
-    variable any   ; # Symbol to map any unknown symbol to. If not
-    #              ; # specified (eq "") then unknown symbols will  cause non-
-    #              ; # acceptance.
-    variable curr  ; # State the underlying DFA is currently in.
-    variable inerr ; # Boolean flag. Set if an error was reached.
-
-
-    # ### ### ### ######### ######### #########
-    ## Instance API Implementation.
-
-    constructor {fa args} {
-	set any {}
-	set cmd {}
-	$self configurelist $args
-
-	if {![$fa is deterministic]} {
-	    return -code error "Source FA is not deterministic"
-	}
-	if {($any ne "") && ![$fa symbol exists $any]} {
-	    return -code error "Chosen any symbol \"$any\" does not exist"
-	}
-	if {![llength $cmd]} {
-	    return -code error "Command callback missing"
-	}
-
-	# In contrast to the acceptor we do not complete the FA. We
-	# will later report BADTRANS errors instead if a non-existing
-	# transition is attempted. For the acceptor it made sense as
-	# it made the accept/!accept decision easier. However here for
-	# the generic execution it is unreasonable interference with
-	# whatever higher levels might wish to do when encountering
-	# this.
-
-	set start [lindex [$fa startstates] 0]
-	foreach s [$fa finalstates]        {set final($s) .}
-	foreach s [set syms [$fa symbols]] {set sym($s) .}
-
-	foreach s [$fa states] {
-	    foreach sy [$fa symbols@ $s] {
-		set trans($s,$sy) [lindex [$fa next $s $sy] 0]
-	    }
-	}
-
-	$self reset
-	return
-    }
-
-    #destructor {}
-
-    onconfigure -command {value} {
-	set options(-command) $value
-	set cmd               $value
-	return
-    }
-
-    onconfigure -any {value} {
-	set options(-any) $value
-	set any           $value
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method reset {} {
-	set curr  $start
-	set inerr 0
-	## puts -nonewline " \[$curr\]" ; flush stdout
-
-	uplevel #0 [linsert $cmd end \
-		reset]
-	return
-    }
-
-    method state {} {
-	return $curr
-    }
-
-    method put {sy} {
-	if {$inerr} return
-	## puts " --($sy)-->"
-
-	if {![info exists sym($sy)]} {
-	    if {$any eq ""} {
-		# No any mapping of unknown symbols, report as error
-		## puts " BAD SYMBOL"
-
-		set inerr 1
-		uplevel #0 [linsert $cmd end \
-			error BADSYM "Bad symbol \"$sy\""]
-		return
-	    } else {
-		# Mapping of unknown symbols to any.
-		set sy $any
-	    }
-	}
-
-	if {[catch {
-	    set new $trans($curr,$sy)
-	}]} {
-	    ## puts " NO DESTINATION"
-	    set inerr 1
-	    uplevel #0 [linsert $cmd end \
-		    error BADTRANS "Bad transition (\"$curr\" \"$sy\"), no destination"]
-	    return
-	}
-	set curr $new
-	
-	uplevel #0 [linsert $cmd end \
-		state $curr]
-	
-	## puts -nonewline " \[$curr\]" ; flush stdout
-
-	if {[info exists final($curr)]} {
-	    ## puts -nonewline " FINAL" ; flush stdout
-
-	    uplevel #0 [linsert $cmd end \
-		    final $curr]
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Type API implementation.
-
-    # ### ### ### ######### ######### #########
-    ## Type Internals.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::fa::dexec 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/fa.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/fa.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1270 +1,0 @@
-# -*- tcl -*-
-# (c) 2004-1007 Andreas Kupries
-# Grammar / Finite Automatons / Container
-
-# ### ### ### ######### ######### #########
-## Package description
-
-## A class whose instances hold all the information describing a
-## single finite automaton (states, symbols, start state, set of
-## accepting states, transition function), and operations to define,
-## manipulate, and query this information.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::fa::op ; # Heavy FA operations.
-package require snit            ; # OO system in use
-package require struct::list    ; # Extended list operations.
-package require struct::set     ; # Extended set operations.
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::grammar::fa {
-    # ### ### ### ######### ######### #########
-    ## Type API. A number of operations on FAs
-
-    # ### ### ### ######### ######### #########
-    ## Instance API
-
-    #constructor {args} {}
-    #destructor  {}
-
-    method =   {b} {}
-    method --> {b} {}
-
-    method serialize {} {}
-    method deserialize {value} {}
-    method deserialize_merge {value} {}
-
-    method states {} {}
-    method state {cmd s args} {}
-
-    method startstates {} {}
-    method start?      {s} {}
-    method start?set   {states} {}
-    method start       {cmd args} {}
-
-    method finalstates {} {}
-    method final?      {s} {}
-    method final?set   {states} {}
-    method final       {cmd args} {}
-
-    method symbols     {} {}
-    method symbols@    {state} {}
-    method symbols@set {states} {}
-    method symbol      {cmd sym} {}
-
-    method next  {s sym args} {}
-    method !next {s sym args} {}
-    method nextset {states sym} {}
-
-    method is {cmd} {}
-
-    method reachable_states   {} {}
-    method unreachable_states {} {}
-    method reachable          {s} {}
-
-    method useful_states   {} {}
-    method unuseful_states {} {}
-    method useful          {s} {}
-
-    method epsilon_closure {s} {}
-
-    method clear {} {}
-
-    # ### ### ### ######### ######### #########
-    ## Instance API. Complex FA operations.
-    ## The heavy lifting is done by the operations package.
-
-    method reverse    {}                          {op::reverse    $self}
-    method complete   {{sink {}}}                 {op::complete   $self $sink}
-    method remove_eps {}                          {op::remove_eps $self}
-    method trim       {{what !reachable|!useful}} {op::trim       $self $what}
-    method complement {}                          {op::complement $self}
-    method kleene     {}                          {op::kleene     $self}
-    method optional   {}                          {op::optional   $self}
-    method fromRegex  {regex {over {}}}           {op::fromRegex  $self $regex $over}
-
-    method determinize {{mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::determinize $self map
-    }
-
-    method minimize {{mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::minimize $self map
-    }
-
-    method union {fa {mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::union $self $fa map
-    }
-
-    method intersect {fa {mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::intersect $self $fa map
-    }
-
-    method difference {fa {mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::difference $self $fa map
-    }
-
-    method concatenate {fa {mapvar {}}} {
-	if {$mapvar ne ""} {upvar 1 $mapvar map}
-	op::concatenate $self $fa map
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal data structures.
-
-    ## State information:
-    ## - Order    : Defined for all states, values provide creation order.
-    ## - Start    : Defined for states which are "start" (Input processing begins in).
-    ## - Final    : Defined for states which are "final" ("accept" input).
-    ## - Transinv : Inverse transitions. Per state the set of (state,sym)'s
-    ##              which have transitions into the state. Defined only for
-    ##              states which have inbound transitions.
-    ##
-    ## Transinv is maintained to make state deletion easier: Direct
-    ## access to the states and transitions which are inbound, for
-    ## their deletion.
-
-    variable order        ; # Map : State -> Order of creation
-    variable final        ; # Map : State -> .   Exists <=> Is a final State
-    variable start        ; # Map : State -> .   Exists <=> Is a start State
-    variable transinv     ; # Map : State -> {(State, Sym)}
-
-    ## Global information:
-    ## - Scount     : Counter for creation order of states.
-
-    variable scount     0  ; # Counter for orderering states.
-
-    ## Symbol information:
-    ## - Symbol : Defined for all symbols, values irrelevant.
-
-    variable symbol       ; # Map : Symbol -> . Exists = Symbol declared.
-
-    ## Transition data:
-    ## - TransN  : Dynamically created instance variables. Transition tables
-    ##             for single states. Defined only for states which have
-    ##             transitions.
-    ## - Transym : List of states having transitions on that symbol.
-
-    ## Transym is maintained for symbol deletion. Direct access to the transitions
-    ## we have to delete as well.
-
-    ## selfns::trans_$order(state) : Per state map : symbol -> list of destinations.
-    variable transym      ; # Map : Sym -> {State}
-
-    ## Derived information:
-    ## - Reach       : Cache for set of states reachable from start.
-    ## - Reachvalid  : Boolean flag. True iff the reach cache contains valid data
-    ## - Useful      : Cache for set of states able to reach final.
-    ## - Usefulvalid : Boolean flag. True iff the useful cache contains valid data
-    ## - Nondete     : Set of states which are non-deterministic, because they have
-    #                  epsilon-transitions.
-    # -  EC          : Cache of epsilon-closures
-
-    variable reach      {} ; # Set of states reachable from 'start'.
-    variable reachvalid 0  ; # Boolean flag, if 'reach' is valid.
-
-    variable useful      {} ; # Set of states able to reach 'final'.
-    variable usefulvalid 0  ; # Boolean flag, if 'useful' is valid.
-
-    variable nondete    {} ; # Set of non-deterministic states, by epsilon/non-epsilon.
-    variable nondets       ; # Per non-det state the set of symbols it is non-det in.
-
-    variable ec            ; # Cache of epsilon-closures for states.
-
-
-    # ### ### ### ######### ######### #########
-    ## Instance API Implementation.
-
-    constructor {args} {
-	set alen [llength $args]
-	if {($alen != 2) && ($alen != 0) && ($alen != 3)} {
-	    return -code error "wrong#args: $self ?=|:=|<--|as|deserialize a'|fromRegex re ?over??"
-	}
-
-	array set order    {} ; set nondete     {}
-	array set start    {} ; set scount      0
-	array set final    {} ; set reach       {}
-	array set symbol   {} ; set reachvalid  0
-	array set transym  {} ; set useful      {}
-	array set transinv {} ; set usefulvalid 0
-	array set nondets  {}
-	array set ec       {}
-
-	if {$alen == 0} return
-
-	foreach {cmd object} $args break
-	switch -exact -- $cmd {
-	    = - := - <-- - as {
-		if {$alen != 2} {
-		    return -code error "wrong#args: $self ?=|:=|<--|as|deserialize a'|fromRegex re ?over??"
-		}
-		$self = $object
-	    }
-	    deserialize {
-		if {$alen != 2} {
-		    return -code error "wrong#args: $self ?=|:=|<--|as|deserialize a'|fromRegex re ?over??"
-		}
-		# Object is actually a value, the deserialization to use.
-		$self deserialize $object
-	    }
-	    fromRegex {
-		# Object is actually a value, the regular expression to use.
-		if {$alen == 2} {
-		    $self fromRegex $object
-		} else {
-		    $self fromRegex $object [lindex $args 2]
-		}
-	    }
-	    default {
-		return -code error "bad assignment: $self ?=|:=|<--|as|deserialize a'|fromRegex re ?over??"
-	    }
-	}
-	return
-    }
-
-    # destructor {}
-
-    # --- --- --- --------- --------- ---------
-
-    method = {b} {
-	$self deserialize [$b serialize]
-    }
-
-    method --> {b} {
-	$b deserialize [$self serialize]
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method serialize {} {
-	set ord {}
-	foreach {s n} [array get order] {
-	    lappend ord [list $s $n]
-	}
-	set states {} ; # Dictionary
-	foreach item [lsort -index 1 -integer -increasing $ord] {
-	    set s [lindex $item 0]
-	    set sdata {}
-
-	    # Dict data per state :
-
-	    lappend sdata [info exists start($s)]
-	    lappend sdata [info exists final($s)]
-
-	    # Transitions from the state.
-
-	    upvar #0 ${selfns}::trans_$order($s) jump
-
-	    if {![info exists jump]} {
-		lappend sdata {}
-	    } else {
-		lappend sdata [array get jump]
-	    }
-
-	    # ----------------------
-	    lappend states $s $sdata
-	}
-
-	return [::list \
-		grammar::fa \
-		[array names symbol] \
-		$states \
-		]
-    }
-
-    method deserialize {value} {
-	$self CheckSerialization $value st states acc tr newsymbols
-	$self clear
-
-	foreach s   $states     {set order($s)    [incr scount]}
-	foreach sym $newsymbols {set symbol($sym) .}
-	foreach s   $acc        {set final($s)    .}
-	foreach s   $st         {set start($s)    .}
-
-	foreach {sa sym se} $tr {$self Next $sa $sym $se}
-	return
-    }
-
-    method deserialize_merge {value} {
-	$self CheckSerialization $value st states acc tr newsymbols
-
-	foreach s   $states     {set order($s)    [incr scount]}
-	foreach sym $newsymbols {set symbol($sym) .}
-	foreach s   $acc        {set final($s)    .}
-	foreach s   $st         {set start($s)    .}
-
-	foreach {sa sym se} $tr {$self Next $sa $sym $se}
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method states {} {
-	return [array names order]
-    }
-
-    method state {cmd s args} {
-	switch -exact -- $cmd {
-	    add {
-		set args [linsert $args 0 $s]
-		foreach s $args {
-		    if {[info exists order($s)]} {
-			return -code error "State \"$s\" is already known"
-		    }
-		}
-		foreach s $args {set order($s) [incr scount]}
-		return
-	    }
-	    delete {
-		set args [linsert $args 0 $s]
-		$self StateCheckSet $args
-
-		foreach s $args {
-		    unset -nocomplain start($s)                   ; # Start/Initial indicator
-		    unset -nocomplain final($s)                   ; # Final/Accept indicator
-
-		    # Remove all inbound transitions.
-		    if {[info exists transinv($s)]} {
-			set src $transinv($s)
-			unset    transinv($s)
-
-			foreach srcitem $src {
-			    struct::list assign $srcitem sin sym
-			    $self !Next $sin $sym $s
-			}
-		    }
-
-		    # We remove transition data only after the inbound
-		    # ones. Otherwise we screw up the removal of
-		    # looping transitions. We have to consider the
-		    # backpointers to us in transinv as well.
-
-		    upvar #0  ${selfns}::trans_$order($s) jump
-		    if {[info exists jump]} {
-			foreach sym [array names jump] {
-			    $self !Transym $s $sym
-			    foreach nexts $jump($sym) {
-				$self !Transinv $s $sym $nexts
-			    }
-			}
-
-			unset ${selfns}::trans_$order($s) ; # Transitions from s
-		    }
-		    unset order($s)                               ; # State ordering
-
-		    # Removal of a state may break the automaton into
-		    # disconnected pieces. This means that the set of
-		    # reachable and useful states may change, and the
-		    # cache cannot be used from now on.
-
-		    $self InvalidateReach
-		    $self InvalidateUseful
-		}
-		return
-	    }
-	    rename {
-		set alen [llength $args]
-		if {($alen != 1)} {
-		    return -code error "wrong#args: [list $self] state rename s s'"
-		}
-		$self StateCheck $s
-		set snew [lindex $args 0]
-		if {[info exists order($snew)]} {
-		    return -code error "State \"$snew\" is already known"
-		}
-
-		set o $order($s)
-		unset order($s)                               ; # State ordering
-		set   order($snew) $o
-
-                # Start/Initial indicator
-		if {[info exists start($s)]} {
-		    set   start($snew) $start($s)
-		    unset start($s)
-		}
-                # Final/Accept indicator
-		if {[info exists final($s)]} {
-		    set   final($snew) $final($s)
-		    unset final($s)
-		}
-		# Update all inbound transitions.
-		if {[info exists transinv($s)]} {
-		    set   transinv($snew) $transinv($s)
-		    unset transinv($s)
-
-		    # We have to perform a bit more here. We have to
-		    # go through the inbound transitions and chane the
-		    # listed destination state to the new name.
-
-		    foreach srcitem $transinv($snew) {
-			struct::list assign $srcitem sin sym
-			upvar #0 ${selfns}::trans_$order($sin) jump
-			upvar 0 jump($sym) destinations
-			set pos [lsearch -exact $destinations $s]
-			set destinations [lreplace $destinations $pos $pos $snew]
-		    }
-		}
-
-		# Another place to change are the back pointers from
-		# all the states we have transitions to, i.e. transinv
-		# for all outbound states.
-
-		upvar #0 ${selfns}::trans_$o jump
-		if {[info exists jump]} {
-		    foreach sym [array names jump] {
-			foreach sout $jump($sym) {
-			    upvar 0 transinv($sout) backpointer
-			    set pos [lsearch -exact $backpointer [list $s $sym]]
-			    set backpointer [lreplace $backpointer $pos $pos [list $snew $sym]]
-			}
-
-			# And also to update: Transym information for the symbol.
-			upvar 0 transym($sym) users
-			set pos [lsearch -exact $users $s]
-			set users [lreplace $users $pos $pos $snew]
-		    }
-		}
-
-		# Changing the name of a state does not change the
-		# reachables / useful states per se. We just may have
-		# to replace the name in the caches as well.
-
-		# - Invalidation will do the same, at the expense of a
-		# - larger computation later.
-
-		$self InvalidateReach
-		$self InvalidateUseful
-	    }
-	    exists {
-		set alen [llength $args]
-		if {$alen != 0} {
-		    return -code error "wrong#args: [list $self] state exists s"
-		}
-		return [info exists order($s)]
-	    }
-	    default {
-		return -code error "Expected add, exists, delete, or rename, got \"$cmd\""
-	    }
-	}
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method startstates {} {
-	return [array names start]
-    }
-
-    method start? {s} {
-	$self StateCheck $s
-	return [info exists start($s)]
-    }
-
-    method start?set {states} {
-	$self StateCheckSet $states
-	foreach s $states {
-	    if {[info exists start($s)]} {return 1}
-	}
-	return 0
-    }
-
-    method start {cmd args} {
-	# Note: Adding or removing start states does not change
-	# usefulness, only reachability
-	switch -exact -- $cmd {
-	    add {
-		if {[llength $args] < 1} {
-		    return -code error "wrong#args: start add state ..."
-		}
-		$self StateCheckSet $args
-		foreach s $args {set start($s) .}
-		$self InvalidateReach
-	    }
-	    set {
-		if {[llength $args] != 1} {
-		    return -code error "wrong#args: start set states"
-		}
-		set states [lindex $args 0]
-		$self StateCheckSet $states
-		array unset start
-		foreach s $states {set start($s) .}
-		$self InvalidateReach
-	    }
-	    remove {
-		if {[llength $args] < 1} {
-		    return -code error "wrong#args: start remove state ..."
-		}
-		$self StateCheckSet $args
-		foreach s $args {
-		    unset -nocomplain start($s)
-		}
-		$self InvalidateReach
-	    }
-	    clear {
-		if {[llength $args] != 0} {
-		    return -code error "wrong#args: start clear"
-		}
-		array unset start
-		$self InvalidateReach
-	    }
-	    default {
-		return -code error "Expected add, clear, remove, or set, got \"$cmd\""
-	    }
-	}
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method finalstates {} {
-	return [array names final]
-    }
-
-    method final? {s} {
-	$self StateCheck $s
-	return [info exists final($s)]
-    }
-
-    method final?set {states} {
-	$self StateCheckSet $states
-	foreach s $states {
-	    if {[info exists final($s)]} {return 1}
-	}
-	return 0
-    }
-
-    method final {cmd args} {
-	# Note: Adding or removing start states does not change
-	# reachability, only usefulness
-	switch -exact -- $cmd {
-	    add {
-		if {[llength $args] < 1} {
-		    return -code error "wrong#args: final add state ..."
-		}
-		$self StateCheckSet $args
-		foreach s $args {set final($s) .}
-		$self InvalidateUseful
-	    }
-	    set {
-		if {[llength $args] != 1} {
-		    return -code error "wrong#args: final set states"
-		}
-		set states [lindex $args 0]
-		$self StateCheckSet $states
-		array unset final
-		foreach s $states {set final($s) .}
-		$self InvalidateReach
-	    }
-	    remove {
-		if {[llength $args] < 1} {
-		    return -code error "wrong#args: final remove state ..."
-		}
-		$self StateCheckSet $args
-		foreach s $args {
-		    unset -nocomplain final($s)
-		}
-		$self InvalidateUseful
-	    }
-	    clear {
-		if {[llength $args] != 0} {
-		    return -code error "wrong#args: final clear"
-		}
-		array unset final
-		$self InvalidateReach
-	    }
-	    default {
-		return -code error "Expected add, clear, remove, or set, got \"$cmd\""
-	    }
-	}
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method symbols {} {
-	return [array names symbol]
-    }
-
-    method symbols@ {s {t {}}} {
-	$self StateCheck $s
-	if {$t ne ""} {	$self StateCheck $t}
-	upvar #0 ${selfns}::trans_$order($s) jump
-	if {![info exists jump]} {return {}}
-	if {$t eq ""} {
-	    # No destination, all symbols.
-	    return [array names jump]
-	}
-	# Specific destination, locate the symbols going there.
-	set result {}
-	foreach sym [array names jump] {
-	    if {[lsearch -exact $jump($sym) $t] < 0} continue
-	    lappend result $sym
-	}
-	return [lsort -uniq $result]
-    }
-
-    method symbols@set {states} {
-	# Union (fa symbol@ s, f.a. s in states)
-
-	$self StateCheckSet $states
-	set result {}
-	foreach s $states {
-	    upvar #0 ${selfns}::trans_$order($s) jump
-	    if {![info exists jump]} continue
-	    foreach sym [array names jump] {
-		lappend result $sym
-	    }
-	}
-	return [lsort -uniq $result]
-    }
-
-    method symbol {cmd sym args} {
-	switch -exact -- $cmd {
-	    add {
-		set args [linsert $args 0 $sym]
-		foreach sym $args {
-		    if {$sym eq ""} {
-			return -code error "Cannot add illegal empty symbol \"\""
-		    }
-		    if {[info exists symbol($sym)]} {
-			return -code error "Symbol \"$sym\" is already known"
-		    }
-		}
-		foreach sym $args {set symbol($sym) .}
-	    }
-	    delete {
-		set args [linsert $args 0 $sym]
-		$self SymbolCheckSetNE $args
-		foreach sym $args {
-		    unset symbol($sym)
-
-		    # Delete all transitions using the removed symbol.
-
-		    if {[info exists transym($sym)]} {
-			foreach s $transym($sym) {
-			    $self !Next $s $sym
-			}
-		    }
-		}
-	    }
-	    rename {
-		set alen [llength $args]
-		if {$alen != 1} {
-		    return -code error "wrong#args: [list $self] symbol rename sym newsym"
-		}
-		$self SymbolCheckNE $sym
-		set newsym [lindex $args 0]
-
-		if {$newsym eq ""} {
-		    return -code error "Cannot add illegal empty symbol \"\""
-		}
-		if {[info exists symbol($newsym)]} {
-		    return -code error "Symbol \"$newsym\" is already known"
-		}
-
-		unset symbol($sym)
-		set symbol($newsym) .
-
-		if {[info exists transym($sym)]} {
-		    set   transym($newsym) [set states $transym($sym)]
-		    unset transym($sym)
-
-		    foreach s $states {
-			# Update the jump tables for each of the states
-			# using this symbol, and the reverse tables as
-			# well.
-
-			upvar #0 ${selfns}::trans_$order($s) jump
-			set   jump($newsym) [set destinations $jump($sym)]
-			unset jump($sym)
-
-			foreach sd $destinations {
-			    upvar 0 transinv($sd) backpointer
-			    set pos [lsearch -exact $backpointer [list $s $sym]]
-			    set backpointer [lreplace $backpointer $pos $pos [list $s $newsym]]
-			}
-		    }
-		}
-	    }
-	    exists {
-		set alen [llength $args]
-		if {$alen != 0} {
-		    return -code error "wrong#args: [list $self] symbol exists sym"
-		}
-		return [info exists symbol($sym)]
-	    }
-	    default {
-		return -code error "Expected add, delete, exists, or rename, got \"$cmd\""
-	    }
-	}
-	return
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method next {s sym args} {
-	## Split into checking and functionality ...
-
-	set alen [llength $args]
-	if {($alen != 2) && ($alen != 0)} {
-	    return -code error "wrong#args: [list $self] next s sym ?--> s'?"
-	}
-	$self StateCheck  $s
-	$self SymbolCheck $sym
-
-	if {($alen == 2) && [set cmd [lindex $args 0]] ne "-->"} {
-	    return -code error "Expected -->, got \"$cmd\""
-	}
-
-	if {$alen == 0} {
-	    # Query transition table.
-	    upvar #0 ${selfns}::trans_$order($s) jump
-	    if {![info exists jump($sym)]} {return {}}
-	    return $jump($sym)
-	}
-
-	set nexts [lindex $args 1]
-	$self StateCheck $nexts
-
-	upvar #0 ${selfns}::trans_$order($s) jump
-	if {[info exists jump($sym)] && [struct::set contains $jump($sym) $nexts]} {
-	    return -code error "Transition \"($s, ($sym)) --> $nexts\" is already known"
-	}
-
-	$self Next $s $sym $nexts
-	return
-    }
-
-    method !next {s sym args} {
-	set alen [llength $args]
-	if {($alen != 2) && ($alen != 0)} {
-	    return -code error "wrong#args: [list $self] !next s sym ?--> s'?"
-	}
-	$self StateCheck  $s
-	$self SymbolCheck $sym
-
-	if {$alen == 2} {
-	    if {[lindex $args 0] ne "-->"} {
-		return -code error "Expected -->, got \"[lindex $args 0]\""
-	    }
-	    set nexts [lindex $args 1]
-	    $self StateCheck $nexts
-	    $self !Next $s $sym $nexts
-	} else {
-	    $self !Next $s $sym
-	}
-    }
-
-    method nextset {states sym} {
-	$self SymbolCheck   $sym
-	$self StateCheckSet $states
-
-	set result {}
-	foreach s $states {
-	    upvar #0 ${selfns}::trans_$order($s) jump
-	    if {![info exists jump($sym)]} continue
-	    struct::set add result $jump($sym)
-	}
-	return $result
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method is {cmd} {
-	switch -exact -- $cmd {
-	    complete {
-		# The FA is complete if Trans(State, Sym) != {} for all
-		# states and symbols (Not counting epsilon transitions).
-		# Without symbols the FA is deemed complete. Note:
-		# States with epsilon transitions can use symbols
-		# indirectly! Need their closures for exact
-		# computation.
-
-		set nsymbols [llength [array names symbol]]
-		if {$nsymbols == 0} {return 1}
-		foreach s [array names order] {
-		    upvar #0 ${selfns}::trans_$order($s) jump
-		    if {![info exists jump]} {return 0}
-		    set njsym [array size jump]
-		    if {[info exists jump()]} {
-			set  njsym [llength [$self symbols@set [$self epsilon_closure $s]]]
-			incr njsym -1
-		    }
-		    if {$njsym != $nsymbols}  {return 0}
-		}
-		return 1
-	    }
-	    deterministic {
-		# The FA is deterministic if it has on start state, no
-		# epsilon transitions, and the transition function is
-		# State x Symbol -> State, and not
-		# State x Symbol -> P(State).
-
-		return [expr {
-		    ([array size start] == 1) &&
-		    ![llength $nondete] &&
-		    ![array size nondets]
-		}] ;#{}
-	    }
-	    epsilon-free {
-		# FA is epsion-free if there are no states having epsilon transitions.
-		return [expr {![llength $nondete]}]
-	    }
-	    useful {
-		# The FA is useful if and only if we have states and
-		# all states are reachable and useful.
-
-		set states [$self states]
-		return [expr {
-		    [struct::set size $states] &&
-		    [struct::set equal $states [$self reachable_states]] &&
-		    [struct::set equal $states [$self useful_states]]
-		}] ;# {}
-	    }
-	}
-	return -code error "Expected complete, deterministic, epsilon-free, or useful, got \"$cmd\""
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method reachable_states {} {
-	if {$reachvalid} {return $reach}
-	if {![array size start]} {
-	    set reach {}
-	} else {
-	    # Basic algorithm like for epsilon_closure, except that we
-	    # process all transitions, not only epsilons, and that
-	    # the initial state is fixed to start.
-
-	    set reach   [array names start]
-	    set pending $reach
-	    array set visited {}
-	    while {[llength $pending]} {
-		set s [struct::list shift pending]
-		if {[info exists visited($s)]} continue
-		set visited($s) .
-		upvar #0 ${selfns}::trans_$order($s) jump
-		if {![info exists jump]} continue
-		if {![array size  jump]} continue
-		foreach sym [array names jump] {
-		    struct::set add reach   $jump($sym)
-		    struct::set add pending $jump($sym)
-		}
-	    }
-	}
-	set reachvalid 1
-	return $reach
-    }
-
-    method unreachable_states {} {
-	# unreachable = states - reachables
-	return [struct::set difference \
-		[$self states] [$self reachable_states]]
-    }
-
-    method reachable {s} {
-	$self StateCheck $s
-	return [struct::set contains [$self reachable_states] $s]
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method useful_states {} {
-	if {$usefulvalid} {return $useful}
-
-	# A state is useful if a final state
-	# can be reached from it.
-
-	if {![array size final]} {
-	    set useful {}
-	} else {
-	    # Basic algorithm like for epsilon_closure, except that we
-	    # process all transitions, not only epsilons, and that
-	    # the initial set of states is fixed to final.
-
-	    set useful      [array names final]
-	    array set known [array get final]
-	    set pending $useful
-	    array set visited {}
-	    while {[llength $pending]} {
-		set s [struct::list shift pending]
-		if {[info exists visited($s)]} continue
-		set visited($s) .
-
-		# All predecessors are useful, and have to be visited as well.
-		# We get the predecessors from the transinv structure.
-
-		if {![info exists transinv($s)]} continue
-		foreach before $transinv($s) {
-		    set before [lindex $before 0]
-		    if {[info exists visited($before)]} continue
-		    lappend pending $before
-		    if {[info exists known($before)]} continue
-		    lappend useful $before
-		    set known($before) .
-		}
-	    }
-	}
-	set usefulvalid 1
-	return $useful
-    }
-
-    method unuseful_states {} {
-	# unuseful = states - useful
-	return [struct::set difference \
-		[$self states] [$self useful_states]]
-    }
-
-    method useful {s} {
-	$self StateCheck $s
-	return [struct::set contains [$self useful_states] $s]
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method epsilon_closure {s} {
-	# Iterative graph traversal. Keeps a set of states to look at,
-	# and adds to them everything it can reach from the current
-	# state via epsilon-transitions. Loops are handled through the
-	# visited array to weed out all the states already processed.
-
-	$self StateCheck $s
-
-	# Prefer cached information
-	if {[info exists ec($s)]} {
-	    return $ec($s)
-	}
-
-	set closure [list $s]
-	set pending [list $s]
-	array set visited {}
-	while {[llength $pending]} {
-	    set t [struct::list shift pending]
-	    if {[info exists visited($t)]} continue
-	    set visited($t) .
-	    upvar #0 ${selfns}::trans_$order($t) jump
-	    if {![info exists jump()]} continue
-	    struct::set add closure $jump()
-	    struct::set add pending $jump()
-	}
-	set ec($s) $closure
-	return $closure
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    method clear {} {
-	array unset order    ; set nondete     {}
-	array unset start    ; set scount      0
-	array unset final    ; set reach       {}
-	array unset symbol   ; set reachvalid  0
-	array unset transym  ; set useful      {}
-	array unset transinv ; set usefulvalid 0
-	array unset nondets
-	array unset ec
-
-	# Locate all 'trans_' arrays and remove them as well.
-
-	foreach v [info vars ${selfns}::trans_*] {
-	    unset $v
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Instance Internals.
-
-    method StateCheck {s} {
-	if {![info exists order($s)]} {
-	    return -code error "Illegal state \"$s\""
-	}
-    }
-
-    method StateCheckSet {states} {
-	foreach s $states {
-	    if {![info exists order($s)]} {
-		return -code error "Illegal state \"$s\""
-	    }
-	}
-    }
-
-    method SymbolCheck {sym} {
-	if {$sym eq ""} return
-	if {![info exists symbol($sym)]} {
-	    return -code error "Illegal symbol \"$sym\""
-	}
-    }
-
-    method SymbolCheckNE {sym} {
-	if {($sym eq "") || ![info exists symbol($sym)]} {
-	    return -code error "Illegal symbol \"$sym\""
-	}
-    }
-
-    if 0 {
-	# Unused. Activate when needed.
-	method SymbolCheckSet {symbols} {
-	    foreach sym $symbols {
-		if {$sym eq ""} continue
-		if {![info exists symbol($sym)]} {
-		    return -code error "Illegal symbol \"$sym\""
-		}
-	    }
-	}
-    }
-
-    method SymbolCheckSetNE {symbols} {
-	foreach sym $symbols {
-	    if {($sym eq "") || ![info exists symbol($sym)]} {
-		return -code error "Illegal symbol \"$sym\""
-	    }
-	}
-    }
-
-    method Next {s sym nexts} {
-	# Modify transition table. May update the set of
-	# non-deterministic states. Invalidates reachable
-	# cache, as states may become reachable. Updates
-	# the transym and transinv mappings.
-
-	upvar #0 ${selfns}::trans_$order($s) jump
-
-	$self InvalidateReach
-	$self InvalidateUseful
-	# Clear closure cache when epsilons change.
-	if {$sym eq ""} {array unset ec}
-
-	if {[info exists transym($sym)]} {
-	    struct::set include transym($sym) $s
-	} else {
-	    set transym($sym) [list $s]
-	}
-
-	if {[info exists transinv($nexts)]} {
-	    struct::set include transinv($nexts) [list $s $sym]
-	} else {
-	    set transinv($nexts) [list [list $s $sym]]
-	}
-
-	if {![info exists jump($sym)]} {
-	    set jump($sym) [list $nexts]
-	} else {
-	    struct::set include jump($sym) $nexts
-	}
-	$self NonDeterministic $s $sym
-	return
-    }
-
-    method !Next {s sym args} {
-	upvar #0 ${selfns}::trans_$order($s) jump
-	# Anything to do at all ?
-	if {![info exists jump($sym)]} return
-	$self InvalidateReach
-	$self InvalidateUseful
-	# Clear closure cache when epsilons change.
-	if {$sym eq ""} {array unset ec}
-
-	if {![llength $args]} {
-	    # Unset all transitions for (s, sym)
-	    # Update transym and transinv mappings as well, if existing.
-
-	    $self !Transym $s $sym
-	    foreach nexts $jump($sym) {
-		$self !Transinv $s $sym $nexts
-	    }
-
-	    unset jump($sym)
-	} else {
-	    # Remove the single transition (s, sym) -> nexts
-	    set nexts [lindex $args 0]
-
-	    struct::set exclude jump($sym) $nexts
-	    $self !Transinv $s $sym $nexts
-
-	    if {![struct::set size $jump($sym)]} {
-		$self !Transym $s $sym
-		unset jump($sym)
-		if {![array size jump]} {
-		    unset jump
-		}
-	    }
-	}
-
-	$self NonDeterministic $s $sym
-	return
-    }
-
-    method !Transym {s sym} {
-	struct::set exclude transym($sym) $s
-	if {![struct::set size $transym($sym)]} {
-	    unset transym($sym)
-	}
-    }
-
-    method !Transinv {s sym nexts} {
-	if {[info exists transinv($nexts)]} {
-	    struct::set exclude transinv($nexts) [list $s $sym]
-	    if {![struct::set size $transinv($nexts)]} {
-		unset transinv($nexts)
-	    }
-	}
-    }
-
-    method InvalidateReach {} {
-	set reachvalid 0
-	set reach      {}
-	return
-    }
-
-    method InvalidateUseful {} {
-	set usefulvalid 0
-	set useful     {}
-	return
-    }
-
-    method NonDeterministic {s sym} {
-	upvar #0 ${selfns}::trans_$order($s) jump
-
-	# Epsilon rule, whole state check. Epslion present <=> Not a DFA.
-
-	if {[info exists jump()]} {
-	    struct::set include nondete $s
-	} else {
-	    struct::set exclude nondete $s
-	}
-
-	# Non-determinism over a symbol.
-
-	upvar #0 ${selfns}::trans_$order($s) jump
-
-	if {[info exists jump($sym)] && [struct::set size $jump($sym)] > 1} {
-	    if {![info exists nondets($s)]} {
-		set nondets($s) [list $sym]
-	    } else {
-		struct::set include nondets($s) $sym
-	    }
-	    return
-	} else {
-	    if {![info exists nondets($s)]} return
-	    struct::set exclude nondets($s) $sym
-	    if {![struct::set size $nondets($s)]} {
-		unset nondets($s)
-	    }
-	}
-	return
-    }
-
-    method CheckSerialization {value startst states acc trans syms} {
-	# value is list/3 ('grammar::fa' symbols states)
-	# !("" in symbols)
-	# states is ordered dict (key is state, value is statedata)
-	# statedata is list/3 (start final trans|"")
-	# start is boolean
-	# final is boolean
-	# trans is dict (key in symbols, value is destinations)
-	# destinations is set of states
-
-	upvar 1 $startst startstates \
-		$states  sts \
-		$acc     a \
-		$trans   t \
-		$syms    symbols
-
-	set prefix "error in serialization:"
-	if {[llength $value] != 3} {
-	    return -code error "$prefix list length not 3"
-	}
-
-	struct::list assign $value   stype symbols statedata
-
-	if {$stype ne "grammar::fa"} {
-	    return -code error "$prefix unknown type \"$stype\""
-	}
-	if {[struct::set contains $symbols ""]} {
-	    return -code error "$prefix empty symbol is not legal"
-	}
-
-	if {[llength $statedata] % 2 == 1} {
-	    return -code error "$prefix state data is not a dictionary"
-	}
-	array set _states $statedata
-	if {[llength $statedata] != (2*[array size _states])} {
-	    return -code error "$prefix state data contains duplicate states"
-	}
-	set startstates {}
-	set sts {}
-	set p   {}
-	set a   {}
-	set e   {}
-	set l   {}
-	set m   {}
-	set t   {}
-	foreach {k v} $statedata {
-	    lappend sts $k
-	    if {[llength $v] != 3} {
-		return -code error "$prefix state list length not 3"
-	    }
-
-	    struct::list assign $v begin accept trans
-
-	    if {![string is boolean -strict $begin]} {
-		return -code error "$prefix expected boolean for start, got \"$begin\""
-	    }
-	    if {$begin} {lappend startstates $k}
-	    if {![string is boolean -strict $accept]} {
-		return -code error "$prefix expected boolean for final, got \"$accept\""
-	    }
-	    if {$accept} {lappend a $k}
-
-	    if {[llength $trans] % 2 == 1} {
-		return -code error "$prefix transition data is not a dictionary"
-	    }
-	    array set _trans $trans
-	    if {[llength $trans] != (2*[array size _trans])} {
-		return -code error "$prefix transition data contains duplicate symbols"
-	    }
-	    unset _trans
-
-	    foreach {sym destinations} $trans {
-		# destinations = list of state
-		if {($sym ne "") && ![struct::set contains $symbols $sym]} {
-		    return -code error "$prefix illegal symbol \"$sym\" in transition"
-		}
-		foreach dest $destinations {
-		    if {![info exists _states($dest)]} {
-			return -code error "$prefix illegal destination state \"$dest\""
-		    }
-		    lappend t $k $sym $dest
-		}
-	    }
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Type API implementation.
-
-    # ### ### ### ######### ######### #########
-    ## Type Internals.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Initialization. Specify the container constructor command to use by
-## the operations package.
-
-::grammar::fa::op::constructor ::grammar::fa
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::fa 0.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/faop.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/faop.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1618 +1,0 @@
-# -*- tcl -*-
-# Grammar / FA / Operations
-
-# ### ### ### ######### ######### #########
-## Package description
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require struct::list ; # Extended list operations.
-package require struct::set  ; # Extended set operations.
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::grammar::fa::op {
-
-    # ### ### ### ######### ######### #########
-    ## API. Structure / Language / Compilation
-
-    proc reverse     {fa} {}
-    proc complete    {fa {sink {}}} {}
-    proc remove_eps  {fa} {}
-    proc trim        {fa {what !reachable|!useful}} {}
-    proc determinize {fa {mapvar {}} {idstart 0}} {}
-    proc minimize    {fa {mapvar {}}} {}
-
-    proc complement  {fa} {}
-    proc kleene      {fa} {}
-    proc optional    {fa} {}
-    proc union       {fa fb {mapvar {}}} {}
-    proc intersect   {fa fb {mapvar {}} {idstart 0}} {}
-    proc difference  {fa fb {mapvar {}}} {}
-    proc concatenate {fa fb {mapvar {}}} {}
-
-    proc fromRegex   {fa regex {over {}}} {}
-
-    proc toRegexp    {fa} {}
-    proc toRegexp2   {fa} {}
-
-    proc simplifyRegexp {rex} {}
-    proc toTclRegexp    {rex symdict} {}
-
-    # ### ### ### ######### ######### #########
-
-    namespace export reverse complete remove_eps trim \
-	    determinize minimize complement kleene \
-	    optional union intersect difference \
-	    concatenate fromRegex toRegexp toRegexp2 \
-	    simplifyRegexp toTclRegexp
-
-    # ### ### ### ######### ######### #########
-    ## Internal data structures.
-
-    variable cons {}
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## API implementation. Structure
-
-proc ::grammar::fa::op::reverse {fa} {
-    # Reversal means that all transitions change their direction
-    # and start and final states are swapped.
-
-    # Note that reversed FA might not be deterministic, even if the FA
-    # itself was.
-
-    # One loop is not enough for this. If we reverse the
-    # transitions for a state immediately we may modify a state
-    # which has not been processed yet. And when we come to this
-    # state we reverse already reversed transitions, creating a
-    # complete mess. Thus two loops, one to collect the current
-    # transitions (and also remove them), and a second to insert
-    # the reversed transitions.
-
-    set tmp [$fa finalstates]
-    $fa final set [$fa startstates]
-    $fa start set $tmp
-
-    # FUTURE : Method to retrieve all transitions
-    # FUTURE : Method to delete all transitions
-
-    set trans {}
-    foreach s [$fa states] {
-	foreach sym [$fa symbols@ $s] {
-	    lappend trans $s $sym [$fa next $s $sym]
-	    $fa !next $s $sym
-	}
-    }
-    foreach {s sym destinations} $trans {
-	foreach d $destinations {
-	    $fa next $d $sym --> $s
-	}
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::complete {fa {sink {}}} {
-    if {[$fa is complete]} return
-
-    # We have an incomplete FA.
-
-    if {$sink eq ""} {
-	set sink [FindNewState $fa sink]
-    } elseif {[$fa state exists $sink]} {
-	return -code error "The chosen sink state exists already"
-    }
-    $fa state add $sink
-
-    # Add transitions to it from all states which are not
-    # complete. The sink state itself loops on all inputs. IOW it is a
-    # non-useful state.
-
-    set symbols [$fa symbols]
-    foreach sym $symbols {
-	$fa next $sink $sym --> $sink  
-    }
-
-    if {[$fa is epsilon-free]} {
-	foreach s [$fa states] {
-	    foreach missing [struct::set difference \
-		    $symbols \
-		    [$fa symbols@ $s]] {
-		$fa next $s $missing --> $sink
-	    }
-	}
-    } else {
-	# For an FA with epsilon-transitions we cannot simply look at
-	# the direct transitions to find the used symbols. We have to
-	# determine this for the epsilon-closure of the state in
-	# question. Oh, and we have to defer actually adding the
-	# transitions after we have picked them all, or otherwise the
-	# newly added transitions throw the symbol calculations for
-	# epsilon closures off.
-
-	set new {}
-	foreach s [$fa states] {
-	    foreach missing [struct::set difference \
-		    $symbols \
-		    [$fa symbols@set [$fa epsilon_closure $s]]] {
-		lappend new $s $missing
-	    }
-	}
-
-	foreach {s missing} $new {
-	    $fa next $s $missing --> $sink
-	}
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::remove_eps {fa} {
-    # We eliminate all epsilon transitions by duplicating a number
-    # of regular transitions, which we get through the epsilon
-    # closure of the states having epsilon transitions. We do
-    # nothing if the FA is epsilon free to begin with.
-
-    if {[$fa is epsilon-free]} return
-
-    # Note: Epsilon transitions touching start and final states
-    # propagate the start markers forward and final markers
-    # backward. We do this first by propagating start markers twice,
-    # once with a reversed FA. This also gives us some
-    # epsilon-closures as well.
-
-    foreach n {1 2} {
-	foreach s [$fa startstates] {
-	    foreach e [$fa epsilon_closure $s] {
-		$fa start add $e
-	    }
-	}
-	reverse $fa
-    }
-
-    # Now duplicate all transitions which are followed or preceeded by
-    # epsilon transitions of any number greater than zero.
-
-    # Note: The closure computations done by the FA are cached in the
-    # FA, so doing it multiple times is no big penalty.
-
-    # FUTURE : Retrieve all transitions on one command.
-
-    # FUTURE : Different algorithm ...
-    # Retrieve non-eps transitions for all states ...
-    # Iterate this list. Compute e-closures for endpoints, cache
-    # them. Duplicate the transition if needed, in that case add it to
-    # the end of the list, for possible more duplication (may touch
-    # different e-closures). Stop when the list is empty again.
-
-    set changed 1
-    while {$changed} {
-	set changed 0
-	foreach s [$fa states] {
-	    foreach sym [$fa symbols@ $s] {
-		set dest [$fa next $s $sym]
-		if {$sym eq ""} {
-		    # Epsilon transitions.
-
-		    # Get the closure, and duplicate all transitions for all
-		    # non-empty symbols as transitions of the original state.
-		    # This may lead to parallel transitions between states, hence
-		    # the catch. It prevents the generated error from stopping the
-		    # action, and no actual parallel transitions are created.
-
-		    set clos [$fa epsilon_closure $s]
-		    foreach csym [$fa symbols@set $clos] {
-			if {$csym eq ""} continue
-			foreach d [$fa nextset $clos $csym] {
-			    if {![catch {$fa next $s $csym --> $d} msg]} {
-				set changed 1
-			    }
-			}
-		    }
-		} else {
-		    # Regular transition. Go through all destination
-		    # states, compute their closures and replicate the
-		    # transition if the closure contains more than the
-		    # destination itself, to all states in the closure.
-
-		    foreach d $dest {
-			set clos [$fa epsilon_closure $d]
-			if {[llength $clos] > 1} {
-			    foreach e $clos {
-				if {![catch {$fa next $s $sym --> $e}]} {
-				    set changed 1
-				}
-			    }
-			}
-		    }
-		}
-	    }
-	}
-    }
-
-    # At last, drop the epsilons for all states. Only now is this
-    # possible because otherwise we might compute bad epsilon
-    # closures in the previous loop.
-
-    foreach s [$fa states] {
-	$fa !next $s ""
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::trim {fa {what !reachable|!useful}} {
-    # Remove various unwanted pices from the FA.
-
-    switch -exact -- $what {
-	!reachable {
-	    set remove [$fa unreachable_states]
-	}
-	!useful {
-	    set remove [$fa unuseful_states]
-	}
-	!reachable&!useful -
-	!(reachable|useful) {
-	    set remove [struct::set intersect [$fa unreachable_states] [$fa unuseful_states]]
-	}
-	!reachable|!useful -
-	!(reachable&useful) {
-	    set remove [struct::set union [$fa unreachable_states] [$fa unuseful_states]]
-	}
-	default {
-	    return -code error "Expected !reachable, !useful, !reachable&!useful, !(reachable|useful), !reachable|!useful, or !(reachable&useful), got \"$what\""
-	}
-    }
-
-    foreach s $remove {
-	$fa state delete $s
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::determinize {fa {mapvar {}} {idstart 0}} {
-    # We do the operation in several stages instead of jumping
-    # directly in the subset construction. Basically we try the less
-    # expensive operations first to see if they are enough. It does
-    # help that they will us also bring nearer to the ultimate goal
-    # even if they are not enough.
-
-    set hasmap 0
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map ; set hasmap 1
-    }
-
-    # First, is the input already deterministic ?
-    # There is nothing to do in that case.
-
-    if {[$fa is deterministic]} {
-	if {$hasmap} {set map {}}
-	return
-    }
-
-    # Second, trim unreachable and unuseables. We are done if only
-    # they carried the non-determinism. Otherwise we might have made
-    # the FA smaller and was less time consuming to convert.
-
-    if {[llength [$fa startstates]]} {trim $fa !reachable}
-    if {[llength [$fa finalstates]]} {trim $fa !useful}
-    if {[$fa is deterministic]} {
-	if {$hasmap} {set map {}}
-	return
-    }
-
-    # Third, remove any epsilon transitions, and stop if that was
-    # enough. Of course, weed out again states which have become
-    # irrelevant. The removal of the epsilons will at least ensure
-    # that the subset construction won't have to deal with
-    # closures. I.e. simpler.
-
-    remove_eps $fa
-    if {[llength [$fa startstates]]} {trim $fa !reachable}
-    if {[llength [$fa finalstates]]} {trim $fa !useful}
-    if {[$fa is deterministic]} {
-	if {$hasmap} {set map {}}
-	return
-    }
-
-    # Fourth. There is no way to avoid the subset construction.
-    # Dive in. This is the only part of the algorithm which requires
-    # us to keep a map. We construct the dfa in a transient container
-    # and copy the result back to fa when completed.
-
-    array set subsets {}
-    set id      $idstart
-    set pending {}
-    set dfa [[cons] %AUTO%]
-    # FUTURE : $dfa symbol set [$fa symbols]
-    foreach sym [$fa symbols] {$dfa symbol add $sym}
-
-    # If we have start states we can initialize the algorithm with
-    # their set. Otherwise we have to the single-element sets of all
-    # states as the beginning.
-
-    set starts [$fa startstates]
-    if {[llength $starts] > 0} {
-	# Make the set of start states the initial stae of the result.
-
-	set starts [lsort $starts] ; # Sort to get canonical form.
-	$dfa state add $id
-	$dfa start add $id
-
-	# The start may also be a final state
-	if {[$fa final?set $starts]} {
-	    $dfa final add $id
-	}
-
-	set subsets(dfa,$starts) $id
-	set subsets(nfa,$id) $starts
-	
-	lappend pending $id
-	incr id
-    } else {
-	# Convert all states of the input into sets (of one element)
-	# in the output. Do not forget to mark all final states we
-	# come by. No start states, otherwise we wouldn't be here.
-
-	foreach s [$fa states] {
-	    set nfaset [list $s]
-
-	    $dfa state add $id
-	    if {[$fa final? $s]} {
-		$dfa final add $id
-	    }
-
-	    set subsets(dfa,$nfaset) $id
-	    set subsets(nfa,$id) $nfaset
-	    lappend pending $id
-	    incr id
-	}
-    }
-
-    while {[llength $pending]} {
-	set dfastate [struct::list shift pending]
-
-	# We have to compute the transition function for this dfa state.
-
-	set nfaset $subsets(nfa,$dfastate)
-
-	foreach sym [$fa symbols@set $nfaset] {
-	    set nfanext [lsort [$fa nextset $nfaset $sym]]
-
-	    if {![info exists subsets(dfa,$nfanext)]} {
-		# Unknown destination. Add it as a new state.
-
-		$dfa state add $id
-		if {[$fa final?set $nfanext]} {
-		    $dfa final add $id
-		}
-
-		set subsets(dfa,$nfanext) $id
-		set subsets(nfa,$id) $nfanext
-
-		# Schedule the calculation of the transition function
-		# of the new state.
-
-		lappend pending $id
-		incr id
-	    }
-
-	    # Add the transition
-	    $dfa next $dfastate $sym --> $subsets(dfa,$nfanext)
-	}
-    }
-
-    if {[llength [$fa startstates]]} {trim $fa !reachable}
-    if {[llength [$fa finalstates]]} {trim $fa !useful}
-
-    if {$hasmap} {
-	# The map is from new dfa states to the sets of nfa states.
-
-	set map {}
-	foreach s [$dfa states] {
-	    lappend map $s $subsets(nfa,$s)
-	}
-    }
-
-    $fa = $dfa
-    $dfa destroy
-
-    # ASSERT : $fa is deterministic
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::minimize {fa {mapvar {}}} {
-    # Brzozowski's method:
-    # Reverse, determinize, reverse again, determinize again.
-
-    reverse     $fa
-    determinize $fa mapa
-    reverse     $fa
-    determinize $fa mapb
-
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map
-
-	if {![llength $mapa] && ![llength $mapb]} {
-	    # No state reorganizations, signal up
-	    set map {}
-	} elseif {[llength $mapa] && ![llength $mapb]} {
-	    # Only one reorg, this is the combined reorg as well.
-	    set map $mapa
-	} elseif {![llength $mapa] && [llength $mapb]} {
-	    # Only one reorg, this is the combined reorg as well.
-	    set map $mapb
-	} else {
-	    # Two reorgs. Compose the maps into the final map signaled
-	    # up.
-
-	    # mapb : final state -> set of states in mapa -> sets of original states.
-
-	    set map {}
-	    array set tmp $mapa
-	    foreach {b aset} $mapb {
-		set compose {}
-		foreach a $aset {foreach o $tmp($a) {lappend compose $o}}
-		lappend map $b [lsort -uniq $compose]
-	    }
-	}
-    }
-
-    # The FA is implicitly trimmed by the determinize's.
-    return
-}
-
-# ### ### ### ######### ######### #########
-## API implementation. Language.
-
-proc ::grammar::fa::op::complement {fa} {
-    # Complementing is possible if and only if the FA is complete,
-    # and accomplished by swapping the final and non-final states.
-
-    if {![$fa is complete]} {
-	return -code error "Unable to complement incomplete FA"
-    }
-    if {![$fa is deterministic]} {
-	return -code error "Unable to complement non-deterministic FA"
-    }
-
-    set newfinal [struct::set difference [$fa states] [$fa finalstates]]
-    $fa final set $newfinal
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::kleene {fa} {
-    # The Kleene Closure of the FA makes no sense if we don't have
-    # start and final states we can work from.
-
-    set start [$fa startstates]
-    set final [$fa finalstates]
-
-    if {![llength $start] || ![llength $final]} {
-	return -code error "Unable to add Kleene's closure to a FA without start/final states"
-    }
-
-    # FUTURE :: If final states have no outgoing transitions, and start
-    # FUTURE :: states have no input transitions, then place the new
-    # FUTURE :: transitions directly between start and final
-    # FUTURE :: states. In that case we don't need new states.
-
-    # We need new start/final states, like for optional (see below)
-
-    set ns [NewState $fa s]
-    set nf [NewState $fa f]
-
-    foreach s $start {$fa next $ns "" --> $s}
-    foreach f $final {$fa next $f  "" --> $nf}
-
-    $fa start clear ; $fa start add $ns
-    $fa final clear ; $fa final add $nf
-
-    $fa next $ns "" --> $nf ; # Optionality
-    $fa next $nf "" --> $ns ; # Loop for closure
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::optional {fa} {
-    # The Optionality of the FA makes no sense if we don't have
-    # start and final states we can work from.
-
-    set start [$fa startstates]
-    set final [$fa finalstates]
-
-    if {![llength $start] || ![llength $final]} {
-	return -code error "Unable to make a FA without start/final states optional"
-    }
-
-    # We have to introduce new start and final states to ensure
-    # that we do not get additional recognized words from the FA
-    # due to epsilon transitions. IOW just placing epsilons from
-    # all start to all final states is wrong. Consider unreachable
-    # final states, they become reachable. Or final states able to
-    # reach final states from. Again the epsilons would extend the
-    # language. We have to detach our optional epsilon from anything
-    # in the existing start/final states. Hence the new start/final.
-
-    # FUTURE : Recognize if there are no problems with placing direct
-    # FUTURE : epsilons from start to final.
-
-    set ns [NewState $fa s]
-    set nf [NewState $fa f]
-
-    foreach s $start {$fa next $ns "" --> $s}
-    foreach f $final {$fa next $f  "" --> $nf}
-
-    $fa start clear ; $fa start add $ns
-    $fa final clear ; $fa final add $nf
-
-    $fa next $ns "" --> $nf ; # This is the transition which creates the optionality.
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::union {fa fb {mapvar {}}} {
-    # We union the input symbols, then add the states and
-    # transitions of the second FA to the first, adding in
-    # epsilons for the start and final states as well. When
-    # adding states we make sure that the new states do not
-    # intersect with the existing states.
-
-    struct::list assign \
-	    [MergePrepare $fa $fb union smap] \
-	    astart afinal bstart bfinal
-
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map
-	set map $smap
-    }
-
-    # And now the new start & final states
-
-    set ns [NewState $fa s]
-    set nf [NewState $fa f]
-
-    eLink1N $fa $ns $astart
-    eLink1N $fa $ns $bstart
-
-    eLinkN1 $fa $afinal $nf
-    eLinkN1 $fa $bfinal $nf
-
-    $fa start clear ; $fa start add $ns
-    $fa final clear ; $fa final add $nf
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::intersect {fa fb {mapvar {}} {idstart 0}} {
-    # Intersection has to run the two automata in parallel, using
-    # paired states. If we have start states we begin the
-    # construction with them. This leads to a smaller result as we
-    # do not have create a full cross-crossproduct. The latter is
-    # unfortunately required if there are no start states.
-
-    struct::list assign [CrossPrepare $fa $fb intersection] tmp res
-
-    # The start states of the new FA consist of the cross-product of
-    # the start states of fa with fb. These are also the states used
-    # to seed DoCross.
-
-    set id $idstart
-    set smap {}
-    set bstart [$tmp startstates]
-    foreach a [$fa startstates] {
-	foreach b $bstart {
-	    set pair [list $a $b]
-	    lappend smap    $id $pair
-	    lappend pending $pair $id
-	    $res state add $id
-	    $res start add $id
-	    incr id
-	}
-    }
-
-    set cp [DoCross $fa $tmp $res $id $pending smap]
-
-    foreach {id pair} $smap {
-	struct::list assign $pair a b
-	if {[$fa final? $a] && [$tmp final? $b]} {
-	    $res final add $id
-	}
-    }
-
-    # Remove excess states (generated because of the sinks).
-    trim $res
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map
-	# The loop is required to filter out the mappings for all
-	# states which were trimmed off.
-	set map {}
-	foreach {id pair} $smap {
-	    if {![$res state exists $id]} continue
-	    lappend map $id $pair
-	}
-    }
-
-    # Copy result into permanent storage and delete all intermediaries
-    $fa = $res
-    $res destroy
-    if {$tmp ne $fb} {$tmp destroy}
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::difference {fa fb {mapvar {}}} {
-    # Difference has to run the two automata in parallel, using
-    # paired states. Only the final states are defined differently
-    # than for intersection. It has to be final in fa and _not_ final
-    # in fb to be a final state of the result. <=> Accepted by A, but
-    # not B, to be in the difference.
-
-    struct::list assign [CrossPrepare $fa $fb difference] tmp res
-
-    # The start states of the new FA consist of the cross-product of
-    # the start states of fa with fb. These are also the states used
-    # to seed DoCross.
-
-    set id 0
-    set smap {}
-    set bstart [$tmp startstates]
-    foreach a [$fa startstates] {
-	foreach b $bstart {
-	    set pair [list $a $b]
-	    lappend smap    $id $pair
-	    lappend pending $pair $id
-	    $res state add $id
-	    $res start add $id
-	    incr id
-	}
-    }
-
-    set cp [DoCross $fa $tmp $res $id $pending smap]
-
-    foreach {id pair} $smap {
-	struct::list assign $pair a b
-	if {[$fa final? $a] && ![$tmp final? $b]} {
-	    $res final add $id
-	}
-    }
-
-    # Remove excess states (generated because of the sinks).
-    trim $res
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map
-	# The loop is required to filter out the mappings for all
-	# states which were trimmed off.
-	set map {}
-	foreach {id pair} $smap {
-	    if {![$res state exists $id]} continue
-	    lappend map $id $pair
-	}
-    }
-
-    # Copy result into permanent storage and delete all intermediaries
-    $fa = $res
-    $res destroy
-    if {$tmp ne $fb} {$tmp destroy}
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::concatenate {fa fb {mapvar {}}} {
-    # Like union, only the interconnect between existing and new FA is different.
-
-    struct::list assign \
-	    [MergePrepare $fa $fb concatenate smap] \
-	    astart afinal bstart bfinal
-
-    if {$mapvar ne ""} {
-	upvar 1 $mapvar map
-	set map $smap
-    }
-
-    set ns [NewState $fa s]
-    set nm [NewState $fa m] ;# Midpoint.
-    set nf [NewState $fa f]
-
-    eLink1N $fa $ns $astart
-    eLinkN1 $fa $afinal $nm
-
-    eLink1N $fa $nm $bstart
-    eLinkN1 $fa $bfinal $nf
-
-    $fa start clear ; $fa start add $ns
-    $fa final clear ; $fa final add $nf
-    return
-}
-
-# ### ### ### ######### ######### #########
-## API implementation. Compilation (regexp -> FA).
-
-proc ::grammar::fa::op::fromRegex {fa regex {over {}}} {
-    # Convert a regular expression into a FA. The regex is given as
-    # parse tree in the form of a nested list.
-
-    # {. A B ...} ... Concatenation (accepts zero|one arguments).
-    # {| A B ...} ... Alternatives  (accepts zero|one arguments).
-    # {? A}       ... Optional.
-    # {* A}       ... Kleene.
-    # {+ A}       ... Pos.Kleene.
-    # {! A}       ... Complement/Negation.
-    # {S Symbol}  ... Atom, Symbol
-    #
-    # Recursive descent with a helper ...
-
-    if {![llength $regex]} {
-	$fa clear
-	return
-    }
-
-    set tmp [[cons] %AUTO%]
-
-    if {![llength $over]} {
-	set over [lsort -uniq [RESymbols $regex]]
-    }
-    foreach sym $over {
-	$tmp symbol add $sym
-    }
-
-    set id 0
-    struct::list assign [Regex $tmp $regex id] s f
-    $tmp start set [list $s]
-    $tmp final set [list $f]
-
-    $fa = $tmp
-    $tmp destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers.
-
-proc ::grammar::fa::op::RESymbols {regex} {
-    set cmd [lindex $regex 0]
-    switch -exact -- $cmd {
-	? - * - ! - + {
-	    return [RESymbols [lindex $regex 1]]
-	}
-	. - | - & {
-	    set res {}
-	    foreach sub [lrange $regex 1 end] {
-		foreach sym [RESymbols $sub] {lappend res $sym}
-	    }
-	    return $res
-	}
-	S {
-	    return [list [lindex $regex 1]]
-	}
-	default {
-	    return -code error "Expected . ! ? * | &, or S, got \"$cmd\""
-	}
-    }
-}
-
-proc ::grammar::fa::op::Regex {fa regex idvar} {
-    upvar 1 $idvar id
-    set cmd [lindex $regex 0]
-    switch -exact -- $cmd {
-	? {
-	    # Optional
-	    set a $id ; incr id ; $fa state add $a
-	    set b $id ; incr id ; $fa state add $b
-
-	    struct::list assign [Regex $fa [lindex $regex 1] id] s f
-	    $fa next $a "" --> $s
-	    $fa next $f "" --> $b
-	    $fa next $a "" --> $b
-	}
-	* {
-	    # Kleene
-	    set a $id ; incr id ; $fa state add $a
-	    set b $a
-
-	    struct::list assign [Regex $fa [lindex $regex 1] id] s f
-	    $fa next $a "" --> $s
-	    $fa next $f "" --> $a ;# == b
-	}
-	+ {
-	    # Pos. Kleene
-	    set a $id ; incr id ; $fa state add $a
-	    set b $id ; incr id ; $fa state add $b
-
-	    struct::list assign [Regex $fa [lindex $regex 1] id] s f
-	    $fa next $a "" --> $s
-	    $fa next $f "" --> $b
-	    $fa next $b "" --> $a
-	}
-	! {
-	    # Complement.
-	    # Build up in a temp FA, complement, and
-	    # merge nack into the current
-
-	    set a $id ; incr id ; $fa state add $a
-	    set b $id ; incr id ; $fa state add $b
-
-	    set tmp [[cons] %AUTO%]
-	    foreach sym [$fa symbols] {$tmp symbol add $sym}
-	    struct::list assign [Regex $tmp [lindex $regex 1] id] s f
-	    $tmp start add $s
-	    $tmp final add $f
-
-	    determinize $tmp {} $id
-	    incr id [llength [$tmp states]]
-	    if {![$tmp is complete]} {
-		complete    $tmp $id
-		incr id
-	    }
-	    complement  $tmp
-
-	    # Merge and link.
-	    $fa deserialize_merge [$tmp serialize]
-
-	    eLink1N $fa $a [$tmp startstates]
-	    eLinkN1 $fa [$tmp finalstates] $b
-	    $tmp destroy
-	}
-	& {
-	    # Intersection ... /And
-
-	    if {[llength $regex] < 3} {
-		# Optimized path. Intersection of one sub-expression
-		# is the sub-expression itself.
-
-		struct::list assign [Regex $fa [lindex $regex 1] id] a b
-	    } else {
-		set a $id ; incr id ; $fa state add $a
-		set b $id ; incr id ; $fa state add $b
-
-		set tmp [[cons] %AUTO%]
-		foreach sym [$fa symbols] {$tmp symbol add $sym}
-		set idsub 0
-		struct::list assign [Regex $tmp [lindex $regex 1] idsub] s f
-		$tmp start add $s
-		$tmp final add $f
-
-		set beta [[cons] %AUTO%]
-		foreach sub [lrange $regex 2 end] {
-		    foreach sym [$fa symbols] {$beta symbol add $sym}
-		    struct::list assign [Regex $beta $sub idsub] s f
-		    $beta start add $s
-		    $beta final add $f
-		    intersect $tmp $beta {} $id
-		}
-		$beta destroy
-		determinize $tmp {} $id
-		incr id [llength [$tmp states]]
-
-		# Merge and link.
-		$fa deserialize_merge [$tmp serialize]
-
-		eLink1N $fa $a [$tmp startstates]
-		eLinkN1 $fa [$tmp finalstates] $b
-		$tmp destroy
-	    }
-	}
-	. {
-	    # Concatenation ...
-
-	    if {[llength $regex] == 1} {
-		# Optimized path. No sub-expressions. This represents
-		# language containing only the empty string, aka
-		# epsilon.
-
-		set a $id ; incr id ; $fa state add $a
-		set b $id ; incr id ; $fa state add $b
-		$fa next $a "" --> $b
-
-	    } elseif {[llength $regex] == 2} {
-		# Optimized path. Concatenation of one sub-expression
-		# is the sub-expression itself.
-
-		struct::list assign [Regex $fa [lindex $regex 1] id] a b
-	    } else {
-		set first 1
-		set last {}
-		foreach sub [lrange $regex 1 end] {
-		    struct::list assign [Regex $fa $sub id] s f
-		    if {$first} {set first 0 ; set a $s}
-		    if {$last != {}} {
-			$fa next $last "" --> $s
-		    }
-		    set last $f
-		}
-		set b $f
-	    }
-	}
-	| {
-	    # Alternatives ... (Union)
-
-	    if {[llength $regex] == 1} {
-		# Optimized path. No sub-expressions. This represents
-		# the empty language, i.e. the language without words.
-
-		set a $id ; incr id ; $fa state add $a
-		set b $id ; incr id ; $fa state add $b
-
-	    } elseif {[llength $regex] == 2} {
-		# Optimized path. Choice/Union of one sub-expression
-		# is the sub-expression itself.
-
-		struct::list assign [Regex $fa [lindex $regex 1] id] a b
-	    } else {
-		set a $id ; incr id ; $fa state add $a
-		set b $id ; incr id ; $fa state add $b
-		foreach sub [lrange $regex 1 end] {
-		    struct::list assign [Regex $fa $sub id] s f
-		    $fa next $a "" --> $s
-		    $fa next $f "" --> $b
-		}
-	    }
-	}
-	S {
-	    # Atom, base transition.
-	    set sym [lindex $regex 1]
-	    set a $id ; incr id ; $fa state add $a
-	    set b $id ; incr id ; $fa state add $b
-	    $fa next $a $sym --> $b
-	}
-	default {
-	    return -code error "Expected . ! ? * | &, or S, got \"$cmd\""
-	}
-    }
-    return [list $a $b]
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::CrossPrepare {fa fb label} {
-    set starta [$fa startstates]
-    set finala [$fa finalstates]
-    set startb [$fb startstates]
-    set finalb [$fb finalstates]
-    if {
-	![llength $starta] || ![llength $finala] ||
-	![llength $startb] || ![llength $finalb]
-    } {
-	return -code error "Unable to perform the $label of two FAs without start/final states"
-    }
-
-    # The inputs are made complete over the union of their symbol
-    # sets. A temp. container is used for the second input if necessary.
-
-    set totals [struct::set union [$fa symbols] [$fb symbols]]
-    foreach sym [struct::set difference $totals [$fa symbols]] {
-	$fa symbol add $sym
-    }
-    if {![$fa is epsilon-free]} {
-	remove_eps $fa
-	trim       $fa
-    }
-    if {![$fa is complete]} {
-	complete $fa
-    }
-    set tmp $fb
-    set bnew [struct::set difference $totals [$fb symbols]]
-    if {[llength $bnew]} {
-	set tmp [[cons] %AUTO% = $fb]
-	foreach sym $bnew {
-	    $tmp symbol add $sym
-	}    
-    }
-    if {![$fb is epsilon-free]} {
-	if {$tmp eq $fb} {set tmp [[cons] %AUTO% = $fb]}
-	remove_eps $tmp
-	trim       $tmp
-    }
-    if {![$fb is complete]} {
-	if {$tmp eq $fb} {set tmp [[cons] %AUTO% = $fb]}
-	complete $tmp
-    }
-
-    set res [[cons] %AUTO%]
-    foreach sym $totals {
-	$res symbol add $sym
-    } 
-
-    return [list $tmp $res]
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::DoCross {fa fb res id seed smapvar} {
-    upvar 1 $smapvar smap
-
-    set symbols [$fa symbols]
-    array set tmp $seed
-
-    set pending $seed
-    while {[llength $pending]} {
-	set cpair [struct::list shift pending]
-	set cid   [struct::list shift pending]
-
-	struct::list assign $cpair a b
-
-	# ASSERT: /res state exists /cid
-
-	# Generate the transitions for the pair, add the resulting
-	# destinations to the FA, and schedule them for a visit if
-	# they are new.
-
-	foreach sym $symbols {
-	    set adestinations [$fa next $a $sym]
-	    set bdestinations [$fb next $b $sym]
-
-	    foreach ad $adestinations {
-		foreach bd $bdestinations {
-		    set dest [list $ad $bd]
-
-		    if {![info exists tmp($dest)]} {
-			$res state add $id
-			lappend smap $id $dest
-			lappend pending $dest $id
-			set tmp($dest) $id
-			incr id
-		    }
-		    $res next $cid $sym --> $tmp($dest)
-		}
-	    }
-	}
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::MergePrepare {fa fb label mapvar} {
-    upvar 1 $mapvar map
-
-    set starta [$fa startstates]
-    set finala [$fa finalstates]
-    set startb [$fb startstates]
-    set finalb [$fb finalstates]
-    if {
-	![llength $starta] || ![llength $finala] ||
-	![llength $startb] || ![llength $finalb]
-    } {
-	return -code error "Unable to $label FAs without start/final states"
-    }
-
-    # FUTURE: add {*}[symbols], ignore dup's
-    foreach sym [$fb symbols] {catch {$fa symbol add $sym}}
-
-    set dup [struct::set intersect [$fa states] [$fb states]]
-    if {![llength $dup]} {
-	# The states do not overlap. A plain merge of fb is enough to
-	# copy the information.
-
-	$fa deserialize_merge [$fb serialize]
-	set map {}
-    } else {
-	# We have duplicate states, therefore we have to remap fb to
-	# prevent interference between the two.
-
-	set map {}
-	set tmp [[cons] %AUTO% = $fb]
-	set id 0
-	foreach s $dup {
-	    # The renaming process has to ensure that the new name is
-	    # in neither fa, nor already in fb as well.
-	    while {
-		[$fa  state exists $id] ||
-		[$tmp state exists $id]
-	    } {incr id}
-	    $tmp state rename $s $id
-	    lappend map $id $s
-	    incr id
-	}
-
-	set startb [$tmp startstates]
-	set finalb [$tmp finalstates]
-
-	$fa deserialize_merge [$tmp serialize]
-	$tmp destroy
-    }
-
-    return [list $starta $finala $startb $finalb]
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::eLink1N {fa from states} {
-    foreach s $states {
-	$fa next $from "" --> $s
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::eLinkN1 {fa states to} {
-    foreach s $states {
-	$fa next $s "" --> $to
-    }
-    return
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::NewState {fa prefix} {
-    set newstate [FindNewState $fa $prefix]
-    $fa state add $newstate
-    return $newstate
-}
-
-# --- --- --- --------- --------- ---------
-
-proc ::grammar::fa::op::FindNewState {fa prefix} {
-    #if {![$fa state exists $prefix]} {return $prefix}
-    set n 0
-    while {[$fa state exists ${prefix}.$n]} {incr n}
-    return ${prefix}.$n
-}
-
-# ### ### ### ######### ######### #########
-## API implementation. Decompilation (FA -> regexp).
-
-proc ::grammar::fa::op::toRegexp {fa} {
-    # NOTE: FUTURE - Do not go through the serialization, nor through
-    # a matrix. The algorithm can be expressed more directly as
-    # operations on the automaton (states and transitions).
-
-    set ET [ser_to_ematrix [$fa serialize]]
-    while {[llength $ET] > 2} {
-	set ET [matrix_drop_state $ET]
-    }
-    return [lindex $ET 0 1]
-}
-
-proc ::grammar::fa::op::toRegexp2 {fa} {
-    # NOTE: FUTURE - See above.
-    set ET [ser_to_ematrix [$fa serialize]]
-    while {[llength $ET] > 2} {
-	set ET [matrix_drop_state $ET re2]
-    }
-    return [lindex $ET 0 1]
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers.
-
-proc ::grammar::fa::op::ser_to_ematrix {ser} {
-    if {[lindex $ser 0] ne "grammar::fa"} then {
-	error "Expected grammar::fa automaton serialisation"
-    }
-    set stateL {}
-    set n 2; foreach {state des} [lindex $ser 2] {
-	lappend stateL $state
-	set N($state) $n
-	incr n
-    }
-    set row0 {}
-    for {set k 0} {$k<$n} {incr k} {lappend row0 [list |]}
-    set res [list $row0 $row0]
-    foreach {from des} [lindex $ser 2] {
-	set row [lrange $row0 0 1]
-	if {[lindex $des 0]} then {lset res 0 $N($from) [list .]}
-	if {[lindex $des 1]} then {lset row 1 [list .]}
-	foreach to $stateL {set S($to) [list |]}
-	foreach {symbol targetL} [lindex $des 2] {
-	    if {$symbol eq ""} then {
-		set atom [list .]
-	    } else {
-		set atom [list S $symbol]
-	    }
-	    foreach to $targetL {lappend S($to) $atom}
-	}
-	foreach to $stateL {
-	    if {[llength $S($to)] == 2} then {
-		lappend row [lindex $S($to) 1]
-	    } else {
-		lappend row $S($to)
-	    }
-	}
-	lappend res $row
-    }
-    return $res
-}
-
-proc ::grammar::fa::op::matrix_drop_state {T_in {ns re1}} {
-    set sumcmd ${ns}::|
-    set prodcmd ${ns}::.
-    set T1 {}
-    set lastcol {}
-    foreach row $T_in {
-	lappend T1 [lreplace $row end end]
-	lappend lastcol [lindex $row end]
-    }
-    set lastrow [lindex $T1 end]
-    set T1 [lreplace $T1 end end]
-    set b [${ns}::* [lindex $lastcol end]]
-    set lastcol [lreplace $lastcol end end]
-    set res {}
-    foreach row $T1 a $lastcol {
-	set newrow {}
-	foreach pos $row c $lastrow {
-	    lappend newrow [$sumcmd $pos [$prodcmd $a $b $c]]
-	}
-	lappend res $newrow
-    }
-    return $res
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers. Regexp simplification I.
-
-namespace eval ::grammar::fa::op::re1 {
-    namespace export | . {\*}
-}
-
-proc ::grammar::fa::op::re1::| {args} {
-    set L {}
-
-    # | = Choices.
-    # Sub-choices are lifted into the top expression (foreach).
-    # Identical choices are reduced to a single term (lsort -uniq).
-
-    foreach re $args {
-	switch -- [lindex $re 0] "|" {
-	    foreach term [lrange $re 1 end] {lappend L $term}
-	} default {
-	    lappend L $re
-	}
-    }
-    set L [lsort -unique $L]
-    if {[llength $L] == 1} then {
-	return [lindex $L 0]
-    } else {
-	return [linsert $L 0 |]
-    }
-}
-
-proc ::grammar::fa::op::re1::. {args} {
-    set L {}
-
-    # . = Sequence.
-    # One element sub-choices are lifted into the top expression.
-    # Sub-sequences are lifted into the top expression.
-
-    foreach re $args {
-	switch -- [lindex $re 0] "." {
-	    foreach term [lrange $re 1 end] {lappend L $term}
-	} "|" {
-	    if {[llength $re] == 1} then {return $re}
-	    lappend L $re
-	} default {
-	    lappend L $re
-	}
-    }
-    if {[llength $L] == 1} then {
-	return [lindex $L 0]
-    } else {
-	return [linsert $L 0 .]
-    }
-}
-
-proc ::grammar::fa::op::re1::* {re} {
-    # * = Kleene closure.
-    # Sub-closures are lifted into the top expression.
-    # One-element sub-(choices,sequences) are lifted into the top expression.
-
-    switch -- [lindex $re 0] "|" - "." {
-	if {[llength $re] == 1} then {
-	    return [list .]
-	} else {
-	    return [list * $re]
-	}
-    } "*" {
-	return $re
-    } default {
-	return [list * $re]
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers. Regexp simplification II.
-
-namespace eval ::grammar::fa::op::re2 {
-    # Inherit choices and kleene-closure from the basic simplifier.
-
-    namespace import [namespace parent]::re1::|
-    namespace import [namespace parent]::re1::\\*
-}
-
-proc ::grammar::fa::op::re2::. {args} {
-
-    # . = Sequences
-    # Sub-sequences are lifted into the top expression.
-    # Sub-choices are multiplied out.
-    # <Example a(b|c) => ab|ac >
-
-    set L {}
-    set n -1
-    foreach re $args {
-	incr n
-	switch -- [lindex $re 0] "." {
-	    foreach term [lrange $re 1 end] {lappend L $term}
-	} "|" {
-	    set res [list |]
-	    set L2 [lreplace $args 0 $n]
-	    foreach term [lrange $re 1 end] {
-		lappend res [eval [list .] $L [list $term] $L2]
-	    }
-	    return [eval $res]
-	} default {
-	    lappend L $re
-	}
-    }
-    if {[llength $L] == 1} then {
-	return [lindex $L 0]
-    } else {
-	return [linsert $L 0 .]
-    }
-}
-
-# ### ### ### ######### ######### #########
-## API. Simplification of regular expressions.
-
-proc ::grammar::fa::op::simplifyRegexp {RE0} {
-    set RE1 [namespace inscope nonnull $RE0]
-    if {[lindex $RE1 0] eq "S" || $RE1 eq "." || $RE1 eq "|"} then {
-	return $RE1
-    }
-    set tmp [grammar::fa %AUTO% fromRegex $RE1]
-    $tmp minimize
-    set RE1 [toRegexp $tmp]
-    $tmp destroy
-    if {[string length $RE1] < [string length $RE0]} then {
-	set RE0 $RE1
-    }
-    if {[lindex $RE0 0] eq "S"} then {return $RE0}
-    set res [lrange $RE0 0 0]
-    foreach branch [lrange $RE0 1 end] {
-	lappend res [simplifyRegexp $branch]
-    }
-    return $res
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers.
-
-namespace eval ::grammar::fa::op::nonnull {}
-
-proc ::grammar::fa::op::nonnull::| {args} {
-    set also_empty false
-    set res [list |]
-    foreach branch $args {
-	set RE [eval $branch]
-	if {[lindex $RE 0] eq "?"} then {
-	    set also_empty true
-	    set RE [lindex $RE 1]
-	}
-	switch -- [lindex $RE 0] "|" {
-	    eval [lreplace $RE 0 0 lappend res]
-	} "." {
-	    if {[llength $RE] == 1} then {
-		set also_empty true
-	    } else {
-		lappend res $RE
-	    }
-	} default {
-	    lappend res $RE
-	}
-    }
-    if {!$also_empty} then {return $res}
-    foreach branch [lrange $res 1 end] {
-	if {[lindex $branch 0] eq "*"} then {return $res}
-    }
-    if {[llength $res] == 1} then {
-	return [list .]
-    } elseif {[llength $res] == 2} then {
-	return [lreplace $res 0 0 ?]
-    } else {
-	return [list ? $res]
-    }
-}
-
-proc ::grammar::fa::op::nonnull::. {args} {
-    set res [list .]
-    foreach branch $args {
-	set RE [eval $branch]
-	switch -- [lindex $RE 0] "|" {
-	    if {[llength $RE] == 1} then {return $RE}
-	    lappend res $RE
-	} "." {
-	    eval [lreplace $RE 0 0 lappend res]
-	} default {
-	    lappend res $RE
-	}
-    }
-    return $res
-}
-
-proc ::grammar::fa::op::nonnull::* {sub} {
-    set RE [eval $sub]
-    switch -- [lindex $RE 0] "*" - "?" - "+" {
-	return [lreplace $RE 0 0 *]
-    } default {
-	return [list * $RE]
-    }
-}
-
-proc ::grammar::fa::op::nonnull::+ {sub} {
-    set RE [eval $sub]
-    switch -- [lindex $RE 0] "+" {
-	return $RE
-    } "*" - "?" {
-	return [lreplace $RE 0 0 *]
-    } default {
-	return [list * $RE]
-    }
-}
-
-proc ::grammar::fa::op::nonnull::? {sub} {
-    set RE [eval $sub]
-    switch -- [lindex $RE 0] "?" - "*" {
-	return $RE
-    } "+" {
-	return [lreplace $RE 0 0 *]
-    } default {
-	return [list ? $RE]
-    }
-}
-
-proc ::grammar::fa::op::nonnull::S {name} {
-    return [list S $name]
-}
-
-# ### ### ### ######### ######### #########
-## API. Translate RE of this package to Tcl REs
-
-proc ::grammar::fa::op::toTclRegexp {re symdict} {
-    return [lindex [namespace inscope tclre $re $symdict] 1]
-}
-
-# ### ### ### ######### ######### #########
-## Internal helpers.
-
-namespace eval ::grammar::fa::op::tclre {}
-
-proc ::grammar::fa::op::tclre::S {name dict} {
-    array set A $dict
-    if {[info exists A($name)]} then {
-	return $A($name)
-    } elseif {[string length $name] == 1} then {
-	if {[regexp {[\\\[\]{}.()*+?^$]} $name]} then {
-	    return [list char \\$name]
-	} else {
-	    return [list char $name]
-	}
-    } else {
-	return [list class "\[\[:${name}:\]\]"]
-    }
-}
-
-proc ::grammar::fa::op::tclre::. {args} {
-    set suffix [lrange $args end end]
-    set L {}
-    foreach factor [lrange $args 0 end-1] {
-	set pair [eval $factor $suffix]
-	switch -- [lindex $pair 0] "sum" {
-	    lappend L ([lindex $pair 1])
-	} default {
-	    lappend L [lindex $pair 1]
-	}
-    }
-    return [list prod [join $L ""]]
-}
-
-proc ::grammar::fa::op::tclre::* {re dict} {
-    set pair [eval $re [list $dict]]
-    switch -- [lindex $pair 0] "sum" - "prod" {
-	return [list prod "([lindex $pair 1])*"]
-    } default {
-	return [list prod "[lindex $pair 1]*"]
-    }
-}
-
-proc ::grammar::fa::op::tclre::+ {re dict} {
-    set pair [eval $re [list $dict]]
-    switch -- [lindex $pair 0] "sum" - "prod" {
-	return [list prod "([lindex $pair 1])+"]
-    } default {
-	return [list prod "[lindex $pair 1]+"]
-    }
-}
-
-proc ::grammar::fa::op::tclre::? {re dict} {
-    set pair [eval $re [list $dict]]
-    switch -- [lindex $pair 0] "sum" - "prod" {
-	return [list prod "([lindex $pair 1])?"]
-    } default {
-	return [list prod "[lindex $pair 1]?"]
-    }
-}
-
-proc ::grammar::fa::op::tclre::| {args} {
-    set suffix [lrange $args end end]
-    set charL {}
-    set classL {}
-    set prodL {}
-    foreach factor [lrange $args 0 end-1] {
-	set pair [eval $factor $suffix]
-	switch -- [lindex $pair 0] "char" {
-	    lappend charL [lindex $pair 1]
-	} "class" {
-	    lappend classL [string range [lindex $pair 1] 1 end-1]
-	} default {
-	    lappend prodL [lindex $pair 1]
-	}
-    }
-    if {[llength $charL]>1 || [llength $classL]>0} then {
-	while {[set n [lsearch $charL -]] >= 0} {
-	    lset charL $n {\-}
-	}
-	set bracket "\[[join $charL ""][join $classL ""]\]"
-	if {![llength $prodL]} then {
-	    return [list atom $bracket]
-	}
-	lappend prodL $bracket
-    } else {
-	eval [list lappend prodL] $charL
-    }
-    return [list sum [join $prodL |]]
-}
-
-proc ::grammar::fa::op::tclre::& {args} {
-    error "Cannot express language intersection in Tcl-RE's"
-
-    # Note: This can be translated by constructing an automaton for
-    # the intersection, and then translating its conversion to a
-    # regular expression.
-}
-
-proc ::grammar::fa::op::tclre::! {args} {
-    error "Cannot express language complementation in Tcl-RE's"
-
-    # Note: This can be translated by constructing an automaton for
-    # the complement, and then translating its conversion to a regular
-    # expression. This however requires knowledge regarding the set of
-    # symbols. Large (utf-8) for Tcl regexes.
-}
-
-# ### ### ### ######### ######### #########
-
-proc ::grammar::fa::op::constructor {cmd} {
-    variable cons $cmd
-    return
-}
-
-proc ::grammar::fa::op::cons {} {
-    variable cons
-    if {$cons ne ""} {return $cons}
-    return -code errror "No constructor for FA container was established."
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::fa::op 0.4
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_fa/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,6 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-
-package ifneeded grammar::fa            0.3   [list source [file join $dir fa.tcl]]
-package ifneeded grammar::fa::op        0.4   [list source [file join $dir faop.tcl]]
-package ifneeded grammar::fa::dacceptor 0.1.1 [list source [file join $dir dacceptor.tcl]]
-package ifneeded grammar::fa::dexec     0.2   [list source [file join $dir dexec.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/gasm.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/gasm.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,207 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Package description
-
-## (struct::)Graph based ME Assembler, for use in grammar
-## translations.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval grammar::me::cpu::gasm {}
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-proc ::grammar::me::cpu::gasm::begin {g n {mode okfail} {note {}}} {
-    variable    gas
-    array unset gas *
-
-    # (Re)initialize the assmebler state, create the framework nodes
-    # upon which we will hang all instructions on.
-
-    set         gas(mode) $mode
-    set         gas(node) $n
-    set         gas(grap) $g
-    array set   gas {last {} cond always}
-
-    Nop $note           ; /Label entry ; /Clear
-    if {$mode eq "okfail"} {
-	Nop Exit'OK     ; /Label exit/ok     ; /Clear
-	Nop Exit'FAIL   ; /Label exit/fail   ; /Clear
-    } elseif {$mode eq "halt"} {
-	Cmd icf_halt     ; /Label exit/return ; /Clear
-    } else {
-	Cmd icf_ntreturn ; /Label exit/return ; /Clear
-    }
-
-    /At entry
-    return
-}
-
-proc ::grammar::me::cpu::gasm::done {__ t} {
-    variable gas
-
-    # Save the framework nodes in a grammar tree and shut the
-    # assembler down.
-
-    $t set $gas(node) gas::entry $gas(_entry)
-
-    if {$gas(mode) eq "okfail"} {
-	$t set $gas(node) gas::exit::ok   $gas(_exit/ok)
-	$t set $gas(node) gas::exit::fail $gas(_exit/fail)
-    } else {
-	$t set $gas(node) gas::exit $gas(_exit/return)
-    }
-
-    # Remember the node in the grammar tree which is responsible for
-    # this entry point.
-
-    $gas(grap) node set $gas(_entry) expr $gas(node)
-
-    array unset gas *
-    return
-}
-
-proc ::grammar::me::cpu::gasm::lift {t dst __ src} {
-
-    $t set $dst gas::entry      [$t get $src gas::entry]
-    $t set $dst gas::exit::ok   [$t get $src gas::exit::ok]
-    $t set $dst gas::exit::fail [$t get $src gas::exit::fail]
-    return
-}
-
-proc ::grammar::me::cpu::gasm::state {} {
-    variable gas
-    return [array get gas]
-}
-
-proc ::grammar::me::cpu::gasm::state! {s} {
-    variable  gas
-    array set gas $s
-}
-
-proc ::grammar::me::cpu::gasm::Inline {t node label} {
-    variable gas
-
-    set gas(_${label}/entry)     [$t get $node gas::entry]
-    set gas(_${label}/exit/ok)   [$t get $node gas::exit::ok]
-    set gas(_${label}/exit/fail) [$t get $node gas::exit::fail]
-
-    __Link $gas(_${label}/entry) $gas(cond)
-    /At    ${label}/exit/ok
-    return
-}
-
-proc ::grammar::me::cpu::gasm::Cmd {cmd args} {
-    variable gas
-
-    # Add a new instruction, and link it to the anchor. The created
-    # instruction becomes the new anchor.
-
-    upvar 0 gas(grap) g gas(last) anchor gas(cond) cond
-
-    set node [$g node insert]
-    $g  node set $node instruction $cmd
-    $g  node set $node arguments   $args
-
-    if {$anchor ne ""} {__Link $node $cond}
-
-    set anchor $node
-    set cond   always
-    return
-}
-
-proc ::grammar::me::cpu::gasm::Bra {} {
-    Cmd .BRA
-}
-
-proc ::grammar::me::cpu::gasm::Nop {{text {}}} {
-    Cmd .NOP $text
-}
-
-proc ::grammar::me::cpu::gasm::Note {text} {
-    Cmd .C $text
-}
-
-proc ::grammar::me::cpu::gasm::Jmp {label} {
-    variable gas
-    __Link $gas(_$label) $gas(cond)
-    return
-}
-
-proc ::grammar::me::cpu::gasm::Exit {} {
-    variable gas
-    if {$gas(mode) eq "okfail"} {
-	__Link $gas(_exit/$gas(cond)) $gas(cond)
-    } else {
-	__Link $gas(_exit/return) always
-    }
-    return
-}
-
-proc ::grammar::me::cpu::gasm::Who {label} {
-    variable gas
-    return  $gas(_$label)
-}
-
-proc ::grammar::me::cpu::gasm::__Link {to cond} {
-    variable gas
-    upvar 0 gas(grap) g gas(last) anchor
-
-    set arc [$g arc insert $anchor $to]
-    $g  arc set $arc condition $cond
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/Label {name} {
-    variable gas
-    set gas(_$name) $gas(last)
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/Clear {} {
-    variable gas
-    set gas(last) {}
-    set gas(cond) always
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/Ok {} {
-    variable gas
-    set gas(cond) ok
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/Fail {} {
-    variable gas
-    set gas(cond) fail
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/At {name} {
-    variable gas
-    set gas(last) $gas(_$name)
-    set gas(cond) always
-    return
-}
-
-proc ::grammar::me::cpu::gasm::/CloseLoop {} {
-    variable gas
-    $gas(grap) node set $gas(last) LOOP .
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Interfacing
-
-namespace eval grammar::me::cpu::gasm {
-    namespace export begin done lift state state!
-    namespace export Inline Cmd Bra Nop Note Jmp Exit Who
-    namespace export /Label /Clear /Ok /Fail /At /CloseLoop
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide grammar::me::cpu::gasm 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_cpu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_cpu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,103 +1,0 @@
-# -*- tcl -*-
-# (C) 2005-2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# ### ### ### ######### ######### #########
-## Package description
-
-## Implementation of ME virtual machines, object-based API to the
-## state values provided by "grammar::me::cpu::core".
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require grammar::me::cpu::core
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::grammar::me::cpu {
-    constructor {code_} {
-	# The 'core new' call validates the code as well.
-
-	set state [core::new $code_]
-	return
-    }
-
-    method lc     {location}     {return [core::lc     $state $location]}
-    method tok    {args}         {return [eval [linsert $args 0 core::tok $state]]}
-    method pc     {}             {return [core::pc     $state]}
-    method iseof  {}             {return [core::iseof  $state]}
-    method at     {}             {return [core::at     $state]}
-    method cc     {}             {return [core::cc     $state]}
-    method sv     {}             {return [core::sv     $state]}
-    method ok     {}             {return [core::ok     $state]}
-    method error  {}             {return [core::error  $state]}
-    method lstk   {}             {return [core::lstk   $state]}
-    method astk   {}             {return [core::astk   $state]}
-    method mstk   {}             {return [core::mstk   $state]}
-    method estk   {}             {return [core::estk   $state]}
-    method rstk   {}             {return [core::rstk   $state]}
-    method nc     {}             {return [core::nc     $state]}
-    method ast    {}             {return [core::ast    $state]}
-    method halted {}             {return [core::halted $state]}
-    method code   {}             {return [core::code   $state]}
-
-    method eof {} {
-	core::eof state
-	return
-    }
-
-    method put {tok lex line col} {
-	core::put state $tok $lex $line $col
-	return
-    }
-
-    method putstring {str lvar cvar} {
-	upvar 1 $lvar line $cvar col
-	foreach ch [split $str {}] {
-	    core::put state $ch {} $line $col
-	    if {$ch eq "\n"} {
-		incr line
-		set  col 0
-	    } else {
-		incr col
-	    }
-	}
-	return
-    }
-
-    method run {{n -1}} {
-	core::run state $n
-	return
-    }
-
-    method pull {next} {
-	while {1} {
-	    core::run state
-	    if {[core::halted $state]} break
-
-	    set tokdata [uplevel \#0 $next]
-	    if {![llength $tokdata]} break
-	    if {[llength $tokdata] != 4} {
-		return -code error "Bad callback result, expected 4 elements"
-	    }
-	    foreach {tok lex line col} $tokdata break
-	    core::put state $tok $lex $line $col
-	}
-    }
-
-    method reset {} {
-	set state [core::new [core::code $state]]
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable state ; # State of ME cpu handled here.
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide grammar::me::cpu 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_cpucore.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_cpucore.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1156 +1,0 @@
-# -*- tcl -*-
-# (C) 2005-2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# ### ### ### ######### ######### #########
-## Package description
-
-## Implementation of ME virtual machines based on state values
-## manipulated by the commands according to the match
-## instructions. Allows for implementation in C.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::grammar::me::cpu::core {}
-
-# ### ### ### ######### ######### #########
-## Implementation, API. Ensemble command.
-
-proc ::grammar::me::cpu::core {cmd args} {
-    # Dispatcher for the ensemble command.
-    variable core::cmds
-    return [uplevel 1 [linsert $args 0 $cmds($cmd)]]
-}
-
-namespace eval grammar::me::cpu::core {
-    variable cmds
-
-    # Mapping from cmd names to procedures for quick dispatch. The
-    # objects will shimmer into resolved command references.
-
-    array set cmds {
-	disasm ::grammar::me::cpu::core::disasm
-	asm    ::grammar::me::cpu::core::asm
-	new    ::grammar::me::cpu::core::new
-	lc     ::grammar::me::cpu::core::lc
-	tok    ::grammar::me::cpu::core::tok
-	pc     ::grammar::me::cpu::core::pc
-	iseof  ::grammar::me::cpu::core::iseof
-	at     ::grammar::me::cpu::core::at
-	cc     ::grammar::me::cpu::core::cc
-	sv     ::grammar::me::cpu::core::sv
-	ok     ::grammar::me::cpu::core::ok
-	error  ::grammar::me::cpu::core::error
-	lstk   ::grammar::me::cpu::core::lstk
-	astk   ::grammar::me::cpu::core::astk
-	mstk   ::grammar::me::cpu::core::mstk
-	estk   ::grammar::me::cpu::core::estk
-	rstk   ::grammar::me::cpu::core::rstk
-	nc     ::grammar::me::cpu::core::nc
-	ast    ::grammar::me::cpu::core::ast
-	halted ::grammar::me::cpu::core::halted
-	code   ::grammar::me::cpu::core::code
-	eof    ::grammar::me::cpu::core::eof
-	put    ::grammar::me::cpu::core::put
-	run    ::grammar::me::cpu::core::run
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ensemble implementation
-
-proc ::grammar::me::cpu::core::disasm {code} {
-    variable iname
-    variable tclass
-    variable anum
-
-    Validate $code ord dst jmp
-
-    set label 0
-    foreach k [array names jmp] {
-	set jmp($k) bra$label
-	incr label
-    }
-    foreach k [array names dst] {
-	if {![info exists jmp($k)]} {
-	    set jmp($k) {}
-	}
-    }
-
-    set result {}
-    foreach {asm pool tokmap} $code break
-
-    set pc    0
-    set pcend [llength $asm]
-
-    while {$pc < $pcend} {
-	set base $pc
-	set insn [lindex $asm $pc] ; incr pc
-	set an   [lindex $anum $insn]
-
-	if {$an == 1} {
-	    set a [lindex $asm $pc] ; incr pc
-	} elseif {$an == 2} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	} elseif {$an == 3} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	    set c [lindex $asm $pc] ; incr pc
-	}
-
-	set     instruction {}
-	lappend instruction $jmp($base)
-	lappend instruction $iname($insn)
-
-	switch -exact $insn {
-	    0 - 5 - 20 - 24 - 25 - 26 -
-	    a/string {
-		lappend instruction [lindex $pool $a]
-	    }
-	    1 {
-		# a/tok b/string
-		if {![llength $tokmap]} {
-		    lappend instruction [lindex $pool $a]
-		} else {
-		    lappend instruction ${a}:$ord($a)
-		}
-		lappend instruction [lindex $pool $b]
-	    }
-	    2 {
-		# a/tokstart b/tokend c/string
-		if {![llength $tokmap]} {
-		    lappend instruction [lindex $pool $a]
-		    lappend instruction [lindex $pool $b]
-		} else {
-		    # tokmap defined: a = b = order rank.
-		    lappend instruction ${a}:$ord($a)
-		    lappend instruction ${b}:$ord($b)
-		}
-		lappend instruction [lindex $pool $c]
-	    }
-	    3 {
-		# a/class(0-5) b/string
-		lappend instruction [lindex $tclass $a]
-		lappend instruction [lindex $pool $b]
-	    }
-	    4 {
-		# a/branch b/string
-		lappend instruction $jmp($a)
-		lappend instruction [lindex $pool $b]
-	    }
-	    6 - 11 - 12 - 13 -
-	    a/branch {
-		lappend instruction $jmp($a)
-	    }
-	    default {}
-	}
-
-	lappend result $instruction
-    }
-
-    return $result
-}
-
-proc ::grammar::me::cpu::core::asm {code} {
-    variable iname
-    variable anum
-    variable tccode
-
-    # code = list(insn), insn = list (label insn-name ...)
-
-    # I. Indices for the labels, based on instruction sizes.
-
-    array set jmp {}
-    set off 0
-    foreach insn $code {
-	foreach {label name} $insn break
-	# Ignore embedded comments, except for labels
-	if {$label ne ""} {
-	    set jmp($label) $off
-	}
-	if {$name eq ".C"} continue
-	if {![info exists iname($name)]} {
-	    return -code error "Bad instruction \"$insn\", unknown command \"$name\""
-	}
-	set an [lindex $anum $iname($name)]
-	if {[llength $insn] != ($an+2)} {
-	    return -code error "Bad instruction \"$insn\", expected $an argument[expr {$an == 1 ? "" : "s"}]"
-	}
-	incr off
-	incr off [lindex $anum $iname($name)]
-    }
-
-    set asm          {}
-    set pool         {}
-    array set poolh  {}
-    array set tokmap {}
-    array set ord    {}
-    set plain        0
-
-    foreach insn $code {
-	foreach {label name} $insn break
-	# Ignore embedded comments
-	if {$name eq ".C"} continue
-	set an [lindex $anum $iname($name)]
-
-	# Instruction code to assembly ...
-	lappend asm $iname($name)
-
-	# Encode arguments ...
-	switch -exact -- $name {
-	    ict_advance            -
-	    inc_save               -
-	    ier_nonterminal        -
-	    isv_nonterminal_leaf   -
-	    isv_nonterminal_range  -
-	    isv_nonterminal_reduce {
-		lappend asm [Str [lindex $insn 2]]
-	    }
-	    ict_match_token {
-		lappend asm [Tok [lindex $insn 2]]
-		lappend asm [Str [lindex $insn 3]]
-	    }
-	    ict_match_tokrange {
-		lappend asm [Tok [lindex $insn 2]]
-		lappend asm [Tok [lindex $insn 3]]
-		lappend asm [Str [lindex $insn 4]]
-	    }
-	    ict_match_tokclass {
-		set ccode [lindex $insn 2]
-		if {![info exists tccode($ccode)]} {
-		    return -code error "Bad instruction \"$insn\", unknown class code \"$ccode\""
-		}
-		lappend asm $tccode($ccode)
-		lappend asm [Str [lindex $insn 3]]
-
-	    }
-	    inc_restore {
-		set jmpto [lindex $insn 2]
-		if {![info exists jmp($jmpto)]} {
-		    return -code error "Bad instruction \"$insn\", unknown branch destination \"$jmpto\""
-		}
-		lappend asm $jmp($jmpto)
-		lappend asm [Str [lindex $insn 3]]
-	    }
-	    icf_ntcall  -
-	    icf_jalways -
-	    icf_jok     -
-	    icf_jfail   {
-		set jmpto [lindex $insn 2]
-		if {![info exists jmp($jmpto)]} {
-		    return -code error "Bad instruction \"$insn\", unknown branch destination \"$jmpto\""
-		}
-		lappend asm $jmp($jmpto)
-	    }
-	}
-    }
-
-    return [list $asm $pool [array get tokmap]]
-}
-
-proc ::grammar::me::cpu::core::new {code} {
-    # The code generating the state is drawn out to integrate a
-    # specification of how the machine state is mapped to Tcl as well.
-
-    Validate $code
-
-    set     state {}   ; # The state is representend as a Tcl list.
-    # ### ### ### ######### ######### #########
-    lappend state $code ; # [_0] code  - list  - code to run (-)
-    lappend state 0     ; # [_1] pc    - int   - Program counter
-    lappend state 0     ; # [_2] halt  - bool  - Flag, set (internal) when machine was halted (icf_halt).
-    lappend state 0     ; # [_3] eof   - bool  - Flag, set (external) when where will be no more input.
-    lappend state {}    ; # [_4] tc    - list  - Terminal cache, pending and processed tokens.
-    lappend state -1    ; # [_5] cl    - int   - Current Location
-    lappend state {}    ; # [_6] ct    - token - Current Character
-    lappend state 0     ; # [_7] ok    - bool  - Match Status
-    lappend state {}    ; # [_8] sv    - any   - Semantic Value
-    lappend state {}    ; # [_9] er    - list  - Error status (*)
-    lappend state {}    ; # [10] ls    - list  - Location Stack (x)
-    lappend state {}    ; # [11] as    - list  - Ast Stack
-    lappend state {}    ; # [12] ms    - list  - Ast Marker Stack
-    lappend state {}    ; # [13] es    - list  - Error Stack
-    lappend state {}    ; # [14] rs    - list  - Return Stack
-    lappend state {}    ; # [15] nc    - dict  - Nonterminal Cache (backtracking)
-    # ### ### ### ######### ######### #########
-
-    # tc    = list(token)
-    # token = list(str lexeme line col)
-
-
-    # (-) See manpage of this package for the representation.
-
-    # (*) 2 elements, first is error location, second is list of 
-    # ... strings, the error messages. The strings are actually
-    # ... represented by references into the pool element of the code.
-
-    # (x) Regarding the various stacks maintained in the state, their
-    #     top element is always at the right end, i.e. the last
-    #     element in the list representing it.
-
-    return $state
-}
-
-proc ::grammar::me::cpu::core::ntok {state} {
-    return [llength [lindex $state 4]]
-}
-
-proc ::grammar::me::cpu::core::lc {state loc} {
-    set tc  [lindex $state 4]
-    set loc [INDEX $tc $loc "Illegal location"]
-    return [lrange [lindex $tc $loc] 2 3]
-    # result = list(line col)
-}
-
-proc ::grammar::me::cpu::core::tok {state args} {
-    if {[llength $args] > 2} {
-	return -code error {wrong # args: should be "grammar::me::cpu::core::tok state ?from ?to??"}
-    }
-    set tc [lindex $state 4]
-    if {[llength $args] == 0} {
-	return $tc
-    } elseif {[llength $args] == 1} {
-	set at [INDEX $tc [lindex $args 0] "Illegal location"]
-	return [lrange $tc $at $at]
-    } else {
-	set from [INDEX $tc [lindex $args 0] "Illegal start location"]
-	set to   [INDEX $tc [lindex $args 1] "Illegal end location"]
-	if {$from > $to} {
-	    return -code error "Illegal empty location range $from .. $to"
-	}
-	return [lrange $tc $from $to]
-    }
-    # result = list(token), token = list(str lex line col)
-}
-
-proc ::grammar::me::cpu::core::pc {state} {
-    return [lindex $state 1]
-}
-
-proc ::grammar::me::cpu::core::iseof {state} {
-    return [lindex $state 3]
-}
-
-proc ::grammar::me::cpu::core::at {state} {
-    return [lindex $state 5]
-}
-
-proc ::grammar::me::cpu::core::cc {state} {
-    return [lindex $state 6]
-}
-
-proc ::grammar::me::cpu::core::sv {state} {
-    return [lindex $state 8]
-}
-
-proc ::grammar::me::cpu::core::ok {state} {
-    return [lindex $state 7]
-}
-
-proc ::grammar::me::cpu::core::error {state} {
-    set er [lindex $state 9]
-    if {[llength $er]} {
-	foreach {l m} $er break
-
-	set pool [lindex $state 0 1] ; # state ->/0 code ->/1 pool
-	set mx   {}
-	foreach id $m {
-	    lappend mx [lindex $pool $id]
-	}
-	set er [list $l $mx]
-    }
-    return $er
-}
-
-proc ::grammar::me::cpu::core::lstk {state} {
-    return [lindex $state 10]
-}
-
-proc ::grammar::me::cpu::core::astk {state} {
-    return [lindex $state 11]
-}
-
-proc ::grammar::me::cpu::core::mstk {state} {
-    return [lindex $state 12]
-}
-
-proc ::grammar::me::cpu::core::estk {state} {
-    return [lindex $state 13]
-}
-
-proc ::grammar::me::cpu::core::rstk {state} {
-    return [lindex $state 14]
-}
-
-proc ::grammar::me::cpu::core::nc {state} {
-    return [lindex $state 15]
-}
-
-proc ::grammar::me::cpu::core::ast {state} {
-    return [lindex $state 11 end]
-}
-
-proc ::grammar::me::cpu::core::halted {state} {
-    return [lindex $state 2]
-}
-
-proc ::grammar::me::cpu::core::code {state} {
-    return [lindex $state 0]
-}
-
-proc ::grammar::me::cpu::core::eof {statevar} {
-    upvar 1 $statevar state
-    lset state 3 1
-    return
-}
-
-proc ::grammar::me::cpu::core::put {statevar tok lex line col} {
-    upvar 1 $statevar state
-    if {[lindex $state 3]} {
-	return -code error "Cannot add input data after eof"
-    }
-    set     tc [K [lindex $state 4] [lset state 4 {}]]
-    lappend tc [list $tok $lex $line $col]
-    lset state 4 $tc
-    return
-}
-
-proc ::grammar::me::cpu::core::run {statevar {steps -1}} {
-    # Execution loop. Should be instrumented for statistics about
-    # dynamic instruction frequency. I.e. which instructions are
-    # executed the most => put them at the front of the if/switch for
-    # quicker selection. I.e. frequency coding of the branches for
-    # speed.
-
-    # A C implementation can shimmer the state into a directly
-    # accessible data structure. And the asm instructions can shimmer
-    # into an integer index upon which we can switch fast.
-
-    variable anum
-    variable tclass
-    upvar 1 $statevar state
-    variable iname ; # For debug output
-
-    # Do nothing for a stopped machine (halt flag set).
-    if {[lindex $state 2]} {return $state}
-
-    # Fail if there are no instruction to execute
-    if {![llength [lindex $state 0 0]]} {
-	# No instructions to execute
-	return -code error "No instructions to execute"
-    }
-
-    # Unpack state into locally accessible variables
-    #        0    1  2    3   4  5  6  7  8  9  10 11 12 13 14 15 16 17 18  19  20
-    foreach {code pc halt eof tc cl ct ok sv er ls as ms es rs nc} $state break
-
-    # Unpack match program for easy access as well.
-    #        0   1    2
-    foreach {asm pool tokmap} $code break
-
-    if 0 {
-	puts ________________________
-	puts [join [disasm $code] \n]
-	puts ________________________
-    }
-
-    # Ensure that the unpacked information is not shared
-    unset state
-
-    # Internal flags for optimal handling of the nonterminal
-    # cache. Avoid multiple unpacking of the dictionary, and avoid
-    # repacking if it was not modified.
-
-    set ncunpacked 0
-    set ncmodified 0
-    set tmunpacked 0
-
-    while {1} {
-	# Stop execution if the specified number of instructions have
-	# been executed. Ignore if infinity was specified.
-	if {$steps == 0} break
-	if {$steps > 0} {incr steps -1}
-
-	# Get current instruction ...
-
-	if 0 {puts .$pc:\t$iname([lindex $asm $pc])}
-	if 0 {puts -nonewline .$pc:\t$iname([lindex $asm $pc])}
-
-	set insn [lindex $asm $pc] ; incr pc
-
-	# And its arguments ...
-
-	set an [lindex $anum $insn]
-	if {$an == 1} {
-	    set a [lindex $asm $pc] ; incr pc
-	    if 0 {puts \t<$a>}
-	} elseif {$an == 2} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	    if 0 {puts \t<$a|$b>}
-	} elseif {$an == 3} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	    set c [lindex $asm $pc] ; incr pc
-	    if 0 {puts \t<$a|$b|$c>}
-	} ;# else {puts ""}
-
-	# Dispatch to implementation of the instruction ...
-
-	# Separate if commands are used for easier ordering of the
-	# dispatch. The order of the branches should be frequency
-	# coded to have the most frequently used instructions first.
-
-	# ict_advance <a:message>
-	if {$insn == 0} {
-	    if 0 {puts \t\[$cl|[llength $tc]|$eof\]}
-	    incr cl
-	    if {$cl < [llength $tc]} {
-		if 0 {puts \tConsume}
-
-		set ct [lindex $tc $cl 0]
-		set ok 1
-		set er {}
-	    } elseif {$eof} {
-		if 0 {puts \tFail<Eof>}
-
-		# We have no input, and there won't be more coming in
-		# either. Fail the advance. We do _not_ stop the match
-		# loop, the program has to complete. The failure might
-		# be no such, revealed during backtracking. The current
-		# location is not rewound automatically, this is the
-		# responsibility of any backtracking.
-
-		set er  [list $cl [list $a]]
-		set ok  0
-	    } else {
-		if 0 {puts \tSuspend&Wait}
-
-		# We have no input, stop matching and wait for
-		# more. We reset the machine into a state
-		# which will restart this instruction when
-		# execution resumes.
-
-		incr cl -1
-		incr pc -2 ; # code and message argument
-		break
-	    }
-	    if 0 {puts .Next}
-	    continue
-	}
-
-	# ict_match_token <a:token> <b:message>
-	if {$insn == 1} {
-	    if {[llength $tokmap]} {
-		if {!$tmunpacked} {
-		    array set tm $tokmap
-		    set tmunpacked 1
-		}
-		set ok [expr {$a == $tm($ct)}]
-	    } else {
-		set xch [lindex $pool $a]
-		set ok  [expr {$xch eq $ct}]
-	    }
-	    if {!$ok} {
-		set er [list $cl [list $b]]
-	    } else {
-		set er {}
-	    }
-	    continue
-	}
-
-	# ict_match_tokrange <a:tokstart> <b:tokend> <c:message>
-	if {$insn == 2} {
-	    if {[llength $tokmap]} {
-		if {!$tmunpacked} {
-		    array set tm $tokmap
-		    set tmunpacked 1
-		}
-		set x $tm($ct)
-		set ok [expr {($a <= $x) && ($x <= $b)}]
-	    } else {
-		set a [lindex $pool $a]
-		set b [lindex $pool $b]
-		set ok [expr {
-		    ([string compare $a $ct] <= 0) &&
-		    ([string compare $ct $b] <= 0)
-		}] ; # {}
-	    }
-	    if {!$ok} {
-		set er [list $cl [list $c]]
-	    } else {
-		set er {}
-	    }
-	    continue
-	}
-
-	# ict_match_tokclass <a:code> <b:message>
-	if {$insn == 3} {
-	    set strcode [lindex $tclass $a]
-	    set ok   [string is $strcode -strict $ct]
-	    if {!$ok} {
-		set er [list $cl [list $b]]
-	    } else {
-		set er {}
-	    }
-	    continue
-	}
-
-	# inc_restore <a:branchtarget> <b:nonterminal>
-	if {$insn == 4} {
-	    set sym [lindex $pool $b]
-
-	    # Unpack the cache dict, only here.
-	    # 8.5 - Use dict operations instead.
-
-	    if {!$ncunpacked} {
-		array set ncc $nc
-		set ncunpacked 1
-	    }
-
-	    if {[info exists ncc($cl,$sym)]} {
-		foreach {go ok error sv} $ncc($cl,$sym) break
-
-		# Go forward, as the nonterminal matches (or not).
-		set cl $go
-		set pc $a
-	    }
-	    continue
-	}
-
-	# inc_save <a:nonterminal>
-	if {$insn == 5} {
-	    set sym [lindex $pool $a]
-	    set at  [lindex $ls end]
-	    set ls  [lrange $ls 0 end-1]
-
-	    # Unpack, modify, only here.
-	    # 8.5 - Use dict operations instead.
-
-	    if {!$ncunpacked} {
-		array set ncc $nc
-		set ncunpacked 1
-	    }
-
-	    set ncc($at,$sym) [list $cl $ok $er $sv]
-	    set ncmodified 1
-	    continue
-	}
-
-	# icf_ntcall <a:branchtarget>
-	if {$insn == 6} {
-	    lappend rs $pc
-	    set     pc $a
-	    continue
-	}
-
-	# icf_ntreturn
-	if {$insn == 7} {
-	    set pc [lindex $rs end]
-	    set rs [lrange $rs 0 end-1]
-	    continue
-	}
-
-	# iok_ok
-	if {$insn == 8} {
-	    set ok 1
-	    continue
-	}
-
-	# iok_fail
-	if {$insn == 9} {
-	    set ok 0
-	    continue
-	}
-
-	# iok_negate
-	if {$insn == 10} {
-	    set ok [expr {!$ok}]
-	    continue
-	}
-
-	# icf_jalways <a:branchtarget>
-	if {$insn == 11} {
-	    set pc $a
-	    continue
-	}
-
-	# icf_jok <a:branchtarget>
-	if {$insn == 12} {
-	    if {$ok} {set pc $a}
-	    # !ok => pc is already on next instruction.
-	    continue
-	}
-
-	# icf_jfail <a:branchtarget>
-	if {$insn == 13} {
-	    if {!$ok} {set pc $a}
-	    # ok => pc is already on next instruction.
-	    continue
-	}
-
-	# icf_halt
-	if {$insn == 14} {
-	    set halt 1
-	    break
-	}
-
-	# icl_push
-	if {$insn == 15} {
-	    lappend ls $cl
-	    continue
-	}
-
-	# icl_rewind
-	if {$insn == 16} {
-	    set cl [lindex $ls end]
-	    set ls [lrange $ls 0 end-1]
-	    continue
-	}
-
-	# icl_pop
-	if {$insn == 17} {
-	    set ls [lrange $ls 0 end-1]
-	    continue
-	}
-
-	# ier_push
-	if {$insn == 18} {
-	    lappend es $er
-	    continue
-	}
-
-	# ier_clear
-	if {$insn == 19} {
-	    set er {}
-	    continue
-	}
-
-	# ier_nonterminal <a:nonterminal>
-	if {$insn == 20} {
-	    if {[llength $er]} {
-		set  pos [lindex $ls end]
-		incr pos
-		set eloc [lindex $er 0]
-		if {$eloc == $pos} {
-		    set er [list $eloc [list $a]]
-		}
-	    }
-	    continue
-	}
-
-	# ier_merge
-	if {$insn == 21} {
-	    set old [lindex $es end]
-	    set es  [lrange $es 0 end-1]
-
-	    # We have either old or current error data, keep it.
-
-	    if {![llength $er]} {
-		# No current data, keep old
-		set er $old
-	    } elseif {[llength $old]} {
-		# If one of the errors is further on in the input
-		# choose that as the information to propagate.
-
-		foreach {loe msgse} $er  break
-		foreach {lon msgsn} $old break
-
-		if {$lon > $loe} {
-		    set er $old
-		} elseif {$loe == $lon} {
-		    # Equal locations, merge the message lists.
-
-		    foreach m $msgsn {lappend msgse $m}
-		    set er [list $loe [lsort -uniq $msgse]]
-		}
-		# else lon < loe - er is better - nothing
-	    }
-	    # else - !old, but er - nothing
-
-	    continue
-	}
-
-	# isv_clear
-	if {$insn == 22} {
-	    set sv {}
-	    continue
-	}
-
-	# isv_terminal (implied ias_push)
-	if {$insn == 23} {
-	    set sv [list {} $cl $cl]
-	    lappend as $sv
-	    continue
-	}
-
-	# isv_nonterminal_leaf <a:nonterminal>
-	if {$insn == 24} {
-	    set pos [lindex $ls end]
-	    set sv  [list $a $pos $cl]
-	    continue
-	}
-
-	# isv_nonterminal_range <a:nonterminal>
-	if {$insn == 25} {
-	    set pos [lindex $ls end]
-	    set sv  [list $a $pos $cl [list {} $pos $cl]]
-	    continue
-	}
-
-	# isv_nonterminal_reduce <a:nonterminal>
-	if {$insn == 26} {
-	    set pos [lindex $ls end]
-	    if {[llength $ms]} {
-		set  mrk [lindex $ms end]
-		incr mrk
-	    } else {
-		set mrk 0
-	    }
-	    set sv [lrange $as $mrk end]
-	    set sv [linsert $sv 0 $a $pos $cl]
-	    continue
-	}
-
-	# ias_push
-	if {$insn == 27} {
-	    lappend as $sv
-	    continue
-	}
-
-	# ias_mark
-	if {$insn == 28} {
-	    set  mark [llength $as]
-	    incr mark -1
-	    lappend ms $mark
-	    continue
-	}
-
-	# ias_mrewind
-	if {$insn == 29} {
-	    set mark [lindex $ms end]
-	    set ms   [lrange $ms 0 end-1]
-	    set as   [lrange $as 0 $mark]
-	    continue
-	}
-
-	# ias_mpop
-	if {$insn == 30} {
-	    set ms [lrange $ms 0 end-1]
-	    continue
-	}
-
-	return -code error "Illegal instruction $insn"
-    }
-
-    # Repack a modified cache dictionary, then repack and store the
-    # updated state value.
-
-    if 0 {puts .Repackage\ state}
-
-    if {$ncmodified} {set nc [array get ncc]}
-    set state [list $code $pc $halt $eof $tc $cl $ct $ok $sv $er $ls $as $ms $es $rs $nc]
-    return
-}
-
-namespace eval grammar::me::cpu::core {
-    # Map between class codes and names
-    variable tclass {}
-    variable tccode
-
-    foreach {x code} {
-	0 alnum
-	1 alpha
-	2 digit
-	3 xdigit
-	4 punct
-	5 space
-    } {
-	lappend tclass $code
-	set tccode($code) $x
-    }
-
-    # Number of arguments per ME instruction.
-    # Indexed by instruction code.
-    variable anum {}
-
-    # Mapping between instruction codes and names.
-    variable iname
-
-    foreach {z insn x notes} {
-	0  ict_advance            1	{-- TESTED}
-	1  ict_match_token        2	{-- TESTED}
-	2  ict_match_tokrange     3	{-- TESTED}
-	3  ict_match_tokclass     2	{-- TESTED}
-	4  inc_restore            2	{-- TESTED}
-	5  inc_save               1	{-- TESTED}
-	6  icf_ntcall             1	{-- TESTED}
-	7  icf_ntreturn           0	{-- TESTED}
-	8  iok_ok                 0	{-- TESTED}
-	9  iok_fail               0	{-- TESTED}
-	10 iok_negate             0	{-- TESTED}
-	11 icf_jalways            1	{-- TESTED}
-	12 icf_jok                1	{-- TESTED}
-	13 icf_jfail              1	{-- TESTED}
-	14 icf_halt               0	{-- TESTED}
-	15 icl_push               0	{-- TESTED}
-	16 icl_rewind             0	{-- TESTED}
-	17 icl_pop                0	{-- TESTED}
-	18 ier_push               0	{-- TESTED}
-	19 ier_clear              0	{-- TESTED}
-	20 ier_nonterminal        1	{-- TESTED}
-	21 ier_merge              0	{-- TESTED}
-	22 isv_clear              0	{-- TESTED}
-	23 isv_terminal           0	{-- TESTED}
-	24 isv_nonterminal_leaf   1	{-- TESTED}
-	25 isv_nonterminal_range  1	{-- TESTED}
-	26 isv_nonterminal_reduce 1	{-- TESTED}
-	27 ias_push               0	{-- TESTED}
-	28 ias_mark               0	{-- TESTED}
-	29 ias_mrewind            0	{-- TESTED}
-	30 ias_mpop               0	{-- TESTED}
-    } {
-	lappend anum $x
-	set iname($z) $insn
-	set iname($insn) $z
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Helper commands ((Dis)Assembler, runtime).
-
-proc ::grammar::me::cpu::core::INDEX {list i label} {
-    if {$i eq "end"} {
-	set i [expr {[llength $list] - 1}]
-    } elseif {[regexp {^end-([0-9]+)$} $i -> n]} {
-	set i [expr {[llength $list] - $n -1}]
-    }
-    if {
-	![string is integer -strict $i] ||
-	($i < 0) ||
-	($i >= [llength $list])
-    } {
-	return -code error "$label $i"
-    }
-    return $i
-}
-
-proc ::grammar::me::cpu::core::K {x y} {set x}
-
-proc ::grammar::me::cpu::core::Str {str} {
-    upvar 1 pool pool poolh poolh
-    if {![info exists poolh($str)]} {
-	set poolh($str) [llength $pool]
-	lappend pool $str
-    }
-    return $poolh($str)
-}
-
-proc ::grammar::me::cpu::core::Tok {str} {
-    upvar 1 tokmap tokmap ord ord plain plain
-
-    if {[regexp {^([^:]+):(.+)$} $str -> id name]} {
-	if {$plain} {
-	    return -code error "Bad assembly, mixing plain and ranked tokens"
-	}
-	if {[info exists ord($id)]} {
-	    return -code error "Bad assembly, non-total ordering for $name and $ord($id), at rank $id"
-	}
-	set ord($id) $name
-	set tokmap($name) $id
-
-	return $id
-    } else {
-	if {[array size ord]} {
-	    return -code error "Bad assembly, mixing plain and ranked tokens"
-	}
-	set plain 1
-	return [uplevel 1 [list Str $str]]
-    }
-}
-
-proc ::grammar::me::cpu::core::Validate {code {ovar {}} {tvar {}} {jvar {}}} {
-    variable anum
-    variable iname
-
-    # Basic validation of structure ...
-
-    if {[llength $code] != 3} {
-	return -code error "Bad length"
-    }
-
-    foreach {asm pool tokmap} $code break
-
-    if {[llength $tokmap] % 2 == 1} {
-	return -code error "Bad tokmap, expected a dictionary"
-    }
-
-    array set ord {}
-    if {[llength $tokmap] > 0} {
-	foreach {tok rank} $tokmap {
-	    if {[info exists ord($rank)]} {
-		return -code error "Bad tokmap, non-total ordering for $tok and $ord($rank), at rank $rank"
-	    }
-	    set ord($rank) $tok
-	}
-    }
-
-    # Basic validation of ME code: Valid instructions, collect valid
-    # branch target indices
-
-    array set target {}
-
-    set pc 0
-    set pcend   [llength $asm]
-    set poolend [llength $pool]
-
-    while {$pc < $pcend} {
-	set target($pc) .
-
-	set insn [lindex $asm $pc]
-	if {($insn < 0) || ($insn > 30)} {
-	    return -code error "Invalid instruction $insn at PC $pc"
-	}
-
-	incr pc
-	incr pc [lindex $anum $insn]
-    }
-
-    if {$pc > $pcend} {
-	return -code error "Bad program, last instruction $insn ($iname($insn)) is truncated"
-    }
-
-    # Validation of ME instruction arguments (pool references, branch
-    # targets, ...)
-
-    if {$jvar ne ""} {
-	upvar 1 $jvar jmp
-    }
-    array set jmp {}
-
-    set pc 0
-    while {$pc < $pcend} {
-	set base $pc
-	set insn [lindex $asm $pc] ; incr pc
-	set an   [lindex $anum $insn]
-
-	if {$an == 1} {
-	    set a [lindex $asm $pc] ; incr pc
-	} elseif {$an == 2} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	} elseif {$an == 3} {
-	    set a [lindex $asm $pc] ; incr pc
-	    set b [lindex $asm $pc] ; incr pc
-	    set c [lindex $asm $pc] ; incr pc
-	}
-
-	switch -exact $insn {
-	    0 - 5 - 20 - 24 - 25 - 26 -
-	    a/string {
-		if {($a < 0) || ($a >= $poolend)} {
-		    return -code error "Invalid string reference $a for instruction $insn ($iname($insn)) at $base"
-		}
-	    }
-	    1 {
-		# a/tok b/string
-		if {![llength $tokmap]} {
-		    if {($a < 0) || ($a >= $poolend)} {
-			return -code error "Invalid string reference $a for instruction $insn ($iname($insn)) at $base"
-		    }
-		} else {
-		    if {![info exists ord($a)]} {
-			return -code error "Invalid token rank $a for instruction $insn ($iname($insn)) at $base"
-		    }
-		}
-		if {($b < 0) || ($b >= $poolend)} {
-		    return -code error "Invalid string reference $b for instruction $insn ($iname($insn)) at $base"
-		}
-	    }
-	    2 {
-		# a/tokstart b/tokend c/string
-
-		if {![llength $tokmap]} {
-		    # a = b = string references.
-		    if {($a < 0) || ($a >= $poolend)} {
-			return -code error "Invalid string reference $a for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {($b < 0) || ($b >= $poolend)} {
-			return -code error "Invalid string reference $b for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {$a == $b} {
-			return -code error "Invalid single-token range for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {[string compare [lindex $pool $a] [lindex $pool $b]] > 0} {
-			return -code error "Invalid empty range for instruction $insn ($iname($insn)) at $base"
-		    }
-		} else {
-		    # tokmap defined: a = b = order rank.
-		    if {![info exists ord($a)]} {
-			return -code error "Invalid token rank $a for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {![info exists ord($b)]} {
-			return -code error "Invalid token rank $b for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {$a == $b} {
-			return -code error "Invalid single-token range for instruction $insn ($iname($insn)) at $base"
-		    }
-		    if {$a > $b} {
-			return -code error "Invalid empty range for instruction $insn ($iname($insn)) at $base"
-		    }
-		}
-		if {($c < 0) || ($c >= $poolend)} {
-		    return -code error "Invalid string reference $c for instruction $insn ($iname($insn)) at $base"
-		}
-	    }
-	    3 {
-		# a/class(0-5) b/string
-		if {($a < 0) || ($a > 5)} {
-		    return -code error "Invalid token-class $a for instruction $insn ($iname($insn)) at $base"
-		}
-		if {($b < 0) || ($b >= $poolend)} {
-		    return -code error "Invalid string reference $b for instruction $insn ($iname($insn)) at $base"
-		}
-	    }
-	    4 {
-		# a/branch b/string
-		if {![info exists target($a)]} {
-		    return -code error "Invalid branch target $a for instruction $insn ($iname($insn)) at $base"
-		} else {
-		    set jmp($a) .
-		}
-		if {($b < 0) || ($b >= $poolend)} {
-		    return -code error "Invalid string reference $b for instruction $insn ($iname($insn)) at $base"
-		}
-	    }
-	    6 - 11 - 12 - 13 -
-	    a/branch {
-		if {![info exists target($a)]} {
-		    return -code error "Invalid branch target $a for instruction $insn ($iname($insn)) at $base"
-		} else {
-		    set jmp($base) $a
-		}
-	    }
-	    default {}
-	}
-    }
-
-    # All checks passed, code is deemed good enough.
-    # Caller may have asked for some of the collected
-    # information.
-
-    if {$ovar ne ""} {
-	upvar 1 $ovar o
-	array set o [array get ord]
-    }
-    if {$tvar ne ""} {
-	upvar 1 $tvar t
-	array set t [array get target]
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide grammar::me::cpu::core 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,521 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Package description
-
-## Implementation of the ME virtual machine as a singleton, tied to
-## Tcl for control flow and stack handling (except the AST stack).
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::grammar::me::tcl {
-    namespace export \
-	init lc tok sv tokens ast \
-	astall ctok nc next ord \
-	\
-	isv_clear              ict_advance        inc_save    \
-	isv_terminal           ict_match_token    inc_restore \
-	isv_nonterminal_leaf   ict_match_tokrange icl_get     \
-	isv_nonterminal_range  ict_match_tokclass icl_rewind  \
-	isv_nonterminal_reduce iok_ok      \
-	ier_clear              iok_fail    \
-	ier_get                iok_negate  \
-	ier_expected           ias_push    \
-	ier_nonterminal        ias_mark    \
-	ier_merge              ias_pop2mark
-
-    variable ok
-}
-
-# ### ### ### ######### ######### #########
-## Implementation, API. Ensemble command.
-
-proc ::grammar::me::tcl {cmd args} {
-    # Dispatcher for the ensemble command.
-    variable tcl::cmds
-    return [uplevel 1 [linsert $args 0 $cmds($cmd)]]
-}
-
-namespace eval grammar::me::tcl {
-    variable cmds
-
-    # Mapping from cmd names to procedures for quick dispatch. The
-    # objects will shimmer into resolved command references.
-
-    array set cmds {
-	init   ::grammar::me::tcl::init
-	lc     ::grammar::me::tcl::lc
-	tok    ::grammar::me::tcl::tok
-	sv     ::grammar::me::tcl::sv
-	tokens ::grammar::me::tcl::tokens
-	ast    ::grammar::me::tcl::ast
-	astall ::grammar::me::tcl::astall
-	ctok   ::grammar::me::tcl::ctok
-	nc     ::grammar::me::tcl::nc
-	next   ::grammar::me::tcl::next
-	ord    ::grammar::me::tcl::ord
-    }
-}
-
-# ### ### ### ######### ######### #########
-## API Implementation.
-
-proc ::grammar::me::tcl::init {nxcmd {tokmap {}}} {
-    variable next  $nxcmd
-    variable as    {}
-    variable ok    0
-    variable error {}
-    variable sv    {}
-    variable loc  -1
-    variable ct    {}
-    variable tc    {}
-    variable nc
-    variable tokOrd
-    variable tokUseOrd 0
-
-    array unset nc     *
-    array unset tokOrd *
-
-    if {[llength $tokmap]} {
-	if {[llength $tokmap] % 2 == 1} {
-	    return -code error \
-		    "Bad token order map, not a dictionary"
-	}
-	array set tokOrd $tokmap
-	set tokUseOrd 1
-    }
-    return
-}
-
-proc ::grammar::me::tcl::lc {pos} {
-    variable tc
-    return [lrange [lindex $tc $pos] 2 3]
-}
-
-proc ::grammar::me::tcl::tok {from {to {}}} {
-    variable tc
-    if {$to == {}} {set to $from}
-    return [lrange $tc $from $to]
-}
-
-proc ::grammar::me::tcl::tokens {} {
-    variable tc
-    return [llength $tc]
-}
-
-proc ::grammar::me::tcl::sv {} {
-    variable sv
-    return  $sv
-}
-
-proc ::grammar::me::tcl::ast {} {
-    variable as
-    return [lindex $as end]
-}
-
-proc ::grammar::me::tcl::astall {} {
-    variable as
-    return $as
-}
-
-proc ::grammar::me::tcl::ctok {} {
-    variable ct
-    return  $ct
-}
-
-proc ::grammar::me::tcl::nc {} {
-    variable nc
-    return [array get nc]
-}
-
-proc ::grammar::me::tcl::next {} {
-    variable next
-    return  $next
-}
-
-proc ::grammar::me::tcl::ord {} {
-    variable tokOrd
-    return [array get tokOrd]
-}
-
-# ### ### ### ######### ######### #########
-## Terminal matching
-
-proc ::grammar::me::tcl::ict_advance {msg} {
-    # Inlined: Getch, Expected, ClearErrors
-
-    variable ok
-    variable error
-    # ------------------------
-    variable tc
-    variable loc
-    variable ct
-    # ------------------------
-    variable next
-    # ------------------------
-
-    # Satisfy from input cache if possible.
-    incr loc
-    if {$loc < [llength $tc]} {
-	set ct [lindex $tc $loc 0]
-	set ok 1
-	set error {}
-	return
-    }
-
-    # Actually read from the input, and remember
-    # the information.
-
-    # Read from buffer, and remember.
-    # Note: loc is the instance variable.
-    # This implicitly increments the location!
-
-    set tokdata [uplevel \#0 $next]
-    if {![llength $tokdata]} {
-	set ok 0
-	set error [list $loc [list $msg]]
-	return
-    } elseif {[llength $tokdata] != 4} {
-	return -code error "Bad callback result, expected 4 elements"
-    }
-
-    lappend tc $tokdata
-    set ct [lindex $tokdata 0]
-    set ok    1
-    set error {}
-    return
-}
-
-proc ::grammar::me::tcl::ict_match_token {tok msg} {
-    variable ct
-    variable ok
-
-    set ok [expr {$tok eq $ct}]
-
-    OkFail $msg
-    return
-}
-
-proc ::grammar::me::tcl::ict_match_tokrange {toks toke msg} {
-    variable ct
-    variable ok
-    variable tokUseOrd
-    variable tokOrd
-
-    if {$tokUseOrd} {
-	set ord $tokOrd($ct)
-	set ok [expr {
-	    ($toks <= $ord) &&
-	    ($ord <= $toke)
-	}] ; # {}
-    } else {
-	set ok [expr {
-	    ([string compare $toks   $ct] <= 0) &&
-	    ([string compare $ct   $toke] <= 0)
-	}] ; # {}
-    }
-
-    OkFail $msg
-    return
-}
-
-proc ::grammar::me::tcl::ict_match_tokclass {code msg} {
-    variable ct
-    variable ok
-
-    set ok [string is $code -strict $ct]
-
-    OkFail $msg
-    return
-}
-
-proc ::grammar::me::tcl::OkFail {msg} {
-    variable ok
-    variable error
-    variable loc
-
-    # Inlined: Expected, Unget, ClearErrors
-
-    if {!$ok} {
-	set error [list $loc [list $msg]]
-	incr loc -1
-    } else {
-	set error {}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Nonterminal cache
-
-proc ::grammar::me::tcl::inc_restore {symbol} {
-    variable loc
-    variable nc
-    variable ok
-    variable error
-    variable sv
-
-    # Satisfy from cache if possible.
-    if {[info exists nc($loc,$symbol)]} {
-	foreach {go ok error sv} $nc($loc,$symbol) break
-
-	# Go forward, as the nonterminal matches (or not).
-	set loc $go
-	return 1
-    }
-    return 0
-}
-
-proc ::grammar::me::tcl::inc_save {symbol at} {
-    variable loc
-    variable nc
-    variable ok
-    variable error
-    variable sv
-
-    if 0 {
-	if {[info exists nc($at,$symbol)]} {
-	    return -code error "Cannot overwrite\
-		    existing data @ ($at, $symbol)"
-	}
-    }
-
-    # FIXME - end location should be argument.
-
-    # Store not only the value, but also how far
-    # the match went (if it was a match).
-
-    set nc($at,$symbol) [list $loc $ok $error $sv]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Unconditional matching.
-
-proc ::grammar::me::tcl::iok_ok {} {
-    variable ok 1
-    return
-}
-
-proc ::grammar::me::tcl::iok_fail {} {
-    variable ok 0
-    return
-}
-
-proc ::grammar::me::tcl::iok_negate {} {
-    variable ok
-    set ok [expr {!$ok}]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Basic input handling and tracking
-
-proc ::grammar::me::tcl::icl_get {} {
-    variable loc
-    return  $loc
-}
-
-proc ::grammar::me::tcl::icl_rewind {oldloc} {
-    variable loc
-
-    if 0 {
-	if {($oldloc < -1) || ($oldloc > $loc)} {
-	    return -code error "Bad location \"$oldloc\" (vs $loc)"
-	}
-    }
-    set loc $oldloc
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Error handling.
-
-proc ::grammar::me::tcl::ier_get {} {
-    variable error
-    return  $error
-}
-
-proc ::grammar::me::tcl::ier_clear {} {
-    variable error {}
-    return
-}
-
-proc ::grammar::me::tcl::ier_nonterminal {msg pos} {
-    # Inlined: Errors, Expected.
-
-    variable error
-
-    if {[llength $error]} {
-	foreach {l m} $error break
-	incr pos
-	if {$l == $pos} {
-	    set error [list $l [list $msg]]
-	}
-    }
-}
-
-proc ::grammar::me::tcl::ier_merge {new} {
-    variable error
-
-    # We have either old or new error data, keep it.
-
-    if {![llength $error]} {set error $new ; return}
-    if {![llength $new]}   {return}
-
-    # If one of the errors is further on in the input choose that as
-    # the information to propagate.
-
-    foreach {loe msgse} $error break
-    foreach {lon msgsn} $new   break
-
-    if {$lon > $loe} {set error $new ; return}
-    if {$loe > $lon} {return}
-
-    # Equal locations, merge the message lists.
-
-    foreach m $msgsn {lappend msgse $m}
-    set error [list $loe [lsort -uniq $msgse]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Operations for the construction of the
-## abstract syntax tree (AST).
-
-proc ::grammar::me::tcl::isv_clear {} {
-    variable sv {}
-    return
-}
-
-proc ::grammar::me::tcl::isv_terminal {} {
-    variable loc
-    variable sv
-    variable as
-
-    set sv [list {} $loc $loc]
-    lappend as $sv
-    return
-}
-
-proc ::grammar::me::tcl::isv_nonterminal_leaf {nt pos} {
-    # Inlined clear, reduce, and optimized.
-    variable ok
-    variable loc
-    variable sv {}
-
-    # Clear ; if {$ok} {Reduce $nt}
-
-    if {$ok} {
-	incr pos
-	set sv [list $nt $pos $loc]
-    }
-    return
-}
-
-proc ::grammar::me::tcl::isv_nonterminal_range {nt pos} {
-    variable ok
-    variable loc
-    variable sv {}
-
-    if {$ok} {
-	# TerminalString $pos
-	# Get all characters after 'pos' to current location as terminal data.
-
-	incr pos
-	set sv [list $nt $pos $loc [list {} $pos $loc]]
-
-	#set sv [linsert $sv 0 $nt] ;#Reduce $nt
-    }
-    return
-}
-
-proc ::grammar::me::tcl::isv_nonterminal_reduce {nt pos {mrk 0}} {
-    variable ok
-    variable as
-    variable loc
-    variable sv {}
-
-    if {$ok} {
-	incr pos
-	set sv [lrange $as $mrk end]         ;#SaveToMark $mrk
-	set sv [linsert $sv 0 $nt $pos $loc] ;#Reduce $nt
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## AST stack handling
-
-proc ::grammar::me::tcl::ias_push {} {
-    variable as
-    variable sv
-    lappend as $sv
-    return
-}
-
-proc ::grammar::me::tcl::ias_mark {} {
-    variable as
-    return [llength $as]
-}
-
-proc ::grammar::me::tcl::ias_pop2mark {mark} {
-    variable as
-    if {[llength $as] <= $mark} return
-    incr mark -1
-    set as [lrange $as 0 $mark]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Data structures.
-
-namespace eval ::grammar::me::tcl {
-    # ### ### ### ######### ######### #########
-    ## Public State of MVM (Matching Virtual Machine)
-
-    variable ok   0  ; # Boolean: Ok/Fail of last match operation.
-
-    # ### ### ### ######### ######### #########
-    ## Internal state.
-
-    variable ct   {}  ; # Current token.
-    variable loc  0   ; # Location of 'ct' as offset in input.
-
-    variable error {} ; # Error data for last match.
-    #                 ; # == List (loc, list of strings)
-    #                 ; # or empty list
-    variable sv   {}  ; # Semantic value for last match.
-
-    # ### ### ### ######### ######### #########
-    ## Data structures for AST construction
-
-    variable as {} ; # Stack of values for AST
-
-    # ### ### ### ######### ######### #########
-    ## Memo data structures for tokens and match results.
-
-    variable tc {}
-    variable nc ; array set nc {}
-
-    # ### ### ### ######### ######### #########
-    ## Input buffer, location of next character to read.
-    ## ASSERT (loc <= cloc)
-
-    variable next   ; # Callback to get next character.
-
-    # Token ordering for range checks. Optional
-
-    variable tokOrd ; array set tokOrd {}
-    variable tokUseOrd 0
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::me::tcl 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_util.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/me_util.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,188 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Package description
-
-## Utility commands for the conversion between various representations
-## of abstract syntax trees.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::grammar::me::util {
-    namespace export ast2tree ast2etree tree2ast
-}
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-# ### ### ### ######### ######### #########
-## API Implementation.
-
-proc ::grammar::me::util::ast2tree {ast tree {root {}}} {
-    # See grammar::me_ast for the specification of both value and tree
-    # representations.
-
-    if {$root eq ""} {
-	set root [$tree rootname]
-    }
-
-    # Decompose the AST value into its components.
-
-    if {[llength $ast] < 3} {
-	return -code error "Bad node \"$ast\", not enough elements"
-    }
-
-    set type     [lindex $ast 0]
-    set range    [lrange $ast 1 2]
-    set children [lrange $ast 3 end]
-
-    if {($type eq "") && [llength $children]} {
-	return -code error \
-	    "Terminal node \"[lrange $ast 0 2]\" has children"
-    }
-    foreach {s e} $range break
-    if {
-	![string is integer -strict $s] || ($s < 0) ||
-	![string is integer -strict $e] || ($e < 0)
-    } {
-	return -code error "Bad range information \"$range\""
-    }
-
-    # Create a node for the root of the AST and fill it with the data
-    # from the value. Afterward recurse and build the tree for the
-    # children of the root.
-
-    set new [lindex [$tree insert $root end] 0]
-
-    if {$type eq ""} {
-	$tree set $new type terminal
-    } else {
-	$tree set $new type   nonterminal
-	$tree set $new detail $type
-    }
-
-    $tree set $new range $range
-
-    foreach child $children {
-	ast2tree $child $tree $new
-    }
-    return
-}
-
-proc ::grammar::me::util::ast2etree {ast mcmd tree {root {}}} {
-    # See grammar::me_ast for the specification of both value and tree
-    # representations.
-
-    if {$root eq ""} {
-	set root [$tree rootname]
-    }
-
-    # Decompose the AST value into its components.
-
-    if {[llength $ast] < 3} {
-	return -code error "Bad node \"$ast\", not enough elements"
-    }
-
-    set type     [lindex $ast 0]
-    set range    [lrange $ast 1 2]
-    set children [lrange $ast 3 end]
-
-    if {($type eq "") && [llength $children]} {
-	return -code error \
-	    "Terminal node \"[lrange $ast 0 2]\" has children"
-    }
-    foreach {s e} $range break
-    if {
-	![string is integer -strict $s] || ($s < 0) ||
-	![string is integer -strict $e] || ($e < 0)
-    } {
-	return -code error "Bad range information \"$range\""
-    }
-
-    # Create a node for the root of the AST and fill it with the data
-    # from the value. Afterward recurse and build the tree for the
-    # children of the root.
-
-    set new [lindex [$tree insert $root end] 0]
-
-    if {$type eq ""} {
-	set     cmd $mcmd
-	lappend cmd tok
-	foreach loc $range {lappend cmd $loc}
-
-	$tree set $new type   terminal
-	$tree set $new detail [uplevel \#0 $cmd]
-    } else {
-	$tree set $new type   nonterminal
-	$tree set $new detail $type
-    }
-
-    set range_lc {}
-    foreach loc $range {
-	lappend range_lc [uplevel \#0 \
-		[linsert $mcmd end lc $loc]]
-    }
-
-    $tree set $new range    $range
-    $tree set $new range_lc $range_lc
-
-    foreach child $children {
-	ast2etree $child $mcmd $tree $new
-    }
-    return
-}
-
-proc ::grammar::me::util::tree2ast {tree {root {}}} {
-    # See grammar::me_ast for the specification of both value and tree
-    # representations.
-
-    if {$root eq ""} {
-	set root [$tree rootname]
-    }
-
-    set value {}
-
-    if {![$tree keyexists $root type]} {
-	return -code error "Bad node \"$root\", type information is missing"
-    }
-    if {![$tree keyexists $root range]} {
-	return -code error "Bad node \"$root\", range information is missing"
-    }
-
-    set range [$tree get $root range]
-    if {[llength $range] != 2} {
-	return -code error "Bad node \"root\", bad range information \"$range\""
-    }
-
-    foreach {s e} $range break
-    if {
-	![string is integer -strict $s] || ($s < 0) ||
-	![string is integer -strict $e] || ($e < 0)
-    } {
-	return -code error "Bad node \"root\", bad range information \"$range\""
-    }
-
-    if {[$tree get $root type] eq "terminal"} {
-	lappend value {}
-    } else {
-	if {![$tree keyexists $root detail]} {
-	    return -code error "Bad node \"$root\", nonterminal detail is missing"
-	}
-
-	lappend value [$tree get $root detail]
-    }
-
-    # Range data ...
-    lappend value $s $e
-
-    foreach child [$tree children $root] {
-	lappend value [tree2ast $tree $child]
-    }
-
-    return $value
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::me::util 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_me/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-
-package ifneeded grammar::me::util      0.1 [list source [file join $dir me_util.tcl]]
-package ifneeded grammar::me::tcl       0.1 [list source [file join $dir me_tcl.tcl]]
-package ifneeded grammar::me::cpu       0.2 [list source [file join $dir me_cpu.tcl]]
-package ifneeded grammar::me::cpu::core 0.2 [list source [file join $dir me_cpucore.tcl]]
-package ifneeded grammar::me::cpu::gasm 0.1 [list source [file join $dir gasm.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,541 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Grammars / Parsing Expression Grammars / Container
-
-# ### ### ### ######### ######### #########
-## Package description
-
-# A class whose instances hold all the information describing a single
-# parsing expression grammar (terminal symbols, nonterminal symbols,
-# nonterminal rules, start expression, hints), and operations to
-# define, manipulate, and query this information.
-#
-# The container has only one functionality beyond the simple storage
-# of the aforementioned information. It keeps track if the provided
-# grammar is valid (*). The container provides no higher-level
-# operations on the grammar, like removal of unreachable nonterminals,
-# rule rewriting, etc.
-#
-# The set of terminal symbols is the set of characters (i.e.
-# implicitly defined). For Tcl this means that all the unicode
-# characters are supported.
-#
-# (*) A grammar is valid if and only if all its rules are valid.  A
-# rule is valid if and only if all nonterminals referenced by the RHS
-# of the rule are in the set of nonterminals, and if only the allowed
-# operators are used in the expression.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit         ; # Tcllib | OO system used
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::grammar::peg {
-    # ### ### ### ######### ######### #########
-    ## Type API. Helpful methods for PEs.
-
-    proc ValidateSerial {e prefix} {}
-    proc Validate   {e} {}
-    proc References {e} {}
-    proc Rename     {e old new} {}
-
-    # ### ### ### ######### ######### #########
-    ## Instance API
-
-    constructor {args} {}
-
-    method clear {} {}
-
-    method =   {src} {}
-    method --> {dst} {}
-    method serialize {} {}
-    method deserialize {value} {}
-
-    method {is valid} {} {}
-    method start {args} {}
-
-    method nonterminals {} {}
-    method {nonterminal add}    {nts pae} {}
-    method {nonterminal delete} {nts pae} {}
-    method {nonterminal exists} {nts} {}
-    method {nonterminal rename} {ntsold ntsnew} {}
-    method {nonterminal mode}   {nts args} {}
-
-    method {unknown nonterminals} {} {}
-
-    method {nonterminal rule}   {nts} {}
-
-    # ### ### ### ######### ######### #########
-    ## Internal data structures.
-
-    ## - Set of nonterminal symbols, and
-    ## - Mapping from nonterminals to their defining parsing
-    ##   expressions, and
-    ## - Start parsing expression.
-    ## - And usage of nonterminals by others, required for tracking
-    ##   of validity.
-
-    ## se: expression               | Start expression
-    ## nt: nonterm -> expression    | Known Nt's, their rules
-    ## re: nonterm -> list(nonterm) | Known Nt's, what others they use.
-    ## ir: nonterm -> list(nonterm) | Nt's, possibly unknown, their users.
-    ## uk: nonterm -> use counter   | Nt's which are unknown.
-    ##
-    ## Both 're' and 'ir' can list a nonterminal A multiple times,
-    ## if it uses or is used multiple times.
-    ##
-    ## Grammar is invalid <=> '[array size uk] > 0'
-
-    variable se        epsilon
-    variable nt -array {}
-    variable re -array {}
-    variable ir -array {}
-    variable uk -array {}
-    variable mo -array {}
-
-    # ### ### ### ######### ######### #########
-    ## Instance API Implementation.
-
-    constructor {args} {
-	if {
-	    (([llength $args] != 0) && ([llength $args] != 2)) ||
-	    (([llength $args] == 2) && ([lsearch {= := <-- as deserialize} [lindex $args 0]]) < 0)
-	} {
-	    return -code error "wrong#args: $self ?=|:=|<--|as|deserialize a'?"
-	}
-
-	# Serialization arguments.
-	# [llength args] in {0 2}
-	#
-	# =           src-obj
-	# :=          src-obj
-	# <--         src-obj
-	# as          src-obj
-	# deserialize src-value
-
-	if {[llength $args] == 2} {
-	    foreach {op val} $args break
-	    switch -exact -- $op {
-		= - := - <-- - as {
-		    $self deserialize [$val serialize]
-		}
-		deserialize {
-		    $self deserialize $val
-		}
-	    }
-	}
-	return
-    }
-
-    #destructor {}
-
-    method clear {} {
-	array unset nt *
-	array unset re *
-	array unset ir *
-	array unset uk *
-	array unset mo *
-	set se epsilon
-	return
-    }
-
-    method = {src} {
-	$self dserialize [$src serialize]
-    }
-
-    method --> {dst} {
-	$dst deserialize [$self serialize]
-    }
-
-    method serialize {} {
-	return [::list \
-		grammar::pegc \
-		[array get nt] \
-		[array get mo] \
-		$se]
-    }
-
-    method deserialize {value} {
-	# Validate value, then clear and refill.
-
-	$self CheckSerialization $value ntv mov sev
-	$self clear
-
-	foreach {s e} $ntv {
-	    $self NtAdd $s $e
-	}
-	array set mo $mov
-	$self start $sev
-	return
-    }
-
-    method {is valid} {} {
-	return [expr {[array size uk] == 0}]
-    }
-
-    method start {args} {
-	if {[llength $args] == 0} {
-	    return $se
-	}
-	if {[llength $args] > 1} {
-	    return -code error "wrong#args: $self start ?pe?"
-	}
-	set newse [lindex $args 0]
-	Validate $newse
-	set se   $newse
-	return
-    }
-
-    method nonterminals {} {
-	return [array names nt]
-    }
-
-    method {nonterminal add} {nts pae} {
-	$self CheckNtKnown $nts
-	Validate $pae
-	$self NtAdd $nts $pae
-	return
-    }
-
-    method {nonterminal mode} {nts args} {
-	$self CheckNt $nts
-	if {![llength $args]} {
-	    return $mo($nts)
-	} elseif {[llength $args] == 1} {
-	    set mo($nts) [lindex $args 0]
-	    return
-	} else {
-	    return -code error "wrong#args"
-	}
-	return
-    }
-
-    method {nonterminal delete} {nts args} {
-	set args [linsert $args 0 $nts]
-	foreach nts $args {
-	    $self CheckNt $nts
-	}
-
-	foreach nts $args {
-	    $self NtDelete $nts
-	}
-	return
-    }
-
-    method {nonterminal exists} {nts} {
-	return [info exists nt($nts)]
-    }
-
-    method {nonterminal rename} {ntsold ntsnew} {
-	$self CheckNt      $ntsold
-	$self CheckNtKnown $ntsnew
-
-	# Difficult. We have to go through all rules and rewrite their
-	# RHS to use the new name of the nonterminal. We can however
-	# restrict ourselves to the rules which actually use the
-	# changed nonterminal.
-
-	# We also have to update the used/user information. We know
-	# that the validity of the grammar is unchanged by this
-	# operation. The unknown information is unchanged as well, as
-	# we cannot rename an unknown nonterminal. IOW we know that
-	# 'ntsold' is not in 'uk', and so 'ntsnew' will not be in that
-	# array either after the rename.
-
-	set myusers $ir($ntsold)
-	set myused  $re($ntsold)
-
-	set nt($ntsnew) $nt($ntsold)
-	unset            nt($ntsold)
-
-	set mo($ntsnew) $mo($ntsold)
-	unset            mo($ntsold)
-
-	foreach x $myusers {
-	    set nt($x) [Rename $nt($x) $ntsold $ntsnew]
-	}
-
-	# It is possible to use myself, and be used by myself.
-
-	while {[set pos [lsearch -exact $myusers $ntsold]] >= 0} {
-	    set myusers [lreplace $myusers $pos $pos $ntsnew]
-	}
-	while {[set pos [lsearch -exact $myused $ntsold]] >= 0} {
-	    set myused [lreplace $myused $pos $pos $ntsnew]
-	}
-
-	set re($ntsnew) $myusers
-	set ir($ntsnew) $myused
-
-	unset            re($ntsold)
-	unset            ir($ntsold)
-	return
-    }
-
-    method {unknown nonterminals} {} {
-	return [array names uk]
-    }
-
-    method {nonterminal rule} {nts} {
-	$self CheckNt $nts
-	return $nt($nts)
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper methods
-
-    method NtAdd {nts pae} {
-	# None of the symbols is known. We can add them to the
-	# grammar. If however any of their PEs is known to the PE
-	# storage then we had expressions refering to unknown
-	# symbols. The grammar is most certainly invalid and may have
-	# become valid right now. We have to invalidate the validity
-	# cache.
-
-	set nt($nts) $pae
-	set mo($nts) value
-
-	# Track users, uses, and unknowns.
-
-	set references [References $pae]
-
-	# We use the refered symbols
-	set re($nts) $references
-
-	# We are a user for the refered symbols
-	# Record unknown symbols immediately.
-	foreach x $references {
-	    lappend ir($x) $nts
-	    if {[info exists nt($x)]} continue
-	    if {[catch {incr uk($x)}]} {set uk($x) 1}
-	}
-
-	# We are definitely not unknown.
-	unset -nocomplain uk($nts)
-	return
-    }
-
-    method NtDelete {nts} {
-	set references $re($nt)
-
-	# We are gone. We are not using anything anymore.
-	unset    nt($nts)
-	unset    re($nts)
-	unset    mo($nts)
-
-	# Our references loose us as their user.
-	foreach x $references {
-	    set pos [lsearch -exact $ir($x) $x]
-	    if {$pos < 0} {error PANIC}
-	    set ir($x) [lreplace $ir($x) $pos $pos]
-	    if {[llength $ir($x)] == 0} {
-		unset ir($x)
-		# x is not referenced anywhere, cannot be unknown.
-		unset -nocomplain uk($x)
-	    }
-	    if {[info exists uk($x)]} {
-		incr uk($x) -1
-	    }
-	}
-
-	# We might be used by others still, and therefore become
-	# unknown.
-
-	if {[info exists ir($nts]} {
-	    set uk($nts) [llength $ir($nts)]
-	}
-	return
-    }
-
-    method CheckNt {nts} {
-	if {![info exists nt($nts)]} {
-	    return -code error "Invalid nonterminal \"$nts\""
-	}
-	return
-    }
-
-    method CheckNtKnown {nts} {
-	if {[info exists nt($nts)]} {
-	    return -code error "Nonterminal \"$nts\" is already known"
-	}
-	return
-    }
-
-    method CheckSerialization {value ntv mov sev} {
-	# value is list/3 ('grammar::pegc' nonterminals start)
-	# terminals is list of string.
-	# nonterminals is doct (key is string, value is expr)
-	# start is expr
-	# terminals * nonterminals == empty
-	# expr is parsing expression (Validate PE).
-
-	upvar 1 \
-	    $ntv ntvs \
-	    $mov movs \
-	    $sev sevs
-
-	set prefix "error in serialization:"
-	if {[llength $value] != 4} {
-	    return -code error "$prefix list length not 4"
-	}
-
-	struct::list assign $value type nonterminals hints start
-	if {$type ne "grammar::pegc"} {
-	    return -code error "$prefix unknown type \"$type\""
-	}
-
-	ValidateSerial $start "$prefix invalid start expression"
-
-	if {[llength $nonterminals] % 2 == 1} {
-	    return -code error "$prefix nonterminal data is not a dictionary"
-	}
-	array set _nt $nonterminals
-	if {[llength $nonterminals] != (2*[array size _nt])} {
-	    return -code error "$prefix nonterminal data contains duplicate names, or misses some"
-	}
-
-	foreach {s e} $nonterminals {
-	    ValidateSerial $start "$prefix nonterminal \"$s\", invalid parsing expression"
-	}
-
-
-	if {[llength $hints] % 2 == 1} {
-	    return -code error "$prefix nonterminal modes is not a dictionary"
-	}
-	array set _mo $hints
-	if {[llength $hints] != (2*[array size _mo])} {
-	    return -code error "$prefix nonterminal modes contains duplicate names, or misses some"
-	}
-	foreach {s _} $hints {
-	    if {![info exists _nt($s)]} {
-		return -code error "$prefix nonterminal mode for unknown nonterminal \"$s\""
-	    }
-	}
-
-	set ntvs $nonterminals
-	set sevs $start
-	set movs $hints
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-
-    # ### ### ### ######### ######### #########
-    ## Type API implementation.
-
-    proc ValidateSerial {e prefix} {
-	if {![catch {Validate $e} msg]} return
-	return -code error "$prefix, $msg"
-    }
-
-    proc Validate {e} {
-	if {[llength $e] == 0} {
-	    return -code error "invalid empty expression list"
-	}
-
-	set op [lindex $e 0]
-	set ar [lrange $e 1 end]
-
-	switch -exact -- $op {
-	    epsilon - alpha - alnum - dot {
-		if {[llength $ar] > 0} {
-		    return -code error "wrong#args for \"$op\""
-		}
-	    }
-	    .. {
-		if {[llength $ar] != 2} {
-		    return -code error "wrong#args for \"$op\""
-		}
-		# Leaf, arguments are not expressions to validate.
-	    }
-	    n - t {
-		if {[llength $ar] != 1} {
-		    return -code error "wrong#args for \"$op\""
-		}
-		# Leaf, argument is not expression to validate.
-	    }
-	    & - ! - * - + - ? {
-		if {[llength $ar] != 1} {
-		    return -code error "wrong#args for \"$op\""
-		}
-		Validate [lindex $ar 0]
-	    }
-	    x - / {
-		if {![llength $ar]} {
-		    return -code error "wrong#args for \"$op\""
-		}
-		foreach e $ar {
-		    Validate $e
-		}
-	    }
-	    default {
-		return -code error "invalid operator \"$op\""
-	    }
-	}
-    }
-
-    proc References {e} {
-	set references {}
-
-	set op [lindex $e 0]
-	set ar [lrange $e 1 end]
-
-	switch -exact -- $op {
-	    epsilon - t - alpha - alnum - dot - .. {}
-	    n {
-		# Remember referenced nonterminal
-		lappend references [lindex $ar 0]
-	    }
-	    & - ! - * - + - ? {
-		foreach r [References [lindex $ar 0]] {
-		    lappend references $r
-		}
-	    }
-	    x - / {
-		foreach e $ar {
-		    foreach r [References $e] {
-			lappend references $r
-		    }
-		}
-	    }
-	}
-	return $references
-    }
-
-    proc Rename {e old new} {
-	set op [lindex $e 0]
-	set ar [lrange $e 1 end]
-
-	switch -exact -- $op {
-	    epsilon - t - alpha - alnum - dot - .. {return $e}
-	    n {
-		if {[lindex $ar 0] ne $old} {return $e}
-		return [list n $new]
-	    }
-	    & - ! - * - + - ? {
-		return [list $op [Rename [lindex $ar 0] $old $new]]
-	    }
-	    x - / {
-		set res $op
-		foreach e $ar {
-		    lappend res [Rename $e $old $new]
-		}
-		return $res
-	    }
-	}
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Type Internals.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/peg_interp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/peg_interp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,350 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Grammar / Parsing Expression Grammar / Interpreter (Namespace based)
-
-# ### ### ### ######### ######### #########
-## Package description
-
-## The instances of this class match an input provided by a buffer to
-## a parsing expression grammar provided by a peg container. The
-## matching process is interpretative, i.e. expressions are matched on
-## the fly and multiple as they are encountered. The interpreter
-## operates in pull-push mode, i.e. the interpreter object is in
-## charge and reads the character stream from the buffer as it needs,
-## and returns with the result of the match either when encountering
-## an error, or when the match was successful.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::me::tcl
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::grammar::peg::interp {
-    # Import the virtual machine for matching.
-
-    namespace import ::grammar::me::tcl::*
-    upvar #0 ::grammar::me::tcl::ok ok
-}
-
-# ### ### ### ######### ######### #########
-## Instance API Implementation.
-
-proc ::grammar::peg::interp::setup {peg} {
-    variable ru
-    variable mo
-    variable se
-
-    if {![$peg is valid]} {
-        return -code error "Cannot initialize interpreter for invalid grammar"
-    }
-    set se [$peg start]
-    foreach s [$peg nonterminals] {
-        set ru($s) [$peg nonterminal rule $s]
-        set mo($s) [$peg nonterminal mode $s]
-    }
-
-    #parray mo
-    return
-}
-
-proc ::grammar::peg::interp::parse {nxcmd emvar astvar} {
-    variable ok
-    variable se
-
-    upvar 1 $emvar emsg $astvar ast
-
-    init $nxcmd
-
-    MatchExpr $se
-    isv_nonterminal_reduce ALL -1
-    set ast [sv]
-    if {!$ok} {
-        foreach {l m} [ier_get] break
-        lappend l [lc $l]
-        set emsg [list $l $m]
-    }
-
-    return $ok
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper methods
-
-proc ::grammar::peg::interp::MatchExpr {e} {
-    variable ok
-    variable mode
-    variable mo
-    variable ru
-
-    set op [lindex $e 0]
-    set ar [lrange $e 1 end]
-
-    switch -exact -- $op {
-        epsilon {
-            # No input to match, nor consume. Match always.
-            iok_ok
-        }
-        dot {
-            # Match and consume one character. No matter which
-            # character. Fails only when reaching eof. Does not
-            # consume input on failure.
-            
-            ict_advance "Expected any character (got EOF)"
-            if {$ok && ($mode eq "value")} {isv_terminal}
-        }
-        alnum - alpha {
-            ict_advance            "Expected <$op> (got EOF)"
-            if {!$ok} return
-
-            ict_match_tokclass $op "Expected <$op>"
-            if {$ok && ($mode eq "value")} {isv_terminal}
-        }
-        t {
-            # Match and consume one specific character. Fails if
-            # the character at the location is not what was
-            # expected. Does not consume input on failure.
-
-            set ch [lindex $ar 0]
-
-            ict_advance     "Expected $ch (got EOF)"
-            if {!$ok} return
-
-            ict_match_token "Expected $ch"
-            if {$ok && ($mode eq "value")} {isv_terminal}
-        }
-        .. {
-            # Match and consume one character, if in the specified
-            # range. Fails if the read character is outside of the
-            # range. Does not consume input on failure.
-
-            foreach {chbegin chend} $ar break
-
-            ict_advance                        "Expected \[$chbegin .. $chend\] (got EOF)"
-            if {!$ok} return
-
-            ict_match_tokrange $chbegin $chend "Expected \[$chbegin .. $chend\]"
-            if {$ok && ($mode eq "value")} {isv_terminal}
-        }
-        n {
-            # To match a nonterminal in the input we match its
-            # parsing expression. This can be cut short if the
-            # necessary information can be obtained from the memo
-            # cache. Does not consume input on failure.
-
-            set nt [lindex $ar 0]
-            set savemode $mode
-            set mode $mo($nt)
-
-            if {[inc_restore $nt]} {
-                if {$ok && ($mode ne "discard")} ias_push
-                set mode $savemode
-                return
-            }
-
-            set pos [icl_get]
-            set mrk [ias_mark]
-
-            MatchExpr $ru($nt)
-
-            # Generate semantic value, based on mode.
-            if {$mode eq "value"} {
-                isv_nonterminal_reduce $nt $pos $mrk
-            } elseif {$mode eq "match"} {
-                isv_nonterminal_range  $nt $pos
-            } elseif {$mode eq "leaf"} {
-                isv_nonterminal_leaf   $nt $pos
-            } else {
-                # mode eq "discard"
-                isv_clear
-            }
-            inc_save $nt $pos
-
-            # AST operations ...
-            ias_pop2mark $mrk
-            if {$ok && ($mode ne "discard")} ias_push
-
-            set mode $savemode
-            # Even if match is ok.
-	    ier_nonterminal "Expected $nt" $pos
-        }
-        & {
-            # Lookahead predicate. And. Matches the expression
-            # against the input and returns match result. Never
-            # consumes any input.
-
-            set pos [icl_get]
-
-            MatchExpr [lindex $ar 0]
-
-            icl_rewind $pos
-            return
-        }
-        ! {
-            # Negated lookahead predicate. Matches the expression
-            # against the input and returns the negated match
-            # result. Never consumes any input.
-
-            set pos [icl_get]
-            set mrk [ias_mark]
-            
-            MatchExpr [lindex $ar 0]
-
-            if {$ok} {ias_pop2mark $mrk}
-            icl_rewind $pos
-
-            iok_negate
-            return
-        }
-        * {
-            # Zero or more repetitions. This consumes as much
-            # input as it was able to match the sub
-            # expression. The expresion as a whole always matches,
-            # even if the sub expression fails (zero repetition).
-
-            set sub [lindex $ar 0]
-
-            while {1} {
-                set pos [icl_get]
-
-                set old [ier_get]
-                MatchExpr $sub
-                ier_merge $old
-
-                if {$ok} continue
-		break
-            }
-
-	    icl_rewind $pos
-	    iok_ok
-	    return
-        }
-        + {
-            # One or more repetition. Like *, except for one match
-            # at the front which has to match for success. This
-            # expression can fail. It will consume only as much
-            # input as it was able to match.
-
-            set sub [lindex $ar 0]
-
-            set pos [icl_get]
-
-            MatchExpr $sub
-            if {!$ok} {
-                icl_rewind $pos
-                return
-            }
-
-            while {1} {
-                set pos [icl_get]
-
-                set old [ier_get]
-                MatchExpr $sub
-                ier_merge $old
-
-                if {$ok} continue
-		break
-            }
-
-	    icl_rewind $pos
-	    iok_ok
-	    return
-        }
-        ? {
-            # Optional matching. Tries to match the sub
-            # expression. Will never fail, even if the sub
-            # expression is not matching. Consumes only input as
-            # it could match in the sub expression. Like *, but
-            # without the repetition.
-
-            set pos [icl_get]
-
-	    set old [ier_get]
-            MatchExpr [lindex $ar 0]
-	    ier_merge $old
-
-            if {!$ok} {
-                icl_rewind $pos
-                iok_ok
-            }
-            return
-        }
-        x {
-            # Sequence. Matches each sub expression in turn, each
-            # consuming input. In case of failure by one of the
-            # sequence elements nothing is consumed at all.
-
-            set pos [icl_get]
-            set mrk [ias_mark]
-            ier_clear
-
-            foreach e $ar {
-
-                set old [ier_get]
-                MatchExpr $e
-                ier_merge $old
-
-                if {!$ok} {
-                    ias_pop2mark $mrk
-                    icl_rewind $pos
-                    return
-                }
-            }
-            # OK
-            return
-        }
-        / {
-            # Choice. Matches each sub expression in turn, always
-            # starting from the current location. Nothing is
-            # consumed if all branches fail. Consumes as much as
-            # was consumed by the matching branch.
-
-            set pos [icl_get]
-            set mrk [ias_mark]
-
-            ier_clear
-            foreach e $ar {
-
-                set old [ier_get]
-                MatchExpr $e
-                ier_merge $old
-
-                if {!$ok} {
-                    ias_pop2mark $mrk
-                    icl_rewind $pos
-                    continue
-                }
-                return
-            }
-            # FAIL
-            iok_fail
-            return
-        }
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Interpreter data structures.
-
-namespace eval ::grammar::peg::interp {
-    ## Start expression.
-    ## Map from nonterminals to their expressions.
-    ## Reference to internal memo cache.
-
-    variable se {} ; # Start expression.
-    variable ru    ; # Nonterminals and rule map.
-    variable mo    ; # Nonterminal modes.
-
-    variable mode value ; # Matching mode.
-
-    array set ru {}
-    array set mo {}
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide grammar::peg::interp 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/grammar_peg/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-package ifneeded grammar::peg         0.1 [list source [file join $dir peg.tcl]]
-package ifneeded grammar::peg::interp 0.1 [list source [file join $dir peg_interp.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/html/html.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/html/html.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1477 +1,0 @@
-# html.tcl --
-#
-#	Procedures to make generating HTML easier.
-#
-#	This module depends on the ncgi module for the procedures
-#	that initialize form elements based on current CGI values.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2006 Michael Schlenker <mic42@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# Originally by Brent Welch, with help from Dan Kuchler and Melissa Chawla
-
-package require Tcl 8.2
-package require ncgi
-package provide html 1.4
-
-namespace eval ::html {
-
-    # State about the current page
-
-    variable page
-
-    # A simple set of global defaults for tag parameters is implemented
-    # by storing into elements indexed by "key.param", where key is
-    # often the name of an HTML tag (anything for scoping), and
-    # param must be the name of the HTML tag parameter (e.g., "href" or "size")
-    #	input.size
-    #	body.bgcolor
-    #	body.text
-    #	font.face
-    #	font.size
-    #	font.color
-
-    variable defaults
-    array set defaults {
-	input.size	45
-	body.bgcolor	white
-	body.text	black
-    }
-
-    # In order to nandle nested calls to redefined control structures,
-    # we need a temporary variable that is known not to exist.  We keep this
-    # counter to append to the varname.  Each time we need a temporary
-    # variable, we increment this counter.
-
-    variable randVar 0
-
-    # No more export, because this defines things like
-    # foreach and if that do HTML things, not Tcl control
-    # namespace export *
-
-    # Dictionary mapping from special characters to their entities.
-
-    variable entities {
-        \xa0 &nbsp; \xa1 &iexcl; \xa2 &cent; \xa3 &pound; \xa4 &curren;
-        \xa5 &yen; \xa6 &brvbar; \xa7 &sect; \xa8 &uml; \xa9 &copy;
-        \xaa &ordf; \xab &laquo; \xac &not; \xad &shy; \xae &reg;
-        \xaf &macr; \xb0 &deg; \xb1 &plusmn; \xb2 &sup2; \xb3 &sup3;
-        \xb4 &acute; \xb5 &micro; \xb6 &para; \xb7 &middot; \xb8 &cedil;
-        \xb9 &sup1; \xba &ordm; \xbb &raquo; \xbc &frac14; \xbd &frac12;
-        \xbe &frac34; \xbf &iquest; \xc0 &Agrave; \xc1 &Aacute; \xc2 &Acirc;
-        \xc3 &Atilde; \xc4 &Auml; \xc5 &Aring; \xc6 &AElig; \xc7 &Ccedil;
-        \xc8 &Egrave; \xc9 &Eacute; \xca &Ecirc; \xcb &Euml; \xcc &Igrave;
-        \xcd &Iacute; \xce &Icirc; \xcf &Iuml; \xd0 &ETH; \xd1 &Ntilde;
-        \xd2 &Ograve; \xd3 &Oacute; \xd4 &Ocirc; \xd5 &Otilde; \xd6 &Ouml;
-        \xd7 &times; \xd8 &Oslash; \xd9 &Ugrave; \xda &Uacute; \xdb &Ucirc;
-        \xdc &Uuml; \xdd &Yacute; \xde &THORN; \xdf &szlig; \xe0 &agrave;
-        \xe1 &aacute; \xe2 &acirc; \xe3 &atilde; \xe4 &auml; \xe5 &aring;
-        \xe6 &aelig; \xe7 &ccedil; \xe8 &egrave; \xe9 &eacute; \xea &ecirc;
-        \xeb &euml; \xec &igrave; \xed &iacute; \xee &icirc; \xef &iuml;
-        \xf0 &eth; \xf1 &ntilde; \xf2 &ograve; \xf3 &oacute; \xf4 &ocirc;
-        \xf5 &otilde; \xf6 &ouml; \xf7 &divide; \xf8 &oslash; \xf9 &ugrave;
-        \xfa &uacute; \xfb &ucirc; \xfc &uuml; \xfd &yacute; \xfe &thorn;
-        \xff &yuml; \u192 &fnof; \u391 &Alpha; \u392 &Beta; \u393 &Gamma;
-        \u394 &Delta; \u395 &Epsilon; \u396 &Zeta; \u397 &Eta; \u398 &Theta;
-        \u399 &Iota; \u39A &Kappa; \u39B &Lambda; \u39C &Mu; \u39D &Nu;
-        \u39E &Xi; \u39F &Omicron; \u3A0 &Pi; \u3A1 &Rho; \u3A3 &Sigma;
-        \u3A4 &Tau; \u3A5 &Upsilon; \u3A6 &Phi; \u3A7 &Chi; \u3A8 &Psi;
-        \u3A9 &Omega; \u3B1 &alpha; \u3B2 &beta; \u3B3 &gamma; \u3B4 &delta;
-        \u3B5 &epsilon; \u3B6 &zeta; \u3B7 &eta; \u3B8 &theta; \u3B9 &iota;
-        \u3BA &kappa; \u3BB &lambda; \u3BC &mu; \u3BD &nu; \u3BE &xi;
-        \u3BF &omicron; \u3C0 &pi; \u3C1 &rho; \u3C2 &sigmaf; \u3C3 &sigma;
-        \u3C4 &tau; \u3C5 &upsilon; \u3C6 &phi; \u3C7 &chi; \u3C8 &psi;
-        \u3C9 &omega; \u3D1 &thetasym; \u3D2 &upsih; \u3D6 &piv;
-        \u2022 &bull; \u2026 &hellip; \u2032 &prime; \u2033 &Prime;
-        \u203E &oline; \u2044 &frasl; \u2118 &weierp; \u2111 &image;
-        \u211C &real; \u2122 &trade; \u2135 &alefsym; \u2190 &larr;
-        \u2191 &uarr; \u2192 &rarr; \u2193 &darr; \u2194 &harr; \u21B5 &crarr;
-        \u21D0 &lArr; \u21D1 &uArr; \u21D2 &rArr; \u21D3 &dArr; \u21D4 &hArr;
-        \u2200 &forall; \u2202 &part; \u2203 &exist; \u2205 &empty;
-        \u2207 &nabla; \u2208 &isin; \u2209 &notin; \u220B &ni; \u220F &prod;
-        \u2211 &sum; \u2212 &minus; \u2217 &lowast; \u221A &radic;
-        \u221D &prop; \u221E &infin; \u2220 &ang; \u2227 &and; \u2228 &or;
-        \u2229 &cap; \u222A &cup; \u222B &int; \u2234 &there4; \u223C &sim;
-        \u2245 &cong; \u2248 &asymp; \u2260 &ne; \u2261 &equiv; \u2264 &le;
-        \u2265 &ge; \u2282 &sub; \u2283 &sup; \u2284 &nsub; \u2286 &sube;
-        \u2287 &supe; \u2295 &oplus; \u2297 &otimes; \u22A5 &perp;
-        \u22C5 &sdot; \u2308 &lceil; \u2309 &rceil; \u230A &lfloor;
-        \u230B &rfloor; \u2329 &lang; \u232A &rang; \u25CA &loz;
-        \u2660 &spades; \u2663 &clubs; \u2665 &hearts; \u2666 &diams;
-        \x22 &quot; \x26 &amp; \x3C &lt; \x3E &gt; \u152 &OElig;
-        \u153 &oelig; \u160 &Scaron; \u161 &scaron; \u178 &Yuml;
-        \u2C6 &circ; \u2DC &tilde; \u2002 &ensp; \u2003 &emsp; \u2009 &thinsp;
-        \u200C &zwnj; \u200D &zwj; \u200E &lrm; \u200F &rlm; \u2013 &ndash;
-        \u2014 &mdash; \u2018 &lsquo; \u2019 &rsquo; \u201A &sbquo;
-        \u201C &ldquo; \u201D &rdquo; \u201E &bdquo; \u2020 &dagger;
-        \u2021 &Dagger; \u2030 &permil; \u2039 &lsaquo; \u203A &rsaquo;
-        \u20AC &euro;
-    }
-}
-
-# ::html::foreach
-#
-#	Rework the "foreach" command to blend into HTML template files.
-#	Rather than evaluating the body, we return the subst'ed body.  Each
-#	iteration of the loop causes another string to be concatenated to
-#	the result value.  No error checking is done on any arguments.
-#
-# Arguments:
-#	varlist	Variables to instantiate with values from the next argument.
-#	list	Values to set variables in varlist to.
-#	args	?varlist2 list2 ...? body, where body is the string to subst
-#		during each iteration of the loop.
-#
-# Results:
-#	Returns a string composed of multiple concatenations of the
-#	substitued body.
-#
-# Side Effects:
-#	None.
-
-proc ::html::foreach {vars vals args} {
-    variable randVar
-
-    # The body of the foreach loop must be run in the stack frame
-    # above this one in order to have access to local variable at that stack
-    # level.
-
-    # To support nested foreach loops, we use a uniquely named
-    # variable to store incremental results.
-    incr randVar
-    ::set resultVar "result_$randVar"
-
-    # Extract the body and any varlists and valuelists from the args.
-    ::set body [lindex $args end]
-    ::set varvals [linsert [lreplace $args end end] 0 $vars $vals]
-
-    # Create the script to eval in the stack frame above this one.
-    ::set script "::foreach"
-    ::foreach {vars vals} $varvals {
-        append script " [list $vars] [list $vals]"
-    }
-    append script " \{\n"
-    append script "  append $resultVar \[subst \{$body\}\]\n"
-    append script "\}\n"
-
-    # Create a temporary variable in the stack frame above this one,
-    # and use it to store the incremental results of the multiple loop
-    # iterations.  Remove the temporary variable when we're done so there's
-    # no trace of this loop left in that stack frame.
-
-    upvar 1 $resultVar tmp
-    ::set tmp ""
-    uplevel 1 $script
-    ::set result $tmp
-    unset tmp
-    return $result
-}
-
-# ::html::for
-#
-#	Rework the "for" command to blend into HTML template files.
-#	Rather than evaluating the body, we return the subst'ed body.  Each
-#	iteration of the loop causes another string to be concatenated to
-#	the result value.  No error checking is done on any arguments.
-#
-# Arguments:
-#	start	A script to evaluate once at the very beginning.
-#	test	An expression to eval before each iteration of the loop.
-#		Once the expression is false, the command returns.
-#	next	A script to evaluate after each iteration of the loop.
-#	body	The string to subst during each iteration of the loop.
-#
-# Results:
-#	Returns a string composed of multiple concatenations of the
-#	substitued body.
-#
-# Side Effects:
-#	None.
-
-proc ::html::for {start test next body} {
-    variable randVar
-
-    # The body of the for loop must be run in the stack frame
-    # above this one in order to have access to local variable at that stack
-    # level.
-
-    # To support nested for loops, we use a uniquely named
-    # variable to store incremental results.
-    incr randVar
-    ::set resultVar "result_$randVar"
-
-    # Create the script to eval in the stack frame above this one.
-    ::set script "::for [list $start] [list $test] [list $next] \{\n"
-    append script "  append $resultVar \[subst \{$body\}\]\n"
-    append script "\}\n"
-
-    # Create a temporary variable in the stack frame above this one,
-    # and use it to store the incremental resutls of the multiple loop
-    # iterations.  Remove the temporary variable when we're done so there's
-    # no trace of this loop left in that stack frame.
-
-    upvar 1 $resultVar tmp
-    ::set tmp ""
-    uplevel 1 $script
-    ::set result $tmp
-    unset tmp
-    return $result
-}
-
-# ::html::while
-#
-#	Rework the "while" command to blend into HTML template files.
-#	Rather than evaluating the body, we return the subst'ed body.  Each
-#	iteration of the loop causes another string to be concatenated to
-#	the result value.  No error checking is done on any arguments.
-#
-# Arguments:
-#	test	An expression to eval before each iteration of the loop.
-#		Once the expression is false, the command returns.
-#	body	The string to subst during each iteration of the loop.
-#
-# Results:
-#	Returns a string composed of multiple concatenations of the
-#	substitued body.
-#
-# Side Effects:
-#	None.
-
-proc ::html::while {test body} {
-    variable randVar
-
-    # The body of the while loop must be run in the stack frame
-    # above this one in order to have access to local variable at that stack
-    # level.
-
-    # To support nested while loops, we use a uniquely named
-    # variable to store incremental results.
-    incr randVar
-    ::set resultVar "result_$randVar"
-
-    # Create the script to eval in the stack frame above this one.
-    ::set script "::while [list $test] \{\n"
-    append script "  append $resultVar \[subst \{$body\}\]\n"
-    append script "\}\n"
-
-    # Create a temporary variable in the stack frame above this one,
-    # and use it to store the incremental resutls of the multiple loop
-    # iterations.  Remove the temporary variable when we're done so there's
-    # no trace of this loop left in that stack frame.
-
-    upvar 1 $resultVar tmp
-    ::set tmp ""
-    uplevel 1 $script
-    ::set result $tmp
-    unset tmp
-    return $result
-}
-
-# ::html::if
-#
-#	Rework the "if" command to blend into HTML template files.
-#	Rather than evaluating a body clause, we return the subst'ed body.
-#	No error checking is done on any arguments.
-#
-# Arguments:
-#	test	An expression to eval to decide whether to use the then body.
-#	body	The string to subst if the test case was true.
-#	args	?elseif test body2 ...? ?else bodyn?, where bodyn is the string
-#		to subst if none of the tests are true.
-#
-# Results:
-#	Returns a string composed by substituting a body clause.
-#
-# Side Effects:
-#	None.
-
-proc ::html::if {test body args} {
-    variable randVar
-
-    # The body of the then/else clause must be run in the stack frame
-    # above this one in order to have access to local variable at that stack
-    # level.
-
-    # To support nested if's, we use a uniquely named
-    # variable to store incremental results.
-    incr randVar
-    ::set resultVar "result_$randVar"
-
-    # Extract the elseif clauses and else clause if they exist.
-    ::set cmd [linsert $args 0 "::if" $test $body]
-
-    ::foreach {keyword test body} $cmd {
-        ::if {[string equal $keyword "else"]} {
-            append script " else \{\n"
-            ::set body $test
-        } else {
-            append script " $keyword [list $test] \{\n"
-        }
-        append script "  append $resultVar \[subst \{$body\}\]\n"
-        append script "\} "
-    }
-
-    # Create a temporary variable in the stack frame above this one,
-    # and use it to store the incremental resutls of the multiple loop
-    # iterations.  Remove the temporary variable when we're done so there's
-    # no trace of this loop left in that stack frame.
-
-    upvar $resultVar tmp
-    ::set tmp ""
-    uplevel $script
-    ::set result $tmp
-    unset tmp
-    return $result
-}
-
-# ::html::set
-#
-#	Rework the "set" command to blend into HTML template files.
-#	The return value is always "" so nothing is appended in the
-#	template.  No error checking is done on any arguments.
-#
-# Arguments:
-#	var	The variable to set.
-#	val	The new value to give the variable.
-#
-# Results:
-#	Returns "".
-#
-# Side Effects:
-#	None.
-
-proc ::html::set {var val} {
-
-    # The variable must be set in the stack frame above this one.
-
-    ::set cmd [list set $var $val]
-    uplevel 1 $cmd
-    return ""
-}
-
-# ::html::eval
-#
-#	Rework the "eval" command to blend into HTML template files.
-#	The return value is always "" so nothing is appended in the
-#	template.  No error checking is done on any arguments.
-#
-# Arguments:
-#	args	The args to evaluate.  At least one must be given.
-#
-# Results:
-#	Returns "".
-#
-# Side Effects:
-#	Throws an error if no arguments are given.
-
-proc ::html::eval {args} {
-
-    # The args must be evaluated in the stack frame above this one.
-    ::eval [linsert $args 0 uplevel 1]
-    return ""
-}
-
-# ::html::init
-#
-#	Reset state that gets accumulated for the current page.
-#
-# Arguments:
-#	nvlist	Name, value list that is used to initialize default namespace
-#		variables that set font, size, etc.
-#
-# Side Effects:
-#	Wipes the page state array
-
-proc ::html::init {{nvlist {}}} {
-    variable page
-    variable defaults
-    ::if {[info exists page]} {
-	unset page
-    }
-    ::if {[info exists defaults]} {
-	unset defaults
-    }
-    array set defaults $nvlist
-}
-
-# ::html::head
-#
-#	Generate the <head> section.  There are a number of
-#	optional calls you make *before* this to inject
-#	meta tags - see everything between here and the bodyTag proc.
-#
-# Arguments:
-#	title	The page title
-#
-# Results:
-#	HTML for the <head> section
-
-proc ::html::head {title} {
-    variable page
-    ::set html "[openTag html][openTag head]\n"
-    append html "\t[title $title]"
-    ::if {[info exists page(author)]} {
-	append html "\t$page(author)"
-    }
-    ::if {[info exists page(meta)]} {
-	::foreach line $page(meta) {
-	    append html "\t$line\n"
-	}
-    }
-    ::if {[info exists page(css)]} {
-	::foreach style $page(css) {
-	    append html "\t$style\n"
-	}
-    }
-    ::if {[info exists page(js)]} {
-	::foreach script $page(js) {
-	    append html "\t$script\n"
-	}
-    }
-    append html "[closeTag]\n"
-}
-
-# ::html::title
-#
-#	Wrap up the <title> and tuck it away for use in the page later.
-#
-# Arguments:
-#	title	The page title
-#
-# Results:
-#	HTML for the <title> section
-
-proc ::html::title {title} {
-    variable page
-    ::set page(title) $title
-    ::set html "<title>$title</title>\n"
-    return $html
-}
-
-# ::html::getTitle
-#
-#	Return the title of the current page.
-#
-# Arguments:
-#	None
-#
-# Results:
-#	The title
-
-proc ::html::getTitle {} {
-    variable page
-    ::if {[info exists page(title)]} {
-	return $page(title)
-    } else {
-	return ""
-    }
-}
-
-# ::html::meta
-#
-#	Generate a meta tag.  This tag gets bundled into the <head>
-#	section generated by html::head
-#
-# Arguments:
-#	args	A name-value list of meta tag names and values.
-#
-# Side Effects:
-#	Stores HTML for the <meta> tag for use later by html::head
-
-proc ::html::meta {args} {
-    variable page
-    ::set html ""
-    ::foreach {name value} $args {
-	append html "<meta name=\"$name\" content=\"[quoteFormValue $value]\">"
-    }
-    lappend page(meta) $html
-    return ""
-}
-
-# ::html::refresh
-#
-#	Generate a meta refresh tag.  This tag gets bundled into the <head>
-#	section generated by html::head
-#
-# Arguments:
-#	content	Time period, in seconds, before the refresh
-#	url	(option) new page to view. If not specified, then
-#		the current page is reloaded.
-#
-# Side Effects:
-#	Stores HTML for the <meta> tag for use later by html::head
-
-proc ::html::refresh {content {url {}}} {
-    variable page
-    ::set html "<meta http-equiv=\"Refresh\" content=\"$content"
-    ::if {[string length $url]} {
-	append html "; url=$url"
-    }
-    append html "\">\n"
-    lappend page(meta) $html
-    return ""
-}
-
-# ::html::headTag
-#
-#	Embed a tag into the HEAD section
-#	generated by html::head
-#
-# Arguments:
-#	string	Everything but the < > for the tag.
-#
-# Side Effects:
-#	Stores HTML for the tag for use later by html::head
-
-proc ::html::headTag {string} {
-    variable page
-    lappend page(meta) <$string>
-    return ""
-}
-
-# ::html::keywords
-#
-#	Add META tag keywords to the <head> section.
-#	Call this before you call html::head
-#
-# Arguments:
-#	args	The keywords
-#
-# Side Effects:
-#	See html::meta
-
-proc ::html::keywords {args} {
-    html::meta keywords [join $args ", "]
-}
-
-# ::html::description
-#
-#	Add a description META tag to the <head> section.
-#	Call this before you call html::head
-#
-# Arguments:
-#	description	The description
-#
-# Side Effects:
-#	See html::meta
-
-proc ::html::description {description} {
-    html::meta description $description
-}
-
-# ::html::author
-#
-#	Add an author comment to the <head> section.
-#	Call this before you call html::head
-#
-# Arguments:
-#	author	Author's name
-#
-# Side Effects:
-#	sets page(author)
-
-proc ::html::author {author} {
-    variable page
-    ::set page(author) "<!-- $author -->\n"
-    return ""
-}
-
-# ::html::tagParam
-#
-#	Return a name, value string for the tag parameters.
-#	The values come from "hard-wired" values in the 
-#	param agrument, or from the defaults set with html::init.
-#
-# Arguments:
-#	tag	Name of the HTML tag (case insensitive).
-#	param	pname=value info that overrides any default values
-#
-# Results
-#	A string of the form:
-#		pname="keyvalue" name2="2nd value"
-
-proc ::html::tagParam {tag {param {}}} {
-    variable defaults
-
-    ::set def ""
-    ::foreach key [lsort [array names defaults $tag.*]] {
-	append def [default $key $param]
-    }
-    return [string trimleft $param$def]
-}
-
-# ::html::default
-#
-#	Return a default value, if one has been registered
-#	and an overriding value does not occur in the existing
-#	tag parameters.
-#
-# Arguments:
-#	key	Index into the defaults array defined by html::init
-#		This is expected to be in the form tag.pname where
-#		the pname part is used in the tag parameter name
-#	param	pname=value info that overrides any default values
-#
-# Results
-#	pname="keyvalue"
-
-proc ::html::default {key {param {}}} {
-    variable defaults
-    ::set pname [string tolower [lindex [split $key .] 1]]
-    ::set key [string tolower $key]
-    ::if {![regexp -nocase "(\[ 	\]|^)$pname=" $param] &&
-	    [info exists defaults($key)] &&
-	    [string length $defaults($key)]} {
-	return " $pname=\"$defaults($key)\""
-    } else {
-	return ""
-    }
-}
-
-# ::html::bodyTag
-#
-#	Generate a body tag
-#
-# Arguments:
-#	none
-#
-# Results
-#	A body tag
-
-proc ::html::bodyTag {args} {
-    return [openTag body [join $args]]\n
-}
-
-# The following procedures are all related to generating form elements
-# that are initialized to store the current value of the form element
-# based on the CGI state.  These functions depend on the ncgi::value
-# procedure and assume that the caller has called ncgi::parse and/or
-# ncgi::init appropriately to initialize the ncgi module.
-
-# ::html::formValue
-#
-#	Return a name and value pair, where the value is initialized
-#	from existing form data, if any.
-#
-# Arguments:
-#	name		The name of the form element
-#	defvalue	A default value to use, if not appears in the CGI
-#			inputs.  DEPRECATED - use ncgi::defValue instead.
-#
-# Retults:
-#	A string like:
-#	name="fred" value="freds value"
-
-proc ::html::formValue {name {defvalue {}}} {
-    ::set value [ncgi::value $name]
-    ::if {[string length $value] == 0} {
-	::set value $defvalue
-    }
-    return "name=\"$name\" value=\"[quoteFormValue $value]\""
-}
-
-# ::html::quoteFormValue
-#
-#	Quote a value for use in a value=\"$value\" fragment.
-#
-# Arguments:
-#	value		The value to quote
-#
-# Retults:
-#	A string like:
-#	&#34;Hello, &lt;b&gt;World!&#34;
-
-proc ::html::quoteFormValue {value} {
-    return [string map [list "&" "&amp;" "\"" "&#34;" \
-			    "'" "&#39;" "<" "&lt;" ">" "&gt;"] $value]
-}
-
-# ::html::textInput --
-#
-#	Return an <input type=text> element.  This uses the
-#	input.size default falue.
-#
-# Arguments:
-#	name		The form element name
-#	args		Additional attributes for the INPUT tag
-#
-# Results:
-#	The html fragment
-
-proc ::html::textInput {name {value {}} args} {
-    ::set html "<input type=\"text\" "
-    append html [formValue $name $value]
-    append html [default input.size $args]
-    ::if {[llength $args] != 0} then {
-	append html " " [join $args]
-    }
-    append html ">\n"
-    return $html
-}
-
-# ::html::textInputRow --
-#
-#	Format a table row containing a text input element and a label.
-#
-# Arguments:
-#	label	Label to display next to the form element
-#	name	The form element name
-#	args	Additional attributes for the INPUT tag
-#
-# Results:
-#	The html fragment
-
-proc ::html::textInputRow {label name {value {}} args} {
-    ::set html [row $label [::eval [linsert $args 0 html::textInput $name $value]]]
-    return $html
-}
-
-# ::html::passwordInputRow --
-#
-#	Format a table row containing a password input element and a label.
-#
-# Arguments:
-#	label	Label to display next to the form element
-#	name	The form element name
-#
-# Results:
-#	The html fragment
-
-proc ::html::passwordInputRow {label {name password}} {
-    ::set html [row $label [passwordInput $name]]
-    return $html
-}
-
-# ::html::passwordInput --
-#
-#	Return an <input type=password> element.
-#
-# Arguments:
-#	name	The form element name. Defaults to "password"
-#
-# Results:
-#	The html fragment
-
-proc ::html::passwordInput {{name password}} {
-    ::set html "<input type=\"password\" name=\"$name\">\n"
-    return $html
-}
-
-# ::html::checkbox --
-#
-#	Format a checkbox so that it retains its state based on
-#	the current CGI values
-#
-# Arguments:
-#	name		The form element name
-#	value		The value associated with the checkbox
-#
-# Results:
-#	The html fragment
-
-proc ::html::checkbox {name value} {
-    ::set html "<input type=\"checkbox\" [checkValue $name $value]>\n"
-}
-
-# ::html::checkValue
-#
-#	Like html::formalue, but for checkboxes that need CHECKED
-#
-# Arguments:
-#	name		The name of the form element
-#	defvalue	A default value to use, if not appears in the CGI
-#			inputs
-#
-# Retults:
-#	A string like:
-#	name="fred" value="freds value" CHECKED
-
-
-proc ::html::checkValue {name {value 1}} {
-    ::foreach v [ncgi::valueList $name] {
-	::if {[string compare $value $v] == 0} {
-	    return "name=\"$name\" value=\"[quoteFormValue $value]\" checked"
-	}
-    }
-    return "name=\"$name\" value=\"[quoteFormValue $value]\""
-}
-
-# ::html::radioValue
-#
-#	Like html::formValue, but for radioboxes that need CHECKED
-#
-# Arguments:
-#	name	The name of the form element
-#	value	The value associated with the radio button.
-#
-# Retults:
-#	A string like:
-#	name="fred" value="freds value" CHECKED
-
-proc ::html::radioValue {name value {defaultSelection {}}} {
-    ::if {[string equal $value [ncgi::value $name $defaultSelection]]} {
-	return "name=\"$name\" value=\"[quoteFormValue $value]\" checked"
-    } else {
-	return "name=\"$name\" value=\"[quoteFormValue $value]\""
-    }
-}
-
-# ::html::radioSet --
-#
-#	Display a set of radio buttons while looking for an existing
-#	value from the query data, if any.
-
-proc ::html::radioSet {key sep list {defaultSelection {}}} {
-    ::set html ""
-    ::set s ""
-    ::foreach {label v} $list {
-	append html "$s<input type=\"radio\" [radioValue $key $v $defaultSelection]> $label"
-	::set s $sep
-    }
-    return $html
-}
-
-# ::html::checkSet --
-#
-#	Display a set of check buttons while looking for an existing
-#	value from the query data, if any.
-
-proc ::html::checkSet {key sep list} {
-    ::set s ""
-    ::foreach {label v} $list {
-	append html "$s<input type=\"checkbox\" [checkValue $key $v]> $label"
-	::set s $sep
-    }
-    return $html
-}
-
-# ::html::select --
-#
-#	Format a <select> element that retains the state of the
-#	current CGI values.
-#
-# Arguments:
-#	name		The form element name
-#	param		The various size, multiple parameters for the tag
-#	choices		A simple list of choices
-#	current		Value to assume if nothing is in CGI state
-#
-# Results:
-#	The html fragment
-
-proc ::html::select {name param choices {current {}}} {
-    ::set def [ncgi::valueList $name $current]
-    ::set html "<select name=\"$name\"[string trimright  " $param"]>\n"
-    ::foreach {label v} $choices {
-	::if {[lsearch -exact $def $v] != -1} {
-	    ::set SEL " selected"
-	} else {
-	    ::set SEL ""
-	}
-	append html "<option value=\"$v\"$SEL>$label\n"
-    }
-    append html "</select>\n"
-    return $html
-}
-
-# ::html::selectPlain --
-#
-#	Format a <select> element where the values are the same
-#	as those that are displayed.
-#
-# Arguments:
-#	name		The form element name
-#	param		Tag parameters
-#	choices		A simple list of choices
-#
-# Results:
-#	The html fragment
-
-proc ::html::selectPlain {name param choices {current {}}} {
-    ::set namevalue {}
-    ::foreach c $choices {
-	lappend namevalue $c $c
-    }
-    return [select $name $param $namevalue $current]
-}
-
-# ::html::textarea --
-#
-#	Format a <textarea> element that retains the state of the
-#	current CGI values.
-#
-# Arguments:
-#	name		The form element name
-#	param		The various size, multiple parameters for the tag
-#	current		Value to assume if nothing is in CGI state
-#
-# Results:
-#	The html fragment
-
-proc ::html::textarea {name {param {}} {current {}}} {
-    ::set value [ncgi::value $name $current]
-    return "<[string trimright \
-	"textarea name=\"$name\"\
-		[tagParam textarea $param]"]>$value</textarea>\n"
-}
-
-# ::html::submit --
-#
-#	Format a submit button.
-#
-# Arguments:
-#	label		The string to appear in the submit button.
-#	name		The name for the submit button element
-#
-# Results:
-#	The html fragment
-
-
-proc ::html::submit {label {name submit}} {
-    ::set html "<input type=\"submit\" name=\"$name\" value=\"$label\">\n"
-}
-
-# ::html::varEmpty --
-#
-#	Return true if the variable doesn't exist or is an empty string
-#
-# Arguments:
-#	varname	Name of the variable
-#
-# Results:
-#	1 if the variable doesn't exist or has the empty value
-
-proc ::html::varEmpty {name} {
-    upvar 1 $name var
-    ::if {[info exists var]} {
-	::set value $var
-    } else {
-	::set value ""
-    }
-    return [expr {[string length [string trim $value]] == 0}]
-}
-
-# ::html::getFormInfo --
-#
-#	Generate hidden fields to capture form values.
-#
-# Arguments:
-#	args	List of elements to save.  If this is empty, everything is
-#		saved in hidden fields.  This is a list of string match
-#		patterns.
-#
-# Results:
-#	A bunch of <input type=hidden> elements
-
-proc ::html::getFormInfo {args} {
-    ::if {[llength $args] == 0} {
-	::set args *
-    }
-    ::set html ""
-    ::foreach {n v} [ncgi::nvlist] {
-	::foreach pat $args {
-	    ::if {[string match $pat $n]} {
-		append html "<input type=\"hidden\" name=\"$n\" \
-				    value=\"[quoteFormValue $v]\">\n"
-	    }
-	}
-    }
-    return $html
-}
-
-# ::html::h1
-#	Generate an H1 tag.
-#
-# Arguments:
-#	string
-#	param
-#
-# Results:
-#	Formats the tag.
-
-proc ::html::h1 {string {param {}}} {
-    html::h 1 $string $param
-}
-proc ::html::h2 {string {param {}}} {
-    html::h 2 $string $param
-}
-proc ::html::h3 {string {param {}}} {
-    html::h 3 $string $param
-}
-proc ::html::h4 {string {param {}}} {
-    html::h 4 $string $param
-}
-proc ::html::h5 {string {param {}}} {
-    html::h 5 $string $param
-}
-proc ::html::h6 {string {param {}}} {
-    html::h 6 $string $param
-}
-proc ::html::h {level string {param {}}} {
-    return "<[string trimright "h$level [tagParam h$level $param]"]>$string</h$level>\n"
-}
-
-# ::html::openTag
-#	Remember that a tag  is opened so it can be closed later.
-#	This is used to automatically clean up at the end of a page.
-#
-# Arguments:
-#	tag	The HTML tag name
-#	param	Any parameters for the tag
-#
-# Results:
-#	Formats the tag.  Also keeps it around in a per-page stack
-#	of open tags.
-
-proc ::html::openTag {tag {param {}}} {
-    variable page
-    lappend page(stack) $tag
-    return "<[string trimright "$tag [tagParam $tag $param]"]>"
-}
-
-# ::html::closeTag
-#	Pop a tag from the stack and close it.
-#
-# Arguments:
-#	None
-#
-# Results:
-#	A close tag.  Also pops the stack.
-
-proc ::html::closeTag {} {
-    variable page
-    ::if {[info exists page(stack)]} {
-	::set top [lindex $page(stack) end]
-	::set page(stack) [lreplace $page(stack) end end]
-    }
-    ::if {[info exists top] && [string length $top]} {
-	return </$top>
-    } else {
-	return ""
-    }
-}
-
-# ::html::end
-#
-#	Close out all the open tags.  Especially useful for
-#	Tables that do not display at all if they are unclosed.
-#
-# Arguments:
-#	None
-#
-# Results:
-#	Some number of close HTML tags.
-
-proc ::html::end {} {
-    variable page
-    ::set html ""
-    ::while {[llength $page(stack)]} {
-	append html [closeTag]\n
-    }
-    return $html
-}
-
-# ::html::row
-#
-#	Format a table row.  If the default font has been set, this
-#	takes care of wrapping the table cell contents in a font tag.
-#
-# Arguments:
-#	args	Values to put into the row
-#
-# Results:
-#	A <tr><td>...</tr> fragment
-
-proc ::html::row {args} {
-    ::set html <tr>\n
-    ::foreach x $args {
-	append html \t[cell "" $x td]\n
-    }
-    append html "</tr>\n"
-    return $html
-}
-
-# ::html::hdrRow
-#
-#	Format a table row.  If the default font has been set, this
-#	takes care of wrapping the table cell contents in a font tag.
-#
-# Arguments:
-#	args	Values to put into the row
-#
-# Results:
-#	A <tr><th>...</tr> fragment
-
-proc ::html::hdrRow {args} {
-    variable defaults
-    ::set html <tr>\n
-    ::foreach x $args {
-	append html \t[cell "" $x th]\n
-    }
-    append html "</tr>\n"
-    return $html
-}
-
-# ::html::paramRow
-#
-#	Format a table row.  If the default font has been set, this
-#	takes care of wrapping the table cell contents in a font tag.
-#
-#       Based on html::row
-#
-# Arguments:
-#	list	Values to put into the row
-#       rparam   Parameters for row
-#       cparam   Parameters for cells
-#
-# Results:
-#	A <tr><td>...</tr> fragment
-
-proc ::html::paramRow {list {rparam {}} {cparam {}}} {
-    ::set html "<tr $rparam>\n"
-    ::foreach x $list {
-	append html \t[cell $cparam $x td]\n
-    }
-    append html "</tr>\n"
-    return $html
-}
-
-# ::html::cell
-#
-#	Format a table cell.  If the default font has been set, this
-#	takes care of wrapping the table cell contents in a font tag.
-#
-# Arguments:
-#	param	Td tag parameters
-#	value	The value to put into the cell
-#	tag	(option) defaults to TD
-#
-# Results:
-#	<td>...</td> fragment
-
-proc ::html::cell {param value {tag td}} {
-    ::set font [font]
-    ::if {[string length $font]} {
-	::set value $font$value</font>
-    }
-    return "<[string trimright "$tag $param"]>$value</$tag>"
-}
-
-# ::html::tableFromArray
-#
-#	Format a Tcl array into an HTML table
-#
-# Arguments:
-#	arrname	The name of the array
-#	param	The <table> tag parameters, if any.
-#	pat	A string match pattern for the element keys
-#
-# Results:
-#	A <table>
-
-proc ::html::tableFromArray {arrname {param {}} {pat *}} {
-    upvar 1 $arrname arr
-    ::set html ""
-    ::if {[info exists arr]} {
-	append html "<table $param>\n"
-	append html "<tr><th colspan=2>$arrname</th></tr>\n"
-	::foreach name [lsort [array names arr $pat]] {
-	    append html [row $name $arr($name)]
-	}
-	append html </table>\n
-    }
-    return $html
-}
-
-# ::html::tableFromList
-#
-#	Format a table from a name, value list
-#
-# Arguments:
-#	querylist	A name, value list
-#	param		The <table> tag parameters, if any.
-#
-# Results:
-#	A <table>
-
-proc ::html::tableFromList {querylist {param {}}} {
-    ::set html ""
-    ::if {[llength $querylist]} {
-	append html "<table $param>"
-	::foreach {label value} $querylist {
-	    append html [row $label $value]
-	}
-	append html </table>
-    }
-    return $html
-}
-
-# ::html::mailto
-#
-#	Format a mailto: HREF tag
-#
-# Arguments:
-#	email	The target
-#	subject	The subject of the email, if any
-#
-# Results:
-#	A <a href=mailto> tag </a>
-
-proc ::html::mailto {email {subject {}}} {
-    ::set html "<a href=\"mailto:$email"
-    ::if {[string length $subject]} {
-	append html ?subject=$subject
-    }
-    append html "\">$email</a>"
-    return $html
-}
-
-# ::html::font
-#
-#	Generate a standard <font> tag.  This depends on defaults being
-#	set via html::init
-#
-# Arguments:
-#	args	Font parameters.  
-#
-# Results:
-#	HTML
-
-proc ::html::font {args} {
-
-    # e.g., font.face, font.size, font.color
-    ::set param [tagParam font [join $args]]
-
-    ::if {[string length $param]} {
-	return "<[string trimright "font $param"]>"
-    } else {
-	return ""
-    }
-}
-
-# ::html::minorMenu
-#
-#	Create a menu of links given a list of label, URL pairs.
-#	If the URL is the current page, it is not highlighted.
-#
-# Arguments:
-#
-#	list	List that alternates label, url, label, url
-#	sep	Separator between elements
-#
-# Results:
-#	html
-
-proc ::html::minorMenu {list {sep { | }}} {
-    ::set s ""
-    ::set html ""
-    regsub -- {index.h?tml$} [ncgi::urlStub] {} this
-    ::foreach {label url} $list {
-	regsub -- {index.h?tml$} $url {} that
-	::if {[string compare $this $that] == 0} {
-	    append html "$s$label"
-	} else {
-	    append html "$s<a href=\"$url\">$label</a>"
-	}
-	::set s $sep
-    }
-    return $html
-}
-
-# ::html::minorList
-#
-#	Create a list of links given a list of label, URL pairs.
-#	If the URL is the current page, it is not highlighted.
-#
-#       Based on html::minorMenu
-#
-# Arguments:
-#
-#	list	List that alternates label, url, label, url
-#       ordered Boolean flag to choose between ordered and
-#               unordered lists. Defaults to 0, i.e. unordered.
-#
-# Results:
-#	A <ul><li><a...><\li>.....<\ul> fragment
-#    or a <ol><li><a...><\li>.....<\ol> fragment
-
-proc ::html::minorList {list {ordered 0}} {
-    ::set s ""
-    ::set html ""
-    ::if { $ordered } {
-	append html [openTag ol]
-    } else {
-	append html [openTag ul]
-    }
-    regsub -- {index.h?tml$} [ncgi::urlStub] {} this
-    ::foreach {label url} $list {
-	append html [openTag li]
-	regsub -- {index.h?tml$} $url {} that
-	::if {[string compare $this $that] == 0} {
-	    append html "$s$label"
-	} else {
-	    append html "$s<a href=\"$url\">$label</a>"
-	}
-	append html [closeTag]
-	append html \n
-    }
-    append html [closeTag]
-    return $html
-}
-
-# ::html::extractParam
-#
-#	Extract a value from parameter list (this needs a re-do)
-#
-# Arguments:
-#   param	A parameter list.  It should alredy have been processed to
-#		remove any entity references
-#   key		The parameter name
-#   varName	The variable to put the value into (use key as default)
-#
-# Results:
-#	returns "1" if the keyword is found, "0" otherwise
-
-proc ::html::extractParam {param key {varName ""}} {
-    ::if {$varName == ""} {
-	upvar $key result
-    } else {
-	upvar $varName result
-    }
-    ::set ws " \t\n\r"
- 
-    # look for name=value combinations.  Either (') or (") are valid delimeters
-    ::if {
-      [regsub -nocase [format {.*%s[%s]*=[%s]*"([^"]*).*} $key $ws $ws] $param {\1} value] ||
-      [regsub -nocase [format {.*%s[%s]*=[%s]*'([^']*).*} $key $ws $ws] $param {\1} value] ||
-      [regsub -nocase [format {.*%s[%s]*=[%s]*([^%s]+).*} $key $ws $ws $ws] $param {\1} value] } {
-        ::set result $value
-        return 1
-    }
-
-    # now look for valueless names
-    # I should strip out name=value pairs, so we don't end up with "name"
-    # inside the "value" part of some other key word - some day
-	
-    ::set bad \[^a-zA-Z\]+
-    ::if {[regexp -nocase  "$bad$key$bad" -$param-]} {
-	return 1
-    } else {
-	return 0
-    }
-}
-
-# ::html::urlParent --
-#	This is like "file dirname", but doesn't screw with the slashes
-#       (file dirname will collapse // into /)
-#
-# Arguments:
-#	url	The URL
-#
-# Results:
-#	The parent directory of the URL.
-
-proc ::html::urlParent {url} {
-    ::set url [string trimright $url /]
-    regsub -- {[^/]+$} $url {} url
-    return $url
-}
-
-# ::html::html_entities --
-#	Replaces all special characters in the text with their
-#	entities.
-#
-# Arguments:
-#	s	The near-HTML text
-#
-# Results:
-#	The text with entities in place of specials characters.
-
-proc ::html::html_entities {s} {
-    variable entities
-    return [string map $entities $s]
-}
-
-# ::html::nl2br --
-#	Replaces all line-endings in the text with <br> tags.
-#
-# Arguments:
-#	s	The near-HTML text
-#
-# Results:
-#	The text with <br> in place of line-endings.
-
-proc ::html::nl2br {s} {
-    return [string map [list \n\r <br> \n <br> \r <br>] $s]
-}
-
-# ::html::doctype
-#	Create the DOCTYPE tag and tuck it away for usage
-#
-# Arguments:
-#	arg	The DOCTYPE you want to declare
-#
-# Results:
-#	HTML for the doctype section
-
-proc ::html::doctype {arg} {
-    variable doctypes
-    set code [string toupper $arg]
-    if {![info exists doctypes($code)]} {
-	return -code error "Unknown doctype \"$arg\""
-    }
-    return $doctypes($code)
-}
-
-namespace eval ::html {
-    variable  doctypes
-    array set doctypes {
-	HTML32   {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">}
-	HTML40   {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">}
-	HTML40T  {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">}
-	HTML40F  {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">}
-	HTML401  {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">}
-	HTML401T {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">}
-	HTML401F {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">}
-	XHTML10S {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">}
-	XHTML10T {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">}
-	XHTML10F {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">}
-	XHTML11  {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">}
-	XHTMLB   {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">}
-    }
-}
-
-# ::html::css
-#	Create the text/css tag and tuck it away for usage
-#
-# Arguments:
-#	href	The location of the css file to include the filename and path
-#
-# Results:
-#	HTML for the  section
-
-proc ::html::css {href} {
-    variable page
-    set page(css) \
-	"<link rel=\"stylesheet\" type=\"text/css\" href=\"[quoteFormValue $href]\">\n"
-    return
-}
-
-# ::html::js
-#   Create the text/javascript tag and tuck it away for usage
-#
-# Arguments:
-#	href	The location of the javascript file to include the filename and path
-#
-# Results:
-#	HTML for the  section
-
-proc ::html::js {href} {
-    variable page
-    set page(js) \
-	"<script language=\"javascript\" type=\"text/javascript\" src=\"[quoteFormValue $href]\"></script>\n"
-    return
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/html/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/html/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded html 1.4 [list source [file join $dir html.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/htmlparse/htmlparse.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/htmlparse/htmlparse.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,894 +1,0 @@
-# htmlparse.tcl --
-#
-#	This file implements a simple HTML parsing library in Tcl.
-#	It may take advantage of parsers coded in C in the future.
-#
-#	The functionality here is a subset of the
-#
-#		Simple HTML display library by Stephen Uhler (stephen.uhler@sun.com)
-#		Copyright (c) 1995 by Sun Microsystems
-#		Version 0.3 Fri Sep  1 10:47:17 PDT 1995
-#
-#	The main restriction is that all Tk-related code in the above
-#	was left out of the code here. It is expected that this code
-#	will go into a 'tklib' in the future.
-#
-# Copyright (c) 2001 by ActiveState Tool Corp.
-# See the file license.terms.
-
-package require Tcl       8.2
-package require struct::stack
-package require cmdline   1.1
-
-namespace eval ::htmlparse {
-    namespace export		\
-	    parse		\
-	    debugCallback	\
-	    mapEscapes		\
-	    2tree		\
-	    removeVisualFluff	\
-	    removeFormDefs
-
-    # Table of escape characters. Maps from their names to the actual
-    # character.  See http://htmlhelp.org/reference/html40/entities/
-
-    variable namedEntities
-
-    # I. Latin-1 Entities (HTML 4.01)
-    array set namedEntities {
-	nbsp \xa0 iexcl \xa1 cent \xa2 pound \xa3 curren \xa4
-	yen \xa5 brvbar \xa6 sect \xa7 uml \xa8 copy \xa9
-	ordf \xaa laquo \xab not \xac shy \xad reg \xae
-	macr \xaf deg \xb0 plusmn \xb1 sup2 \xb2 sup3 \xb3
-	acute \xb4 micro \xb5 para \xb6 middot \xb7 cedil \xb8
-	sup1 \xb9 ordm \xba raquo \xbb frac14 \xbc frac12 \xbd
-	frac34 \xbe iquest \xbf Agrave \xc0 Aacute \xc1 Acirc \xc2
-	Atilde \xc3 Auml \xc4 Aring \xc5 AElig \xc6 Ccedil \xc7
-	Egrave \xc8 Eacute \xc9 Ecirc \xca Euml \xcb Igrave \xcc
-	Iacute \xcd Icirc \xce Iuml \xcf ETH \xd0 Ntilde \xd1
-	Ograve \xd2 Oacute \xd3 Ocirc \xd4 Otilde \xd5 Ouml \xd6
-	times \xd7 Oslash \xd8 Ugrave \xd9 Uacute \xda Ucirc \xdb
-	Uuml \xdc Yacute \xdd THORN \xde szlig \xdf agrave \xe0
-	aacute \xe1 acirc \xe2 atilde \xe3 auml \xe4 aring \xe5
-	aelig \xe6 ccedil \xe7 egrave \xe8 eacute \xe9 ecirc \xea
-	euml \xeb igrave \xec iacute \xed icirc \xee iuml \xef
-	eth \xf0 ntilde \xf1 ograve \xf2 oacute \xf3 ocirc \xf4
-	otilde \xf5 ouml \xf6 divide \xf7 oslash \xf8 ugrave \xf9
-	uacute \xfa ucirc \xfb uuml \xfc yacute \xfd thorn \xfe
-	yuml \xff
-    }
-
-    # II. Entities for Symbols and Greek Letters (HTML 4.01)
-    array set namedEntities {
-	fnof \u192 Alpha \u391 Beta \u392 Gamma \u393 Delta \u394
-	Epsilon \u395 Zeta \u396 Eta \u397 Theta \u398 Iota \u399
-	Kappa \u39A Lambda \u39B Mu \u39C Nu \u39D Xi \u39E
-	Omicron \u39F Pi \u3A0 Rho \u3A1 Sigma \u3A3 Tau \u3A4
-	Upsilon \u3A5 Phi \u3A6 Chi \u3A7 Psi \u3A8 Omega \u3A9
-	alpha \u3B1 beta \u3B2 gamma \u3B3 delta \u3B4 epsilon \u3B5
-	zeta \u3B6 eta \u3B7 theta \u3B8 iota \u3B9 kappa \u3BA
-	lambda \u3BB mu \u3BC nu \u3BD xi \u3BE omicron \u3BF
-	pi \u3C0 rho \u3C1 sigmaf \u3C2 sigma \u3C3 tau \u3C4
-	upsilon \u3C5 phi \u3C6 chi \u3C7 psi \u3C8 omega \u3C9
-	thetasym \u3D1 upsih \u3D2 piv \u3D6 bull \u2022
-	hellip \u2026 prime \u2032 Prime \u2033 oline \u203E
-	frasl \u2044 weierp \u2118 image \u2111 real \u211C
-	trade \u2122 alefsym \u2135 larr \u2190 uarr \u2191
-	rarr \u2192 darr \u2193 harr \u2194 crarr \u21B5
-	lArr \u21D0 uArr \u21D1 rArr \u21D2 dArr \u21D3 hArr \u21D4
-	forall \u2200 part \u2202 exist \u2203 empty \u2205
-	nabla \u2207 isin \u2208 notin \u2209 ni \u220B prod \u220F
-	sum \u2211 minus \u2212 lowast \u2217 radic \u221A
-	prop \u221D infin \u221E ang \u2220 and \u2227 or \u2228
-	cap \u2229 cup \u222A int \u222B there4 \u2234 sim \u223C
-	cong \u2245 asymp \u2248 ne \u2260 equiv \u2261 le \u2264
-	ge \u2265 sub \u2282 sup \u2283 nsub \u2284 sube \u2286
-	supe \u2287 oplus \u2295 otimes \u2297 perp \u22A5
-	sdot \u22C5 lceil \u2308 rceil \u2309 lfloor \u230A
-	rfloor \u230B lang \u2329 rang \u232A loz \u25CA
-	spades \u2660 clubs \u2663 hearts \u2665 diams \u2666
-    }
-
-    # III. Special Entities (HTML 4.01)
-    array set namedEntities {
-	quot \x22 amp \x26 lt \x3C gt \x3E OElig \u152 oelig \u153
-	Scaron \u160 scaron \u161 Yuml \u178 circ \u2C6
-	tilde \u2DC ensp \u2002 emsp \u2003 thinsp \u2009
-	zwnj \u200C zwj \u200D lrm \u200E rlm \u200F ndash \u2013
-	mdash \u2014 lsquo \u2018 rsquo \u2019 sbquo \u201A
-	ldquo \u201C rdquo \u201D bdquo \u201E dagger \u2020
-	Dagger \u2021 permil \u2030 lsaquo \u2039 rsaquo \u203A
-	euro \u20AC
-    }
-
-    # Internal cache for the foreach variable-lists and the
-    # substitution strings used to split a HTML string into
-    # incrementally handleable scripts. This should reduce the
-    # time compute this information for repeated calls with the same
-    # split-factor. The array is indexed by a combination of the
-    # numerical split factor and the length of the command prefix and
-    # maps this to a 2-element list containing variable- and
-    # subst-string.
-
-    variable  splitdata
-    array set splitdata {}
-
-}
-
-# htmlparse::parse --
-#
-#	This command is the basic parser for HTML. It takes a HTML
-#	string, parses it and invokes a command prefix for every tag
-#	encountered. It is not necessary for the HTML to be valid for
-#	this parser to function. It is the responsibility of the
-#	command invoked for every tag to check this. Another
-#	responsibility of the invoked command is the handling of tag
-#	attributes and character entities (escaped characters). The
-#	parser provides the un-interpreted tag attributes to the
-#	invoked command to aid in the former, and the package at large
-#	provides a helper command, '::htmlparse::mapEscapes', to aid
-#	in the handling of the latter. The parser *does* ignore
-#	leading DOCTYPE declarations and all valid HTML comments it
-#	encounters.
-#
-#	All information beyond the HTML string itself is specified via
-#	options, these are explained below.
-#
-#	To help understanding the options some more background
-#	information about the parser.
-#
-#	It is capable to detect incomplete tags in the HTML string
-#	given to it. Under normal circumstances this will cause the
-#	parser to throw an error, but if the option '-incvar' is used
-#	to specify a global (or namespace) variable the parser will
-#	store the incomplete part of the input into this variable
-#	instead. This will aid greatly in the handling of
-#	incrementally arriving HTML as the parser will handle whatever
-#	he can and defer the handling of the incomplete part until
-#	more data has arrived.
-#
-#	Another feature of the parser are its two possible modes of
-#	operation. The normal mode is activated if the option '-queue'
-#	is not present on the command line invoking the parser. If it
-#	is present the parser will go into the incremental mode instead.
-#
-#	The main difference is that a parser in normal mode will
-#	immediately invoke the command prefix for each tag it
-#	encounters. In incremental mode however the parser will
-#	generate a number of scripts which invoke the command prefix
-#	for groups of tags in the HTML string and then store these
-#	scripts in the specified queue. It is then the responsibility
-#	of the caller of the parser to ensure the execution of the
-#	scripts in the queue.
-#
-#	Note: The queue objecct given to the parser has to provide the
-#	same interface as the queue defined in tcllib -> struct. This
-#	does for example mean that all queues created via that part of
-#	tcllib can be immediately used here. Still, the queue doesn't
-#	have to come from tcllib -> struct as long as the same
-#	interface is provided.
-#
-#	In both modes the parser will return an empty string to the
-#	caller.
-#
-#	To a parser in incremental mode the option '-split' can be
-#	given and will specify the size of the groups he creates. In
-#	other words, -split 5 means that each of the generated scripts
-#	will invoke the command prefix for 5 consecutive tags in the
-#	HTML string. A parser in normal mode will ignore this option
-#	and its value.
-#
-#	The option '-vroot' specifies a virtual root tag. A parser in
-#	normal mode will invoke the command prefix for it immediately
-#	before and after he processes the tags in the HTML, thus
-#	simulating that the HTML string is enclosed in a <vroot>
-#	</vroot> combination. In incremental mode however the parser
-#	is unable to provide the closing virtual root as he never
-#	knows when the input is complete. In this case the first
-#	script generated by each invocation of the parser will contain
-#	an invocation of the command prefix for the virtual root as
-#	its first command.
-#
-#	Interface to the command prefix:
-#
-#	In normal mode the parser will invoke the command prefix with
-#	for arguments appended. See '::htmlparse::debugCallback' for a
-#	description. In incremental mode however the generated scripts
-#	will invoke the command prefix with five arguments
-#	appended. The last four of these are the same which were
-#	mentioned above. The first however is a placeholder string
-#	(\win\) for a clientdata value to be supplied later during the
-#	actual execution of the generated scripts. This could be a tk
-#	window path, for example. This allows the user of this package
-#	to preprocess HTML strings without commiting them to a
-#	specific window, object, whatever during parsing. This
-#	connection can be made later. This also means that it is
-#	possible to cache preprocessed HTML. Of course, nothing
-#	prevents the user of the parser to replace the placeholder
-#	with an empty string.
-#
-# Arguments:
-#	args	An option/value-list followed by the string to
-#		parse. Available options are:
-#
-#		-cmd	The command prefix to invoke for every tag in
-#			the HTML string. Defaults to
-#			'::htmlparse::debugCallback'.
-#
-#		-vroot	The virtual root tag to add around the HTML in
-#			normal mode. In incremental mode it is the
-#			first tag in each chunk processed by the
-#			parser, but there will be no closing tags.
-#			Defaults to 'hmstart'.
-#
-#		-split	The size of the groups produced by an
-#			incremental mode parser. Ignored when in
-#			normal mode. Defaults to 10. Values <= 0 are
-#			not allowed.
-#
-#		-incvar	The name of the variable where to store any
-#			incomplete HTML into. Optional.
-#
-#		-queue
-#			The handle/name of the queue objecct to store
-#			the generated scripts into. Activates
-#			incremental mode. Normal mode is used if this
-#			option is not present.
-#
-#		After the option the command explect a single argument
-#		containing the HTML string to parse.
-#
-# Side Effects:
-#	In normal mode as of the invoked command. Else none.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::parse {args} {
-    # Convert the HTML string into a evaluable command sequence.
-
-    variable splitdata
-
-    # Option processing, start with the defaults, then run through the
-    # list of arguments.
-
-    set cmd    ::htmlparse::debugCallback
-    set vroot  hmstart
-    set incvar ""
-    set split  10
-    set queue  ""
-
-    while {[set err [cmdline::getopt args {cmd.arg vroot.arg incvar.arg split.arg queue.arg} opt arg]]} {
-	if {$err < 0} {
-	    return -code error "::htmlparse::parse : $arg"
-	}
-	switch -exact -- $opt {
-	    cmd    -
-	    vroot  -
-	    incvar -
-	    queue  {
-		if {[string length $arg] == 0} {
-		    return -code error "::htmlparse::parse : -$opt illegal argument (empty)"
-		}
-		# Each option has an variable with the same name associated with it.
-		# FRINK: nocheck
-		set $opt $arg
-	    }
-	    split  {
-		if {$arg <= 0} {
-		    return -code error "::htmlparse::parse : -split illegal argument (<= 0)"
-		}
-		set split $arg
-	    }
-	    default {# Can't happen}
-	}
-    }
-
-    if {[llength $args] > 1} {
-	return -code error "::htmlparse::parse : to many arguments behind the options, expected one"
-    }
-    if {[llength $args] < 1} {
-	return -code error "::htmlparse::parse : html string missing"
-    }
-
-    set html [PrepareHtml [lindex $args 0]]
-
-    # Look for incomplete HTML from the last iteration and prepend it
-    # to the input we just got.
-
-    if {$incvar != {}} {
-	upvar $incvar incomplete
-    } else {
-	set incomplete ""
-    }
-
-    if {[catch {set new $incomplete$html}]} {set new $html}
-    set html $new
-
-    # Handle incomplete HTML (Recognize incomplete tag at end, buffer
-    # it up for the next call).
-
-    set end [lindex \{$html\} end]
-    if {[set idx [string last < $end]] > [string last > $end]} {
-
-	if {$incvar == {}} {
-	    return -code error "::htmlparse::parse : HTML is incomplete, option -incvar is missing"
-	}
-
-	#  upvar $incvar incomplete -- Already done, s.a.
-	set incomplete [string range $end $idx end]
-	incr idx -1
-	set html       [string range $end 0 $idx]
-	
-    } else {
-	set incomplete ""
-    }
-
-    # Convert the HTML string into a script.
-
-    set sub "\}\n$cmd {\\1} {} {\\2} \{\}\n$cmd {\\1} {/} {} \{"
-    regsub -all -- {<([^\s>]+)\s*([^>]*)/>} $html $sub html
-
-    set sub "\}\n$cmd {\\2} {\\1} {\\3} \{"
-    regsub -all -- {<(/?)([^\s>]+)\s*([^>]*)>} $html $sub html
-
-    # The value of queue now determines wether we process the HTML by
-    # ourselves (queue is empty) or if we generate a list of  scripts
-    # each of which processes n tags, n the argument to -split.
-
-    if {$queue == {}} {
-	# And evaluate it. This is the main parsing step.
-
-	eval "$cmd {$vroot} {} {} \{$html\}"
-	eval "$cmd {$vroot} /  {} {}"
-    } else {
-	# queue defined, generate list of scripts doing small chunks of tags.
-
-	set lcmd [llength $cmd]
-	set key  $split,$lcmd
-
-	if {![info exists splitdata($key)]} {
-	    for {set i 0; set group {}} {$i < $split} {incr i} {
-		# Use the length of the command prefix to generate
-		# additional variables before the main variable after
-		# which the placeholder will be inserted.
-
-		for {set j 1} {$j < $lcmd} {incr j} {
-		    append group "b${j}_$i "
-		}
-
-		append group "a$i c$i d$i e$i f$i\n"
-	    }
-	    regsub -all -- {(a[0-9]+)}          $group    {{$\1} \\\\win\\\\} subgroup
-	    regsub -all -- {([b-z_0-9]+[0-9]+)} $subgroup {{$\1}}             subgroup
-
-	    set splitdata($key) [list $group $subgroup]
-	}
-
-	foreach {group subgroup} $splitdata($key) break ; # lassign
-	foreach $group "$cmd {$vroot} {} {} \{$html\}" {
-	    $queue put [string trimright [subst $subgroup]]
-	}
-    }
-    return
-}
-
-# htmlparse::PrepareHtml --
-#
-#	Internal helper command of '::htmlparse::parse'. Removes
-#	leading DOCTYPE declarations and comments, protects the
-#	special characters of tcl from evaluation.
-#
-# Arguments:
-#	html	The HTML string to prepare
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	The provided HTML string with the described modifications
-#	applied to it.
-
-proc ::htmlparse::PrepareHtml {html} {
-    # Remove the following items from the text:
-    # - A leading	<!DOCTYPE...> declaration.
-    # - All comments	<!-- ... -->
-    #
-    # Also normalize the line endings (\r -> \n).
-
-    # Tcllib SF Bug 861287 - Processing of comments.
-    # Recognize EOC by RE, instead of fixed string.
-
-    set html [string map [list \r \n] $html]
-
-    regsub -- "^.*<!DOCTYPE\[^>\]*>"    $html {}     html
-    regsub -all -- "--(\[ \t\n\]*)>"      $html "\001\\1\002" html
-
-    # Recognize borken beginnings of a comment and convert them to PCDATA.
-    regsub -all -- "<--(\[^\001\]*)\001(\[^\002\]*)\002" $html {\&lt;--\1--\2\&gt;} html
-
-    # And now recognize true comments, remove them.
-    regsub -all -- "<!--\[^\001\]*\001(\[^\002\]*)\002"  $html {}                   html
-
-    # Protect characters special to tcl (braces, slashes) by
-    # converting them to their escape sequences.
-
-    return [string map [list \
-		    "\{" "&#123;" \
-		    "\}" "&#125;" \
-		    "\\" "&#92;"] $html]
-}
-
-
-
-# htmlparse::debugCallback --
-#
-#	The standard callback used by the parser in
-#	'::htmlparse::parse' if none was specified by the user. Simply
-#	dumps its arguments to stdout.  This callback can be used for
-#	both normal and incremental mode of the calling parser. In
-#	other words, it accepts four or five arguments. The last four
-#	arguments are described below. The optional fifth argument
-#	contains the clientdata value given to the callback by a
-#	parser in incremental mode. All callbacks have to follow the
-#	signature of this command in the last four arguments, and
-#	callbacks used in incremental parsing have to follow this
-#	signature in the last five arguments.
-#
-# Arguments:
-#	tag			The name of the tag currently
-#				processed by the parser.
-#
-#	slash			Either empty or a slash. Allows us to
-#				distinguish between opening (slash is
-#				empty) and closing tags (slash is
-#				equal to a '/').
-#
-#	param			The un-interpreted list of parameters
-#				to the tag.
-#
-#	textBehindTheTag	The text found by the parser behind
-#				the tag named in 'tag'.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::debugCallback {args} {
-    # args = ?clientData? tag slash param textBehindTheTag
-    puts "==> $args"
-    return
-}
-
-# htmlparse::mapEscapes --
-#
-#	Takes a HTML string, substitutes all escape sequences with
-#	their actual characters and returns the resulting string.
-#	HTML not containing escape sequences or invalid escape
-#	sequences is returned unchanged.
-#
-# Arguments:
-#	html	The string to modify
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	The argument string with all escape sequences replaced with
-#	their actual characters.
-
-proc ::htmlparse::mapEscapes {html} {
-    # Find HTML escape characters of the form &xxx(;|EOW)
-
-    # Quote special Tcl chars so they pass through [subst] unharmed.
-    set new [string map [list \] \\\] \[ \\\[ \$ \\\$ \\ \\\\] $html]
-    regsub -all -- {&([[:alnum:]]{2,7})(;|\M)} $new {[DoNamedMap \1 {\2}]} new
-    regsub -all -- {&#([[:digit:]]{1,5})(;|\M)} $new {[DoDecMap \1 {\2}]} new
-    regsub -all -- {&#x([[:xdigit:]]{1,4})(;|\M)} $new {[DoHexMap \1 {\2}]} new
-    return [subst $new]
-}
-
-proc ::htmlparse::DoNamedMap {name endOf} {
-    variable namedEntities
-    if {[info exist namedEntities($name)]} {
-	return $namedEntities($name)
-    } else {
-	# Put it back..
-	return "&$name$endOf"
-    }
-}
-
-proc ::htmlparse::DoDecMap {dec endOf} {
-    scan $dec %d dec
-    if {$dec <= 0xFFFD} {
-	return [format %c $dec]
-    } else {
-	# Put it back..
-	return "&#$dec$endOf"
-    }
-}
-
-proc ::htmlparse::DoHexMap {hex endOf} {
-    scan $hex %x value
-    if {$value <= 0xFFFD} {
-	return [format %c $value]
-    } else {
-	# Put it back..
-	return "&#x$hex$endOf"
-    }
-}
-
-# htmlparse::2tree --
-#
-#	This command is a wrapper around '::htmlparse::parse' which
-#	takes a HTML string and converts it into a tree containing the
-#	logical structure of the parsed document. The tree object has
-#	to be created by the caller. It is also expected that the tree
-#	object provides the same interface as the tree object from
-#	tcllib -> struct. It doesn't have to come from that module
-#	though. The internal callback does some basic checking of HTML
-#	validity and tries to recover from the most basic errors.
-#
-# Arguments:
-#	html	The HTML string to parse and convert.
-#	tree	The name of the tree to fill.
-#
-# Side Effects:
-#	Creates a tree object (see tcllib -> struct)
-#	and modifies it.
-#
-# Results:
-#	The contents of 'tree'.
-
-proc ::htmlparse::2tree {html tree} {
-
-    # One internal datastructure is required, a stack of open
-    # tags. This stack is also provided by the 'struct' module of
-    # tcllib. As the operation of this command is synchronuous we
-    # don't have to take care against multiple running copies at the
-    # same times (Such are possible, but will be in different
-    # interpreters and true concurrency is possible only if they are
-    # in different threads too). IOW, no need for tricks to make the
-    # internal datastructure unique.
-
-    catch {::htmlparse::tags destroy}
-
-    ::struct::stack ::htmlparse::tags
-    ::htmlparse::tags push root
-    $tree set root type root
-
-    parse -cmd [list ::htmlparse::2treeCallback $tree] $html
-
-    # A bit hackish, correct the ordering of nodes for the optional
-    # tag types, over a larger area when was seen by the parser itself.
-
-    $tree walk root -order post n {
-	::htmlparse::Reorder $tree $n
-    }
-
-    ::htmlparse::tags destroy
-    return $tree
-}
-
-# htmlparse::2treeCallback --
-#
-#	Internal helper command. A special callback to
-#	'::htmlparse::parse' used by '::htmlparse::2tree' which takes
-#	the incoming stream of tags and converts them into a tree
-#	representing the inner structure of the parsed HTML
-#	document. Recovers from simple HTML errors like missing
-#	opening tags, missing closing tags and overlapping tags.
-#
-# Arguments:
-#	tree			The name of the tree to manipulate.
-#	tag			See '::htmlparse::debugCallback'.
-#	slash			See '::htmlparse::debugCallback'.
-#	param			See '::htmlparse::debugCallback'.
-#	textBehindTheTag	See '::htmlparse::debugCallback'.
-#
-# Side Effects:
-#	Manipulates the tree object whose name was given as the first
-#	argument.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::2treeCallback {tree tag slash param textBehindTheTag} {
-    # This could be table-driven I think but for now the switches
-    # should work fine.
-
-    # Normalize tag information for later comparisons. Also remove
-    # superfluous whitespace. Don't forget to decode the standard
-    # entities.
-
-    set  tag  [string tolower $tag]
-    set  textBehindTheTag [string trim $textBehindTheTag]
-    if {$textBehindTheTag != {}} {
-	set text [mapEscapes $textBehindTheTag]
-    }
-
-    if {"$slash" == "/"} {
-	# Handle closing tags. Standard operation is to pop the tag
-	# from the stack of open tags. We don't do this for </p> and
-	# </li>. As they were optional they were never pushed onto the
-	# stack (Well, actually they are just popped immediately after
-	# they were pusheed, see below).
-
-	switch -exact -- $tag {
-	    base - option - meta - li - p {
-		# Ignore, nothing to do.		
-	    }
-	    default {
-		# The moment we get a closing tag which does not match
-		# the tag on the stack we have two possibilities on how
-		# this came into existence to choose from:
-		#
-		# a) A tag is now closed but was never opened.
-		# b) A tag requiring an end tag was opened but the end
-		#    tag was omitted and we now are at a tag which was
-		#    opened before the one with the omitted end tag.
-
-		# NOTE:
-		# Pages delivered from the amazon.uk site contain both
-		# cases: </a> without opening, <b> & <font> without
-		# closing. Another error: <a><b></a></b>, i.e. overlapping
-		# tags. Fortunately this can be handled by the algorithm
-		# below, in two cycles, one of which is case (b), followed
-		# by case (a). It seems as if Amazon/UK believes that visual
-		# markup like <b> and <font> is an option (switch-on) instead
-		# of a region.
-
-		# Algorithm used here to deal with these:
-		# 1) Search whole stack for the matching opening tag.
-		#    If there is one assume case (b) and pop everything
-		#    until and including this opening tag.
-		# 2) If no matching opening tag was found assume case
-		#    (a) and ignore the tag.
-		#
-		# Part (1) also subsumes the normal case, i.e. the
-		# matching tag is at the top of the stack.
-
-		set nodes [::htmlparse::tags peek [::htmlparse::tags size]]
-		# Note: First item is top of stack, last item is bottom of stack !
-		# (This behaviour of tcllib stacks is not documented
-		# -> we should update the manpage).
-
-		#foreach n $nodes {lappend tstring [p get $n -key type]}
-		#puts stderr --[join $tstring]--
-
-		set level 1
-		set found 0
-		foreach n $nodes {
-		    set type [$tree get $n type]
-		    if {0 == [string compare $tag $type]} {
-			# Found an earlier open tag -> (b).
-			set found 1
-			break
-		    }
-		    incr level
-		}
-		if {$found} {
-		    ::htmlparse::tags pop $level
-		    if {$level > 1} {
-			#foreach n $nodes {lappend tstring [$tree get $n type]}
-			#puts stderr "\tdesync at <$tag> ($tstring) => pop $level"
-		    }
-		} else {
-		    #foreach n $nodes {lappend tstring [$tree get $n type]}
-		    #puts stderr "\tdesync at <$tag> ($tstring) => ignore"
-		}
-	    }
-	}
-
-	# If there is text behind a closing tag X it belongs to the
-	# parent tag of X.
-
-	if {$textBehindTheTag != {}} {
-	    # Attach the text behind the closing tag to the reopened
-	    # context.
-
-	    set        pcd  [$tree insert [::htmlparse::tags peek] end]
-	    $tree set $pcd  type PCDATA
-	    $tree set $pcd  data $textBehindTheTag
-	}
-
-    } else {
-	# Handle opening tags. The standard operation for most is to
-	# push them onto the stack and thus open a nested context.
-	# This does not happen for both the optional tags (p, li) and
-	# the ones which don't have closing tags (meta, br, option,
-	# input, area, img).
-	#
-	# The text coming with the tag will be added after the tag if
-	# it is a tag without a matching close, else it will be added
-	# as a node below the tag (as it is the region between the
-	# opening and closing tag and thus nested inside). Empty text
-	# is ignored under all circcumstances.
-
-	set        node [$tree insert [::htmlparse::tags peek] end]
-	$tree set $node type $tag
-	$tree set $node data $param
-
-	if {$textBehindTheTag != {}} {
-	    switch -exact -- $tag {
-		input -	area - img - br {
-		    set pcd  [$tree insert [::htmlparse::tags peek] end]
-		}
-		default {
-		    set pcd  [$tree insert $node end]
-		}
-	    }
-	    $tree set $pcd type PCDATA
-	    $tree set $pcd data $textBehindTheTag
-	}
-
-	::htmlparse::tags push $node
-
-	# Special handling: <p>, <li> may have no closing tag => pop
-	#                 : them immediately.
-	#
-	# Special handling: <meta>, <br>, <option>, <input>, <area>,
-	#                 : <img>: no closing tags for these.
-
-	switch -exact -- $tag {
-	    hr - base - meta - li - br - option - input - area - img - p - h1 - h2 - h3 - h4 - h5 - h6 {
-		::htmlparse::tags pop
-	    }
-	    default {}
-	}
-    }
-}
-
-# htmlparse::removeVisualFluff --
-#
-#	This command walks a tree as generated by '::htmlparse::2tree'
-#	and removes all the nodes which represent visual tags and not
-#	structural ones. The purpose of the command is to make the
-#	tree easier to navigate without getting bogged down in visual
-#	information not relevant to the search.
-#
-# Arguments:
-#	tree	The name of the tree to cut down.
-#
-# Side Effects:
-#	Modifies the specified tree.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::removeVisualFluff {tree} {
-    $tree walk root -order post n {
-	::htmlparse::RemoveVisualFluff $tree $n
-    }
-    return
-}
-
-# htmlparse::removeFormDefs --
-#
-#	Like '::htmlparse::removeVisualFluff' this command is here to
-#	cut down on the size of the tree as generated by
-#	'::htmlparse::2tree'. It removes all nodes representing forms
-#	and form elements.
-#
-# Arguments:
-#	tree	The name of the tree to cut down.
-#
-# Side Effects:
-#	Modifies the specified tree.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::removeFormDefs {tree} {
-    $tree walk root -order post n {
-	::htmlparse::RemoveFormDefs $tree $n
-    }
-    return
-}
-
-# htmlparse::RemoveVisualFluff --
-#
-#	Internal helper command to
-#	'::htmlparse::removeVisualFluff'. Does the actual work.
-#
-# Arguments:
-#	tree	The name of the tree currently processed
-#	node	The name of the node to look at.
-#
-# Side Effects:
-#	Modifies the specified tree.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::RemoveVisualFluff {tree node} {
-    switch -exact -- [$tree get $node type] {
-	hmstart - html - font - center - div - sup - b - i {
-	    # Removes the node, but does not affect the nodes below
-	    # it. These are just made into chiildren of the parent of
-	    # this node, in its place.
-
-	    $tree cut $node
-	}
-	script - option - select - meta - map - img {
-	    # Removes this node and everything below it.
-	    $tree delete $node
-	}
-	default {
-	    # Ignore tag
-	}
-    }
-}
-
-# htmlparse::RemoveFormDefs --
-#
-#	Internal helper command to
-#	'::htmlparse::removeFormDefs'. Does the actual work.
-#
-# Arguments:
-#	tree	The name of the tree currently processed
-#	node	The name of the node to look at.
-#
-# Side Effects:
-#	Modifies the specified tree.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::RemoveFormDefs {tree node} {
-    switch -exact -- [$tree get $node type] {
-	form {
-	    $tree delete $node
-	}
-	default {
-	    # Ignore tag
-	}
-    }
-}
-
-# htmlparse::Reorder --
-
-#	Internal helper command to '::htmlparse::2tree'. Moves the
-#	nodes between p/p, li/li and h<i> sequences below the
-#	paragraphs and items. IOW, corrects misconstructions for
-#	the optional node types.
-#
-# Arguments:
-#	tree	The name of the tree currently processed
-#	node	The name of the node to look at.
-#
-# Side Effects:
-#	Modifies the specified tree.
-#
-# Results:
-#	None.
-
-proc ::htmlparse::Reorder {tree node} {
-    switch -exact -- [set tp [$tree get $node type]] {
-	h1 - h2 - h3 - h4 - h5 - h6 - p - li {
-	    # Look for right siblings until the next node with a
-	    # similar type (or end of level) and move these below this
-	    # node.
-
-	    while {1} {
-		set sibling [$tree next $node]
-		if {
-		    ($sibling == {}) ||
-		    ([lsearch -exact {h1 h2 h3 h4 h5 h6 p li} [$tree get $sibling type]] != -1)
-		} {
-		    break
-		}
-		$tree move $node end $sibling
-	    }
-	}
-	default {
-	    # Ignore tag
-	}
-    }
-}
-
-# ### ######### ###########################
-
-package provide htmlparse 1.1.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/htmlparse/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/htmlparse/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded htmlparse 1.1.2 [list source [file join $dir htmlparse.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/http/autoproxy.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/http/autoproxy.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,446 +1,0 @@
-# autoproxy.tcl - Copyright (C) 2002 Pat Thoyts <patthoyts@users.sf.net>
-#
-# On Unix the standard for identifying the local HTTP proxy server
-# seems to be to use the environment variable http_proxy or ftp_proxy and
-# no_proxy to list those domains to be excluded from proxying.
-#
-# On Windows we can retrieve the Internet Settings values from the registry
-# to obtain pretty much the same information.
-#
-# With this information we can setup a suitable filter procedure for the 
-# Tcl http package and arrange for automatic use of the proxy.
-#
-# Example:
-#   package require autoproxy
-#   autoproxy::init
-#   set tok [http::geturl http://wiki.tcl.tk/]
-#   http::data $tok
-#
-# To support https add:
-#   package require tls
-#   http::register https 443 ::autoproxy::tls_socket
-#
-# @(#)$Id: autoproxy.tcl,v 1.9 2007/03/12 22:53:25 patthoyts Exp $
-
-package require http;                   # tcl
-package require uri;                    # tcllib
-package require base64;                 # tcllib
-
-namespace eval ::autoproxy {
-    variable rcsid {$Id: autoproxy.tcl,v 1.9 2007/03/12 22:53:25 patthoyts Exp $}
-    variable version 1.4
-    variable options
-
-    if {! [info exists options]} {
-        array set options {
-            proxy_host ""
-            proxy_port 80
-            no_proxy   {}
-            basic      {} 
-            authProc   {}
-        }
-    }
-
-    variable winregkey
-    set winregkey [join {
-        HKEY_CURRENT_USER
-        Software Microsoft Windows
-        CurrentVersion "Internet Settings"
-    } \\]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Obtain configuration options for the server.
-#
-proc ::autoproxy::cget {option} {
-    variable options
-    switch -glob -- $option] {
-        -host -
-        -proxy_h* { set options(proxy_host) }
-        -port -
-        -proxy_p* { set options(proxy_port) }
-        -no*      { set options(no_proxy) }
-        -basic    { set options(basic) }
-        -authProc { set options(authProc) }
-        default {
-            set err [join [lsort [array names options]] ", -"]
-            return -code error "bad option \"$option\":\
-                       must be one of -$err"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Configure the autoproxy package settings.
-#  You may only configure one type of authorisation at a time as once we hit
-#  -basic, -digest or -ntlm - all further args are passed to the protocol
-#  specific script.
-#
-#  Of course, most of the point of this package is to fill as many of these
-#  fields as possible automatically. You should call autoproxy::init to
-#  do automatic configuration and then call this method to refine the details.
-#
-proc ::autoproxy::configure {args} {
-    variable options
-
-    if {[llength $args] == 0} {
-        foreach {opt value} [array get options] {
-            lappend r -$opt $value
-        }
-        return $r
-    }
-
-    while {[string match "-*" [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -host - 
-            -proxy_h* { set options(proxy_host) [Pop args 1]}
-            -port - 
-            -proxy_p* { set options(proxy_port) [Pop args 1]}
-            -no*      { set options(no_proxy) [Pop args 1] }
-            -basic    { Pop args; configure:basic $args ; break }
-            -authProc { set options(authProc) [Pop args] }
-            --        { Pop args; break }
-            default {
-                set opts [join [lsort [array names options]] ", -"]
-                return -code error "bad option \"$option\":\
-                       must be one of -$opts"
-            }
-        }
-        Pop args
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Initialise the http proxy information from the environment or the
-#  registry (Win32)
-#
-#  This procedure will load the http package and re-writes the
-#  http::geturl method to add in the authorisation header.
-#
-#  A better solution will be to arrange for the http package to request the
-#  authorisation key on receiving an authorisation reqest.
-#
-proc ::autoproxy::init {{httpproxy {}} {no_proxy {}}} {
-    global tcl_platform
-    global env
-    variable winregkey
-    variable options
-
-    # Look for standard environment variables.
-    if {[string length $httpproxy] > 0} {
-        
-        # nothing to do
-
-    } elseif {[info exists env(http_proxy)]} {
-        set httpproxy $env(http_proxy)
-        if {[info exists env(no_proxy)]} {
-            set no_proxy $env(no_proxy)
-        }
-    } else {
-        if {$tcl_platform(platform) == "windows"} {
-            package require registry 1.0
-            array set reg {ProxyEnable 0 ProxyServer "" ProxyOverride {}}
-            catch {
-                # IE5 changed ProxyEnable from a binary to a dword value.
-                switch -exact -- [registry type $winregkey "ProxyEnable"] {
-                    dword {
-                        set reg(ProxyEnable) [registry get $winregkey "ProxyEnable"]
-                    }
-                    binary {
-                        set v [registry get $winregkey "ProxyEnable"]
-                        binary scan $v i reg(ProxyEnable)
-                    }
-                    default { 
-                        return -code error "unexpected type found for\
-                               ProxyEnable registry item"
-                    }
-                }
-                set reg(ProxyServer) [GetWin32Proxy http]
-                set reg(ProxyOverride) [registry get $winregkey "ProxyOverride"]
-            }
-            if {![string is bool $reg(ProxyEnable)]} {
-                set reg(ProxyEnable) 0
-            }
-            if {$reg(ProxyEnable)} {
-                set httpproxy $reg(ProxyServer)
-                set no_proxy  $reg(ProxyOverride)
-            }
-        }
-    }
-    
-    # If we found something ...
-    if {[string length $httpproxy] > 0} {
-        # The http_proxy is supposed to be a URL - lets make sure.
-        if {![regexp {\w://.*} $httpproxy]} {
-            set httpproxy "http://$httpproxy"
-        }
-        
-        # decompose the string.
-        array set proxy [uri::split $httpproxy]
-
-        # turn the no_proxy value into a tcl list
-        set no_proxy [string map {; " " , " "} $no_proxy]
-
-        # configure ourselves
-        configure -proxy_host $proxy(host) \
-            -proxy_port $proxy(port) \
-            -no_proxy $no_proxy
-
-        # Lift the authentication details from the environment if present.
-        if {[string length $proxy(user)] < 1 \
-                && [info exists env(http_proxy_user)] \
-                && [info exists env(http_proxy_pass)]} {
-            set proxy(user) $env(http_proxy_user)
-            set proxy(pwd)  $env(http_proxy_pass)
-        }
-
-        # Maybe the proxy url has authentication parameters?
-        # At this time, only Basic is supported.
-        if {[string length $proxy(user)] > 0} {
-            configure -basic -username $proxy(user) -password $proxy(pwd)
-        }
-
-        # setup and configure the http package to use our proxy info.
-        http::config -proxyfilter [namespace origin filter]
-    }
-    return $httpproxy
-}
-
-# autoproxy::GetWin32Proxy -- 
-#
-#	Parse the Windows Internet Settings registry key and return the
-#	protocol proxy requested. If the same proxy is in use for all 
-#	protocols, then that will be returned. Otherwise the string is
-#	parsed. Example:
-#	 ftp=proxy:80;http=proxy:80;https=proxy:80
-#
-proc ::autoproxy::GetWin32Proxy {protocol} {
-    variable winregkey
-    set proxies [split [registry get $winregkey "ProxyServer"] ";"]
-    foreach proxy $proxies {
-        if {[string first = $proxy] == -1} {
-            return $proxy
-        } else {
-            foreach {prot host} [split $proxy =] break
-            if {[string compare $protocol $prot] == 0} {
-                return $host
-            }
-        }
-    }
-    return -code error "failed to identify an '$protocol' proxy"
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-proc ::autoproxy::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description
-#   An example user authentication procedure.
-# Returns:
-#   A two element list consisting of the users authentication id and 
-#   password. 
-proc ::autoproxy::defAuthProc {{user {}} {passwd {}} {realm {}}} {
-    if {[string length $realm] > 0} {
-        set title "Realm: $realm"
-    } else {
-        set title {}
-    }
-
-    # If you are using BWidgets then the following will do:
-    #
-    #    package require BWidget
-    #    return [PasswdDlg .defAuthDlg -parent {} -transient 0 \
-    #         -title $title -logintext $user -passwdtext $passwd]
-    #
-    # if you just have Tk and no BWidgets --
-    
-    set dlg [toplevel .autoproxy_defAuthProc -class Dialog]
-    wm title $dlg "$realm"
-    label $dlg.ll -text Login -underline 0 -anchor w
-    entry $dlg.le -textvariable [namespace current]::${dlg}:l
-    label $dlg.pl -text Password -underline 0 -anchor w
-    entry $dlg.pe -show * -textvariable [namespace current]::${dlg}:p
-    button $dlg.ok -text OK -default active -width -11 \
-        -command [list set [namespace current]::${dlg}:ok 1]
-    grid $dlg.ll $dlg.le -sticky news
-    grid $dlg.pl $dlg.pe -sticky news
-    grid $dlg.ok - -sticky e
-    grid columnconfigure $dlg 1 -weight 1
-    bind $dlg <Return> [list $dlg.ok invoke]
-    bind $dlg <Alt-l> [list focus $dlg.le]
-    bind $dlg <Alt-p> [list focus $dlg.pe]
-    variable ${dlg}:l $user; variable ${dlg}:p $passwd
-    variable ${dlg}:ok 0
-    wm deiconify $dlg; focus $dlg.pe; update idletasks
-    set old [::grab current]; grab $dlg
-    tkwait variable [namespace current]::${dlg}:ok
-    grab release $dlg ; if {[llength $old] > 0} {::grab $old}
-    set r [list [set ${dlg}:l] [set ${dlg}:p]]
-    unset ${dlg}:l; unset ${dlg}:p; unset ${dlg}:ok
-    destroy $dlg
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Implement support for the Basic authentication scheme (RFC 1945,2617).
-# Options:
-#  -user userid  - pass in the user ID (May require Windows NT domain
-#                  as DOMAIN\\username)
-#  -password pwd - pass in the user's password.
-#  -realm realm  - pass in the http realm.
-#
-proc ::autoproxy::configure:basic {arglist} {
-    variable options
-    array set opts {user {} passwd {} realm {}}
-    foreach {opt value} $arglist {
-        switch -glob -- $opt {
-            -u* { set opts(user) $value}
-            -p* { set opts(passwd) $value}
-            -r* { set opts(realm) $value}
-            default {
-                return -code error "invalid option \"$opt\": must be one of\
-                     -username or -password or -realm"
-            }
-        }
-    }
-
-    # If nothing was provided, try calling the authProc
-    if {$options(authProc) != {} \
-            && ($opts(user) == {} || $opts(passwd) == {})} {
-        set r [$options(authProc) $opts(user) $opts(passwd) $opts(realm)]
-        set opts(user) [lindex $r 0]
-        set opts(passwd) [lindex $r 1]
-    }
-
-    # Store the encoded string to avoid re-encoding all the time.
-    set options(basic) [list "Proxy-Authorization" \
-                            [concat "Basic" \
-                                 [base64::encode $opts(user):$opts(passwd)]]]
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  An http package proxy filter. This attempts to work out if a request
-#  should go via the configured proxy using a glob comparison against the
-#  no_proxy list items. A typical no_proxy list might be
-#   [list localhost *.my.domain.com 127.0.0.1]
-#
-#  If we are going to use the proxy - then insert the proxy authorization
-#  header.
-#
-proc ::autoproxy::filter {host} {
-    variable options
-
-    if {$options(proxy_host) == {}} {
-        return {}
-    }
-    
-    foreach domain $options(no_proxy) {
-        if {[string match $domain $host]} {
-            return {}
-        }
-    }
-    
-    # Add authorisation header to the request (by Anders Ramdahl)
-    catch {
-        upvar state State
-        if {$options(basic) != {}} {
-            set State(-headers) [concat $options(basic) $State(-headers)]
-        }
-    }
-    return [list $options(proxy_host) $options(proxy_port)]
-}
-
-# autoproxy::tls_connect --
-#
-#	Create a connection to a remote machine through a proxy
-#	if necessary. This is used by the tls_socket comment for 
-#	use with the http package but can also be used more generally
-#	provided your proxy will permit CONNECT attempts to ports
-#	other than port 443 (many will not).
-#
-proc ::autoproxy::tls_connect {host port {useragent {}}} {
-    variable options
-    if {[string length $options(proxy_host)] > 0} {
-        set s [::socket $options(proxy_host) $options(proxy_port)]
-        fconfigure $s -blocking 1 -buffering line -translation crlf
-        puts $s "CONNECT $host:$port HTTP/1.1"
-        puts $s "Host: $host"
-        if {[string length $useragent] > 0} {
-            puts $s "User-Agent: $useragent"
-        }
-        puts $s "Proxy-Connection: keep-alive"
-        puts $s "Connection: keep-alive"
-        if {[string length $options(basic)] > 0} {
-            puts $s [join $options(basic) ": "]
-        }
-        puts $s ""
-
-        set block ""
-        while {[gets $s r] > 0} {
-            lappend block $r
-        }
-        set result [lindex $block 0]
-        set code [lindex [split $result { }] 1]
-
-        if {$code >= 200 && $code < 300} {
-            fconfigure $s -blocking 1 -buffering none -translation binary
-            tls::import $s
-        } else {
-            close $s
-            return -code error $result
-        }
-    } else {
-        set s [eval [linsert $args 0 ::tls::socket]]
-    }
-    return $s
-}
-
-# autoproxy::tls_socket --
-#
-#	This can be used to handle TLS connections indenpendantly of
-#	proxy presence. It can only be used with the Tcl http package
-#	and to use it you must do:
-#	   http::register https 443 ::autoproxy::tls_socket
-#	After that you can use the http::geturl command to access
-#	secure web pages and any proxy details will be handled for you.
-#
-proc ::autoproxy::tls_socket {args} {
-    variable options
-
-    # Look into the http package for the actual target. The function
-    # has unfortunately not passed these as parameters.
-    upvar host host port port
-    set s [tls_connect $host $port [http::config -useragent]]
-
-    # record the tls connection status in the http state array.
-    upvar state state
-    tls::handshake $s
-    set state(tls_status) [tls::status $s]
-
-    return $s
-}
-
-# -------------------------------------------------------------------------
-
-package provide autoproxy $::autoproxy::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/http/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/http/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded autoproxy 1.4 [list source [file join $dir autoproxy.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ident/ident.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ident/ident.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,90 +1,0 @@
-# ident.tcl --
-#
-#	Implemetation of the client side of the ident protocol.
-#	See RFC 1413 for details on the protocol.
-#
-# Copyright (c) 2004 Reinhard Max <max@tclers.tk>
-#
-# -------------------------------------------------------------------------
-# This software is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the file 'license.terms' for
-# more details.
-# -------------------------------------------------------------------------
-# RCS: @(#) $Id: ident.tcl,v 1.2 2004/07/12 14:01:04 patthoyts Exp $
-
-package provide ident 0.42
-
-namespace eval ident {
-    namespace export query configure
-}
-
-proc ident::parse {string} {
-
-    # remove all white space for easier parsing
-    regsub -all {\s} $string "" s
-    if {[regexp {^\d+,\d+:(\w+):(.*)} $s -> resptype addinfo]} {
-	switch -exact -- $resptype {
-	    USERID {
-		if { [regexp {^([^,]+)(,([^:]+))?:} \
-			  $addinfo -> opsys . charset]
-		 } then {
-		    # get the user-if from the original string, because it
-		    # is allowed to contain white space.
-		    set index [string last : $string]
-		    incr index
-		    set userid [string range $string $index end]
-		    if {$charset != ""} {
-			set (user-id) \
-			    [encoding convertfrom $charset $userid]
-		    }
-		    set answer [list resp-type USERID opsys $opsys \
-				    user-id $userid]
-		}
-	    }
-	    ERROR {
-		set answer [list resp-type ERROR error $addinfo]
-	    }
-	}
-    }
-    if {![info exists answer]} {
-	set answer [list resp-type FATAL \
-			error "Unexpected response:\"$string\""]
-    }
-    return $answer
-}
-
-proc ident::Callback {sock command} {
-    gets $sock answer
-    close $sock
-    lappend command [parse $answer]
-    eval $command
-}
-
-proc ident::query {socket {command {}}} {
-
-    foreach {sock_ip sock_host sock_port} [fconfigure $socket -sockname] break
-    foreach {peer_ip peer_host peer_port} [fconfigure $socket -peername] break
-    
-    set blocking [string equal $command ""]
-    set failed [catch {socket $peer_ip ident} sock]
-    if {$failed} {
-	set result [list resp-type FATAL error $sock]
-	if {$blocking} {
-	    return $result
-	} else {
-	    after idle [list $command $result]
-	    return
-	}
-    }
-    fconfigure $sock -encoding binary -buffering line -blocking $blocking
-    puts $sock "$peer_port,$sock_port"
-    if {$blocking} {
-	gets $sock answer
-	close $sock
-	return [parse $answer]
-    } else {
-	fileevent $sock readable \
-	    [namespace code [list Callback $sock $command]]
-    }    
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ident/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ident/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded ident 0.42 [list source [file join $dir ident.tcl]]
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/inifile/ini.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/inifile/ini.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,308 +1,0 @@
-# ini.tcl --
-#
-#       Querying and modifying old-style windows configuration files (.ini)
-#
-# Copyright (c) 2003-2007    Aaron Faupell <afaupell@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: ini.tcl,v 1.13 2007/08/20 21:03:17 andreas_kupries Exp $
-
-package provide inifile 0.2.1
-
-namespace eval ini {
-    variable nexthandle; if {![info exists nexthandle]} {set nexthandle 0}
-    variable commentchar; if {![info exists commentchar]} {set commentchar \;}
-}
-
-proc ::ini::open {ini {mode r+}} {
-    variable nexthandle
-
-    if { ![regexp {^(w|r)\+?$} $mode] } {
-        error "$mode is not a valid access mode"
-    }
-
-    ::set fh ini$nexthandle
-    ::set tmp [::open $ini $mode]
-    fconfigure $tmp -translation crlf
-
-    namespace eval ::ini::$fh {
-        variable data;     array set data     {}
-        variable comments; array set comments {}
-        variable sections; array set sections {}
-    }
-    ::set ::ini::${fh}::channel $tmp
-    ::set ::ini::${fh}::file    [_normalize $ini]
-    ::set ::ini::${fh}::mode    $mode
-
-    incr nexthandle
-    if { [string match "r*" $mode] } {
-        _loadfile $fh
-    }
-    return $fh
-}
-
-# close the file and delete all stored info about it
-# this does not save any changes. see ::ini::commit
-
-proc ::ini::close {fh} {
-    _valid_ns $fh
-    ::close [::set ::ini::${fh}::channel]
-    namespace delete ::ini::$fh
-}
-
-# write all changes to disk
-
-proc ::ini::commit {fh} {
-    _valid_ns $fh
-    namespace eval ::ini::$fh {
-        if { $mode == "r" } {
-            error "cannot write to read-only file"
-        }
-        ::close $channel
-        ::set channel [::open $file w]
-        ::set char $::ini::commentchar
-        #seek $channel 0 start
-        foreach sec [array names sections] {
-            if { [info exists comments($sec)] } {
-                puts $channel "$char [join $comments($sec) "\n$char "]\n"
-            }
-            puts $channel "\[$sec\]"
-            foreach key [lsort -dictionary [array names data [::ini::_globescape $sec]\000*]] {
-                ::set key [lindex [split $key \000] 1]
-                if {[info exists comments($sec\000$key)]} {
-                    puts $channel "$char [join $comments($sec\000$key) "\n$char "]"
-                }
-                puts $channel "$key=$data($sec\000$key)"
-            }
-            puts $channel ""
-        }
-        catch { unset char sec key }
-        close $channel
-        ::set channel [::open $file r+]
-    }
-    return
-}
-
-# internal command to read in a file
-# see open and revert for public commands
-
-proc ::ini::_loadfile {fh} {
-    namespace eval ::ini::$fh {
-        ::set cur {}
-        ::set com {}
-        set char $::ini::commentchar
-        seek $channel 0 start
-
-        foreach line [split [read $channel] "\n"] {
-            if { [string match "$char*" $line] } {
-                lappend com [string trim [string range $line [string length $char] end]]
-            } elseif { [string match {\[*\]} $line] } {
-                ::set cur [string range $line 1 end-1]
-                if { $cur == "" } { continue }
-                ::set sections($cur) 1
-                if { $com != "" } {
-                    ::set comments($cur) $com
-                    ::set com {}
-                }
-            } elseif { [string match {*=*} $line] } {
-                ::set line [split $line =]
-                ::set key [string trim [lindex $line 0]]
-                if { $key == "" || $cur == "" } { continue }
-                ::set value [string trim [join [lrange $line 1 end] =]]
-                if { [regexp "^(\".*\")\s+${char}(.*)$" $value -> 1 2] } {
-                    set value $1
-                    lappend com $2
-                }
-                ::set data($cur\000$key) $value
-                if { $com != "" } {
-                    ::set comments($cur\000$key) $com
-                    ::set com {}
-                }
-            }
-        }
-        unset char cur com
-        catch { unset line key value 1 2 }
-    }
-}
-
-# internal command to escape glob special characters
-
-proc ::ini::_globescape {string} {
-    return [string map {* \\* ? \\? \\ \\\\ \[ \\\[ \] \\\]} $string]
-}
-
-# internal command to check if a section or key is nonexistant
-
-proc ::ini::_exists {fh sec args} {
-    if { ![info exists ::ini::${fh}::sections($sec)] } {
-        error "no such section \"$sec\""
-    }
-    if { [llength $args] > 0 } {
-        ::set key [lindex $args 0]
-        if { ![info exists ::ini::${fh}::data($sec\000$key)] } {
-            error "can't read key \"$key\""
-        }
-    }
-}
-
-# internal command to check validity of a handle
-
-if { [package vcompare [package provide Tcl] 8.4] < 0 } {
-    proc ::ini::_normalize {path} {
-	return $path
-    }
-    proc ::ini::_valid_ns {name} {
-	variable ::ini::${name}::data
-	if { ![info exists data] } {
-	    error "$name is not an open INI file"
-	}
-    }
-} else {
-    proc ::ini::_normalize {path} {
-	file normalize $path
-    }
-    proc ::ini::_valid_ns {name} {
-	if { ![namespace exists ::ini::$name] } {
-	    error "$name is not an open INI file"
-	}
-    }
-}
-
-# get and set the ini comment character
-
-proc commentchar { {new {}} } {
-    if {$new != ""} {
-        if {[string length $new] > 1} { error "comment char must be a single character" }
-        ::set ::ini::commentchar $new
-    }
-    return $::ini::commentchar
-}
-
-# return all section names
-
-proc ::ini::sections {fh} {
-    _valid_ns $fh
-    return [array names ::ini::${fh}::sections]
-}
-
-# return boolean indicating existance of section or key in section
-
-proc ::ini::exists {fh sec {key {}}} {
-    _valid_ns $fh
-    if { $key == "" } {
-        return [info exists ::ini::${fh}::sections($sec)]
-    }
-    return [info exists ::ini::${fh}::data($sec\000$key)]
-}
-
-# return all key names of section
-# error if section is nonexistant
-
-proc ::ini::keys {fh sec} {
-    _valid_ns $fh
-    _exists $fh $sec
-    ::set keys {}
-    foreach x [array names ::ini::${fh}::data [_globescape $sec]\000*] {
-        lappend keys [lindex [split $x \000] 1]
-    }
-    return $keys
-}
-
-# return all key value pairs of section
-# error if section is nonexistant
-
-proc ::ini::get {fh sec} {
-    _valid_ns $fh
-    _exists $fh $sec
-    upvar 0 ::ini::${fh}::data data
-    ::set r {}
-    foreach x [array names data [_globescape $sec]\000*] {
-        lappend r [lindex [split $x \000] 1] $data($x)
-    }
-    return $r
-}
-
-# return the value of a key
-# return default value if key or section is nonexistant otherwise error
-
-proc ::ini::value {fh sec key {default {}}} {
-    _valid_ns $fh
-    if {$default != "" && ![info exists ::ini::${fh}::data($sec\000$key)]} {
-        return $default
-    }
-    _exists $fh $sec $key
-    return [::set ::ini::${fh}::data($sec\000$key)]
-}
-
-# set the value of a key
-# new section or key names are created
-
-proc ::ini::set {fh sec key value} {
-    _valid_ns $fh
-    ::set sec [string trim $sec]
-    ::set key [string trim $key]
-    if { $sec == "" || $key == "" } {
-        error "section or key may not be empty"
-    }
-    ::set ::ini::${fh}::data($sec\000$key) $value
-    ::set ::ini::${fh}::sections($sec) 1
-    return $value
-}
-
-# delete a key or an entire section
-# may delete nonexistant keys and sections
-
-proc ::ini::delete {fh sec {key {}}} {
-    _valid_ns $fh
-    if { $key == "" } {
-        array unset ::ini::${fh}::data [_globescape $sec]\000*
-        array unset ::ini::${fh}::sections [_globescape $sec]
-    }
-    catch {unset ::ini::${fh}::data($sec\000$key)}
-}
-
-# read and set comments for sections and keys
-# may comment nonexistant sections and keys
-
-proc ::ini::comment {fh sec key args} {
-    _valid_ns $fh
-    upvar 0 ::ini::${fh}::comments comments
-    ::set r $sec
-    if { $key != "" } { append r \000$key }
-    if { [llength $args] == 0 } {
-        if { ![info exists comments($r)] } { return {} }
-        return $comments($r)
-    }
-    if { [llength $args] == 1 && [lindex $args 0] == "" } {
-        unset -nocomplain comments($r)
-        return {}
-    }
-    # take care of any embedded newlines
-    for {::set i 0} {$i < [llength $args]} {incr i} {
-        ::set args [eval [list lreplace $args $i $i] [split [lindex $args $i] \n]]
-    }
-    eval [list lappend comments($r)] $args
-}
-
-# return the physical filename for the handle
-
-proc ::ini::filename {fh} {
-    _valid_ns $fh
-    return [::set ::ini::${fh}::file]
-}
-
-# reload the file from disk losing all changes since the last commit
-
-proc ::ini::revert {fh} {
-    _valid_ns $fh
-    namespace eval ::ini::$fh {
-        array set data     {}
-        array set comments {}
-        array set sections {}
-    }
-    if { ![string match "w*" $mode] } {
-        _loadfile $fh
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/inifile/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/inifile/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if { ![package vsatisfies [package provide Tcl] 8.2] } { return }
-package ifneeded inifile 0.2.1 [list source [file join $dir ini.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/interp/deleg_method.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/interp/deleg_method.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,64 +1,0 @@
-# interp.tcl
-# Some utility commands for creation of delegation methods.
-# (Delegation of methods to a remote interpreter via a comm
-# handle).
-#
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: deleg_method.tcl,v 1.2 2006/09/01 19:58:21 andreas_kupries Exp $
-
-package require Tcl 8.3
-package require snit
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::interp::delegate {}
-
-# ### ### ### ######### ######### #########
-## Public API
-
-snit::macro ::interp::delegate::method {args} {
-    # syntax: ?-async? name arguments comm id
-
-    set async 0
-    while {[string match -* [set opt [lindex $args 0]]]} {
-	switch -exact -- $opt {
-	    -async {set async 1 ; set args [lrange $args 1 end]}
-	    default {
-		return -code error "unknown option \"$opt\", expected -async"
-	    }
-	}
-    }
-    if {[llength $args] != 4} {
-	return -code error "wrong # args"
-    }
-    foreach {name arguments comm rid} $args break
-
-    if {![llength $arguments]} {
-	set delegate "[list $name]"
-    } elseif {[string equal args [lindex $arguments end]]} {
-	if {[llength $arguments] == 1} {
-	    set delegate "\[linsert \$args 0 [list $name]\]"
-	} else {
-	    set delegate "\[linsert \$args 0 [list $name] \$[join [lrange $arguments 0 end-1] " \$"]\]"
-	}
-    } else {
-	set delegate "\[list [list $name] \$[join $arguments " \$"]\]"
-    }
-
-    set    body ""
-    append body [list $comm] " " "send "
-    if {$async} {append body "-async "}
-    append body [list $rid] " " $delegate
-
-    ::method $name $arguments $body
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-package provide interp::delegate::method 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/interp/deleg_proc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/interp/deleg_proc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,68 +1,0 @@
-# interp.tcl
-# Some utility commands for creation of delegation procedures
-# (Delegation of commands to a remote interpreter via a comm
-# handle).
-#
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: deleg_proc.tcl,v 1.2 2006/09/01 19:58:21 andreas_kupries Exp $
-
-package require Tcl 8.3
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::interp::delegate {}
-
-# ### ### ### ######### ######### #########
-## Public API
-
-proc ::interp::delegate::proc {args} {
-    # syntax: ?-async? name arguments comm id
-
-    set async 0
-    while {[string match -* [set opt [lindex $args 0]]]} {
-	switch -exact -- $opt {
-	    -async {
-		set async 1
-		set args [lrange $args 1 end]
-	    }
-	    default {
-		return -code error "unknown option \"$opt\", expected -async"
-	    }
-	}
-    }
-    if {[llength $args] != 4} {
-	return -code error "wrong # args"
-    }
-    foreach {name arguments comm rid} $args break
-    set base [namespace tail $name]
-
-    if {![llength $arguments]} {
-	set delegate "[list $base]"
-    } elseif {[string equal args [lindex $arguments end]]} {
-	if {[llength $arguments] == 1} {
-	    set delegate "\[linsert \$args 0 [list $base]\]"
-	} else {
-	    set delegate "\[linsert \$args 0 [list $base] \$[join [lrange $arguments 0 end-1] " \$"]\]"
-	}
-    } else {
-	set delegate "\[list [list $base] \$[join $arguments " \$"]\]"
-    }
-
-    set    body ""
-    append body [list $comm] " " "send "
-    if {$async} {append body "-async "}
-    append body [list $rid] " " $delegate
-
-    uplevel 1 [list ::proc $name $arguments $body]
-    return $name
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-package provide interp::delegate::proc 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/interp/interp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/interp/interp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,82 +1,0 @@
-# interp.tcl
-# Some utility commands for interpreter creation
-#
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: interp.tcl,v 1.3 2007/08/20 21:06:33 andreas_kupries Exp $
-
-package require Tcl 8.3
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::interp {}
-
-# ### ### ### ######### ######### #########
-## Public API
-
-proc ::interp::createEmpty {args} {
-    # Create interpreter, predefined path or
-    # automatic naming.
-
-    if {[llength $args] > 1} {
-	return -code error "wrong#args: Expected ?path?"
-    } elseif {[llength $args] == 1} {
-	set i [interp create [lindex $args 0]]
-    } else {
-	set i [interp create]
-    }
-
-    # Clear out namespaces and commands, leaving an empty interpreter
-    # behind. Take care to delete the rename command last, as it is
-    # needed to perform the deletions. We have to keep the 'rename'
-    # command until last to allow us to delete all ocmmands. We also
-    # have to defer deletion of the ::tcl namespace (if present), as
-    # it may contain state for the auto-loader, which may be
-    # invoked. This also forces us to defer the deletion of the
-    # builtin command 'namespace' so that we can delete ::tcl at last.
-
-    foreach n [interp eval $i [list ::namespace children ::]] {
-	if {[string equal $n ::tcl]} continue
-	interp eval $i [list namespace delete $n]
-    }
-    foreach c [interp eval $i [list ::info commands]] {
-	if {[string equal $c rename]}    continue
-	if {[string equal $c namespace]} continue
-	interp eval $i [list ::rename $c {}]
-    }
-
-    interp eval $i [list ::namespace delete ::tcl]
-    interp eval $i [list ::rename namespace {}]
-    interp eval $i [list ::rename rename    {}]
-
-    # Done. Result is ready.
-
-    return $i
-}
-
-proc ::interp::snitLink {path methods} {
-    foreach m $methods {
-	set dst   [uplevel 1 [linsert $m 0 mymethod]]
-	set alias [linsert $dst 0 interp alias $path [lindex $m 0] {}]
-	eval $alias
-    }
-    return
-}
-
-proc ::interp::snitDictLink {path methoddict} {
-    foreach {c m} $methoddict {
-	set dst   [uplevel 1 [linsert $m 0 mymethod]]
-	set alias [linsert $dst 0 interp alias $path $c {}]
-	eval $alias
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-package provide interp 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/interp/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/interp/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} return
-package ifneeded interp                   0.1.1 [list source [file join $dir interp.tcl]]
-package ifneeded interp::delegate::proc   0.2   [list source [file join $dir deleg_proc.tcl]]
-package ifneeded interp::delegate::method 0.2   [list source [file join $dir deleg_method.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/irc/irc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/irc/irc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,521 +1,0 @@
-# irc.tcl --
-#
-#	irc implementation for Tcl.
-#
-# Copyright (c) 2001-2003 by David N. Welton <davidw@dedasys.com>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: irc.tcl,v 1.26 2006/04/23 22:35:57 patthoyts Exp $
-
-package require Tcl 8.3
-
-namespace eval ::irc {
-    variable version 0.6
-
-    # counter used to differentiate connections
-    variable conn 0
-    variable config
-    variable irctclfile [info script]
-    array set config {
-        debug 0
-        logger 0
-    }
-}
-
-# ::irc::config --
-#
-# Set global configuration options.
-#
-# Arguments:
-#
-# key	name of the configuration option to change.
-#
-# value	value of the configuration option.
-
-proc ::irc::config { args } {
-    variable config
-    if { [llength $args] == 0 } {
-        return [array get config]
-    } elseif { [llength $args] == 1 } {
-        return $config($key)
-    } elseif { [llength $args] > 2 } {
-        error "wrong # args: should be \"config key ?val?\""
-    }
-    set key [lindex $args 0]
-    set value [lindex $args 1]
-    foreach ns [namespace children] {
-        if { [info exists config($key)] && [info exists ${ns}::config($key)] \
-                && [set ${ns}::config($key)] == $config($key)} {
-            ${ns}::cmd-config $key $value
-        }
-    }
-    set config($key) $value
-}
-
-
-# ::irc::connections --
-#
-# Return a list of handles to all existing connections
-
-proc ::irc::connections { } {
-    set r {}
-    foreach ns [namespace children] {
-        lappend r ${ns}::network
-    }
-    return $r
-}
-
-# ::irc::reload --
-#
-# Reload this file, and merge the current connections into
-# the new one.
-
-proc ::irc::reload { } {
-    variable conn
-    set oldconn $conn
-    namespace eval :: {
-	source [set ::irc::irctclfile]
-    }
-    foreach ns [namespace children] {
-        foreach var {sock logger host port} {
-            set $var [set ${ns}::$var]
-        }
-        array set dispatch [array get ${ns}::dispatch]
-        array set config [array get ${ns}::config]
-        # make sure our new connection uses the same namespace
-        set conn [string range $ns 10 end]
-        ::irc::connection
-        foreach var {sock logger host port} {
-            set ${ns}::$var [set $var]
-        }
-        array set ${ns}::dispatch [array get dispatch]
-        array set ${ns}::config [array get config]
-    }
-    set conn $oldconn
-}
-
-# ::irc::connection --
-#
-# Create an IRC connection namespace and associated commands.
-
-proc ::irc::connection { args } {
-    variable conn
-    variable config
-
-    # Create a unique namespace of the form irc$conn::$host
-
-    set name [format "%s::irc%s" [namespace current] $conn]
-
-    namespace eval $name {
-	set sock {}
-	array set dispatch {}
-	array set linedata {}
-	array set config [array get ::irc::config]
-	if { $config(logger) || $config(debug)} {
-	    package require logger
-            set logger [logger::init [namespace tail [namespace current]]]
-            if { !$config(debug) } { ${logger}::disable debug }
-        }
-	
-
-	# ircsend --
-	# send text to the IRC server
-
-	proc ircsend { msg } {
-	    variable sock
-	    variable dispatch
-	    if { $sock == "" } { return }
-	    cmd-log debug "ircsend: '$msg'"
-	    if { [catch {puts $sock $msg} err] } {
-	        catch { close $sock }
-	        set sock {}
-		if { [info exists dispatch(EOF)] } {
-		    eval $dispatch(EOF)
-		}
-		cmd-log error "Error in ircsend: $err"
-	    }
-	}
-
-
-	#########################################################
-	# Implemented user-side commands, meaning that these commands
-	# cause the calling user to perform the given action.
-	#########################################################
-
-
-        # cmd-config --
-        #
-        # Set or return per-connection configuration options.
-        #
-        # Arguments:
-        #
-        # key	name of the configuration option to change.
-        #
-        # value	value (optional) of the configuration option.
-
-        proc cmd-config { args } {
-            variable config
-	    variable logger
-	    
-	    if { [llength $args] == 0 } {
-		return [array get config]
-	    } elseif { [llength $args] == 1 } {
-		return $config($key)
-	    } elseif { [llength $args] > 2 } {
-		error "wrong # args: should be \"config key ?val?\""
-	    }
-	    set key [lindex $args 0]
-	    set value [lindex $args 1]
-            if { $key == "debug" } {
-                if {$value} {
-                    if { !$config(logger) } { cmd-config logger 1 }
-                    ${logger}::enable debug
-                } elseif { [info exists logger] } {
-                    ${logger}::disable debug
-	        }
-            }
-            if { $key == "logger" } {
-                if { $value && !$config(logger)} {
-                    package require logger
-                    set logger [logger::init [namespace tail [namespace current]]]
-                } elseif { [info exists logger] } {
-                    ${logger}::delete
-                    unset logger
-	        }
-            }
-            set config($key) $value
-        }
-        
-        proc cmd-log {level text} {
-	    variable logger
-            if { ![info exists logger] } return
-            ${logger}::$level $text
-        }
-        
-        proc cmd-logname { } {
-            variable logger
-            if { ![info exists logger] } return
-            return $logger
-        }
-
-        # cmd-destroy --
-        #
-        # destroys the current connection and its namespace
-
-        proc cmd-destroy { } {
-            variable logger
-            variable sock
-            if { [info exists logger] } { ${logger}::delete }
-            catch {close $sock}
-            namespace delete [namespace current]
-        }
-
-        proc cmd-connected { } {
-            variable sock
-            if { $sock == "" } { return 0 }
-            return 1
-        }
-
-	proc cmd-user { username hostname servername {userinfo ""} } {
-	    if { $userinfo == "" } {
-		ircsend "USER $username $hostname server :$servername"
-	    } else {
-		ircsend "USER $username $hostname $servername :$userinfo"
-	    }
-	}
-
-	proc cmd-nick { nk } {
-	    ircsend "NICK $nk"
-	}
-
-	proc cmd-ping { target } {
-	    ircsend "PRIVMSG $target :\001PING [clock seconds]\001"
-	}
-
-	proc cmd-serverping { } {
-	    ircsend "PING [clock seconds]"
-	}
-
-	proc cmd-ctcp { target line } {
-	    ircsend "PRIVMSG $target :\001$line\001"
-	}
-
-	proc cmd-join { chan {key {}} } {
-	    ircsend "JOIN $chan $key"
-	}
-
-	proc cmd-part { chan {msg ""} } {
-	    if { $msg == "" } {
-		ircsend "PART $chan"
-	    } else {
-		ircsend "PART $chan :$msg"
-	    }
-	}
-
-	proc cmd-quit { {msg {tcllib irc module - http://tcllib.sourceforge.net/}} } {
-	    ircsend "QUIT :$msg"
-	}
-
-	proc cmd-privmsg { target msg } {
-	    ircsend "PRIVMSG $target :$msg"
-	}
-
-	proc cmd-notice { target msg } {
-	    ircsend "NOTICE $target :$msg"
-	}
-
-	proc cmd-kick { chan target {msg {}} } {
-	    ircsend "KICK $chan $target :$msg"
-	}
-
-	proc cmd-mode { target args } {
-	    ircsend "MODE $target [join $args]"
-	}
-
-	proc cmd-topic { chan msg } {
-	    ircsend "TOPIC $chan :$msg"
-	}
-
-	proc cmd-invite { chan target } {
-	    ircsend "INVITE $target $chan"
-	}
-
-	proc cmd-send { line } {
-	    ircsend $line
-	}
-
-	proc cmd-peername { } {
-	    variable sock
-	    if { $sock == "" } { return {} }
-	    return [fconfigure $sock -peername]
-	}
-
-	proc cmd-sockname { } {
-	    variable sock
-	    if { $sock == "" } { return {} }
-	    return [fconfigure $sock -sockname]
-	}
-
-        proc cmd-socket { } {
-            variable sock
-            return $sock
-        }
-        
-	proc cmd-disconnect { } {
-	    variable sock
-	    if { $sock == "" } { return -1 }
-	    catch { close $sock }
-	    set sock {}
-	    return 0
-	}
-
-	# Connect --
-	# Create the actual tcp connection.
-
-	proc cmd-connect { h {p 6667} } {
-	    variable sock
-	    variable host
-	    variable port
-
-	   set host $h
-	   set port $p
-
-	    if { $sock == "" } {
-		set sock [socket $host $port]
-		fconfigure $sock -translation crlf -buffering line
-		fileevent $sock readable [namespace current]::GetEvent
-	    }
-	    return 0
-	}
-
-	# Callback API:
-
-	# These are all available from within callbacks, so as to
-	# provide an interface to provide some information on what is
-	# coming out of the server.
-
-	# action --
-
-	# Action returns the action performed, such as KICK, PRIVMSG,
-	# MODE etc, including numeric actions such as 001, 252, 353,
-	# and so forth.
-
-	proc action { } {
-	    variable linedata
-	    return $linedata(action)
-	}
-
-	# msg --
-
-	# The last argument of the line, after the last ':'.
-
-	proc msg { } {
-	    variable linedata
-	    return $linedata(msg)
-	}
-
-	# who --
-
-	# Who performed the action.  If the command is called as [who address],
-	# it returns the information in the form
-	# nick!ident@host.domain.net
-
-	proc who { {address 0} } {
-	    variable linedata
-	    if { $address == 0 } {
-		return [lindex [split $linedata(who) !] 0]
-	    } else {
-		return $linedata(who)
-	    }
-	}
-
-	# target --
-
-	# To whom was this action done.
-
-	proc target { } {
-	    variable linedata
-	    return $linedata(target)
-	}
-
-	# additional --
-
-	# Returns any additional header elements beyond the target as a list.
-
-	proc additional { } {
-	    variable linedata
-	    return $linedata(additional)
-	}
-
-	# header --
-
-	# Returns the entire header in list format.
-
-	proc header { } {
-	    variable linedata
-	    return [concat [list $linedata(who) $linedata(action) \
-				$linedata(target)] $linedata(additional)]
-	}
-
-	# GetEvent --
-
-	# Get a line from the server and dispatch it.
-
-	proc GetEvent { } {
-	    variable linedata
-	    variable sock
-	    variable dispatch
-	    array set linedata {}
-	    set line "eof"
-	    if { [eof $sock] || [catch {gets $sock} line] } {
-		close $sock
-		set sock {}
-		cmd-log error "Error receiving from network: $line"
-		if { [info exists dispatch(EOF)] } {
-		    eval $dispatch(EOF)
-		}
-		return
-	    }
-	    cmd-log debug "Recieved: $line"
-	    if { [set pos [string first " :" $line]] > -1 } {
-		set header [string range $line 0 [expr {$pos - 1}]]
-		set linedata(msg) [string range $line [expr {$pos + 2}] end]
-	    } else {
-		set header [string trim $line]
-		set linedata(msg) {}
-	    }
-
-	    if { [string match :* $header] } {
-		set header [split [string trimleft $header :]]
-	    } else {
-		set header [linsert [split $header] 0 {}]
-	    }
-	    set linedata(who) [lindex $header 0]
-	    set linedata(action) [lindex $header 1]
-	    set linedata(target) [lindex $header 2]
-	    set linedata(additional) [lrange $header 3 end]
-	    if { [info exists dispatch($linedata(action))] } {
-		eval $dispatch($linedata(action))
-	    } elseif { [string match {[0-9]??} $linedata(action)] } {
-		eval $dispatch(defaultnumeric)
-	    } elseif { $linedata(who) == "" } {
-		eval $dispatch(defaultcmd)
-	    } else {
-		eval $dispatch(defaultevent)
-	    }
-	}
-
-	# registerevent --
-
-	# Register an event in the dispatch table.
-
-	# Arguments:
-	# evnt: name of event as sent by IRC server.
-	# cmd: proc to register as the event handler
-
-	proc cmd-registerevent { evnt cmd } {
-	    variable dispatch
-	    set dispatch($evnt) $cmd
-	    if { $cmd == "" } {
-		unset dispatch($evnt)
-	    }
-	}
-
-	# getevent --
-
-	# Return the currently registered handler for the event.
-
-	# Arguments:
-	# evnt: name of event as sent by IRC server.
-
-	proc cmd-getevent { evnt } {
-	    variable dispatch
-	    if { [info exists dispatch($evnt)] } {
-		return $dispatch($evnt)
-	    }
-	    return {}
-	}
-
-	# eventexists --
-
-	# Return a boolean value indicating if there is a handler
-	# registered for the event.
-
-	# Arguments:
-	# evnt: name of event as sent by IRC server.
-
-	proc cmd-eventexists { evnt } {
-	    variable dispatch
-	    return [info exists dispatch($evnt)]
-	}
-
-	# network --
-
-	# Accepts user commands and dispatches them.
-
-	# Arguments:
-	# cmd: command to invoke
-	# args: arguments to the command
-
-	proc network { cmd args } {
-	    eval [linsert $args 0 [namespace current]::cmd-$cmd]
-	}
-
-	# Create default handlers.
-
-	set dispatch(PING) {network send "PONG :[msg]"}
-	set dispatch(defaultevent) #
-	set dispatch(defaultcmd) #
-	set dispatch(defaultnumeric) #
-    }
-
-    set returncommand [format "%s::irc%s::network" [namespace current] $conn]
-    incr conn
-    return $returncommand
-}
-
-# -------------------------------------------------------------------------
-
-package provide irc $::irc::version
-
-# -------------------------------------------------------------------------
Index: tolsh/tolsh.vfs/lib/tcllib1.10/irc/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/irc/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-# pkgIndex.tcl                                                    -*- tcl -*-
-# $Id: pkgIndex.tcl,v 1.7 2006/04/23 22:35:57 patthoyts Exp $
-if { ![package vsatisfies [package provide Tcl] 8.3] } {
-    # PRAGMA: returnok
-    return 
-}
-package ifneeded irc 0.6 [list source [file join $dir irc.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/javascript/javascript.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/javascript/javascript.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,453 +1,0 @@
-# javascript.tcl --
-#
-#	This file contains procedures that create HTML and Java Script
-#	functions that implement objects such as:
-#
-#		paired multi-selection boxes
-#		guarded submit buttons
-#		parent and child checkboxes
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: javascript.tcl,v 1.5 2005/09/30 05:36:39 andreas_kupries Exp $
-
-package require Tcl 8
-package require ncgi 1
-package provide javascript 1.0.2
-
-
-namespace eval ::javascript {
-
-    # The SelectionObjList namespace variable is used to keep the list of
-    # selection boxes that were created as parts of paired multi-selection
-    # boxes.  When a submit button is made for pages that have paired
-    # multi-selection boxes, we set a hidden field to store the initial values
-    # in the box.
-
-    variable SelectionObjList {}
-}
-
-# ::javascript::BeginJS --
-#
-#	Create HTML code to begin a java script program.
-#
-# Arguments:
-#	none.
-#
-# Results:
-#	Returns HTML code.
-
-proc ::javascript::BeginJS {} {
-    return "\n<SCRIPT LANGUAGE=\"JavaScript\">\n"
-}
-
-# ::javascript::EndJS --
-#
-#	Create HTML code to end a java script program.
-#
-# Arguments:
-#	none.
-#
-# Results:
-#	Returns HTML code.
-
-proc ::javascript::EndJS {} {
-    return "\n</SCRIPT>\n"
-}
-
-# ::javascript::MakeMultiSel --
-#
-#	Construct HTML code to create a multi-selection box.
-#
-# Arguments:
-#	id		The suffix of all HTML objects in this megawidget.
-#	side		Either "left" or "right".
-#	eltValues	The values to populate the selection box with.
-#	eltNames	The values to populate the selection box with.
-#	emptyElts	The number of empty box entry to stuff in the
-#			Selection box as placeholders for elts to be added.
-#	length		The number of elts to show before adding a vertical
-#			scrollbar.
-#	minWidth	Number of spaces to determin the minimum box width.
-#
-# Results:
-#	Returns HTML to show the selection box.
-
-proc ::javascript::MakeMultiSel {id side eltValues eltNames emptyElts \
-	length minWidth} {
-
-    variable SelectionObjList
-
-    # Add this selection box to the list.
-
-    set name "$side$id"
-    lappend SelectionObjList $name
-
-    # Create the selection box and populate it with elts.
-
-    set html ""
-    append html "<select name=$name multiple size=$length>"
-    foreach elt $eltValues name $eltNames {
-	set encodedElt [ncgi::encode $elt]
-	append html "<option value=$encodedElt>$name"
-    }
-
-    # Add empty values for the remaining elements.
-
-    for {set i 0} {$i < $emptyElts} {incr i} {
-	append html "<option value=\"\"> "
-    }
-
-    # Add an empty value with text that is as wide as the minWidth.
-
-    set filler ""
-    for {set i 0} {$i < $minWidth} {incr i} {
-	append filler "&nbsp;&nbsp;"
-    }
-    append html "<option value=\"\">$filler"
-
-    append html "</select>"
-    return $html
-}
-
-# ::javascript::MakeClickProc --
-#
-#	Create a "moveSelected$id" java script procedure to move selected items
-#	from one selection box to the other.
-#
-# Arguments:
-#	id	The suffix of all objects in this multiselection megawidget.
-#
-# Results:
-#	Returns java script code.
-
-proc ::javascript::MakeClickProc {id} {
-
-    set result "\nfunction moveSelected${id}(fromObj,toObj) \{\n"
-
-    # If nothing is selected, do nothing.
-
-    append result "\n    if (fromObj.selectedIndex > -1) \{"
-
-    # Find the first empty element in the toObj.
-
-    append result {
-        for (var k = 0; toObj.options[k].value != ""; k++) {}
-}
-
-    # Move the selected elements from the fromObj to the end of the toObj.
-    # Shift the objects in the fromObj to fill any empty spots.
-    # Clear out any extra slots in the fromObj.
-    # Deselect any selected elements (deselect with both 'selected = false'
-    # and by setting selectedIndex to -1, because setting selectedIndex to
-    # -1 didn't seem to clear selection on all windows browsers.
-
-    append result {
-        for (var i = fromObj.selectedIndex, j = fromObj.selectedIndex; fromObj.options[i].value != ""; i++) {
-            if (fromObj.options[i].selected) {
-                toObj.options[k].text = fromObj.options[i].text
-                toObj.options[k++].value = fromObj.options[i].value
-                fromObj.options[i].selected = false
-            } else {
-                fromObj.options[j].text = fromObj.options[i].text
-                fromObj.options[j++].value = fromObj.options[i].value
-            }
-        }
-        for (; j < i; j++) {
-            fromObj.options[j].text = ""
-            fromObj.options[j].value = ""
-        }
-        fromObj.selectedIndex = -1
-}
-
-    # Close the if statement and the function
-
-    append result "    \}
-\}
-"
-    return $result
-}
-
-# ::javascript::makeSelectorWidget --
-#
-#	Construct HTML code to create a dual-multi-selection megawidget.  This
-#	megawidget consists of two side-by-side multi-selection boxes
-#	separated by a left arrow and a right arrow button.  The right arrow
-#	button moves all items selected in the left box to the right box.  The
-#	left arrow button moves all items selected in the right box to the left
-#	box.
-#
-# Arguments:
-#	id		The suffix of all HTML objects in this megawidget.
-#	leftLabel	The text that appears above the left selection box.
-#	leftValueList	The values of items in the left selection box.
-#	leftNameList	The names to appear in the left selection box.
-#	rightLabel	The text that appears above the right selection box.
-#	rightValueList	The values of items in the right selection box.
-#	rightNameList	The names to appear in the right selection box.
-#	length		(optional) The number of elts to show before adding a
-#			vertical scrollbar.  Defaults to 8.
-#	minWidth	(optional) The number of spaces to determin the
-#			minimum box width.  Defaults to 32.
-#
-# Results:
-#	Returns HTML to show the dual-multi-selection megawidget.
-
-proc ::javascript::makeSelectorWidget {id leftLabel leftValueList leftNameList \
-	rightLabel rightValueList rightNameList {length 8} {minWidth 32}} {
-
-    set html ""
-    append html [BeginJS] \
-	    [MakeClickProc $id] \
-	    [EndJS]
-
-    append html "<table border=0 cellspacing=0 cellpadding=2>\n<tr><th>" \
-	    $leftLabel "</th><th></th><th>" $rightLabel "</th></tr>\n<tr>"
-
-    set leftLen [llength $leftValueList]
-    set rightLen [llength $rightValueList]
-    set len [expr {$leftLen + $rightLen}]
-
-    append html "<td valign=top colspan=1>" \
-	    [MakeMultiSel $id "left" $leftValueList $leftNameList \
-		$rightLen $length $minWidth] \
-	    "&nbsp;&nbsp;</td>\n"
-
-    append html "<td>" \
-	    "<table border=0 cellspacing=0 cellpadding=2>\n"
-
-    set args "this.form.left${id},this.form.right${id}"
-
-    append html "<tr><td><input type=button name=left${id}Button
-    onClick=\"moveSelected${id}(${args})\" value=\" >> \"></td></tr>"
-
-    set args "this.form.right${id},this.form.left${id}"
-
-    append html "<tr><td><input type=button name=right${id}Button
-	onClick=\"moveSelected${id}(${args})\" value=\" << \"></td></tr>"
-
-    append html "</table>\n" \
-	    "</td>\n"
-
-    append html "<td valign=top colspan=1>" \
-	    [MakeMultiSel $id "right" $rightValueList $rightNameList \
-		$leftLen $length $minWidth] \
-	    "&nbsp;&nbsp;</td>\n"
-
-    append html "</tr>\n" \
-	    "</table>\n"
-
-    # Add a hidden field to collect the data.
-
-    append html "<input type=hidden name=valleft${id} " \
-	    "value=\"$leftValueList\">\n" \
-	    "<input type=hidden name=valright${id} " \
-	    "value=\"$rightValueList\">\n"
-
-    return $html
-}
-
-# ::javascript::makeSubmitButton --
-#
-#	Create an HTML submit button that resets a hidden field for each
-#	registered multi-selection box.
-#
-# Arguments:
-#	name	the name of the HTML button object to create.
-#	value	the label of the HTML button object to create.
-#
-# Results:
-#	Returns HTML submit button code.
-
-proc ::javascript::makeSubmitButton {name value} {
-    variable SelectionObjList
-    set html ""
-
-    # Create the java script procedure that gathers the current values for each
-    # registered multi-selection box.
-
-    append html [BeginJS]
-    append html "\nfunction getSelections(form) \{\n"
-
-    # For each registered selection box, reset hidden field to
-    # store nonempty values.
-
-    foreach obj $SelectionObjList {
-	set selObj "form.$obj"
-	set hiddenObj "form.val$obj"
-	append html "    var tmp$obj = \"\"\n"
-	append html "    for (var i$obj = 0; i$obj < $selObj.length; i$obj++) {\n"
-	append html "        if ($selObj.options\[i$obj\].value == \"\") {\n"
-	append html "            break\n"
-	append html "        }\n"
-	append html "        tmp$obj += \" \" + $selObj.options\[i$obj\].value\n"
-	append html "    }\n"
-	append html "    $hiddenObj.value = tmp$obj \n"
-    }
-    append html "\}\n"
-    append html [EndJS]
-
-    # Empty the selection box for the next page.
-
-    set SelectionObjList {}
-
-    # Create the HTML submit button.
-
-    append html "<input type=submit name=\"$name\" value=\"$value\" 
-    onClick=\"getSelections(this.form)\">"
-
-    return $html
-}
-
-# ::javascript::makeProtectedSubmitButton --
-#
-#	Create an HTML submit button that prompts the user with a
-#	continue/cancel shutdown warning before the form is submitted.
-#
-# Arguments:
-#	name	the name of the HTML button object to create.
-#	value	the label of the HTML button object to create.
-#	msg	The message to display when the button is pressed.
-#
-# Results:
-#	Returns HTML submit button code.
-
-proc ::javascript::makeProtectedSubmitButton {name value msg} {
-    set html ""
-
-    # Create the java script procedure that gives the user the option to cancel
-    # the server shutdown request.
-
-    append html [BeginJS]
-    append html "\nfunction areYouSure${name}(form) \{\n"
-    append html "    if (confirm(\"$msg\")) \{\n"
-    append html "        return true\n"
-    append html "    \} else \{\n"
-    append html "        return false\n"
-    append html "    \}\n"
-    append html "\}\n"
-    append html [EndJS]
-
-    # Create the HTML submit button.
-
-    append html "<input type=submit name=\"$name\" value=\"$value\" 
-    onClick=\"return areYouSure${name}(this.form)\">"
-
-    return $html
-}
-
-# ::javascript::makeMasterButton --
-#
-#	Create an HTML button that sets it's slave checkboxs to the boolean
-#	value.
-#
-# Arguments:
-#	master	the name of the child's parent html checkbox object.
-#	value	the value of the master.
-#	slaves	the name of child html checkbox object to create.
-#	boolean	the java script boolean value that will be given to all the
-#		slaves.  Must be true or false.
-#
-# Results:
-#	Returns HTML code to create the child checkbox.
-
-proc ::javascript::makeMasterButton {master value slavePattern boolean} {
-    set html ""
-
-    # Create the java script "checkMaster$name" proc that gets called when the
-    # master checkbox is selected or de-selected.
-
-    append html [BeginJS]
-    append html "\nfunction checkMaster${master}(form) \{\n"
-    append html "    for (var i = 0; i < form.elements.length; i++) \{\n"
-    append html "        if (form.elements\[i\].name.match('$slavePattern')) \{\n"
-    append html "            form.elements\[i\].checked = $boolean \n"
-    append html "        \}\n"
-    append html "    \}\n"
-
-    append html "\}\n"
-    append html [EndJS]
-    
-    # Create the HTML button object.
-
-    append html "<input type=button name=\"$master\" value=\"$value\" " \
-	    "onClick=\"checkMaster${master}(this.form)\">\n"
-
-    return $html
-}
-
-# ::javascript::makeParentCheckbox --
-#
-#	Create an HTML checkbox and tie its value to that of it's child
-#	checkbox.  If the parent is unchecked, the child is automatically
-#	unchecked.
-#
-# Arguments:
-#	parentName	the name of parent html checkbox object to create.
-#	childName	the name of the parent's child html checkbox object
-# Results:
-#	Returns HTML code to create the child checkbox.
-
-proc ::javascript::makeParentCheckbox {parentName childName} {
-    set parentObj "form.$parentName"
-    set childObj "form.$childName"
-    set html ""
-
-    # Create the java script "checkParent$name" proc that gets called when the
-    # parent checkbox is selected or de-selected.
-
-    append html [BeginJS]
-    append html "\nfunction checkParent${parentName}(form) \{\n"
-    append html "    if (!$parentObj.checked && $childObj.checked) \{\n"
-    append html "        $childObj.checked = false\n"
-    append html "    \}\n"
-    append html "\}\n"
-    append html [EndJS]
-
-    # Create the HTML checkbox object.
-
-    append html "<input type=checkbox name=$parentName value=1 " \
-	    "onClick=\"checkParent${parentName}(this.form)\">"
-
-    return $html
-}
-
-# ::javascript::makeChildCheckbox --
-#
-#	Create an HTML checkbox and tie its value to that of it's parent
-#	checkbox.  If the child is checked, the parent is automatically
-#	checked.
-#
-# Arguments:
-#	parentName	the name of the child's parent html checkbox object
-#	childName	the name of child html checkbox object to create.
-#
-# Results:
-#	Returns HTML code to create the child checkbox.
-
-proc ::javascript::makeChildCheckbox {parentName childName} {
-    set parentObj "form.$parentName"
-    set childObj "form.$childName"
-    set html ""
-
-    # Create the java script "checkChild$name" proc that gets called when the
-    # child checkbox is selected or de-selected.
-
-    append html [BeginJS]
-    append html "\nfunction checkChild${childName}(form) \{\n"
-    append html "    if ($childObj.checked && !$parentObj.checked) \{\n"
-    append html "        $parentObj.checked = true\n"
-    append html "    \}\n"
-    append html "\}\n"
-    append html [EndJS]
-
-    # Create the HTML checkbox object.
-
-    append html "<input type=checkbox name=$childName value=1 " \
-	    "onClick=\"checkChild${childName}(this.form)\">"
-
-    return $html
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/javascript/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/javascript/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8]} {return}
-package ifneeded javascript 1.0.2 [list source [file join $dir javascript.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/jpeg/jpeg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/jpeg/jpeg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,920 +1,0 @@
-# jpeg.tcl --
-#
-#       Querying and modifying JPEG image files.
-#
-# Copyright (c) 2004    Aaron Faupell <afaupell@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: jpeg.tcl,v 1.12 2006/09/19 23:36:17 andreas_kupries Exp $
-
-package provide jpeg 0.3
-
-namespace eval ::jpeg {}
-
-# open a file, check jpeg signature, and a return a file handle
-# at the start of the first marker
-proc ::jpeg::openJFIF {file {mode r}} {
-    set fh [open $file $mode]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    # jpeg sig is FFD8, FF is start of first marker
-    if {[read $fh 3] != "\xFF\xD8\xFF"} { close $fh; return -code error "not a jpg file" }
-    # rewind to first marker
-    seek $fh -1 current
-    return $fh
-}
-
-# return a boolean indicating if a file starts with the jpeg sig
-proc ::jpeg::isJPEG {file} {
-    set is [catch {openJFIF $file} fh]
-    catch {close $fh}
-    return [expr {!$is}]
-}
-
-# takes an open filehandle at the start of a jpeg marker, and returns a list
-# containing information about the file markers in the jpeg file. each list
-# element itself a list of the marker type, offset of the start of its data,
-# and the length of its data.
-proc ::jpeg::markers {fh} {
-    set chunks [list]
-    while {[read $fh 1] == "\xFF"} {
-        binary scan [read $fh 3] H2S type len
-        # convert to unsigned
-        set len [expr {$len & 0x0000FFFF}]
-        # decrement len to account for marker bytes
-        incr len -2
-        lappend chunks [list $type [tell $fh] $len]
-        seek $fh $len current
-    }
-    return $chunks
-}
-
-proc ::jpeg::imageInfo {file} {
-    set fh [openJFIF $file r+]
-    set data {}
-    if {[set app0 [lsearch -inline [markers $fh] "e0 *"]] != ""} {
-        seek $fh [lindex $app0 1] start
-        set id [read $fh 5]
-        if {$id == "JFIF\x00"} {
-            binary scan [read $fh 9] cccSScc ver1 ver2 units xr yr xt yt
-            set data [list version $ver1.$ver2 units $units xdensity $xr ydensity $yr xthumb $xt ythumb $yt]
-        }
-    }
-    close $fh
-    return $data
-}
-
-# return an images dimensions by reading the Start Of Frame marker
-proc ::jpeg::dimensions {file} {
-    set fh [openJFIF $file]
-    set sof [lsearch -inline [markers $fh] {c[0-3] *}]
-    seek $fh [lindex $sof 1] start
-    binary scan [read $fh 5] cSS precision height width
-    close $fh
-    return [list $width $height]
-}
-
-# returns a list of all comments (FE segments) in the file
-proc ::jpeg::getComments {file} {
-    set fh [openJFIF $file]
-    set comments {}
-    foreach x [lsearch -all -inline [markers $fh] "fe *"] {
-        seek $fh [lindex $x 1] start
-        lappend comments [read $fh [lindex $x 2]]
-    }
-    close $fh
-    return $comments
-}
-
-# add a new comment to the file
-proc ::jpeg::addComment {file comment args} {
-    set fh [openJFIF $file r+]
-    # find the SoF and save all data after it
-    set sof [lsearch -inline [markers $fh] {c[0-3] *}]
-    seek $fh [expr {[lindex $sof 1] - 4}] start
-    set data2 [read $fh]
-    # seek back to the SoF and write comment(s) segment
-    seek $fh [expr {[lindex $sof 1] - 4}] start
-    foreach x [linsert $args 0 $comment] {
-        if {$x == ""} continue
-        puts -nonewline $fh [binary format a2Sa* "\xFF\xFE" [expr {[string length $x] + 2}] $x]
-    }
-    # write the saved data bac
-    puts -nonewline $fh $data2
-    close $fh
-}
-
-proc ::jpeg::replaceComment {file comment} {
-    set com [getComments $file]
-    removeComments $file
-    eval [list addComment $file] [lreplace $com 0 0 $comment]
-}
-
-# removes all comment segments from the file
-proc ::jpeg::removeComments {file} {
-    set fh [openJFIF $file]
-    set data "\xFF\xD8"
-    foreach marker [markers $fh] {
-        if {[lindex $marker 0] != "fe"} {
-            # seek back 4 bytes to include the marker and length bytes
-            seek $fh [expr {[lindex $marker 1] - 4}] start
-            append data [read $fh [expr {[lindex $marker 2] + 4}]]
-        }
-    }
-    append data [read $fh]
-    close $fh
-    set fh [open $file w]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    puts -nonewline $fh $data
-    close $fh
-}
-
-# rewrites a jpeg file and removes all metadata (comments, exif, photoshop)
-proc ::jpeg::stripJPEG {file} {
-    set fh [openJFIF $file]
-    set data {}
-    
-    set markers [markers $fh]
-    # look for a jfif header segment and save it
-    if {[lindex $markers 0 0] == "e0"} {
-        seek $fh [lindex $markers 0 1] start
-        if {[read $fh 5] == "JFIF\x00"} {
-            seek $fh -9 current
-            set jfif [read $fh [expr {[lindex $markers 0 2] + 4}]]
-        }
-    }
-    # if we dont have a jfif header (exif files), create a fake one
-    if {![info exists jfif]} {
-        set jfif [binary format a2Sa5cccSScc "\xFF\xE0" 16 "JFIF\x00" 1 2 1 72 72 0 0]
-    }
-
-    # remove all the e* and f* markers (metadata)
-    foreach marker $markers {
-        if {![string match {[ef]*} [lindex $marker 0]]} {
-            seek $fh [expr {[lindex $marker 1] - 4}] start
-            append data [read $fh [expr {[lindex $marker 2] + 4}]]
-        }
-    }
-    append data [read $fh]
-
-    close $fh
-    set fh [open $file w+]
-    # write a jpeg file sig, a jfif header, and all the remaining data
-    puts -nonewline $fh \xFF\xD8$jfif$data
-    close $fh
-}
-
-# if file contains a jpeg thumbnail return it. the returned data is the actual
-# jpeg data, it can be written directly to a file
-proc ::jpeg::getThumbnail {file} {
-    # check if the exif information contains a thumbnail
-    array set exif [getExif $file thumbnail]
-    if {[info exists exif(Compression)] && \
-             $exif(Compression) == 6 && \
-             [info exists exif(JPEGInterchangeFormat)] && \
-             [info exists exif(JPEGInterchangeFormatLength)]} {
-        set fh [openJFIF $file]
-        seek $fh [expr {$exif(ExifOffset) + $exif(JPEGInterchangeFormat)}] start
-        set thumb [read $fh $exif(JPEGInterchangeFormatLength)]
-        close $fh
-        return $thumb
-    }
-    # check for a JFXX segment which contains a thumbnail
-    set fh [openJFIF $file]
-    foreach x [lsearch -inline -all [markers $fh] "e0 *"] {
-        seek $fh [lindex $x 1] start
-        binary scan [read $fh 6] a5H2 id excode
-        # excode 10 is jpeg encoding, we cant interpret the other types
-        if {$id == "JFXX\x00" && $excode == "10"} {
-            set thumb [read $fh [expr {[lindex $x 2] - 6}]]
-            close $fh
-            return $thumb
-        }
-    }
-    close $fh
-}
-
-
-# takes key-value pairs returned by getExif and converts their values into
-# human readable format
-proc ::jpeg::formatExif {exif} {
-    variable exif_values
-    set out {}
-    foreach {tag val} $exif {
-        if {[info exists exif_values($tag,$val)]} {
-            set val $exif_values($tag,$val)
-        } elseif {[info exists exif_values($tag,)]} {
-            set val $exif_values($tag,)
-        } else {
-            switch -exact -- $tag {
-                UserComment {set val [string trim [string range $val 8 end] \x00]}
-                ComponentsConfiguration {binary scan $val cccc a b c d; set val $a,$b,$c,$d}
-                ExifVersion {set val [expr [string range $val 0 1].[string range $val 2 3]]}
-                FNumber {set val [format %2.1f $val]}
-                MaxApertureValue -
-                ApertureValue {
-                    set val [format %2.1f [expr {2 * (log($val) / log(2))}]]
-                }
-                ShutterSpeedValue {
-                    set val [expr {pow(2, $val)}]
-                    if {abs(round($val) - $val) < 0.2} {set val [expr {round($val)}]}
-                    set val 1/[string trimright [string trimright [format %.2f $val] 0] .]
-                }
-                ExposureTime {
-                    set val 1/[string trimright [string trimright [format %.4f [expr {1 / $val}]] 0] .]
-                }
-            }
-        }
-        lappend out $tag $val
-    }
-    return $out
-}
-
-# returns a list of all known exif keys
-proc ::jpeg::exifKeys {} {
-    variable exif_tags
-    set ret {}
-    foreach {x y} [array get exif_tags] {lappend ret $y}
-    return $ret
-}
-
-proc ::jpeg::getExif {file {type main}} {
-    set fh [openJFIF $file]
-    # foreach because file may have multiple e1 markers
-    foreach app1 [lsearch -inline -all [markers $fh] "e1 *"] {
-        seek $fh [lindex $app1 1] start
-        # check that this e1 is really an Exif segment
-        if {[read $fh 6] != "Exif\x00\x00"} continue
-        # save offset because exif offsets are relative to this
-        set start [tell $fh]
-        # next 2 bytes determine byte order
-        binary scan [read $fh 2] H4 byteOrder
-        if {$byteOrder == "4d4d"} {
-            set byteOrder big
-        } elseif {$byteOrder == "4949"} {
-            set byteOrder little
-        } else {
-            close $fh
-            return
-        }
-        # the answer is 42, if we have our byte order correct
-        _scan $byteOrder [read $fh 6] si magic next
-        if {$magic != 42} { close $fh; return }
-        seek $fh [expr {$start + $next}] start
-        if {$type != "thumbnail"} {
-            set data [_exif $fh $byteOrder $start]
-        } else {
-            # number of entries in this exif block
-            _scan $byteOrder [read $fh 2] s num
-            # each entry is 12 bytes
-            seek $fh [expr {$num * 12}] current
-            # offset of next exif block (for thumbnail)
-            _scan $byteOrder [read $fh 4] i next
-            if {$next <= 0} { close $fh; return }
-            # but its relative to start
-            seek $fh [expr {$start + $next}] start
-            set data [_exif $fh $byteOrder $start]
-        }
-        close $fh
-        lappend data ExifOffset $start ExifByteOrder $byteOrder
-        return $data
-    }
-    close $fh
-}
-
-proc ::jpeg::removeExif {file} {
-    set fh [openJFIF $file]
-    set data {}
-    set markers [markers $fh]
-    if {[lsearch $markers "e1 *"] < 0} { close $fh; return }
-    foreach marker $markers {
-        if {[lindex $marker 0] != "e1"} {
-            seek $fh [expr {[lindex $marker 1] - 4}] start
-            append data [read $fh [expr {[lindex $marker 2] + 4}]]
-        } else {
-            seek $fh [lindex $marker 1] start
-            if {[read $fh 6] == "Exif\x00\x00"} continue
-            seek $fh -10 current
-            append data [read $fh [expr {[lindex $marker 2] + 4}]]
-        }
-    }
-    append data [read $fh]
-    close $fh
-    set fh [open $file w]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    puts -nonewline $fh "\xFF\xD8"
-    if {[lindex $markers 0 0] != "e0"} {
-        puts -nonewline $fh [binary format a2Sa5cccSScc "\xFF\xE0" 16 "JFIF\x00" 1 2 1 72 72 0 0]
-    }
-    puts -nonewline $fh $data
-    close $fh
-}
-
-proc ::jpeg::_exif2 {data} {
-    variable exif_tags
-    set byteOrder little
-    set start 0
-    set i 2
-    for {_scan $byteOrder $data @0s num} {$num > 0} {incr num -1} {
-        binary scan $data @${i}H2H2 t1 t2
-        if {$byteOrder == "big"} {
-            set tag $t1$t2
-        } else {
-            set tag $t2$t1
-        }
-        incr i 2
-        _scan $byteOrder $data @${i}si format components
-        incr i 6
-        set value [string range $data $i [expr {$i + 3}]]
-        if {$tag == "8769" || $tag == "a005"} {
-            _scan $byteOrder $value i next
-            #set pos [tell $fh]
-            #seek $fh [expr {$offset + $next}] start
-            #eval lappend return [_exif $fh $byteOrder $offset]
-            #seek $fh $pos start
-            continue
-        }
-        if {![info exists exif_formats($format)]} continue
-        if {[info exists exif_tags($tag)]} { set tag $exif_tags($tag) }
-        set size [expr {$exif_formats($format) * $components}]
-        if {$size > 4} {
-            _scan $byteOrder $value i value
-            #puts "$value"
-            #set value [string range $data [expr {$i + $offset + $value}] [expr {$size - 1}]]
-        }
-        lappend ret $tag [_format $byteOrder $value $format $components]
-    }
-}
-
-# reads an exif block and returns key-value pairs
-proc ::jpeg::_exif {fh byteOrder offset} {
-    variable exif_formats
-    variable exif_tags
-    set return {}
-    for {_scan $byteOrder [read $fh 2] s num} {$num > 0} {incr num -1} {
-        binary scan [read $fh 2] H2H2 t1 t2
-        _scan $byteOrder [read $fh 6] si format components
-        if {$byteOrder == "big"} {
-            set tag $t1$t2
-        } else {
-            set tag $t2$t1
-        }
-        set value [read $fh 4]
-        # special tags, they point to more exif blocks
-        if {$tag == "8769" || $tag == "a005"} {
-            _scan $byteOrder $value i next
-            set pos [tell $fh]
-            seek $fh [expr {$offset + $next}] start
-            eval lappend return [_exif $fh $byteOrder $offset]
-            seek $fh $pos start
-            continue
-        }
-        if {![info exists exif_formats($format)]} continue
-        if {[info exists exif_tags($tag)]} { set tag $exif_tags($tag) }
-        set size [expr {$exif_formats($format) * $components}]
-        # if the data is over 4 bytes, its stored later in the file, with the
-        # data being the offset relative to the exif header
-        if {$size > 4} {
-            set pos [tell $fh]
-            _scan $byteOrder $value i value
-            seek $fh [expr {$offset + $value}] start
-            set value [read $fh $size]
-            seek $fh $pos start
-        }
-        lappend return $tag [_format $byteOrder $value $format $components]
-    }
-    return $return
-}
-
-proc ::jpeg::MakerNote {offset byteOrder Make data} {
-    if {$Make == "Canon"} {
-        set data [MakerNoteCanon $offset $byteOrder $data]
-    } elseif {[string match Nikon* $data] || $Make == "NIKON"} {
-        set data [MakerNoteNikon $offset $byteOrder $data]
-    } elseif {[string match FUJIFILM* $data]} {
-        set data [MakerNoteFuji $offset $byteOrder $data]
-    } elseif {[string match OLYMP* $data]} {
-        set data [MakerNoteOlympus $offset $byteOrder $data]
-    }
-    return $data
-}
-
-proc ::jpeg::MakerNoteNikon {offset byteOrder data} {
-    variable exif_formats
-    set return {}
-    if {[string match Nikon* $data]} {
-        set i 8
-    } else {
-        set i 0
-    }
-    binary scan $data @8s num
-    incr i 2
-    puts [expr {($num * 12) + $i}]
-    puts [string range $data 142 150]
-    #exit
-    for {} {$num > 0} {incr num -1} {
-        binary scan $data @${i}H2H2 t1 t2
-        if {$byteOrder == "big"} {
-            set tag $t1$t2
-        } else {
-            set tag $t2$t1
-        }
-        incr i 2
-        _scan $byteOrder $data @${i}si format components
-        incr i 6
-        set value [string range $data $i [expr {$i + 3}]]
-        if {![info exists exif_formats($format)]} continue
-        #if {[info exists exif_tags($tag)]} { set tag $exif_tags($tag) }
-        set size [expr {$exif_formats($format) * $components}]
-        if {$size > 4} {
-            _scan $byteOrder $value i value
-            puts "$value"
-            set value 1
-            #set value [string range $data [expr {$i + $offset + $value}] [expr {$size - 1}]]
-        } else {
-        
-        lappend ret $tag [_format $byteOrder $value $format $components]
-        }
-        puts "$tag $format $components $value"
-    }
-    return $return
-}
-
-proc ::jpeg::debug {file} {
-    set fh [openJFIF $file]
-
-    puts "marker: d8 length: 0"
-    puts "  SOI (Start Of Image)"
-
-    foreach marker [markers $fh] {
-        seek $fh [lindex $marker 1] 
-        puts "marker: [lindex $marker 0] length: [lindex $marker 2]"
-        switch -glob -- [lindex $marker 0] {
-            c[0-3] {
-                binary scan [read $fh 6] cSSc precision height width color
-                puts "  SOF (Start Of Frame) [string map {c0 "Baseline" c1 "Non-baseline" c2 "Progressive" c3 "Lossless"} [lindex $marker 0]]"
-                puts "    Image dimensions: $width $height"
-                puts "    Precision: $precision"
-                puts "    Color Components: $color"
-            }
-            c4 {
-                puts "  DHT (Define Huffman Table)"
-                binary scan [read $fh 17] cS bits symbols
-                puts "    $symbols symbols"
-            }
-            da {
-                puts "  SOS (Start Of Scan)"
-                binary scan [read $fh 2] c num
-                puts "    Components: $num"
-            }
-            db {
-                puts "  DQT (Define Quantization Table)"
-            }
-            dd {
-                puts "  DRI (Define Restart Interval)"
-                binary scan [read $fh 2] S num
-                puts "    Interval: $num blocks"
-            }
-            e0 {
-                set id [read $fh 5]
-                if {$id == "JFIF\x00"} {
-                    puts "  JFIF"
-                    binary scan [read $fh 9] cccSScc ver1 ver2 units xr vr xt yt
-                    puts "    Header: $ver1.$ver2 $units $xr $vr $xt $yt"
-                } elseif {$id == "JFXX\x00"} {
-                    puts "  JFXX (JFIF Extension)"
-                    binary scan [read $fh 1] H2 excode
-                    if {$excode == "10"} { set excode "10 (JPEG thumbnail)" }
-                    if {$excode == "11"} { set excode "11 (Palletized thumbnail)" }
-                    if {$excode == "13"} { set excode "13 (RGB thumbnail)" }
-                    puts "    Extension code: 0x$excode"
-                } else {
-                    puts "  Unknown APP0 segment: $id"
-                }
-            }
-            e1 {
-                if {[read $fh 6] == "Exif\x00\x00"} {
-                    puts "  EXIF data"
-                    puts "    MAIN EXIF"
-                    foreach {x y} [getExif $file] {
-                        puts "    $x $y"
-                    }
-                    puts "    THUMBNAIL EXIF"
-                    foreach {x y} [getExif $file thumbnail] {
-                        puts "    $x $y"
-                    }
-                } else {
-                    puts "  APP1 (unknown)"
-                }
-            }
-            e2 {
-                if {[read $fh 12] == "ICC_PROFILE\x00"} {
-                    puts "  ICC profile"
-                } else {
-                    puts "  APP2 (unknown)"
-                }
-            }
-            ed {
-                if {[read $fh 18] == "Photoshop 3.0\0008BIM"} {
-                    puts "  Photoshop 8BIM data"
-                } else {
-                    puts "  APP13 (unknown)"
-                }
-            }
-            ee {
-                if {[read $fh 5] == "Adobe"} {
-                    puts "  Adobe metadata"
-                } else {
-                    puts "  APP14 (unknown)"
-                }
-            }
-            e[3456789abcf] {
-                puts [format "  %s%d %s" APP 0x[string index [lindex $marker 0] 1] (unknown)]
-            }
-            fe {
-                puts "  Comment: [read $fh [lindex $marker 2]]"
-            }
-            default {
-                puts "  Unknown"
-            }
-        }
-    }
-}
-
-# for mapping the exif format types to byte lengths
-array set ::jpeg::exif_formats [list 1 1 2 1 3 2 4 4 5 8 6 1 7 1 8 2 9 4 10 8 11 4 12 8]
-
-# list of recognized exif tags. if a tag is not listed here it will show up as its raw hex value
-array set ::jpeg::exif_tags {
-    0100 ImageWidth
-    0101 ImageLength
-    0102 BitsPerSample
-    0103 Compression
-    0106 PhotometricInterpretation
-    0112 Orientation
-    0115 SamplesPerPixel
-    011c PlanarConfiguration
-    0212 YCbCrSubSampling
-    0213 YCbCrPositioning
-    011a XResolution
-    011b YResolution
-    0128 ResolutionUnit
-
-    0111 StripOffsets
-    0116 RowsPerStrip
-    0117 StripByteCounts
-    0201 JPEGInterchangeFormat
-    0202 JPEGInterchangeFormatLength
-
-    012d TransferFunction
-    013e WhitePoint
-    013f PrimaryChromaticities
-    0211 YCbCrCoefficients
-    0213 YCbCrPositioning
-    0214 ReferenceBlackWhite
-
-    0132 DateTime
-    010e ImageDescription
-    010f Make
-    0110 Model
-    0131 Software  
-    013b Artist
-    8298 Copyright
-    
-    9000 ExifVersion  
-    a000 FlashpixVersion
-
-    a001 ColorSpace
-
-    9101 ComponentsConfiguration
-    9102 CompressedBitsPerPixel
-    a002 ExifImageWidth
-    a003 ExifImageHeight
-
-    927c MakerNote
-    9286 UserComment
-
-    a004 RelatedSoundFile
-
-    9003 DateTimeOriginal
-    9004 DateTimeDigitized
-    9290 SubsecTime
-    9291 SubsecTimeOriginal
-    9292 SubsecTimeDigitized
-
-    829a ExposureTime
-    829d FNumber
-    8822 ExposureProgram
-    8824 SpectralSensitivity
-    8827 ISOSpeedRatings
-    8828 OECF
-    9201 ShutterSpeedValue
-    9202 ApertureValue
-    9203 BrightnessValue
-    9204 ExposureBiasValue
-    9205 MaxApertureValue
-    9206 SubjectDistance
-    9207 MeteringMode
-    9208 LightSource
-    9209 Flash
-    920a FocalLength
-    9214 SubjectArea
-    a20b FlashEnergy
-    a20c SpatialFrequencyResponse
-    a20e FocalPlaneXResolution
-    a20f FocalPlaneYResolution
-    a210 FocalPlaneResolutionUnit
-    a214 SubjectLocation
-    a215 ExposureIndex
-    a217 SensingMethod
-    a300 FileSource
-    a301 SceneType
-    a302 CFAPattern
-    a401 CustomRendered
-    a402 ExposureMode
-    a403 WhiteBalance
-    a404 DigitalZoomRatio
-    a405 FocalLengthIn35mmFilm
-    a406 SceneCaptureType
-    a407 GainControl
-    a408 Contrast
-    a409 Saturation
-    a40a Sharpness
-    a40b DeviceSettingDescription
-    a40c SubjectDistanceRange
-    a420 ImageUniqueID
-
-    
-    0001 InteroperabilityIndex
-    0002 InteroperabilityVersion
-    1000 RelatedImageFileFormat
-    1001 RelatedImageWidth
-    1002 RelatedImageLength
-    
-    00fe NewSubfileType
-    00ff SubfileType
-    013d Predictor
-    0142 TileWidth
-    0143 TileLength
-    0144 TileOffsets
-    0145 TileByteCounts
-    014a SubIFDs
-    015b JPEGTables
-    828d CFARepeatPatternDim
-    828e CFAPattern
-    828f BatteryLevel
-    83bb IPTC/NAA
-    8773 InterColorProfile
-    8825 GPSInfo
-    8829 Interlace
-    882a TimeZoneOffset
-    882b SelfTimerMode
-    920c SpatialFrequencyResponse
-    920d Noise
-    9211 ImageNumber
-    9212 SecurityClassification
-    9213 ImageHistory
-    9215 ExposureIndex
-    9216 TIFF/EPStandardID
-}
-
-# for mapping exif values to plain english by [formatExif]
-array set ::jpeg::exif_values {
-    Compression,1 none
-    Compression,6 JPEG
-    Compression,  unknown
-
-    PhotometricInterpretation,2 RGB
-    PhotometricInterpretation,6 YCbCr
-    PhotometricInterpretation,  unknown
-
-    Orientation,1 normal
-    Orientation,2 mirrored
-    Orientation,3 "180 degrees"
-    Orientation,4 "180 degrees, mirrored"
-    Orientation,5 "90 degrees ccw, mirrored"
-    Orientation,6 "90 degrees cw"
-    Orientation,7 "90 degrees cw, mirrored"
-    Orientation,8 "90 degrees ccw"
-    Orientation,  unknown
-
-    PlanarConfiguration,1 chunky
-    PlanarConfiguration,2 planar
-    PlanarConfiguration,  unknown
-
-    YCbCrSubSampling,2,1 YCbCr4:2:2
-    YCbCrSubSampling,2,2 YCbCr4:2:0
-    YCbCrSubSampling,    unknown
-
-    YCbCrPositioning,1 centered
-    YCbCrPositioning,2 co-sited
-    YCbCrPositioning,  unknown
-
-    FlashpixVersion,0100 "Flashpix Format Version 1.0"
-    FlashpixVersion,     unknown
-
-    ColorSpace,1     sRGB
-    ColorSpace,32768 uncalibrated
-    ColorSpace,      unknown
-
-    ExposureProgram,0 undefined
-    ExposureProgram,1 manual
-    ExposureProgram,2 normal
-    ExposureProgram,3 "aperture priority"
-    ExposureProgram,4 "shutter priority"
-    ExposureProgram,5 creative
-    ExposureProgram,6 action
-    ExposureProgram,7 portrait
-    ExposureProgram,8 landscape
-    ExposureProgram,  unknown
-
-    LightSource,0   unknown
-    LightSource,1   daylight
-    LightSource,2   flourescent
-    LightSource,3   tungsten
-    LightSource,4   flash
-    LightSource,9   "fine weather"
-    LightSource,10  "cloudy weather"
-    LightSource,11  shade
-    LightSource,12  "daylight flourescent"
-    LightSource,13  "day white flourescent"
-    LightSource,14  "cool white flourescent"
-    LightSource,15  "white flourescent"
-    LightSource,17  "standard light A"
-    LightSource,18  "standard light B"
-    LightSource,19  "standard light C"
-    LightSource,20  D55
-    LightSource,21  D65
-    LightSource,22  D75
-    LightSource,23  D50
-    LightSource,24  "ISO studio tungsten"
-    LightSource,255 other
-    LightSource,    unknown
-
-    Flash,0  "no flash"
-    Flash,1  "flash fired"
-    Flash,5  "strobe return light not detected"
-    Flash,7  "strobe return light detected"
-    Flash,9  "flash fired, compulsory flash mode"
-    Flash,13 "flash fired, compulsory flash mode, return light not detected"
-    Flash,15 "flash fired, compulsory flash mode, return light detected"
-    Flash,16 "flash did not fire, compulsory flash mode"
-    Flash,24 "flash did not fire, auto mode"
-    Flash,25 "flash fired, auto mode"
-    Flash,29 "flash fired, auto mode, return light not detected"
-    Flash,31 "flash fired, auto mode, return light detected"
-    Flash,32 "no flash function"
-    Flash,65 "flash fired, red-eye reduction mode"
-    Flash,69 "flash fired, red-eye reduction mode, return light not detected"
-    Flash,71 "flash fired, red-eye reduction mode, return light detected"
-    Flash,73 "flash fired, compulsory mode, red-eye reduction mode"
-    Flash,77 "flash fired, compulsory mode, red-eye reduction mode, return light not detected"
-    Flash,79 "flash fired, compulsory mode, red-eye reduction mode, return light detected"
-    Flash,89 "flash fired, auto mode, red-eye reduction mode"
-    Flash,93 "flash fired, auto mode, return light not detected, red-eye reduction mode"
-    Flash,95 "flash fired, auto mode, return light detected, red-eye reduction mode"
-    Flash,   unknown
-
-    ResolutionUnit,2 inch
-    ResolutionUnit,3 centimeter
-    ResolutionUnit,  unknown
-
-    SensingMethod,1 undefined
-    SensingMethod,2 "one chip color area sensor"
-    SensingMethod,3 "two chip color area sensor"
-    SensingMethod,4 "three chip color area sensor"
-    SensingMethod,5 "color sequential area sensor"
-    SensingMethod,7 "trilinear sensor"
-    SensingMethod,8 "color sequential linear sensor"
-    SensingMethod,  unknown
-
-    SceneType,\x01\x00\x00\x00 "directly photographed image"
-    SceneType,                 unknown
-
-    CustomRendered,0 normal
-    CustomRendered,1 custom
-
-    ExposureMode,0 auto
-    ExposureMode,1 manual
-    ExposureMode,2 "auto bracket"
-    ExposureMode,  unknown
-
-    WhiteBalance,0 auto
-    WhiteBlanace,1 manual
-    WhiteBlanace,  unknown
-
-    SceneCaptureType,0 standard
-    SceneCaptureType,1 landscape
-    SceneCaptureType,2 portrait
-    SceneCaptureType,3 night
-    SceneCaptureType,  unknown
-
-    GainControl,0 none
-    GainControl,1 "low gain up"
-    GainControl,2 "high gain up"
-    GainControl,3 "low gain down"
-    GainControl,4 "high gain down"
-    GainControl,  unknown
-
-    Contrast,0 normal
-    Contrast,1 soft
-    Contrast,2 hard
-    Contrast,  unknown
-
-    Saturation,0 normal
-    Saturation,1 low
-    Saturation,2 high
-    Saturation,  unknown
-
-    Sharpness,0 normal
-    Sharpness,1 soft
-    Sharpness,2 hard
-    Sharpness,  unknown
-
-    SubjectDistanceRange,0 unknown
-    SubjectDistanceRange,1 macro
-    SubjectDistanceRange,2 close
-    SubjectDistanceRange,3 distant
-    SubjectDistanceRange,  unknown
-    
-    MeteringMode,0   unknown
-    MeteringMode,1   average
-    MeteringMode,2   "center weighted average"
-    MeteringMode,3   spot
-    MeteringMode,4   multi-spot
-    MeteringMode,5   multi-segment
-    MeteringMode,6   partial
-    MeteringMode,255 other
-    MeteringMode,    unknown
-    
-    FocalPlaneResolutionUnit,2 inch
-    FocalPlaneResolutionUnit,3 centimeter
-    FocalPlaneResolutionUnit,  none
-    
-    DigitalZoomRatio,0 "not used"
-    
-    FileSource,\x03\x00\x00\x00 "digital still camera"
-    FileSource,                 unknown
-}
-
-# [binary scan], in the byte order indicated by $e
-proc ::jpeg::_scan {e v f args} {
-     foreach x $args { upvar 1 $x $x }
-     if {$e == "big"} {
-         eval [list binary scan $v [string map {b B h H s S i I} $f]] $args
-     } else {
-         eval [list binary scan $v $f] $args
-     }
-}
-
-
-# formats exif values, the numbers correspond to data types
-# values may be either byte order, as indicated by $end
-# see the exif spec for more info
-proc ::jpeg::_format {end value type num} {
-    if {$num > 1 && $type != 2 && $type != 7} {
-        variable exif_formats
-        set r {}
-        for {set i 0} {$i < $num} {incr i} {
-            set len $exif_formats($type)
-            lappend r [_format $end [string range $value [expr {$len * $i}] [expr {($len * $i) + $len - 1}]] $type 1]
-        }
-        return [join $r ,]
-    }
-    switch -exact -- $type {
-        1 { _scan $end $value c value }
-        2 { set value [string trimright $value \x00] }
-        3 {
-            _scan $end $value s value
-            set value [format %u $value]
-        }
-        4 {
-            _scan $end $value i value
-            set value [format %u $value]
-        }
-        5 {
-            _scan $end $value ii n d
-            set n [format %u $n]
-            set d [format %u $d]
-            if {$d == 0} {set d 1}
-            #set value [string trimright [string trimright [format %5.4f [expr {double($n) / $d}]] 0] .]
-            set value [string trimright [string trimright [expr {double($n) / $d}] 0] .]
-            #set value "$n/$d"
-        }
-        6 { _scan $end $value c value }
-        8 { _scan $end $value s value }
-        9 { _scan $end $value i value }
-        10 {
-            _scan $end $value ii n d
-            if {$d == 0} {set d 1}
-            #set value [string trimright [string trimright [format %5.4f [expr {double($n) / $d}]] 0] .]
-            set value [string trimright [string trimright [expr {double($n) / $d}] 0] .]
-            #set value "$n/$d"
-        }
-        11 { _scan $end $value i value }
-        12 { _scan $end $value w value }
-    }
-    return $value
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/jpeg/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/jpeg/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded jpeg 0.3 [list source [file join $dir jpeg.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/json/json.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/json/json.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,274 +1,0 @@
-#
-#   JSON parser for Tcl.
-#
-#   See http://www.json.org/ && http://www.ietf.org/rfc/rfc4627.txt
-#
-#   Copyright 2006 ActiveState Software Inc.
-#
-#   $Id: json.tcl,v 1.2 2006/08/25 23:19:53 hobbs Exp $
-#
-
-if {$::tcl_version < 8.5} {
-    package require dict
-}
-
-package provide json 1.0
-
-namespace eval json {}
-
-proc json::getc {{txtvar txt}} {
-    # pop single char off the front of the text
-    upvar 1 $txtvar txt
-    if {$txt eq ""} {
-    	return -code error "unexpected end of text"
-    }
-
-    set c [string index $txt 0]
-    set txt [string range $txt 1 end]
-    return $c
-}
-
-proc json::json2dict {txt} {
-    return [_json2dict]
-}
-
-proc json::_json2dict {{txtvar txt}} {
-    upvar 1 $txtvar txt
-
-    set state TOP
-
-    set txt [string trimleft $txt]
-    while {$txt ne ""} {
-    	set c [string index $txt 0]
-
-    	# skip whitespace
-    	while {[string is space $c]} {
-    	    getc
-    	    set c [string index $txt 0]
-    	}
-
-	if {$c eq "\{"} {
-	    # object
-	    switch -- $state {
-		TOP {
-		    # we are dealing with an Object
-		    getc
-		    set state OBJECT
-		    set dictVal [dict create]
-		}
-		VALUE {
-		    # this object element's value is an Object
-		    dict set dictVal $name [_json2dict]
-		    set state COMMA
-		}
-		LIST {
-		    # next element of list is an Object
-		    lappend listVal [_json2dict]
-		    set state COMMA
-		}
-		default {
-		    return -code error "unexpected open brace in $state mode"
-		}
-	    }
-	} elseif {$c eq "\}"} {
-	    getc
-	    if {$state ne "OBJECT" && $state ne "COMMA"} {
-		return -code error "unexpected close brace in $state mode"
-	    }
-	    return $dictVal
-	} elseif {$c eq ":"} {
-	    # name separator
-	    getc
-
-	    if {$state eq "COLON"} {
-		set state VALUE
-	    } else {
-		return -code error "unexpected colon in $state mode"
-	    }
-	} elseif {$c eq ","} {
-	    # element separator
-	    if {$state eq "COMMA"} {
-		getc
-		if {[info exists listVal]} {
-		    set state LIST
-		} elseif {[info exists dictVal]} {
-		    set state OBJECT
-		}
-	    } else {
-		return -code error "unexpected comma in $state mode"
-	    }
-	} elseif {$c eq "\""} {
-	    # string
-	    # capture quoted string with backslash sequences
-	    set reStr {(?:(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\"))}
-	    set string ""
-	    if {![regexp $reStr $txt string]} {
-		set txt [string replace $txt 32 end ...]
-		return -code error "invalid formatted string in $txt"
-	    }
-	    set txt [string range $txt [string length $string] end]
-	    # chop off outer ""s and substitute backslashes
-	    # This does more than the RFC-specified backslash sequences,
-	    # but it does cover them all
-	    set string [subst -nocommand -novariable \
-			    [string range $string 1 end-1]]
-
-	    switch -- $state {
-		TOP {
-		    return $string
-		}
-		OBJECT {
-		    set name $string
-		    set state COLON
-		}
-		LIST {
-		    lappend listVal $string
-		    set state COMMA
-		}
-		VALUE {
-		    dict set dictVal $name $string
-		    unset name
-		    set state COMMA
-		}
-	    }
-	} elseif {$c eq "\["} {
-	    # JSON array == Tcl list
-	    switch -- $state {
-		TOP {
-		    getc
-		    set state LIST
-		}
-		LIST {
-		    lappend listVal [_json2dict]
-		    set state COMMA
-		}
-		VALUE {
-		    dict set dictVal $name [_json2dict]
-		    set state COMMA
-		}
-		default {
-		    return -code error "unexpected open bracket in $state mode"
-		}
-	    }
-	} elseif {$c eq "\]"} {
-	    # end of list
-	    getc
-	    if {![info exists listVal]} {
-		#return -code error "unexpected close bracket in $state mode"
-		# must be an empty list
-		return ""
-	    }
-
-	    return $listVal
-	} elseif {0 && $c eq "/"} {
-	    # comment
-	    # XXX: Not in RFC 4627
-	    getc
-	    set c [getc]
-	    switch -- $c {
-		/ {
-		    # // comment form
-		    set i [string first "\n" $txt]
-		    if {$i == -1} {
-			set txt ""
-		    } else {
-			set txt [string range $txt [incr i] end]
-		    }
-		}
-		* {
-		    # /* comment */ form
-		    getc
-		    set i [string first "*/" $txt]
-		    if {$i == -1} {
-			return -code error "incomplete /* comment"
-		    } else {
-			set txt [string range $txt [incr i] end]
-		    }
-		}
-		default {
-		    return -code error "unexpected slash in $state mode"
-		}
-	    }
-	} elseif {[string match {[-0-9]} $c]} {
-	    # one last check for a number, no leading zeros allowed,
-	    # but it may be 0.xxx
-	    string is double -failindex last $txt
-	    if {$last > 0} {
-		set num [string range $txt 0 [expr {$last - 1}]]
-		set txt [string range $txt $last end]
-
-		switch -- $state {
-		    TOP {
-			return $num
-		    }
-		    LIST {
-			lappend listVal $num
-			set state COMMA
-		    }
-		    VALUE {
-			dict set dictVal $name $num
-			set state COMMA
-		    }
-		    default {
-			getc
-			return -code error "unexpected number '$c' in $state mode"
-		    }
-		}
-	    } else {
-		getc
-		return -code error "unexpected '$c' in $state mode"
-	    }
-	} elseif {[string match {[ftn]} $c]
-		  && [regexp {^(true|false|null)} $txt val]} {
-	    # bare word value: true | false | null
-	    set txt [string range $txt [string length $val] end]
-
-	    switch -- $state {
-		TOP {
-		    return $val
-		}
-		LIST {
-		    lappend listVal $val
-		    set state COMMA
-		}
-		VALUE {
-		    dict set dictVal $name $val
-		    set state COMMA
-		}
-		default {
-		    getc
-		    return -code error "unexpected '$c' in $state mode"
-		}
-	    }
-	} else {
-	    # error, incorrect format or unexpected end of text
-	    return -code error "unexpected '$c' in $state mode"
-	}
-    }
-}
-
-proc json::dict2json {dictVal} {
-    # XXX: Currently this API isn't symmetrical, as to create proper
-    # XXX: JSON text requires type knowledge of the input data
-    set json ""
-
-    dict for {key val} $dictVal {
-	# key must always be a string, val may be a number, string or
-	# bare word (true|false|null)
-	if {0 && ![string is double -strict $val]
-	    && ![regexp {^(?:true|false|null)$} $val]} {
-	    set val "\"$val\""
-	}
-    	append json "\"$key\": $val," \n
-    }
-
-    return "\{${json}\}"
-}
-
-proc json::list2json {listVal} {
-    return "\[$[join $listVal ,]\]"
-}
-
-proc json::string2json {str} {
-    return "\"$str\""
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/json/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/json/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded json 1.0 [list source [file join $dir json.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ldap/ldap.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ldap/ldap.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1857 +1,0 @@
-#-----------------------------------------------------------------------------
-#   Copyright (C) 1999-2004 Jochen C. Loewer (loewerj@web.de)
-#   Copyright (C) 2006      Michael Schlenker (mic42@users.sourceforge.net)    
-#-----------------------------------------------------------------------------
-#
-#   A (partial) LDAPv3 protocol implementation in plain Tcl.
-#
-#   See RFC 2251 and ASN.1 (X.680) and BER (X.690).
-#
-#
-#   This software is copyrighted by Jochen C. Loewer (loewerj@web.de). The
-#   following terms apply to all files associated with the software unless
-#   explicitly disclaimed in individual files.
-#
-#   The authors hereby grant permission to use, copy, modify, distribute,
-#   and license this software and its documentation for any purpose, provided
-#   that existing copyright notices are retained in all copies and that this
-#   notice is included verbatim in any distributions. No written agreement,
-#   license, or royalty fee is required for any of the authorized uses.
-#   Modifications to this software may be copyrighted by their authors
-#   and need not follow the licensing terms described here, provided that
-#   the new terms are clearly indicated on the first page of each file where
-#   they apply.
-#
-#   IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-#   FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-#   ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-#   DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-#   POSSIBILITY OF SUCH DAMAGE.
-#
-#   THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-#   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-#   FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-#   IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-#   NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-#   MODIFICATIONS.
-#
-#   $Id: ldap.tcl,v 1.23 2006/11/15 19:28:03 mic42 Exp $
-#
-#   written by Jochen Loewer
-#   3 June, 1999
-#
-#-----------------------------------------------------------------------------
-
-package require Tcl 8.4
-package require asn 0.7
-package provide ldap 1.6.8
-
-namespace eval ldap {
-
-    namespace export    connect secure_connect  \
-                        disconnect              \
-                        bind unbind             \
-                        bindSASL                \
-                        search                  \
-                        searchInit           	\
-		        searchNext	        \
-		        searchEnd		\
-                        modify                  \
-                        modifyMulti             \
-                        add                     \
-		        addMulti		\
-                        delete                  \
-                        modifyDN		\
-		        info
-
-    namespace import ::asn::*
-    
-    variable SSLCertifiedAuthoritiesFile
-    variable doDebug
-
-    set doDebug 0
-   
-    # LDAP result codes from the RFC
-    variable resultCode2String
-    array set resultCode2String {
-         0  success
-         1  operationsError
-         2  protocolError
-         3  timeLimitExceeded
-         4  sizeLimitExceeded
-         5  compareFalse
-         6  compareTrue
-         7  authMethodNotSupported
-         8  strongAuthRequired
-        10  referral
-        11  adminLimitExceeded
-        12  unavailableCriticalExtension
-        13  confidentialityRequired
-        14  saslBindInProgress
-        16  noSuchAttribute
-        17  undefinedAttributeType
-        18  inappropriateMatching
-        19  constraintViolation
-        20  attributeOrValueExists
-        21  invalidAttributeSyntax
-        32  noSuchObject
-        33  aliasProblem
-        34  invalidDNSyntax
-        35  isLeaf
-        36  aliasDereferencingProblem
-        48  inappropriateAuthentication
-        49  invalidCredentials
-        50  insufficientAccessRights
-        51  busy
-        52  unavailable
-        53  unwillingToPerform
-        54  loopDetect
-        64  namingViolation
-        65  objectClassViolation
-        66  notAllowedOnNonLeaf
-        67  notAllowedOnRDN
-        68  entryAlreadyExists
-        69  objectClassModsProhibited
-        80  other
-    }
-    
-}
-
-
-#-----------------------------------------------------------------------------
-#    Lookup an numerical ldap result code and return a string version
-#
-#-----------------------------------------------------------------------------
-proc ::ldap::resultCode2String {code} {
-    variable resultCode2String
-    if {[::info exists resultCode2String($code)]} {
-	    return $resultCode2String($code)
-    } else {
-	    return "unknownError"
-    }
-}
-
-#-----------------------------------------------------------------------------
-#   Basic sanity check for connection handles
-#   must be an array
-#-----------------------------------------------------------------------------
-proc ::ldap::CheckHandle {handle} {
-    if {![array exists $handle]} {
-        return -code error \
-            [format "Not a valid LDAP connection handle: %s" $handle]
-    }
-}
-
-#-----------------------------------------------------------------------------
-#    info
-#
-#-----------------------------------------------------------------------------
-
-proc ldap::info {args} {
-   set cmd [lindex $args 0]
-   set cmds {connections bound bounduser control extensions features ip saslmechanisms tls whoami}
-   if {[llength $args] == 0} {
-   	return -code error \
-		"Usage: \"info subcommand ?handle?\""    
-   }
-   if {[lsearch -exact $cmds $cmd] == -1} {
-   	return -code error \
-		"Invalid subcommand \"$cmd\", valid commands are\
-		[join [lrange $cmds 0 end-1] ,] and [lindex $cmds end]" 
-   }
-   eval [linsert [lrange $args 1 end] 0 ldap::info_$cmd]    
-}
-
-#-----------------------------------------------------------------------------
-#    get the ip address of the server we connected to
-# 
-#-----------------------------------------------------------------------------
-proc ldap::info_ip {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info ip handle"
-   }
-   CheckHandle [lindex $args 0]
-   upvar #0 [lindex $args 0] conn
-   if {![::info exists conn(sock)]} {
-   	return -code error \
-		"\"[lindex $args 0]\" is not a ldap connection handle"
-   }
-   return [lindex [fconfigure $conn(sock) -peername] 0]
-}
-
-#-----------------------------------------------------------------------------
-#   get the list of open ldap connections
-#
-#-----------------------------------------------------------------------------
-proc ldap::info_connections {args} {
-   if {[llength $args] != 0} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info connections"   
-   }
-   return [::info vars ::ldap::ldap*]
-}
-
-#-----------------------------------------------------------------------------
-#   check if the connection is bound
-#
-#-----------------------------------------------------------------------------
-proc ldap::info_bound {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info bound handle"
-   }
-   CheckHandle [lindex $args 0]
-   upvar #0 [lindex $args 0] conn
-   if {![::info exists conn(bound)]} {
-   	return -code error \
-		"\"[lindex $args 0]\" is not a ldap connection handle"
-   }
-   
-   return $conn(bound)
-}
-
-#-----------------------------------------------------------------------------
-#   check with which user the connection is bound
-#
-#-----------------------------------------------------------------------------
-proc ldap::info_bounduser {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info bounduser handle"
-   }
-   CheckHandle [lindex $args 0]   
-   upvar #0 [lindex $args 0] conn
-   if {![::info exists conn(bound)]} {
-   	return -code error \
-		"\"[lindex $args 0]\" is not a ldap connection handle"
-   }
-   
-   return $conn(bounduser)
-}
-
-#-----------------------------------------------------------------------------
-#   check if the connection uses tls
-#
-#-----------------------------------------------------------------------------
-
-proc ldap::info_tls {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info tls handle"
-   }
-   CheckHandle [lindex $args 0]   
-   upvar #0 [lindex $args 0] conn
-   if {![::info exists conn(tls)]} {
-   	return -code error \
-		"\"[lindex $args 0]\" is not a ldap connection handle"
-   }
-   return $conn(tls)
-}
-
-proc ldap::info_saslmechanisms {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info saslmechanisms handle"
-   }
-   return [Saslmechanisms [lindex $args 0]]
-}
-
-proc ldap::info_extensions {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info extensions handle"
-   }
-   return [Extensions [lindex $args 0]]
-}
-
-proc ldap::info_control {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info control handle"
-   }
-   return [Control [lindex $args 0]]
-}
-
-proc ldap::info_features {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info features handle"
-   }
-   return [Features [lindex $args 0]]
-}
-
-proc ldap::info_whoami {args} {
-   if {[llength $args] != 1} {
-   	return -code error \
-	       "Wrong # of arguments. Usage: ldap::info whoami handle"
-   }
-   return [Whoami [lindex $args 0]]
-}
-
-
-#-----------------------------------------------------------------------------
-# Basic server introspection support
-#
-#-----------------------------------------------------------------------------
-proc ldap::Saslmechanisms {conn} {
-    CheckHandle $conn
-    lindex [ldap::search $conn {} {(objectClass=*)} \
-                    {supportedSASLMechanisms} -scope base] 0 1 1
-}
-
-proc ldap::Extensions {conn} {
-    CheckHandle $conn
-    lindex [ldap::search $conn {} {(objectClass=*)} \
-                    {supportedExtension} -scope base] 0 1 1
-}
-
-proc ldap::Control {conn} {
-    CheckHandle $conn
-    lindex [ldap::search $conn {} {(objectClass=*)} \
-                    {supportedControl} -scope base] 0 1 1
-}
-
-proc ldap::Features {conn} {
-    CheckHandle $conn
-    lindex [ldap::search $conn {} {(objectClass=*)} \
-                    {supportedFeatures} -scope base] 0 1 1
-}
-
-#-------------------------------------------------------------------------------
-# Implements the RFC 4532 extension "Who am I?"
-#
-#-------------------------------------------------------------------------------
-proc ldap::Whoami {handle} {
-    CheckHandle $handle
-    if {[lsearch [ldap::Extensions $handle] 1.3.6.1.4.1.4203.1.11.3] == -1} {
-        return -code error \
-            "Server does not support the \"Who am I?\" extension"
-    }
-    
-    set request [asnApplicationConstr 23 [asnOctetString 1.3.6.1.4.1.4203.1.11.3]]
-    set mid [SendMessage $handle $request]
-    set response [WaitForResponse $handle $mid]
- 
-    asnGetApplication response appNum
-    if {$appNum != 24} {
-        return -code error \
-             "unexpected application number ($appNum != 24)"        
-    }
-    
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-    }
-    set whoami ""
-    if {[string length $response]} {
-        asnRetag response 0x04
-        asnGetOctetString response whoami
-    }
-    return $whoami
-}
-
-#-----------------------------------------------------------------------------
-#    connect
-#
-#-----------------------------------------------------------------------------
-proc ldap::connect { host {port 389} } {
-
-    #--------------------------------------
-    #   connect via TCP/IP
-    #--------------------------------------
-    set sock [socket $host $port]
-    fconfigure $sock -blocking no -translation binary -buffering full
-
-    #--------------------------------------
-    #   initialize connection array
-    #--------------------------------------
-    upvar #0 ::ldap::ldap$sock conn
-    catch { unset conn }
-
-    set conn(host)      $host
-    set conn(sock)      $sock
-    set conn(messageId) 0
-    set conn(tls)       0
-    set conn(bound)     0
-    set conn(bounduser) ""
-    set conn(saslBindInProgress) 0
-    set conn(tlsHandshakeInProgress) 0
-    set conn(lastError) ""
-    
-    fileevent $sock readable [list ::ldap::MessageReceiver ::ldap::ldap$sock]
-    return ::ldap::ldap$sock
-}
-
-#-----------------------------------------------------------------------------
-#    secure_connect
-#
-#-----------------------------------------------------------------------------
-proc ldap::secure_connect { host {port 636} } {
-
-    variable SSLCertifiedAuthoritiesFile
-
-    package require tls
-
-    #------------------------------------------------------------------
-    #   connect via TCP/IP
-    #------------------------------------------------------------------
-    set sock [socket $host $port]
-    fconfigure $sock -blocking no -translation binary -buffering full
-
-    #------------------------------------------------------------------
-    #   make it a SSL connection
-    #
-    #------------------------------------------------------------------
-    #tls::import $sock -cafile $SSLCertifiedAuthoritiesFile -ssl2 no -ssl3 yes -tls1 yes
-    tls::import $sock -cafile "" -certfile "" -keyfile "" \
-                      -request 1 -server 0 -require 0 -ssl2 no -ssl3 yes -tls1 yes
-    set retry 0
-    while {1} {
-        if {$retry > 20} {
-            close $sock
-            return -code error "too long retry to setup SSL connection"
-        }
-        if {[catch { tls::handshake $sock } err]} {
-            if {[string match "*resource temporarily unavailable*" $err]} {
-                after 50
-                incr retry
-            } else {
-                close $sock
-                return -code error $err
-            }
-        } else {
-            break
-        }
-    }
-
-    #--------------------------------------
-    #   initialize connection array
-    #--------------------------------------
-    upvar ::ldap::ldap$sock conn
-    catch { unset conn }
-
-    set conn(host)      $host
-    set conn(sock)      $sock
-    set conn(messageId) 0
-    set conn(tls)       1
-    set conn(bound)     0
-    set conn(bounduser) ""
-    set conn(saslBindInProgress) 0
-    set conn(tlsHandshakeInProgress) 0
-    set conn(lasterror) ""
-    
-    fileevent $sock readable [list ::ldap::MessageReceiver ::ldap::ldap$sock]
-    return ::ldap::ldap$sock
-}
-
-
-#------------------------------------------------------------------------------
-#    starttls -  negotiate tls on an open ldap connection
-#
-#------------------------------------------------------------------------------
-proc ldap::starttls {handle {cafile ""} {certfile ""} {keyfile ""}} {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-    
-    if {$conn(tls)} {
-        return -code error \
-            "Cannot StartTLS on connection, TLS already running"
-    }
-    
-    if {[ldap::waitingForMessages $handle]} {
-        return -code error \
-            "Cannot StartTLS while waiting for repsonses"
-    }
-    
-    if {$conn(saslBindInProgress)} {
-        return -code error \
-            "Cannot StartTLS while SASL bind in progress"
-    }
-    
-    if {[lsearch -exact [ldap::Extensions $handle] 1.3.6.1.4.1.1466.20037] == -1} {
-        return -code error \
-            "Server does not support the StartTLS extension"
-    }
-    package require tls
-    
-    
-    set request [asnApplicationConstr 23 [asnOctetString 1.3.6.1.4.1.1466.20037]]
-    set mid [SendMessage $handle $request]
-    set conn(tlsHandshakeInProgress) 1
-    set response [WaitForResponse $handle $mid]
- 
-    asnGetApplication response appNum
-    if {$appNum != 24} {
-        set conn(tlsHandshakeInProgress) 0
-        return -code error \
-             "unexpected application number ($appNum != 24)"        
-    }
-    
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        set conn(tlsHandshakeInProgress) 0
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-    }
-    set oid "1.3.6.1.4.1.1466.20037"
-    if {[string length $response]} {
-        asnRetag response 0x04
-        asnGetOctetString response oid
-    }
-    if {$oid ne "1.3.6.1.4.1.1466.20037"} {
-        set conn(tlsHandshakeInProgress) 0
-        return -code error \
-            "Unexpected LDAP response"
-    } 
-
-    tls::import $conn(sock) -cafile $cafile -certfile $certfile -keyfile $keyfile \
-                      -request 1 -server 0 -require 0 -ssl2 no -ssl3 yes -tls1 yes
-    set retry 0
-    while {1} {
-        if {$retry > 20} {
-            close $sock
-            return -code error "too long retry to setup SSL connection"
-        }
-        if {[catch { tls::handshake $conn(sock) } err]} {
-            if {[string match "*resource temporarily unavailable*" $err]} {
-                after 50
-                incr retry
-            } else {
-                close $conn(sock)
-                return -code error $err
-            }
-        } else {
-            break
-        }
-    }
-    set conn(tls) 1
-    set conn(tlsHandshakeInProgress) 0
-    return 1
-}
-
-
-
-#------------------------------------------------------------------------------
-#  Create a new unique message and send it over the socket.
-#
-#------------------------------------------------------------------------------
-
-proc ldap::CreateAndSendMessage {handle payload} {
-    upvar #0 $handle conn
-    
-    if {$conn(tlsHandshakeInProgress)} {
-        return -code error \
-            "Cannot send other LDAP PDU while TLS handshake in progress"
-    }
-    
-    incr conn(messageId)
-    set message [asnSequence [asnInteger $conn(messageId)] $payload]
-    debugData "Message $conn(messageId) Sent" $message
-    puts -nonewline $conn(sock) $message
-    flush $conn(sock)
-    return $conn(messageId)
-}
-
-#------------------------------------------------------------------------------
-#  Send a message to the server which expects a response,
-#  returns the messageId which is to be used with FinalizeMessage 
-#  and WaitForResponse
-#
-#------------------------------------------------------------------------------
-proc ldap::SendMessage {handle pdu} {
-    upvar #0 $handle conn
-    set mid [CreateAndSendMessage $handle $pdu] 
-    
-    # safe the state to match responses   
-    set conn(message,$mid) [list]
-    return $mid                
-}
-
-#------------------------------------------------------------------------------
-#  Send a message to the server without expecting a response
-#
-#------------------------------------------------------------------------------
-proc ldap::SendMessageNoReply {handle pdu} {
-    upvar #0 $handle conn
-    return [CreateAndSendMessage $handle $pdu]                
-}
-
-#------------------------------------------------------------------------------
-# Cleanup the storage associated with a messageId
-#
-#------------------------------------------------------------------------------
-proc ldap::FinalizeMessage {handle messageId} {
-    upvar #0 $handle conn
-    trace "Message $messageId finalized"
-    unset -nocomplain conn(message,$messageId)
-}
-
-#------------------------------------------------------------------------------
-#  Wait for a response for the given messageId.
-#
-#  This waits in a vwait if no message has yet been received or returns
-#  the oldest message at once, if it is queued.
-#
-#------------------------------------------------------------------------------
-proc ldap::WaitForResponse {handle messageId} {
-    upvar #0 $handle conn
-    
-    trace "Waiting for Message $messageId"
-    # check if the message waits for a reply
-    if {![::info exists conn(message,$messageId)]} {
-        return -code error \
-            [format "Cannot wait for message %d." $messageId]
-    }
-    
-    # check if we have a received response in the buffer
-    if {[llength $conn(message,$messageId)] > 0} {
-        set response [lindex $conn(message,$messageId) 0]
-        set conn(message,$messageId) [lrange $conn(message,$messageId) 1 end]
-        return $response
-    }
-    
-    # wait for an incoming response
-    vwait [namespace which -variable $handle](message,$messageId)
-    if {[llength $conn(message,$messageId)] == 0} {
-        # We have waited and have been awakended but no message is there
-        if {[string length $conn(lastError)]} {
-            return -code error \
-                [format "Protocol error: %s" $conn(lastError)]
-        } else {
-            return -code error \
-                [format "Broken response for message %d" $messageId]
-        }
-    }
-    set response [lindex $conn(message,$messageId) 0]
-    set conn(message,$messageId) [lrange $conn(message,$messageId) 1 end]
-    return $response        
-}
-
-proc ldap::waitingForMessages {handle} {
-    upvar #0 $handle conn
-    return [llength [array names conn message,*]]
-}
-
-#------------------------------------------------------------------------------
-# Process a single response PDU. Decodes the messageId and puts the
-# message into the appropriate queue.
-#
-#------------------------------------------------------------------------------
-
-proc ldap::ProcessMessage {handle response} {
-    upvar #0 $handle conn
-
-    # decode the messageId
-    asnGetInteger  response messageId
-    
-    # check if we wait for a response
-    if {[::info exists conn(message,$messageId)]} {
-        # append the new message, which triggers 
-        # message handlers using vwait on the entry
-        lappend conn(message,$messageId) $response
-        return
-    }
-    
-    # handle unsolicited server responses
-    
-    if {0} {
-        asnGetApplication response appNum
-        #if { $appNum != 24 } {
-        #     error "unexpected application number ($appNum != 24)"
-        #}
-        asnGetEnumeration response resultCode
-        asnGetOctetString response matchedDN
-        asnGetOctetString response errorMessage
-        if {[string length $response]} {
-            asnGetOctetString response responseName
-        }
-        if {[string length $response]} {
-            asnGetOctetString response responseValue
-        }
-        if {$resultCode != 0} {
-            return -code error \
-		    -errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		    "LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"    
-        }
-    }
-    #dumpASN1Parse $response
-    #error "Unsolicited message from server"
-    
-}
-
-#-------------------------------------------------------------------------------
-# Get the code out of waitForResponse in case of errors
-#
-#-------------------------------------------------------------------------------
-proc ldap::CleanupWaitingMessages {handle} {
-    upvar #0 $handle conn
-    foreach message [array names conn message,*] {
-        set conn($message) [list]
-    }
-}
-
-#-------------------------------------------------------------------------------
-#  The basic fileevent based message receiver.
-#  It reads PDU's from the network in a non-blocking fashion.
-#
-#-------------------------------------------------------------------------------
-proc ldap::MessageReceiver {handle} {
-    upvar #0 $handle conn
-    
-    # We have to account for partial PDUs received, so
-    # we keep some state information.
-    #
-    #   conn(pdu,partial)  -- we are reading a partial pdu if non zero
-    #   conn(pdu,length_bytes) -- the buffer for loading the length
-    #   conn(pdu,length)   -- we have decoded the length if >= 0, if <0 it contains 
-    #                         the length of the length encoding in bytes
-    #   conn(pdu,payload)  -- the payload buffer
-    #   conn(pdu,received) -- the data received
-    
-    # fetch the sequence byte
-    if {[::info exists conn(pdu,partial)] && $conn(pdu,partial) != 0} {
-        # we have decoded at least the type byte    
-    } else {
-        foreach {code type} [ReceiveBytes $conn(sock) 1] {break}
-        switch -- $code {
-            ok {
-                binary scan $type c byte
-                set type [expr {($byte + 0x100) % 0x100}]  
-                if {$type != 0x30} {
-                    CleanupWaitingMessages $handle
-                    set conn(lastError) [format "Expected SEQUENCE (0x30) but got %x" $type]
-                    return
-                } else {
-                    set conn(pdu,partial) 1
-                    append conn(pdu,received) $type
-                }
-                }
-            eof {
-                CleanupWaitingMessages $handle
-                set conn(lastError) "Server closed connection"
-                catch {close $conn(sock)}
-                return
-            } 
-            default {
-                CleanupWaitingMessages $handle
-                set bytes $type[read $conn(sock)]
-                binary scan $bytes h* values
-                set conn(lastError) [format \
-                    "Error reading SEQUENCE response for handle %s : %s : %s" $handle $code $values]
-                return
-                }
-        }
-    }
-    
-    
-    # fetch the length
-    if {[::info exists conn(pdu,length)] && $conn(pdu,length) >= 0} {
-        # we already have a decoded length
-    } else {
-        if {[::info exists conn(pdu,length)] && $conn(pdu,length) < 0} {
-            # we already know the length, but have not received enough bytes to decode it
-            set missing [expr {1+abs($conn(pdu,length))-[string length $conn(pdu,length_bytes)]}]
-            if {$missing != 0} {
-                foreach {code bytes} [ReceiveBytes $conn(sock) $missing] {break}
-                switch -- $code {
-                    "ok"  {
-                        append conn(pdu,length_bytes) $bytes
-                        append conn(pdu,received) $bytes
-                        asnGetLength conn(pdu,length_bytes) conn(pdu,length)
-                    }
-                    "partial" {
-                        append conn(pdu,length_bytes) $bytes
-                        append conn(pdu,received) $bytes
-                        return
-                    }
-                    "eof" {
-                        CleanupWaitingMessages $handle            
-                        catch {close $conn(sock)}
-                        set conn(lastError) "Server closed connection"
-                        return
-                    } 
-                    default {
-                        CleanupWaitingMessages $handle            
-                        set conn(lastError) [format \
-                            "Error reading LENGTH2 response for handle %s : %s" $handle $code]
-                        return
-                    }
-                }
-            }
-        } else {
-            # we know nothing, need to read the first length byte
-            foreach {code bytes} [ReceiveBytes $conn(sock) 1] {break}
-            switch -- $code {
-                "ok"  {
-                    set conn(pdu,length_bytes) $bytes
-                    binary scan $bytes c byte
-                    set size [expr {($byte + 0x100) % 0x100}]  
-                    if {$size > 0x080} {
-                        set conn(pdu,length) [expr {-1* ($size & 0x7f)}]
-                        # fetch the rest with the next fileevent
-                        return 
-                    } else {
-                        asnGetLength conn(pdu,length_bytes) conn(pdu,length)
-                    }
-                }
-                "eof" {
-                    CleanupWaitingMessages $handle            
-                    catch {close $conn(sock)}
-                    set conn(lastError) "Server closed connection"
-                }                 
-                default {
-                    CleanupWaitingMessages $handle            
-                    set conn(lastError) [format \
-                        "Error reading LENGTH1 response for handle %s : %s" $handle $code]
-                    return
-                }       
-            }
-        }
-    }
-    
-    if {[::info exists conn(pdu,payload)]} {
-        # length is decoded, we can read the rest
-        set missing [expr {$conn(pdu,length) - [string length $conn(pdu,payload)]}]
-    } else {
-        set missing $conn(pdu,length)
-    }
-    if {$missing > 0} {
-        foreach {code bytes} [ReceiveBytes $conn(sock) $missing] {break}
-        switch -- $code {
-            "ok" {
-                append conn(pdu,payload) $bytes
-            }
-            "partial" {
-                append conn(pdu,payload) $bytes
-                return
-            }
-            "eof" {
-                CleanupWaitingMessages $handle            
-                catch {close $conn(sock)}
-                set conn(lastError) "Server closed connection"
-            }             
-            default {
-                CleanupWaitingMessages $handle            
-                set conn(lastError) [format \
-                    "Error reading DATA response for handle %s : %s" $handle $code]
-                return
-            }
-        }
-    }
-    
-    # we have a complete PDU, push it for processing
-    set pdu $conn(pdu,payload)
-    set conn(pdu,payload) ""
-    set conn(pdu,partial) 0
-    unset -nocomplain set conn(pdu,length) 
-    set conn(pdu,length_bytes) ""    
-   
-    # reschedule message Processing
-    after 0 [list ::ldap::ProcessMessage $handle $pdu]
-}
-
-#-------------------------------------------------------------------------------
-# Receive the number of bytes from the socket and signal error conditions.
-#
-#-------------------------------------------------------------------------------
-proc ldap::ReceiveBytes {sock bytes} {
-    set status [catch {read $sock $bytes} block]
-    if { $status != 0 } {
-        return [list error $block]
-    } elseif { [string length $block] == $bytes } {
-        # we have all bytes we wanted
-        return [list ok $block]
-    } elseif { [eof $sock] } {
-        return [list eof $block]
-    } elseif { [fblocked $sock] || ([string length $block] < $bytes)} {
-        return [list partial $block]
-    } else {
-        error "Socket state for socket $sock undefined!" 
-    }  
-}
-
-#-----------------------------------------------------------------------------
-#    bindSASL  -  does a bind with SASL authentication
-#-----------------------------------------------------------------------------
-
-proc ldap::bindSASL {handle {name ""} {password ""} } {
-    CheckHandle $handle
-
-    package require SASL
-    
-    upvar #0 $handle conn
-    
-    set mechs [ldap::Saslmechanisms $handle]
-    
-    set conn(saslBindInProgress) 1    
-    set auth 0
-    foreach mech [SASL::mechanisms] {
-        if {[lsearch -exact $mechs $mech] == -1} { continue }
-        trace "Using $mech for SASL Auth"
-        if {[catch {
-            SASLAuth $handle $mech $name $password
-        } msg]} {
-            trace [format "AUTH %s failed: %s" $mech $msg]
-        } else {
-	   # AUTH was successful 
-	   if {$msg == 1} {
-	       set auth 1
-	       break
-	   }
-	}    
-    }        
-    
-    set conn(saslBindInProgress) 0
-    return $auth
-}
-
-#-----------------------------------------------------------------------------
-#    SASLCallback - Callback to use for SASL authentication
-#
-#    More or less cut and copied from the smtp module.
-#    May need adjustments for ldap.
-#
-#-----------------------------------------------------------------------------
-proc ::ldap::SASLCallback {handle context command args} {
-    upvar #0 $handle conn
-    upvar #0 $context ctx
-    array set options $conn(options)
-    trace "SASLCallback $command"
-    switch -exact -- $command {
-        login    { return $options(-username) }
-        username { return $options(-username) }
-        password { return $options(-password) }
-        hostname { return [::info hostname] }
-        realm    { 
-            if {[string equal $ctx(mech) "NTLM"] \
-                    && [info exists ::env(USERDOMAIN)]} {
-                return $::env(USERDOMAIN)
-            } else {
-                return ""
-            }
-        }
-        default  { 
-            return -code error "error: unsupported SASL information requested"
-        }
-    }
-}
-
-#-----------------------------------------------------------------------------
-#    SASLAuth - Handles the actual SASL message exchange
-#
-#-----------------------------------------------------------------------------
-
-proc ldap::SASLAuth {handle mech name password} {
-    upvar 1 $handle conn
-    
-    set conn(options) [list -password $password -username $name]
-
-    # check for tcllib bug # 1545306 and reset the nonce-count if 
-    # found, so a second call to this code does not fail
-    #
-    if {[::info exists ::SASL::digest_md5_noncecount]} {
-        set ::SASL::digest_md5_noncecount 0
-    }
-    
-    set ctx [SASL::new -mechanism $mech \
-                       -service ldap    \
-                       -callback [list ::ldap::SASLCallback $handle]]
-
-    set msg(serverSASLCreds) ""
-    # Do the SASL Message exchanges
-    while {[SASL::step $ctx $msg(serverSASLCreds)]} {
-        # Create and send the BindRequest
-        set request [buildSASLBindRequest "" $mech [SASL::response $ctx]]
-        set messageId [SendMessage $handle $request]
-        debugData bindRequest $request
-        
-        set response [WaitForResponse $handle $messageId]
-        FinalizeMessage $handle $messageId
-        debugData bindResponse $response
-        
-        array set msg [decodeSASLBindResponse $handle $response]
-        
-	# Check for Bind success
-        if {$msg(resultCode) == 0} { 
-            set conn(bound) 1
-            set conn(bounduser) $name
-            SASL::cleanup $ctx
-            break        
-        }
-        
-	# Check if next SASL step is requested
-        if {$msg(resultCode) == 14} {
-            continue
-        }
-	
-        SASL::cleanup $ctx
-        # Something went wrong
-        return 	-code error \
-		-errorcode [list LDAP [resultCode2String $msg(resultCode)] \
-				 $msg(matchedDN) $msg(errorMessage)] \
-		"LDAP error [resultCode2String $msg(resultCode)] '$msg(matchedDN)': $msg(errorMessage)"
-    }
-    
-    return 1
-}
-
-#----------------------------------------------------------------------------
-#
-# Create a LDAP BindRequest using SASL
-#
-#----------------------------------------------------------------------------
-
-proc ldap::buildSASLBindRequest {name mech {credentials {}}} {
-    if {$credentials ne {}} {
-       set request [  asnApplicationConstr 0            		\
-            [asnInteger 3]                 		\
-            [asnOctetString $name]         		\
-            [asnChoiceConstr 3                   	\
-                    [asnOctetString $mech]      	\
-                    [asnOctetString $credentials] 	\
-            ]  \                            		                                      
-        ] 
-    } else {  
-    set request [   asnApplicationConstr 0            		\
-        [asnInteger 3]                 		\
-        [asnOctetString $name]         		\
-        [asnChoiceConstr 3                   	\
-                [asnOctetString $mech]      	\
-        ] \
-        ]                              		                                      
-    }
-    return $request
-}
-
-#-------------------------------------------------------------------------------
-#
-# Decode an LDAP BindResponse
-#
-#-------------------------------------------------------------------------------
-proc ldap::decodeSASLBindResponse {handle response} {
-    upvar #0 $handle conn
-
-    asnGetApplication response appNum
-    if { $appNum != 1 } {
-        error "unexpected application number ($appNum != 1)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-
-    # Check if we have a serverSASLCreds field left,
-    # or if this is a simple response without it
-    # probably an error message then.
-    if {[string length $response]} {
-        asnRetag response 0x04
-        asnGetOctetString response serverSASLCreds
-    } else {
-        set serverSASLCreds ""
-    } 
-    return [list appNum $appNum \
-                 resultCode $resultCode matchedDN $matchedDN \
-                 errorMessage $errorMessage serverSASLCreds $serverSASLCreds]
-}
-
-
-#-----------------------------------------------------------------------------
-#    bind  -  does a bind with simple authentication
-#
-#-----------------------------------------------------------------------------
-proc ldap::bind { handle {name ""} {password ""} } {
-    CheckHandle $handle
-    
-    upvar #0 $handle conn
-
-    #-----------------------------------------------------------------
-    #   marshal bind request packet and send it
-    #
-    #-----------------------------------------------------------------
-    set request [asnApplicationConstr 0                \
-                        [asnInteger 3]                 \
-                        [asnOctetString $name]         \
-                        [asnChoice 0 $password]        \
-                ]                                  
-    set messageId [SendMessage $handle $request]            
-    debugData bindRequest $request
-    
-    set response [WaitForResponse $handle $messageId]
-    FinalizeMessage $handle $messageId
-    debugData bindResponse $response
-    
-    asnGetApplication response appNum
-    if { $appNum != 1 } {
-        error "unexpected application number ($appNum != 1)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-    }
-    set conn(bound) 1
-    set conn(bounduser) $name
-}
-
-
-#-----------------------------------------------------------------------------
-#    unbind
-#
-#-----------------------------------------------------------------------------
-proc ldap::unbind { handle } {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    #------------------------------------------------
-    #   marshal unbind request packet and send it
-    #------------------------------------------------
-    set request [asnApplication 2 ""]         
-    SendMessageNoReply $handle $request
-    
-    set conn(bounduser) ""
-    set conn(bound) 0
-    close $conn(sock)
-    set conn(sock) ""
-}
-
-
-#-----------------------------------------------------------------------------
-#    buildUpFilter  -   parses the text representation of LDAP search
-#                       filters and transforms it into the correct
-#                       marshalled representation for the search request
-#                       packet
-#
-#-----------------------------------------------------------------------------
-proc ldap::buildUpFilter { filter } {
-
-    set first [lindex $filter 0]
-    set data ""
-    switch -regexp -- $first {
-        ^\\&$ {  #--- and -------------------------------------------
-            foreach term [lrange $filter 1 end] {
-                append data [buildUpFilter $term]
-            }
-            return [asnChoiceConstr 0 $data]
-        }
-        ^\\|$ {  #--- or --------------------------------------------
-            foreach term [lrange $filter 1 end] {
-                append data [buildUpFilter $term]
-            }
-            return [asnChoiceConstr 1 $data]
-        }
-        ^\\!$ {  #--- not -------------------------------------------
-            return [asnChoiceConstr 2 [buildUpFilter [lindex $filter 1]]]
-        }
-        =\\*$ {  #--- present ---------------------------------------
-            set endpos [expr {[string length $first] -3}]
-            set attributetype [string range $first 0 $endpos]
-            return [asnChoice 7 $attributetype]
-        }
-        ^[0-9A-z.]*~= {  #--- approxMatch --------------------------
-            regexp {^([0-9A-z.]*)~=(.*)$} $first all attributetype value
-            return [asnChoiceConstr 8 [asnOctetString $attributetype] \
-                                      [asnOctetString $value]         ]
-        }
-        ^[0-9A-z.]*<= {  #--- lessOrEqual --------------------------
-            regexp {^([0-9A-z.]*)<=(.*)$} $first all attributetype value
-            return [asnChoiceConstr 6 [asnOctetString $attributetype] \
-                                      [asnOctetString $value]         ]
-        }
-        ^[0-9A-z.]*>= {  #--- greaterOrEqual -----------------------
-            regexp {^([0-9A-z.]*)>=(.*)$} $first all attributetype value
-            return [asnChoiceConstr 5 [asnOctetString $attributetype] \
-                                      [asnOctetString $value]         ]
-        }
-        ^[0-9A-z.]*=.*\\*.* {  #--- substrings -----------------
-            regexp {^([0-9A-z.]*)=(.*)$} $first all attributetype value
-            regsub -all {\*+} $value {*} value
-            set value [split $value "*"]
-            
-            set firstsubstrtype 0       ;# initial
-            set lastsubstrtype  2       ;# final
-            if {[string equal [lindex $value 0] ""]} {
-                set firstsubstrtype 1       ;# any
-                set value [lreplace $value 0 0]
-            }
-            if {[string equal [lindex $value end] ""]} {
-                set lastsubstrtype 1        ;# any
-                set value [lreplace $value end end]
-            }
-        
-            set n [llength $value]
-        
-            set i 1
-            set l {}
-            set substrtype 0            ;# initial
-            foreach str $value {
-            if {$i == 1 && $i == $n} {
-                if {$firstsubstrtype == 0} {
-                set substrtype 0    ;# initial
-                } elseif {$lastsubstrtype == 2} {
-                set substrtype 2    ;# final
-                } else {
-                set substrtype 1    ;# any
-                }
-            } elseif {$i == 1} {
-                set substrtype $firstsubstrtype
-            } elseif {$i == $n} {
-                set substrtype $lastsubstrtype
-            } else {
-                set substrtype 1        ;# any
-            }
-            lappend l [asnChoice $substrtype $str]
-            incr i
-            }
-            return [asnChoiceConstr 4 [asnOctetString $attributetype]     \
-                      [asnSequenceFromList $l] ]
-        }
-        ^[0-9A-z.]*= {  #--- equal ---------------------------------
-            regexp {^([0-9A-z.]*)=(.*)$} $first all attributetype value
-            trace "equal: attributetype='$attributetype' value='$value'"
-            return [asnChoiceConstr 3 [asnOctetString $attributetype] \
-                                      [asnOctetString $value]         ]
-        }
-        default {
-            return [buildUpFilter $first]
-            #error "cant handle $first for filter part"
-        }
-    }
-}
-
-#-----------------------------------------------------------------------------
-#    search  -  performs a LDAP search below the baseObject tree using a
-#               complex LDAP search expression (like "|(cn=Linus*)(sn=Torvalds*)"
-#               and returns all matching objects (DNs) with given attributes
-#               (or all attributes if empty list is given) as list:
-#
-#  {dn1 { attr1 {val11 val12 ...} attr2 {val21 val22 ... } ... }} {dn2 { ... }} ...
-#
-#-----------------------------------------------------------------------------
-proc ldap::search { handle baseObject filterString attributes args} {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    searchInit $handle $baseObject $filterString $attributes $args
-
-    set results    {}
-    set lastPacket 0
-    while { !$lastPacket } {
-
-	set r [searchNext $handle]
-	if {[llength $r] > 0} then {
-	    lappend results $r
-	} else {
-	    set lastPacket 1
-	}
-    }
-    searchEnd $handle
-
-    return $results
-}
-#-----------------------------------------------------------------------------
-#    searchInProgress - checks if a search is in progress
-#
-#-----------------------------------------------------------------------------
-
-proc ldap::searchInProgress {handle} {
-   CheckHandle $handle
-   upvar #0 $handle conn
-   if {[::info exists conn(searchInProgress)]} {
-   	return $conn(searchInProgress)
-   } else {
-       	return 0
-   }	   
-}
-
-#-----------------------------------------------------------------------------
-#    searchInit - initiates an LDAP search
-#
-#-----------------------------------------------------------------------------
-proc ldap::searchInit { handle baseObject filterString attributes opt} {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    if {[searchInProgress $handle]} {
-        return -code error \
-            "Cannot start search. Already a search in progress for this handle."    
-    }
-    
-    set scope        2
-    set derefAliases 0
-    set sizeLimit    0
-    set timeLimit    0
-    set attrsOnly    0
-
-    foreach {key value} $opt {
-        switch -- [string tolower $key] {
-            -scope {
-                switch -- $value {
-                   base 		{ set scope 0 }
-                   one - onelevel 	{ set scope 1 }
-                   sub - subtree 	{ set scope 2 }
-                   default {  }
-                }
-            }
-	    -derefaliases {
-		switch -- $value {
-		    never 	{ set derefAliases 0 }
-		    search 	{ set derefAliases 1 }
-		    find 	{ set derefAliases 2 }
-		    always 	{ set derefAliases 3 }
-		    default { }
-		}
-	    }
-	    -sizelimit {
-		set sizeLimit $value
-	    }
-	    -timelimit {
-		set timeLimit $value
-	    }
-	    -attrsonly {
-		set attrsOnly $value
-	    }
-	    default {
-		return -code error \
-			"Invalid search option '$key'"
-	    }
-        }
-    }
-    
-    set request [buildSearchRequest $baseObject $scope \
-    			$derefAliases $sizeLimit $timeLimit $attrsOnly $filterString \
-			$attributes]
-    set messageId [SendMessage $handle $request]
-    debugData searchRequest $request
-    
-    # Keep the message Id, so we know about the search
-    set conn(searchInProgress) $messageId
-
-    return $conn(searchInProgress)
-}
-
-proc ldap::buildSearchRequest {baseObject scope derefAliases
-    			       sizeLimit timeLimit attrsOnly filterString
-			       attributes} {
-    #----------------------------------------------------------
-    #   marshal filter and attributes parameter
-    #----------------------------------------------------------
-    regsub -all {\(} $filterString " \{" filterString
-    regsub -all {\)} $filterString "\} " filterString
-
-    set berFilter [buildUpFilter $filterString]
-
-    set berAttributes ""
-    foreach attribute $attributes {
-        append berAttributes [asnOctetString $attribute]
-    }
-
-    #----------------------------------------------------------
-    #   marshal search request packet and send it
-    #----------------------------------------------------------
-    set request [asnApplicationConstr 3             \
-                        [asnOctetString $baseObject]    \
-                        [asnEnumeration $scope]         \
-                        [asnEnumeration $derefAliases]  \
-                        [asnInteger     $sizeLimit]     \
-                        [asnInteger     $timeLimit]     \
-                        [asnBoolean     $attrsOnly]     \
-                        $berFilter                      \
-                        [asnSequence    $berAttributes] \
-                ]                                   
-                
-}
-#-----------------------------------------------------------------------------
-#    searchNext - returns the next result of an LDAP search
-#
-#-----------------------------------------------------------------------------
-proc ldap::searchNext { handle } {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    if {! [::info exists conn(searchInProgress)]} then {
-	return -code error \
-	    "No search in progress"
-    }
-
-    set result {}
-    set lastPacket 0
-
-    #----------------------------------------------------------
-    #   Wait for a search response packet
-    #----------------------------------------------------------
-
-    set response [WaitForResponse $handle $conn(searchInProgress)]
-    debugData searchResponse $response
-
-    asnGetApplication response appNum
-
-    if {$appNum == 4} {
-        trace "Search Response Continue"
-	#----------------------------------------------------------
-	#   unmarshal search data packet
-	#----------------------------------------------------------
-	asnGetOctetString response objectName
-	asnGetSequence    response attributes
-	set result_attributes {}
-	while { [string length $attributes] != 0 } {
-	    asnGetSequence attributes attribute
-	    asnGetOctetString attribute attrType
-	    asnGetSet  attribute attrValues
-	    set result_attrValues {}
-	    while { [string length $attrValues] != 0 } {
-		asnGetOctetString attrValues attrValue
-		lappend result_attrValues $attrValue
-	    }
-	    lappend result_attributes $attrType $result_attrValues
-	}
-	set result [list $objectName $result_attributes]
-    } elseif {$appNum == 5} {
-        trace "Search Response Done"
-	#----------------------------------------------------------
-	#   unmarshal search final response packet
-	#----------------------------------------------------------
-	asnGetEnumeration response resultCode
-	asnGetOctetString response matchedDN
-	asnGetOctetString response errorMessage
-	set result {}
-	FinalizeMessage $handle $conn(searchInProgress)
-        unset conn(searchInProgress) 
-        
-	if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] : $errorMessage"
-	}
-    } else {
-	 error "unexpected application number ($appNum != 4 or 5)"
-    }
-
-    return $result
-}
-
-#-----------------------------------------------------------------------------
-#    searchEnd - end an LDAP search
-#
-#-----------------------------------------------------------------------------
-proc ldap::searchEnd { handle } {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    if {! [::info exists conn(searchInProgress)]} then {
-        # no harm done, just do nothing
-	return 
-    }
-    abandon $handle $conn(searchInProgress)	
-    FinalizeMessage $handle $conn(searchInProgress)
-    
-    unset conn(searchInProgress)
-    return
-}
-
-#-----------------------------------------------------------------------------
-# 
-#    Send an LDAP abandon message 
-#
-#-----------------------------------------------------------------------------    
-proc ldap::abandon {handle messageId} {
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-    trace "MessagesPending: [string length $conn(messageId)]"
-    set request [asnApplication 16      	\
-                        [asnInteger $messageId]         \
-                ]                                  	
-    SendMessageNoReply $handle $request                
-}
-
-#-----------------------------------------------------------------------------
-#    modify  -  provides attribute modifications on one single object (DN):
-#                 o replace attributes with new values
-#                 o delete attributes (having certain values)
-#                 o add attributes with new values
-#
-#-----------------------------------------------------------------------------
-proc ldap::modify { handle dn
-                    attrValToReplace { attrToDelete {} } { attrValToAdd {} } } {
-
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    set lrep {}
-    foreach {attr value} $attrValToReplace {
-	lappend lrep $attr [list $value]
-    }
-
-    set ldel {}
-    foreach {attr value} $attrToDelete {
-	if {[string equal $value ""]} then {
-	    lappend ldel $attr {}
-	} else {
-	    lappend ldel $attr [list $value]
-	}
-    }
-
-    set ladd {}
-    foreach {attr value} $attrValToAdd {
-	lappend ladd $attr [list $value]
-    }
-
-    modifyMulti $handle $dn $lrep $ldel $ladd
-}
-
-
-#-----------------------------------------------------------------------------
-#    modify  -  provides attribute modifications on one single object (DN):
-#                 o replace attributes with new values
-#                 o delete attributes (having certain values)
-#                 o add attributes with new values
-#
-#-----------------------------------------------------------------------------
-proc ldap::modifyMulti {handle dn
-                    attrValToReplace {attrValToDelete {}} {attrValToAdd {}}} {
-
-    CheckHandle $handle
-    upvar #0 $handle conn
-
-    set operationAdd     0
-    set operationDelete  1
-    set operationReplace 2
-
-    set modifications ""
-
-    #------------------------------------------------------------------
-    #   marshal attribute modify operations
-    #    - always mode 'replace' ! see rfc2251:
-    #
-    #        replace: replace all existing values of the given attribute
-    #        with the new values listed, creating the attribute if it
-    #        did not already exist.  A replace with no value will delete
-    #        the entire attribute if it exists, and is ignored if the
-    #        attribute does not exist.
-    #
-    #------------------------------------------------------------------
-    append modifications [ldap::packOpAttrVal $operationReplace \
-				$attrValToReplace]
-
-    #------------------------------------------------------------------
-    #   marshal attribute add operations
-    #
-    #------------------------------------------------------------------
-    append modifications [ldap::packOpAttrVal $operationAdd \
-				$attrValToAdd]
-
-    #------------------------------------------------------------------
-    #   marshal attribute delete operations
-    #
-    #     - a non-empty value will trigger to delete only those
-    #       attributes which have the same value as the given one
-    #
-    #     - an empty value will trigger to delete the attribute
-    #       in all cases
-    #
-    #------------------------------------------------------------------
-    append modifications [ldap::packOpAttrVal $operationDelete \
-				$attrValToDelete]
-
-    #----------------------------------------------------------
-    #   marshal 'modify' request packet and send it
-    #----------------------------------------------------------
-    set request [asnApplicationConstr 6              \
-                        [asnOctetString $dn ]            \
-                        [asnSequence    $modifications ] \
-                ]                                    
-    set messageId [SendMessage $handle $request]            
-    debugData modifyRequest $request
-    set response [WaitForResponse $handle $messageId]
-    FinalizeMessage $handle $messageId    
-    debugData bindResponse $response
-
-    asnGetApplication response appNum
-    if { $appNum != 7 } {
-         error "unexpected application number ($appNum != 7)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"    
-    }
-}
-
-proc ldap::packOpAttrVal {op attrValueTuples} {
-    set p ""
-    foreach {attrName attrValues} $attrValueTuples {
-	set l {}
-	foreach v $attrValues {
-	    lappend l [asnOctetString $v]
-	}
-        append p [asnSequence                        \
-		    [asnEnumeration $op ]            \
-		    [asnSequence                     \
-			[asnOctetString $attrName  ] \
-			[asnSetFromList $l]          \
-		    ]                                \
-		]
-    }
-    return $p
-}
-
-
-#-----------------------------------------------------------------------------
-#    add  -  will create a new object using given DN and sets the given
-#            attributes. Multiple value attributes may be used, provided
-#            that each attr-val pair be listed.
-#
-#-----------------------------------------------------------------------------
-proc ldap::add { handle dn attrValueTuples } {
-
-    CheckHandle $handle
-
-    #
-    # In order to handle multi-valuated attributes (see bug 1191326 on
-    # sourceforge), we walk through tuples to collect all values for
-    # an attribute.
-    # http://sourceforge.net/tracker/index.php?func=detail&atid=112883&group_id=12883&aid=1191326
-    #
-
-    foreach { attrName attrValue } $attrValueTuples {
-	lappend avpairs($attrName) $attrValue
-    }
-
-    return [addMulti $handle $dn [array get avpairs]]
-}
-
-#-----------------------------------------------------------------------------
-#    addMulti -  will create a new object using given DN and sets the given
-#                attributes. Argument is a list of attr-listOfVals pair.
-#
-#-----------------------------------------------------------------------------
-proc ldap::addMulti { handle dn attrValueTuples } {
-
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    #------------------------------------------------------------------
-    #   marshal attribute list
-    #
-    #------------------------------------------------------------------
-    set attrList ""
-
-    foreach { attrName attrValues } $attrValueTuples {
-	set valList {}
-	foreach val $attrValues {
-	    lappend valList [asnOctetString $val]
-	}
-	append attrList [asnSequence                         \
-			    [asnOctetString $attrName ]      \
-			    [asnSetFromList $valList]        \
-			]
-    }
-
-    #----------------------------------------------------------
-    #   marshal search 'add' request packet and send it
-    #----------------------------------------------------------
-    set request [asnApplicationConstr 8             \
-                        [asnOctetString $dn       ] \
-                        [asnSequence    $attrList ] \
-                ]                               
-                
-    set messageId [SendMessage $handle $request]
-    debugData addRequest $request
-    set response [WaitForResponse $handle $messageId]
-    FinalizeMessage $handle $messageId    
-    debugData bindResponse $response
-
-    asnGetApplication response appNum
-    if { $appNum != 9 } {
-         error "unexpected application number ($appNum != 9)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-    }
-}
-
-#-----------------------------------------------------------------------------
-#    delete  -  removes the whole object (DN) inclusive all attributes
-#
-#-----------------------------------------------------------------------------
-proc ldap::delete { handle dn } {
-
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    #----------------------------------------------------------
-    #   marshal 'delete' request packet and send it
-    #----------------------------------------------------------
-    set request [asnApplication 10 $dn ] 
-    set messageId [SendMessage $handle $request]
-    debugData deleteRequest $request
-    set response [WaitForResponse $handle $messageId]
-    FinalizeMessage $handle $messageId
-        
-    debugData deleteResponse $response
-
-    asnGetApplication response appNum
-    if { $appNum != 11 } {
-         error "unexpected application number ($appNum != 11)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-    }
-}
-
-
-#-----------------------------------------------------------------------------
-#    modifyDN  -  moves an object (DN) to another (relative) place
-#
-#-----------------------------------------------------------------------------
-proc ldap::modifyDN { handle dn newrdn { deleteOld 1 } {newSuperior ! } } {
-
-    CheckHandle $handle
-
-    upvar #0 $handle conn
-
-    #----------------------------------------------------------
-    #   marshal 'modifyDN' request packet and send it
-    #----------------------------------------------------------
-
-    if {[string equal $newSuperior "!"]} then {
-        set request [asnApplicationConstr 12                 \
-			    [asnOctetString $dn ]            \
-			    [asnOctetString $newrdn ]        \
-			    [asnBoolean     $deleteOld ]     \
-		    ]                                         
-		    
-    } else {
-	set request [asnApplicationConstr 12                 \
-			    [asnOctetString $dn ]            \
-			    [asnOctetString $newrdn ]        \
-			    [asnBoolean     $deleteOld ]     \
-			    [asnContext     0 $newSuperior]  \
-		    ]                                       
-    }
-    set messageId [SendMessage $handle $request]
-    debugData modifyRequest $request
-    set response [WaitForResponse $handle $messageId]
-
-    asnGetApplication response appNum
-    if { $appNum != 13 } {
-         error "unexpected application number ($appNum != 13)"
-    }
-    asnGetEnumeration response resultCode
-    asnGetOctetString response matchedDN
-    asnGetOctetString response errorMessage
-    if {$resultCode != 0} {
-        return -code error \
-		-errorcode [list LDAP [resultCode2String $resultCode] $matchedDN $errorMessage] \
-		"LDAP error [resultCode2String $resultCode] '$matchedDN': $errorMessage"
-
-    }
-}
-
-#-----------------------------------------------------------------------------
-#    disconnect
-#
-#-----------------------------------------------------------------------------
-proc ldap::disconnect { handle } {
-
-    CheckHandle $handle
-    
-    upvar #0 $handle conn
-
-    # should we sent an 'unbind' ?
-    catch {close $conn(sock)}
-    unset conn
-
-    return
-}
-
-
-
-#-----------------------------------------------------------------------------
-#    trace
-#
-#-----------------------------------------------------------------------------
-proc ldap::trace { message } {
-
-    variable doDebug
-
-    if {!$doDebug} return
-
-    puts stderr $message
-}
-
-
-#-----------------------------------------------------------------------------
-#    debugData
-#
-#-----------------------------------------------------------------------------
-proc ldap::debugData { info data } {
-
-    variable doDebug
-
-    if {!$doDebug} return
-
-    set len [string length $data]
-    trace "$info ($len bytes):"
-    set address ""
-    set hexnums ""
-    set ascii   ""
-    for {set i 0} {$i < $len} {incr i} {
-        set v [string index $data $i]
-        binary scan $v H2 hex
-        binary scan $v c  num
-        set num [expr {( $num + 0x100 ) % 0x100}]
-        set text .
-        if {$num > 31} {
-            set text $v
-        }
-        if { ($i % 16) == 0 } {
-            if {$address != ""} {
-                trace [format "%4s  %-48s  |%s|" $address $hexnums $ascii ]
-                set address ""
-                set hexnums ""
-                set ascii   ""
-            }
-            append address [format "%04d" $i]
-        }
-        append hexnums "$hex "
-        append ascii   $text
-        #trace [format "%3d %2s %s" $i $hex $text]
-    }
-    if {$address != ""} {
-        trace [format "%4s  %-48s  |%s|" $address $hexnums $ascii ]
-    }
-    trace ""
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ldap/ldapx.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ldap/ldapx.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1795 +1,0 @@
-#
-# Extended object interface to entries in LDAP directories or LDIF files.
-#
-# (c) 2006 Pierre David (pdav@users.sourceforge.net)
-#
-# $Id: ldapx.tcl,v 1.11 2007/08/19 20:20:43 pdav Exp $
-#
-# History:
-#   2006/08/08 : pda : design
-#
-
-package require Tcl 8.4
-package require snit		;# tcllib
-package require uri 1.1.5	;# tcllib
-package require base64		;# tcllib
-package require ldap 1.6	;# tcllib, low level code for LDAP directories
-
-package provide ldapx 1.0
-
-##############################################################################
-# LDAPENTRY object type
-##############################################################################
-
-snit::type ::ldapx::entry {
-    #########################################################################
-    # Variables
-    #########################################################################
-
-    #
-    # Format of an individual entry
-    # May be "standard" (standard LDAP entry, read from an LDAP directory
-    # or from a LDIF channel) or "change" (LDIF change, or result of the
-    # comparison of two standard entries).
-    # Special : "uninitialized" means that this entry has not been used,
-    # and the first use will initialize it.
-    #
-
-    variable format "uninitialized"
-
-    #
-    # DN
-    #
-
-    variable dn ""
-
-    #
-    # Standard entry
-    #
-    # Syntax:
-    #   - array indexed by attribute names (lower case)
-    #   - each value is the list of attributes
-    #
-    # The current state may be backed up in an internal state.
-    # (see backup and restore methods)
-    #
-
-    variable attrvals -array {}
-
-    variable backup 0
-    variable bckav  -array {}
-    variable bckdn  ""
-
-    #
-    # Change entry
-    #
-    # Syntax:
-    #	{{<op> <parameters>} ... }
-    #	    if <op> = mod
-    #		{mod {{<modop> <attr> [ {<val1> ... <valn>} ]} ...} }
-    #		where <modop> = modrepl, modadd, moddel
-    #	    if <op> = add
-    #		{add {<attr> {<val1> ... <valn>} ...}}
-    #	    if <op> = del
-    #		{del}
-    #	    if <op> = modrdn
-    #		{modrdn <newrdn> <deleteoldrdn> [ <newsuperior> ]}
-    #
-
-    variable change ""
-
-    #########################################################################
-    # Generic methods (for both standard and change entries)
-    #########################################################################
-
-    # Resets the entry to an empty state
-
-    method reset {} {
-
-	set format "uninitialized"
-	set dn ""
-	array unset attrvals
-	set backup 0
-	array unset bckav
-	set bckdn  ""
-	set change ""
-    }
-
-    # Returns current format
-
-    method format {} {
-
-	return $format
-    }
-
-    # Checks if entry is compatible with a certain format
-    # errors out if not
-
-    method compatible {ref} {
-
-	if {$format eq "uninitialized"} then {
-	    set format $ref
-	} elseif {$format ne $ref} then {
-	    return -code error \
-		"Invalid operation on format $format (should be $ref)"
-	}
-    }
-
-    # Get or set the current dn
-
-    method dn {{newdn {-}}} {
-
-	if {$newdn ne "-"} then {
-	    set dn $newdn
-	}
-	return $dn
-    }
-
-    # Get the "superior" (LDAP slang word) part of current dn
-
-    method superior {} {
-
-	set pos [string first "," $dn]
-	if {$pos == -1} then {
-	    set r ""
-	} else {
-	    set r [string range $dn [expr {$pos+1}] end]
-	}
-	return $r
-    }
-
-    # Get the "rdn" part of current dn
-
-    method rdn {} {
-
-	set pos [string first "," $dn]
-	if {$pos == -1} then {
-	    set r ""
-	} else {
-	    set r [string range $dn 0 [expr {$pos-1}]]
-	}
-	return $r
-    }
-
-    # Get a printable form of the contents
-
-    method print {} {
-
-	set r "dn: $dn"
-	switch -- $format {
-	    uninitialized {
-		# nothing
-	    }
-	    standard {
-		foreach a [lsort [array names attrvals]] {
-		    append r "\n$a: $attrvals($a)"
-		}
-	    }
-	    change {
-		if {[llength $change]} then {
-		    append r "\n$change"
-		}
-	    }
-	    default {
-		append r " (inconsistent value)"
-	    }
-	}
-	return $r
-    }
-
-    # Prints the whole state of an entry
-
-    method debug {} {
-
-	set r "dn = <$dn>\nformat = $format"
-	switch -- $format {
-	    uninitialized {
-		# nothing
-	    }
-	    standard {
-		foreach a [lsort [array names attrvals]] {
-		    append r "\n\t$a: $attrvals($a)"
-		}
-		if {$backup} then {
-		    append r "\nbackup dn = $bckdn"
-		    foreach a [lsort [array names bckav]] {
-			append r "\n\t$a: $bckav($a)"
-		    }
-		} else {
-		    append r "\nno backup"
-		}
-	    }
-	    change {
-		if {[llength $change]} then {
-		    append r "\n$change"
-		} else {
-		    append r "\nno change"
-		}
-	    }
-	    default {
-		append r " (inconsistent value)"
-	    }
-	}
-	return $r
-    }
-
-
-    #########################################################################
-    # Methods for standard entries
-    #########################################################################
-
-    # Tells if the current entry is empty
-
-    method isempty {} {
-
-	$self compatible "standard"
-
-	return [expr {[array size attrvals] == 0}]
-    }
-
-    # Get all values for an attribute
-
-    method get {attr} {
-
-	$self compatible "standard"
-
-	set a [string tolower $attr]
-	if {[info exists attrvals($a)]} then {
-	    set r $attrvals($a)
-	} else {
-	    set r {}
-	}
-	return $r
-    }
-
-    # Get only the first value for an attribute
-
-    method get1 {attr} {
-
-	return [lindex [$self get $attr] 0]
-    }
-
-
-    # Set all values for an attribute
-
-    method set {attr vals} {
-
-	$self compatible "standard"
-
-	set a [string tolower $attr]
-	if {[llength $vals]} then {
-	    set attrvals($a) $vals
-	} else {
-	    unset -nocomplain attrvals($a)
-	}
-	return $vals
-    }
-
-    # Set only one value for an attribute
-
-    method set1 {attr val} {
-
-	if {$val eq ""} then {
-	    set l {}
-	} else {
-	    set l [list $val]
-	}
-
-	return [$self set $attr $l]
-    }
-
-    # Add some values to an attribute
-
-    method add {attr vals} {
-
-	$self compatible "standard"
-
-	set a [string tolower $attr]
-	foreach v $vals {
-	    lappend attrvals($a) $v
-	}
-	return $attrvals($a)
-    }
-
-    # Add only one value to an attribute
-
-    method add1 {attr val} {
-
-	return [$self add $attr [list $val]]
-    }
-
-    # Delete all values (or some values only) for an attribute
-
-    method del {attr {vals {}}} {
-
-	$self compatible "standard"
-
-	set a [string tolower $attr]
-	if {[llength $vals]} then {
-	    set l [$self get $attr]
-	    foreach v $vals {
-		while {[set pos [lsearch -exact $l $v]] != -1} {
-		    set l [lreplace $l $pos $pos]
-		}
-	    }
-	} else {
-	    set l {}
-	}
-
-	if {[llength $l]} then {
-	    $self set $attr $l
-	} else {
-	    unset -nocomplain attrvals($a)
-	}
-	return
-    }
-
-    # Delete only one value from an attribute
-
-    method del1 {attr val} {
-
-	$self del $attr [list $val]
-    }
-
-    # Get all attribute names
-
-    method getattr {} {
-
-	$self compatible "standard"
-
-	return [array names attrvals]
-    }
-
-    # Get all attribute names and values
-
-    method getall {} {
-
-	$self compatible "standard"
-
-	return [array get attrvals]
-    }
-
-    # Reset all attribute names and values at once
-
-    method setall {lst} {
-
-	$self compatible "standard"
-
-	array unset attrvals
-	foreach {attr vals} $lst {
-	    set a [string tolower $attr]
-	    set attrvals($a) $vals
-	}
-    }
-
-    # Back up current entry into a new one or into the internal backup state
-
-    method backup {{other {}}} {
-
-	$self compatible "standard"
-
-	if {$other eq ""} then {
-	    #
-	    # Back-up entry in $self->$oldav and $self->$dn
-	    #
-	    set backup 1
-	    set bckdn $dn
-
-	    array unset bckav
-	    array set bckav [array get attrvals]
-	} else {
-	    #
-	    # Back-up entry in $other
-	    #
-	    $other compatible "standard"
-	    $other dn $dn
-	    $other setall [array get attrvals]
-	}
-    }
-
-    # Restore current entry from an old one or from the internal backup state
-
-    method restore {{other {}}} {
-
-	$self compatible "standard"
-
-	if {$backup} then {
-	    if {$other eq ""} then {
-		#
-		# Restore in current context
-		#
-		set dn $bckdn
-		array unset attrvals
-		array set attrvals [array get bckav]
-	    } else {
-		#
-		# Restore in another object
-		#
-		$other compatible "standard"
-		$other dn $bckdn
-		$other setall [array get bckav]
-	    }
-	} else {
-	    return -code error \
-		"Cannot restore a non backuped object"
-	}
-    }
-
-    # Swap current and backup data, if they reside in the same entry
-
-    method swap {} {
-
-	$self compatible "standard"
-
-	if {$backup} then {
-	    #
-	    # Swap current and backup contexts
-	    #
-	    set swdn $dn
-	    set dn $bckdn
-	    set bckdn $swdn
-
-	    set swav [array get attrvals]
-	    array unset attrvals
-	    array set attrvals [array get bckav]
-	    array unset bckav
-	    array set bckav $swav
-	} else {
-	    return -code error \
-		"Cannot swap a non backuped object"
-	}
-    }
-
-    # Apply some modifications (given by a change entry) to current entry
-
-    method apply {chg} {
-
-	$self compatible "standard"
-	$chg  compatible "change"
-
-	#
-	# Apply $chg modifications to $self
-	#
-
-	foreach mod [$chg change] {
-	    set op [lindex $mod 0]
-	    switch -- $op {
-		add {
-		    if {! [$self isempty]} then {
-			return -code error \
-			    "Cannot add an entry to a non-empty entry"
-		    }
-		    $self setall [lindex $mod 1]
-		    if {[string equal [$self dn] ""]} then {
-			$self dn [$chg dn]
-		    }
-		}
-		mod {
-		    foreach submod [lindex $mod 1] {
-			set subop [lindex $submod 0]
-			set attr [lindex $submod 1]
-			set vals [lindex $submod 2]		    
-			switch -- $subop {
-			    modadd {
-				$self add $attr $vals
-			    }
-			    moddel {
-				$self del $attr $vals
-			    }
-			    modrepl {
-				$self del $attr
-				$self add $attr $vals
-			    }
-			    default {
-				return -code error \
-				    "Invalid submod operation '$subop'"
-			    }
-			}
-		    }
-		}
-		del {
-		    array unset attrvals
-		}
-		modrdn {
-		    set newrdn [lindex $mod 1]
-		    set delold [lindex $mod 2]
-		    set newsup [lindex $mod 3]
-
-		    if {! [regexp {^([^=]+)=([^,]+)$} $newrdn m nattr nval]} then {
-			return -code "Invalid new RDN '$newrdn'"
-		    }
-
-		    set olddn  [$self dn]
-		    if {! [regexp {^([^=]+)=([^,]+),(.*)} $olddn m oattr oval osup]} then {
-			return -code "Invalid old DN '$olddn'"
-		    }
-
-		    if {$newsup eq ""} then {
-			set dn "$newrdn,$osup"
-		    } else {
-			set dn "$newrdn,$newsup"
-		    }
-		    $self dn $dn
-
-		    if {$delold} then {
-			$self del1 $oattr $oval
-		    }
-
-		    # XXX should we ignore case ?
-		    if {[lsearch -exact [$self get $nattr] $nval] == -1} then {
-			$self add1 $nattr $nval
-		    }
-		}
-		default {
-		    return -code error \
-			"Invalid change operation '$op'"
-		}
-	    }
-	}
-    }
-
-    #########################################################################
-    # Methods for change entries
-    #########################################################################
-
-    # Get or set all modifications
-
-    method change {{newchg {-}}} {
-
-	$self compatible "change"
-
-	if {$newchg ne "-"} then {
-	    set change $newchg
-	}
-	return $change
-    }
-
-    # Compute the difference between two entries (or between an entry
-    # and the backed-up internal state) into the current change entry
-    # e1 : new, e2 : old
-    # if e2 is not given, it defaults to backup in e1
-
-    method diff {new {old {}}} {
-
-	$self compatible "change"
-
-	#
-	# Select where backup is. If internal, creates a temporary
-	# standard entry.
-	#
-
-	if {$old eq ""} then {
-	    set destroy_old 1
-	    set old [::ldapx::entry create %AUTO%]
-	    $new restore $old
-	} else {
-	    set destroy_old 0
-	}
-
-	#
-	# Computes differences between values in the two entries
-	#
-
-	if {[$old dn] ne ""} then {
-	    $self dn [$old dn]
-	} elseif {[$new dn] ne ""} then {
-	    $self dn [$new dn]
-	} else {
-	    $self dn ""
-	}
-
-	switch -- "[$new isempty][$old isempty]" {
-	    00 {
-		# They may differ
-		set change [DiffEntries $new $old]
-	    }
-	    01 {
-		# new has been added
-		set change [list [list "add" [$new getall]]]
-	    }
-	    10 {
-		# new has been deleted
-		set change [list [list "del"]]
-	    }
-	    11 {
-		# they are both empty: no change
-		set change {}
-	    }
-	}
-
-	#
-	# Remove temporary standard entry (backup was internal)
-	#
-
-	if {$destroy_old} then {
-	    $old destroy
-	}
-
-	return $change
-    }
-
-    # local procedure to compute differences between two non empty entries
-
-    proc DiffEntries {new old} {
-	array set tnew [$new getall]
-	array set told [$old getall]
-
-	set lmod {}
-
-	#
-	# First step : is there a DN change?
-	#
-
-	set moddn [DiffDn [$new dn] [$old dn] tnew told]
-
-	#
-	# Second step : pick up changes in attributes and/or values
-	#
-
-	foreach a [array names tnew] {
-	    if {[info exists told($a)]} then {
-		#
-		# They are new and old values for this attribute.
-		# We cannot use individual delete or add (rfc 4512,
-		# paragraph 2.5.1) for attributes which do not have an
-		# equality operator, so we use "replace" everywhere.
-		#
-
-		set lnew [lsort $tnew($a)]
-		set lold [lsort $told($a)]
-		if {$lold ne $lnew} then {
-		    lappend lmod [list "modrepl" $a $tnew($a)]
-		}
-
-		unset tnew($a)
-		unset told($a)
-	    } else {
-		lappend lmod [list "modadd" $a $tnew($a)]
-		unset tnew($a)
-	    }
-	}
-
-	foreach a [array names told] {
-	    lappend lmod [list "moddel" $a]
-	}
-
-	set lchg {}
-
-	if {[llength $lmod]} then {
-	    lappend lchg [list "mod" $lmod]
-	}
-
-	#
-	# Third step : insert modDN changes
-	#
-
-	if {[llength $moddn]} then {
-	    set newrdn       [lindex $moddn 0]
-	    set deleteoldrdn [lindex $moddn 1]
-	    set newsuperior  [lindex $moddn 2]
-
-	    set lmod [list "modrdn" $newrdn $deleteoldrdn]
-	    if {! [string equal $newsuperior ""]} then {
-		lappend lmod $newsuperior
-	    }
-	    lappend lchg $lmod
-	}
-
-	return $lchg
-    }
-
-    proc DiffDn {newdn olddn _tnew _told} {
-	upvar $_tnew tnew
-	upvar $_told told
-
-	#
-	# If DNs are the same, exit
-	#
-
-	if {[string equal -nocase $newdn $olddn]} then {
-	    return {}
-	}
-
-	#
-	# Split components of both DNs : attribute, value, superior
-	#
-
-	if {! [regexp {^([^=]+)=([^,]+),(.*)} $olddn m oattr oval osup]} then {
-	    return -code "Invalid old DN '$olddn'"
-	}
-	set oattr [string tolower $oattr]
-	set ordn "$oattr=$oval"
-
-	if {! [regexp {^([^=]+)=([^,]+),(.*)} $newdn m nattr nval nsup]} then {
-	    return -code "Invalid new DN '$newdn'"
-	}
-	set nattr [string tolower $nattr]
-	set nrdn "$nattr=$nval"
-
-	#
-	# Checks if superior has changed
-	#
-
-	if {! [string equal -nocase $osup $nsup]} then {
-	    set newsuperior $nsup
-	} else {
-	    set newsuperior ""
-	}
-
-	#
-	# Checks if rdn has changed
-	#
-
-	if {! [string equal -nocase $ordn $nrdn]} then {
-	    #
-	    # Checks if old rdn must be deleted
-	    #
-
-	    set deleteoldrdn 1
-	    if {[info exists tnew($oattr)]} then {
-		set pos [lsearch -exact [string tolower $tnew($oattr)] \
-					[string tolower $oval]]
-		if {$pos != -1} then {
-		    set deleteoldrdn 0
-		}
-	    }
-
-	    #
-	    # Remove old and new rdn such as DiffEntries doesn't
-	    # detect any modification.
-	    #
-
-	    foreach t {tnew told} {
-		foreach {a v} [list $oattr $oval $nattr $nval] {
-		    if {[info exists ${t}($a)]} then {
-			set l [set ${t}($a)]
-			set pos [lsearch -exact [string tolower $l] \
-						[string tolower $v] ]
-			if {$pos != -1} then {
-			    set l [lreplace $l $pos $pos]
-			    if {[llength $l]} then {
-				set ${t}($a) $l
-			    } else {
-				unset -nocomplain ${t}($a)
-			    }
-			}
-		    }
-		}
-	    }
-	} else {
-	    set deleteoldrdn 0
-	}
-
-	return [list $nrdn $deleteoldrdn $newsuperior]
-    }
-
-
-    #########################################################################
-    # End of ldapentry
-    #########################################################################
-}
-
-##############################################################################
-# UTF8 translator, component used to manage the -utf8 option
-##############################################################################
-
-snit::type ::ldapx::utf8trans {
-
-    #########################################################################
-    # Option
-    #########################################################################
-
-    option -utf8	 -default {{.*} {}}
-
-    #########################################################################
-    # Methods
-    #########################################################################
-
-    method must {attr} {
-	set utf8yes [lindex $options(-utf8) 0]
-	set utf8no  [lindex $options(-utf8) 1]
-	set r 0
-	if {[regexp -expanded -nocase "^$utf8yes$" $attr]} then {
-	    set r 1
-	    if {[regexp -expanded -nocase "^$utf8no$" $attr]} then {
-		set r 0
-	    }
-	}
-	return $r
-    }
-
-    method encode {attr val} {
-	if {[$self must $attr]} then {
-	    set val [encoding convertto utf-8 $val]
-	}
-	return $val
-    }
-
-    method decode {attr val} {
-	if {[$self must $attr]} then {
-	    set val [encoding convertfrom utf-8 $val]
-	}
-	return $val
-    }
-
-    method encodepairs {avpairs} {
-	set r {}
-	foreach {attr vals} $avpairs {
-	    if {[llength $vals]} then {
-		lappend r $attr [$self encode $attr $vals]
-	    } else {
-		lappend r $attr
-	    }
-	}
-	return $r
-    }
-
-    method decodepairs {avpairs} {
-	set r {}
-	foreach {attr vals} $avpairs {
-	    set vals [$self decode $attr $vals]
-	    lappend r $attr $vals
-	}
-	return $r
-    }
-}
-
-##############################################################################
-# LDAP object type
-##############################################################################
-
-snit::type ::ldapx::ldap {
-    #########################################################################
-    # Options
-    #
-    # note : options are lowercase
-    #########################################################################
-
-    option -scope        -default "sub"
-    option -derefaliases -default "never"
-    option -sizelimit	 -default 0
-    option -timelimit	 -default 0
-    option -attrsonly	 -default 0
-
-    component translator
-    delegate option -utf8 to translator
-
-    #
-    # Channel descriptor
-    #
-
-    variable channel ""
-    variable bind 0
-
-    #
-    # Last error
-    #
-
-    variable lastError ""
-
-    #
-    # Defaults connection modes
-    #
-
-    variable connect_defaults -array {
-				    ldap {389 ::ldap::connect}
-				    ldaps {636 ::ldap::secure_connect}
-				}
-
-
-    #########################################################################
-    # Constructor
-    #########################################################################
-
-    constructor {args} {
-	install translator using ::ldapx::utf8trans create %AUTO%
-	$self configurelist $args
-    }
-
-    destructor {
-	catch {$translator destroy}
-    }
-
-    #########################################################################
-    # Methods
-    #########################################################################
-
-    # Get or set the last error message
-
-    method error {{le {-}}} {
-
-	if {! [string equal $le "-"]} then {
-	    set lastError $le
-	}
-	return $lastError
-    }
-
-    # Connect to the LDAP directory, and binds to it if needed
-
-    method connect {url {binddn {}} {bindpw {}}} {
-
-	array set comp [::uri::split $url "ldap"]
-
-	if {! [::info exists comp(host)]} then {
-	    $self error "Invalid host in URL '$url'"
-	    return 0
-	}
-
-	set scheme $comp(scheme)
-	if {! [::info exists connect_defaults($scheme)]} then {
-	    $self error "Unrecognized URL '$url'"
-	    return 0
-	}
-
-	set defport [lindex $connect_defaults($scheme) 0]
-	set fct     [lindex $connect_defaults($scheme) 1]
-
-	if {[string equal $comp(port) ""]} then {
-	    set comp(port) $defport
-	}
-
-	if {[Check $selfns {set channel [$fct $comp(host) $comp(port)]}]} then {
-	    return 0
-	}
-
-	if {$binddn eq ""} then {
-	    set bind 0
-	} else {
-	    set bind 1
-	    if {[Check $selfns {::ldap::bind $channel $binddn $bindpw}]} then {
-		return 0
-	    }
-	}
-	return 1
-    }
-
-    # Disconnect from the LDAP directory
-
-    method disconnect {} {
-
-	Connected $selfns
-
-	if {$bind} {
-	    if {[Check $selfns {::ldap::unbind $channel}]} then {
-		return 0
-	    }
-	}
-	if {[Check $selfns {::ldap::disconnect $channel}]} then {
-	    return 0
-	}
-	set channel ""
-	return 1
-    }
-
-    # New control structure : traverse the DIT and execute the body
-    # for each found entry.
-
-    method traverse {base filter attrs entry body} {
-
-	Connected $selfns
-
-	global errorInfo errorCode
-
-	set lastError ""
-
-	#
-	# Initiate search
-	#
-
-	set opt [list                                             \
-			-scope        $options(-scope)            \
-			-derefaliases $options(-derefaliases)     \
-			-sizelimit    $options(-sizelimit)        \
-			-timelimit    $options(-timelimit)        \
-			-attrsonly    $options(-attrsonly)        \
-			]
-
-	::ldap::searchInit $channel $base $filter $attrs $opt
-
-	#
-	# Execute the specific body for each result found
-	#
-
-	while {1} {
-	    #
-	    # The first call to searchNext may fail when searchInit
-	    # is given some invalid parameters.
-	    # We must terminate the current search in order to allow
-	    # future searches.
-	    #
-
-	    set err [catch {::ldap::searchNext $channel} r]
-
-	    if {$err} then {
-		set ei $errorInfo
-		set ec $errorCode
-		::ldap::searchEnd $channel
-		return -code error -errorinfo $ei -errorcode $ec $r
-	    }
-
-	    #
-	    # End of result messages
-	    #
-
-	    if {[llength $r] == 0} then {
-		break
-	    }
-
-	    #
-	    # Set DN and attributes-values (converted from utf8 if needed)
-	    # for the entry
-	    #
-
-	    $entry reset
-
-	    $entry dn [lindex $r 0]
-	    $entry setall [$translator decodepairs [lindex $r 1]]
-
-	    #
-	    # Execute body with the entry
-	    #
-	    # http://wiki.tcl.tk/685
-	    #
-
-	    set code [catch {uplevel 1 $body} msg]
-	    switch -- $code {
-		0 {
-		    # ok
-		}
-		1 {
-		    # error
-		    set ei $errorInfo
-		    set ec $errorCode
-		    ::ldap::searchEnd $channel
-		    return -code error -errorinfo $ei -errorcode $ec $msg
-		}
-		2 {
-		    # return
-		    ::ldap::searchEnd $channel
-		    return -code return $msg
-		}
-		3 {
-		    # break
-		    ::ldap::searchEnd $channel
-		    return {}
-		}
-		4 {
-		    # continue
-		}
-		default {
-		    # user defined
-		    ::ldap::searchEnd $channel
-		    return -code $code $msg
-		}
-	    }
-	}
-
-	#
-	# Terminate search
-	#
-
-	::ldap::searchEnd $channel
-    }
-
-    # Returns a list of newly created objects which match
-
-    method search {base filter attrs} {
-
-	Connected $selfns
-
-	set e [::ldapx::entry create %AUTO%]
-	set r {}
-	$self traverse $base $filter $attrs $e {
-	    set new [::ldapx::entry create %AUTO%]
-	    $e backup $new
-	    lappend r $new
-	}
-	$e destroy
-	return $r
-    }
-
-    # Read one or more entries, and returns the number of entries found.
-    # Useful to easily read one or more entries.
-
-    method read {base filter args} {
-
-	set n 0
-	set max [llength $args]
-	set e [::ldapx::entry create %AUTO%]
-	$self traverse $base $filter {} $e {
-	    if {$n < $max} then {
-		$e backup [lindex $args $n]
-	    }
-	    incr n
-	}
-	return $n
-    }
-
-    # Commit a list of changes (or standard, backuped entries)
-
-    method commit {args} {
-
-	Connected $selfns
-
-	foreach entry $args {
-	    switch -- [$entry format] {
-		uninitialized {
-		    return -code error \
-			"Uninitialized entry"
-		}
-		standard {
-		    set echg [::ldapx::entry create %AUTO%]
-		    set lchg [$echg diff $entry]
-		    set dn   [$echg dn]
-		    $echg destroy
-		}
-		change {
-		    set dn   [$entry dn]
-		    set lchg [$entry change]
-		}
-	    }
-
-	    foreach chg $lchg {
-		set op   [lindex $chg 0]
-
-		switch -- $op {
-		    {} {
-			# nothing to do
-		    }
-		    add {
-			set av [$translator encodepairs [lindex $chg 1]]
-			if {[Check $selfns {::ldap::addMulti $channel $dn $av}]} then {
-			    return 0
-			}
-		    }
-		    del {
-			if {[Check $selfns {::ldap::delete $channel $dn}]} then {
-			    return 0
-			}
-		    }
-		    mod {
-			set lrep {}
-			set ldel {}
-			set ladd {}
-
-			foreach submod [lindex $chg 1] {
-			    set subop [lindex $submod 0]
-			    set attr [lindex $submod 1]
-			    set vals [lindex $submod 2]
-
-			    set vals [$translator encode $attr $vals]
-			    switch -- $subop {
-				modadd {
-				    lappend ladd $attr $vals
-				}
-				moddel {
-				    lappend ldel $attr $vals
-				}
-				modrepl {
-				    lappend lrep $attr $vals
-				}
-			    }
-			}
-
-			if {[Check $selfns {::ldap::modifyMulti $channel $dn \
-						    $lrep $ldel $ladd}]} then {
-			    return 0
-			}
-		    }
-		    modrdn {
-			set newrdn [lindex $chg 1]
-			set delOld [lindex $chg 2]
-			set newSup [lindex $chg 3]
-			if {[string equal $newSup ""]} then {
-			    if {[Check $selfns {::ldap::modifyDN $channel $dn \
-						    $newrdn $delOld}]} then {
-				return 0
-			    }
-			} else {
-			    if {[Check $selfns {::ldap::modifyDN $channel $dn \
-						    $newrdn $delOld $newSup}]} then {
-				return 0
-			    }
-			}
-		    }
-		}
-	    }
-	}
-
-	return 1
-    }
-
-    #########################################################################
-    # Local procedures
-    #########################################################################
-
-    proc Connected {selfns} {
-	if {$channel eq ""} then {
-	    return -code error \
-		"Object not connected"
-	}
-    }
-
-    proc Check {selfns script} {
-	return [catch {uplevel 1 $script} lastError]
-    }
-
-    #########################################################################
-    # End of LDAP object type
-    #########################################################################
-}
-
-##############################################################################
-# LDIF object type
-##############################################################################
-
-snit::type ::ldapx::ldif {
-
-    #########################################################################
-    # Options
-    #########################################################################
-
-    #
-    # Fields to ignore when reading change file
-    #
-
-    option -ignore {}
-
-    component translator
-    delegate option -utf8 to translator
-
-
-    #########################################################################
-    # Variables
-    #########################################################################
-
-    #
-    # Version of LDIF file (0 means : uninitialized)
-    #
-
-    variable version 0
-
-    #
-    # Channel descriptor
-    #
-
-    variable channel ""
-
-    #
-    # Line number
-    #
-
-    variable lineno 0
-
-    #
-    # Last error message
-    #
-
-    variable lastError ""
-
-    #
-    # Number of entries read or written
-    #
-
-    variable nentries 0
-
-    #
-    # Type of LDIF file
-    #
-
-    variable format "uninitialized"
-
-    #########################################################################
-    # Constructor
-    #########################################################################
-
-    constructor {args} {
-	install translator using ::ldapx::utf8trans create %AUTO%
-	$self configurelist $args
-    }
-
-    destructor {
-	catch {$translator destroy}
-    }
-
-    #########################################################################
-    # Methods
-    #########################################################################
-
-    # Initialize a channel
-
-    method channel {newchan} {
-
-	set channel   $newchan
-	set version   0
-	set nentries  0
-	set format    "uninitialized"
-	set lineno    0
-	return
-    }
-
-    # Get or set the last error message
-
-    method error {{le {-}}} {
-
-	if {$le ne "-"} then {
-	    set lastError $le
-	}
-	return $lastError
-    }
-
-    # An LDIF file cannot include both changes and standard entries
-    # (see RFC 2849, page 2). Check this.
-
-    method compatible {ref} {
-
-	if {$format eq "uninitialized"} then {
-	    set format $ref
-	} elseif {$format ne $ref} then {
-	    return -code error \
-		"Invalid entry ($ref) type for LDIF $format file"
-	}
-    }
-
-    # Reads an LDIF entry (standard or change) from the channel
-    # returns 1 if ok, 0 if error or EOF
-
-    # XXX this method is just coded for tests at this time
-
-    method debugread {entry} {
-
-	$entry compatible "standard"
-	$entry dn "uid=joe,ou=org,o=com"
-	$entry setall {uid {joe} sn {User} givenName {Joe} cn {{Joe User}}
-	    telephoneNumber {+31415926535 +27182818285} objectClass {person}
-	}
-	return 1
-    }
-
-    # Read an LDIF entry (standard or change) from the channel
-    # returns 1 if ok, 0 if error or EOF
-
-    method read {entry} {
-	if {$channel eq ""} then {
-	    return -code error \
-			"Channel not initialized"
-	}
-
-	set r [Lexical $selfns]
-	if {[lindex $r 0] ne "err"} then {
-	    set r [Syntaxic $selfns [lindex $r 1]]
-	}
-
-	if {[lindex $r 0] eq "err"} then {
-	    set lastError [lindex $r 1]
-	    return 0
-	}
-
-	switch -- [lindex $r 0] {
-	    uninitialized {
-		$entry reset
-		set lastError ""
-		set r 0
-	    }
-	    standard {
-		if {[catch {$self compatible "change"}]} then {
-		    set lastError "Standard entry not allowed in LDIF change file"
-		    set r 0
-		} else {
-		    $entry reset
-		    $entry dn     [lindex $r 1]
-		    $entry setall [lindex $r 2]
-		    set r 1
-		}
-	    }
-	    change {
-		if {[catch {$self compatible "change"}]} then {
-		    set lastError "Change entry not allowed in LDIF standard file"
-		    set r 0
-		} else {
-		    $entry reset
-		    $entry dn     [lindex $r 1]
-		    $entry change [list [lindex $r 2]]
-		    set r 1
-		}
-	    }
-	    default {
-		return -code error \
-			"Internal error (invalid returned entry format)"
-	    }
-	}
-
-	return $r
-    }
-
-    # Write an LDIF entry to the channel
-
-    method write {entry} {
-
-	if {$channel eq ""} then {
-	    return -code error \
-			"Channel not initialized"
-	}
-
-	switch -- [$entry format] {
-	    uninitialized {
-		# nothing
-	    }
-	    standard {
-		if {[llength [$entry getall]]} then {
-		    $self compatible "standard"
-
-		    if {$nentries == 0} then {
-			if {$version == 0} then {
-			    set version 1
-			}
-			WriteLine $selfns "version" "$version"
-			puts $channel ""
-		    }
-
-		    WriteLine $selfns "dn" [$entry dn]
-
-		    foreach a [$entry getattr] {
-			foreach v [$entry get $a] {
-			    WriteLine $selfns $a $v
-			}
-		    }
-		    puts $channel ""
-		}
-	    }
-	    change {
-		$self compatible "change"
-
-		set lchg [$entry change]
-		foreach chg $lchg {
-		    if {$nentries == 0} then {
-			if {$version == 0} then {
-			    set version 1
-			}
-			WriteLine $selfns "version" "$version"
-			puts $channel ""
-		    }
-
-		    WriteLine $selfns "dn" [$entry dn]
-
-		    set op [lindex $chg 0]
-		    switch -- $op {
-			add {
-			    WriteLine $selfns "changetype" "add"
-			    foreach {attr vals} [lindex $chg 1] {
-				foreach v $vals {
-				    WriteLine $selfns $attr $v
-				}
-			    }
-			}
-			del {
-			    WriteLine $selfns "changetype" "delete"
-			}
-			mod {
-			    WriteLine $selfns "changetype" "modify"
-			    foreach submod [lindex $chg 1] {
-				set subop [lindex $submod 0]
-				set attr [lindex $submod 1]
-				set vals [lindex $submod 2]
-
-				switch -- $subop {
-				    modadd {
-					WriteLine $selfns "add" $attr
-				    }
-				    moddel {
-					WriteLine $selfns "delete" $attr
-				    }
-				    modrepl {
-					WriteLine $selfns "replace" $attr
-				    }
-				}
-				foreach v $vals {
-				    WriteLine $selfns $attr $v
-				}
-				puts $channel "-"
-			    }
-			}
-			modrdn {
-			    WriteLine $selfns "changetype" "modrdn"
-			    set newrdn [lindex $chg 1]
-			    set delold [lindex $chg 2]
-			    set newsup [lindex $chg 3]
-			    WriteLine $selfns "newrdn" $newrdn
-			    WriteLine $selfns "deleteOldRDN" $delold
-			    if {$newsup ne ""} then {
-				WriteLine $selfns "newSuperior" $newsup
-			    }
-			}
-		    }
-		    puts $channel ""
-		    incr nentries
-		}
-	    }
-	    default {
-		return -code error \
-			"Invalid entry format"
-	    }
-	}
-	return 1
-    }
-
-    #########################################################################
-    # Local procedures to read an entry
-    #########################################################################
-
-    #
-    # Lexical analysis of an entry
-    # Special case for "version:" entry.
-    # Returns a list of lines {ok {{<attr1> <val1>} {<attr2> <val2>} ...}}
-    # or a list {err <message>}
-    #
-
-    proc Lexical {selfns} {
-	set result {}
-	set prev ""
-
-	while {[gets $channel line] > -1} {
-	    incr lineno
-
-	    if {$line eq ""} then {
-		#
-		# Empty line: we are either before the beginning
-		# of the entry or at the empty line after the
-		# entry.
-		# We don't give up before getting something.
-		#
-
-		if {! [FlushLine $selfns "" result prev msg]} then {
-		    return [list "err" $msg]
-		}
-
-		if {[llength $result]} then {
-		    break
-		}
-
-	    } elseif {[regexp {^[ \t]} $line]} then {
-		#
-		# Continuation line
-		#
-
-		append prev [string trim $line]
-
-	    } elseif {[regexp {^-$} $line]} then {
-		#
-		# Separation between individual modifications
-		#
-
-		if {! [FlushLine $selfns "" result prev msg]} then {
-		    return [list "err" $msg]
-		}
-		lappend result [list "-" {}]
-
-	    } else {
-		#
-		# Should be a normal line (key: val)
-		#
-
-		if {! [FlushLine $selfns $line result prev msg]} then {
-		    return [list "err" $msg]
-		}
-
-	    }
-	}
-
-	#
-	# End of file, or end of entry. Flush buffered data from $prev
-	# for EOF case.
-	#
-
-	if {! [FlushLine $selfns "" result prev msg]} then {
-	    return [list "err" $msg]
-	}
-
-	return [list "ok" $result]
-    }
-
-    proc FlushLine {selfns line _result _prev _msg} {
-	upvar $_result result  $_prev prev  $_msg msg
-
-	if {$prev ne ""} then {
-	    set r [DecodeLine $selfns $prev]
-	    if {[llength $r] != 2} then {
-		set msg "$lineno: invalid syntax"
-		return 0
-	    }
-
-	    #
-	    # Special case for "version: 1". This code should not
-	    # be in lexical analysis, but this would be too disruptive
-	    # in syntaxic analysis
-	    #
-
-	    if {[string equal -nocase [lindex $r 0] "version"]} then {
-		if {$version != 0} then {
-		    set msg "version attribute allowed only at the beginning of the LDIF file"
-		    return 0
-		}
-		set val [lindex $r 1]
-		if {[catch {set val [expr {$val+0}]}]} then {
-		    set msg "invalid version value"
-		    return 0
-		}
-		if {$val != 1} then {
-		    set msg "unrecognized version '$val'"
-		    return 0
-		}
-		set version 1
-	    } else {
-		lappend result $r
-	    }
-	}
-	set prev $line
-
-	return 1
-    }
-
-    proc DecodeLine {selfns str} {
-	if {[regexp {^([^:]*)::[ \t]*(.*)} $str d key val]} then {
-	    set key [string tolower $key]
-	    set val [::base64::decode $val]
-	    set val [$translator decode $key $val]
-	    set r [list $key $val]
-	} elseif {[regexp {^([^:]*):[ \t]*(.*)} $str d key val]} then {
-	    set key [string tolower $key]
-	    set val [$translator decode $key $val]
-	    set r [list $key $val]
-	} else {
-	    # syntax error
-	    set r {}
-	}
-	return $r
-    }
-
-    #
-    # Array indexed by current state of the LDIF automaton
-    # Each element is a list of actions, each with the format:
-    #	pattern on on "attribute:value"
-    #	next state
-    #	script (to be evaled in Syntaxic local procedure)
-    #
-
-    variable ldifautomaton -array {
-	begin {
-	    {dn:*		dn		{set dn $val}}
-	    {EOF:*		end		{set r [list "empty"]}}
-	}
-	dn {
-	    {changetype:modify	mod		{set t "change" ; set r {mod}}}
-	    {changetype:modrdn	modrdn		{set t "change" ; set newsup {}}}
-	    {changetype:add	add		{set t "change"}}
-	    {changetype:delete	del		{set t "change"}}
-	    {*:*		standard	{set t "standard" ; lappend tab($key) $val}}
-	}
-	standard {
-	    {EOF:*		end		{set r [array get tab]}}
-	    {*:*		standard	{lappend tab($key) $val}}
-	}
-	mod {
-	    {add:*		mod-add		{set attr [string tolower $val] ; set vals {}}}
-	    {delete:*		mod-del		{set attr [string tolower $val] ; set vals {}}}
-	    {replace:*		mod-repl	{set attr [string tolower $val] ; set vals {}}}
-	    {EOF:*		end		{}}
-	}
-	mod-add {
-	    {*:*		mod-add-attr	{lappend vals $val}}
-	}
-	mod-add-attr {
-	    {-:*		mod		{lappend r [list "modadd" $attr $vals]}}
-	    {*:*		mod-add-attr	{lappend vals $val}}
-	}
-	mod-del {
-	    {-:*		mod		{lappend r [list "moddel" $attr $vals]}}
-	    {*:*		mod-del		{lappend vals $val}}
-	}
-	mod-repl {
-	    {-:*		mod		{lappend r [list "modrepl" $attr $vals]}}
-	    {*:*		mod-repl	{lappend vals $val}}
-	}
-	modrdn {
-	    {newrdn:*		modrdn-new	{set newrdn $val}}
-	}
-	modrdn-new {
-	    {deleteoldrdn:0	modrdn-del	{set delold 0}}
-	    {deleteoldrdn:1	modrdn-del	{set delold 1}}
-	}
-	modrdn-del {
-	    {newsuperior:*	modrdn-end	{set newsup $val}}
-	    {EOF:*		end		{set r [list modrdn $newrdn $delold] }}
-	}
-	modrdn-end {
-	    {EOF:*		end		{set r [list modrdn $newrdn
-						    $delold $newsup]}}
-	}
-	add {
-	    {EOF:*		end		{set r [list add [array get tab]]}}
-	    {*:*		add		{lappend tab($key) $val}}
-	}
-	del {
-	    {EOF:*		end		{set r [list del]}}
-	}
-    }
-
-    proc Syntaxic {selfns lcouples} {
-	set state "begin"
-	set newsup {}
-	set t "uninitialized"
-	foreach c $lcouples {
-	    set key [lindex $c 0]
-	    if {[lsearch [string tolower $options(-ignore)] $key] == -1} then {
-		set val [lindex $c 1]
-		set a [Automaton $selfns $state $key $val]
-		if {$a eq ""} then {
-		    return [list "err" "Syntax error before line $lineno"]
-		}
-		set state [lindex $a 0]
-		set script [lindex $a 1]
-		eval $script
-	    }
-	}
-
-	set a [Automaton $selfns $state "EOF" "EOF"]
-	if {$a eq ""} then {
-	    return [list "err" "Premature EOF"]
-	}
-	set script [lindex $a 1]
-	eval $script
-
-	set result [list $t]
-	switch $t {
-	    uninitialized {
-		# nothing
-	    }
-	    standard {
-		lappend result $dn $r
-	    }
-	    change {
-		lappend result $dn $r
-	    }
-	}
-
-	return $result
-    }
-
-    proc Automaton {selfns state key val} {
-	set r {}
-	if {[info exists ldifautomaton($state)]} then {
-	    foreach a $ldifautomaton($state) {
-		if {[string match [lindex $a 0] "$key:$val"]} then {
-		    set r [lreplace $a 0 0]
-		    break
-		}
-	    }
-	}
-	return $r
-    }
-
-    #########################################################################
-    # Local procedures to write an entry
-    #########################################################################
-
-    proc WriteLine {selfns attr val} {
-
-	if {[string is ascii $val] && [string is print $val]} then {
-	    set sep ":"
-	} else {
-	    set sep "::"
-	    set val [$translator encode $attr $val]
-	    set val [::base64::encode $val]
-	}
-
-	set first 1
-	foreach line [split $val "\n"] {
-	    if {$first} then {
-		puts $channel "$attr$sep $line"
-		set first 0
-	    } else {
-		puts $channel " $line"
-	    }
-	}
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ldap/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ldap/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded ldap 1.6.8 [list source [file join $dir ldap.tcl]]
-
-# the OO level wrapper for ldap
-package ifneeded ldapx 1.0 [list source [file join $dir ldapx.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/log.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/log.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,851 +1,0 @@
-# log.tcl --
-#
-#	Tcl implementation of a general logging facility
-#	(Reaped from Pool_Base and modified to fit into tcllib)
-#
-# Copyright (c) 2001 by ActiveState Tool Corp.
-# See the file license.terms.
-
-package require Tcl 8
-package provide log 1.2
-
-# ### ### ### ######### ######### #########
-
-namespace eval ::log {
-    namespace export levels lv2longform lv2color lv2priority 
-    namespace export lv2cmd lv2channel lvCompare
-    namespace export lvSuppress lvSuppressLE lvIsSuppressed
-    namespace export lvCmd lvCmdForall
-    namespace export lvChannel lvChannelForall lvColor lvColorForall
-    namespace export log logMsg logError
-
-    # The known log-levels.
-
-    variable levels [list \
-	    emergency \
-	    alert \
-	    critical \
-	    error \
-	    warning \
-	    notice \
-	    info \
-	    debug]
-
-    # Array mapping from all unique prefixes for log levels to their
-    # corresponding long form.
-
-    # *future* Use a procedure from 'textutil' to calculate the
-    #          prefixes and to fill the map.
-
-    variable  levelMap
-    array set levelMap {
-	a		alert
-	al		alert
-	ale		alert
-	aler		alert
-	alert		alert
-	c		critical
-	cr		critical
-	cri		critical
-	crit		critical
-	criti		critical
-	critic		critical
-	critica		critical
-	critical	critical
-	d		debug
-	de		debug
-	deb		debug
-	debu		debug
-	debug		debug
-	em		emergency
-	eme		emergency
-	emer		emergency
-	emerg		emergency
-	emerge		emergency
-	emergen		emergency
-	emergenc	emergency
-	emergency	emergency
-	er		error
-	err		error
-	erro		error
-	error		error
-	i		info
-	in		info
-	inf		info
-	info		info
-	n		notice
-	no		notice
-	not		notice
-	noti		notice
-	notic		notice
-	notice		notice
-	w		warning
-	wa		warning
-	war		warning
-	warn		warning
-	warni		warning
-	warnin		warning
-	warning		warning
-    }
-
-    # Map from log-levels to the commands to execute when a message
-    # with that level arrives in the system. The standard command for
-    # all levels is '::log::Puts' which writes the message to either
-    # stdout or stderr, depending on the level. The decision about the
-    # channel is stored in another map and modifiable by the user of
-    # the package.
-
-    variable  cmdMap
-    array set cmdMap {}
-
-    variable lv
-    foreach  lv $levels {set cmdMap($lv) ::log::Puts}
-    unset    lv
-
-    # Map from log-levels to the channels ::log::Puts shall write
-    # messages with that level to. The map can be queried and changed
-    # by the user.
-
-    variable  channelMap
-    array set channelMap {
-	emergency  stderr
-	alert      stderr
-	critical   stderr
-	error      stderr
-	warning    stdout
-	notice     stdout
-	info       stdout
-	debug      stdout
-    }
-
-    # Graphical user interfaces may want to colorize messages based
-    # upon their level. The following array stores a map from levels
-    # to colors. The map can be queried and changed by the user.
-
-    variable  colorMap
-    array set colorMap {
-	emergency red
-	alert     red
-	critical  red
-	error     red
-	warning   yellow
-	notice    seagreen
-	info      {}
-	debug     lightsteelblue
-    }
-
-    # To allow an easy comparison of the relative importance of a
-    # level the following array maps from levels to a numerical
-    # priority. The higher the number the more important the
-    # level. The user cannot change this map (for now). This package
-    # uses the priorities to allow the user to supress messages based
-    # upon their levels.
-
-    variable  priorityMap
-    array set priorityMap {
-	emergency 7
-	alert     6
-	critical  5
-	error     4
-	warning   3
-	notice    2
-	info      1
-	debug     0
-    }
-
-    # The following array is internal and holds the information about
-    # which levels are suppressed, i.e. may not be written.
-    #
-    # 0 - messages with with level are written out.
-    # 1 - messages with this level are suppressed.
-
-    variable  suppressed
-    array set suppressed {
-	emergency 0
-	alert     0
-	critical  0
-	error     0
-	warning   0
-	notice    0
-	info      0
-	debug     0
-    }
-
-    # Internal static information. Map from levels to a string of
-    # spaces. The number of spaces in each string is just enough to
-    # make all level names together with their string of the same
-    # length.
-
-    variable  fill
-    array set fill {
-	emergency ""	alert "    "	critical " "	error "    "
-	warning "  "	notice "   "	info "     "	debug "    "
-    }
-}
-
-
-# log::levels --
-#
-#	Retrieves the names of all known levels.
-#
-# Arguments:
-#	None.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	A list containing the names of all known levels,
-#	alphabetically sorted.
-
-proc ::log::levels {} {
-    variable levels
-    return [lsort $levels]
-}
-
-# log::lv2longform --
-#
-#	Converts any unique abbreviation of a level name to the full
-#	level name.
-#
-# Arguments:
-#	level	The prefix of a level name to convert.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	Returns the full name to the specified abbreviation or an
-#	error.
-
-proc ::log::lv2longform {level} {
-    variable levelMap
-
-    if {[info exists levelMap($level)]} {
-	return $levelMap($level)
-    }
-
-    return -code error "\"$level\" is no unique abbreviation of a level name"
-}
-
-# log::lv2color --
-#
-#	Converts any level name including unique abbreviations to the
-#	corresponding color.
-#
-# Arguments:
-#	level	The level to convert into a color.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	The name of a color or an error.
-
-proc ::log::lv2color {level} {
-    variable colorMap
-    set level [lv2longform $level]
-    return $colorMap($level)
-}
-
-# log::lv2priority --
-#
-#	Converts any level name including unique abbreviations to the
-#	corresponding priority.
-#
-# Arguments:
-#	level	The level to convert into a priority.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	The numerical priority of the level or an error.
-
-proc ::log::lv2priority {level} {
-    variable priorityMap
-    set level [lv2longform $level]
-    return $priorityMap($level)
-}
-
-# log::lv2cmd --
-#
-#	Converts any level name including unique abbreviations to the
-#	command prefix used to write messages with that level.
-#
-# Arguments:
-#	level	The level to convert into a command prefix.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	A string containing a command prefix or an error.
-
-proc ::log::lv2cmd {level} {
-    variable cmdMap
-    set level [lv2longform $level]
-    return $cmdMap($level)
-}
-
-# log::lv2channel --
-#
-#	Converts any level name including unique abbreviations to the
-#	channel used by ::log::Puts to write messages with that level.
-#
-# Arguments:
-#	level	The level to convert into a channel.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	A string containing a channel handle or an error.
-
-proc ::log::lv2channel {level} {
-    variable channelMap
-    set level [lv2longform $level]
-    return $channelMap($level)
-}
-
-# log::lvCompare --
-#
-#	Compares two levels (including unique abbreviations) with
-#	respect to their priority. This command can be used by the
-#	-command option of lsort.
-#
-# Arguments:
-#	level1	The first of the levels to compare.
-#	level2	The second of the levels to compare.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	One of -1, 0 or 1 or an error. A result of -1 signals that
-#	level1 is of less priority than level2. 0 signals that both
-#	levels have the same priority. 1 signals that level1 has
-#	higher priority than level2.
-
-proc ::log::lvCompare {level1 level2} {
-    variable priorityMap
-
-    set level1 $priorityMap([lv2longform $level1])
-    set level2 $priorityMap([lv2longform $level2])
-
-    if {$level1 < $level2} {
-	return -1
-    } elseif {$level1 > $level2} {
-	return 1
-    } else {
-	return 0
-    }
-}
-
-# log::lvSuppress --
-#
-#	(Un)suppresses the output of messages having the specified
-#	level. Unique abbreviations for the level are allowed here
-#	too.
-#
-# Arguments:
-#	level		The name of the level to suppress or
-#			unsuppress. Unique abbreviations are allowed
-#			too.
-#	suppress	Boolean flag. Optional. Defaults to the value
-#			1, which means to suppress the level. The
-#			value 0 on the other hand unsuppresses the
-#			level.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvSuppress {level {suppress 1}} {
-    variable suppressed
-    set level [lv2longform $level]
-
-    switch -exact -- $suppress {
-	0 - 1 {} default {
-	    return -code error "\"$suppress\" is not a member of \{0, 1\}"
-	}
-    }
-
-    set suppressed($level) $suppress
-    return
-}
-
-# log::lvSuppressLE --
-#
-#	(Un)suppresses the output of messages having the specified
-#	level or one of lesser priority. Unique abbreviations for the
-#	level are allowed here too.
-#
-# Arguments:
-#	level		The name of the level to suppress or
-#			unsuppress. Unique abbreviations are allowed
-#			too.
-#	suppress	Boolean flag. Optional. Defaults to the value
-#			1, which means to suppress the specified
-#			levels. The value 0 on the other hand
-#			unsuppresses the levels.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvSuppressLE {level {suppress 1}} {
-    variable suppressed
-    variable levels
-    variable priorityMap
-
-    set level [lv2longform $level]
-
-    switch -exact -- $suppress {
-	0 - 1 {} default {
-	    return -code error "\"$suppress\" is not a member of \{0, 1\}"
-	}
-    }
-
-    set prio  [lv2priority $level]
-
-    foreach l $levels {
-	if {$priorityMap($l) <= $prio} {
-	    set suppressed($l) $suppress
-	}
-    }
-    return
-}
-
-# log::lvIsSuppressed --
-#
-#	Asks the package wether the specified level is currently
-#	suppressed. Unique abbreviations of level names are allowed.
-#
-# Arguments:
-#	level	The level to query.
-#
-# Side Effects:
-#	None.
-#
-# Results:
-#	None.
-
-proc ::log::lvIsSuppressed {level} {
-    variable suppressed
-    set level [lv2longform $level]
-    return $suppressed($level)
-}
-
-# log::lvCmd --
-#
-#	Defines for the specified level with which command to write
-#	the messages having this level. Unique abbreviations of level
-#	names are allowed. The command is actually a command prefix
-#	and this facility will append 2 arguments before calling it,
-#	the level of the message and the message itself, in this
-#	order.
-#
-# Arguments:
-#	level	The level the command prefix is for.
-#	cmd	The command prefix to use for the specified level.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvCmd {level cmd} {
-    variable cmdMap
-    set level [lv2longform $level]
-    set cmdMap($level) $cmd
-    return
-}
-
-# log::lvCmdForall --
-#
-#	Defines for all known levels with which command to write the
-#	messages having this level. The command is actually a command
-#	prefix and this facility will append 2 arguments before
-#	calling it, the level of the message and the message itself,
-#	in this order.
-#
-# Arguments:
-#	cmd	The command prefix to use for all levels.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvCmdForall {cmd} {
-    variable cmdMap
-    variable levels
-
-    foreach l $levels {
-	set cmdMap($l) $cmd
-    }
-    return
-}
-
-# log::lvChannel --
-#
-#	Defines for the specified level into which channel ::log::Puts
-#	(the standard command) shall write the messages having this
-#	level. Unique abbreviations of level names are allowed. The
-#	command is actually a command prefix and this facility will
-#	append 2 arguments before calling it, the level of the message
-#	and the message itself, in this order.
-#
-# Arguments:
-#	level	The level the channel is for.
-#	chan	The channel to use for the specified level.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvChannel {level chan} {
-    variable channelMap
-    set level [lv2longform $level]
-    set channelMap($level) $chan
-    return
-}
-
-# log::lvChannelForall --
-#
-#	Defines for all known levels with which which channel
-#	::log::Puts (the standard command) shall write the messages
-#	having this level. The command is actually a command prefix
-#	and this facility will append 2 arguments before calling it,
-#	the level of the message and the message itself, in this
-#	order.
-#
-# Arguments:
-#	chan	The channel to use for all levels.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvChannelForall {chan} {
-    variable channelMap
-    variable levels
-
-    foreach l $levels {
-	set channelMap($l) $chan
-    }
-    return
-}
-
-# log::lvColor --
-#
-#	Defines for the specified level the color to return for it in
-#	a call to ::log::lv2color. Unique abbreviations of level names
-#	are allowed.
-#
-# Arguments:
-#	level	The level the color is for.
-#	color	The color to use for the specified level.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvColor {level color} {
-    variable colorMap
-    set level [lv2longform $level]
-    set colorMap($level) $color
-    return
-}
-
-# log::lvColorForall --
-#
-#	Defines for all known levels the color to return for it in a
-#	call to ::log::lv2color. Unique abbreviations of level names
-#	are allowed.
-#
-# Arguments:
-#	color	The color to use for all levels.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::lvColorForall {color} {
-    variable colorMap
-    variable levels
-
-    foreach l $levels {
-	set colorMap($l) $color
-    }
-    return
-}
-
-# log::logarray --
-#
-#	Similar to parray, except that the contents of the array
-#	printed out through the log system instead of directly
-#	to stdout.
-#
-#	See also 'log::log' for a general explanation
-#
-# Arguments:
-#	level		The level of the message.
-#	arrayvar	The name of the array varaibe to dump
-#	pattern		Optional pattern to restrict the dump
-#			to certain elements in the array.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::logarray {level arrayvar {pattern *}} {
-    variable cmdMap
-
-    if {[lvIsSuppressed $level]} {
-	# Ignore messages for suppressed levels.
-	return
-    }
-
-    set level [lv2longform $level]
-
-    set cmd $cmdMap($level)
-    if {$cmd == {}} {
-	# Ignore messages for levels without a command
-	return
-    }
-
-    upvar 1 $arrayvar array
-    if {![array exists array]} {
-        error "\"$arrayvar\" isn't an array"
-    }
-    set maxl 0
-    foreach name [lsort [array names array $pattern]] {
-        if {[string length $name] > $maxl} {
-            set maxl [string length $name]
-        }
-    }
-    set maxl [expr {$maxl + [string length $arrayvar] + 2}]
-    foreach name [lsort [array names array $pattern]] {
-        set nameString [format %s(%s) $arrayvar $name]
-
-	eval [linsert $cmd end $level \
-		[format "%-*s = %s" $maxl $nameString $array($name)]]
-    }
-    return
-}
-
-# log::loghex --
-#
-#	Like 'log::log', except that the logged data is assumed to
-#	be binary and is logged as a block of hex numbers.
-#
-#	See also 'log::log' for a general explanation
-#
-# Arguments:
-#	level	The level of the message.
-#	text	Message printed before the hex block
-#	data	Binary data to show as hex.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::loghex {level text data} {
-    variable cmdMap
-
-    if {[lvIsSuppressed $level]} {
-	# Ignore messages for suppressed levels.
-	return
-    }
-
-    set level [lv2longform $level]
-
-    set cmd $cmdMap($level)
-    if {$cmd == {}} {
-	# Ignore messages for levels without a command
-	return
-    }
-
-    # Format the messages and print them.
-
-    set len [string length $data]
-
-    eval [linsert $cmd end $level "$text ($len bytes):"]
-
-    set address ""
-    set hexnums ""
-    set ascii   ""
-
-    for {set i 0} {$i < $len} {incr i} {
-        set v [string index $data $i]
-        binary scan $v H2 hex
-        binary scan $v c  num
-        set num [expr {($num + 0x100) % 0x100}]
-
-        set text .
-        if {$num > 31} {set text $v} 
-
-        if {($i % 16) == 0} {
-            if {$address != ""} {
-                eval [linsert $cmd end $level [format "%4s  %-48s  |%s|" $address $hexnums $ascii]]
-                set address ""
-                set hexnums ""
-                set ascii   ""
-            }
-            append address [format "%04d" $i]
-        }
-        append hexnums "$hex "
-        append ascii   $text
-    }
-    if {$address != ""} {
-	eval [linsert $cmd end $level [format "%4s  %-48s  |%s|" $address $hexnums $ascii]]
-    }
-    eval [linsert $cmd end $level ""]
-    return
-}
-
-# log::log --
-#
-#	Log a message according to the specifications for commands,
-#	channels and suppression. In other words: The command will do
-#	nothing if the specified level is suppressed. If it is not
-#	suppressed the actual logging is delegated to the specified
-#	command. If there is no command specified for the level the
-#	message won't be logged. The standard command ::log::Puts will
-#	write the message to the channel specified for the given
-#	level. If no channel is specified for the level the message
-#	won't be logged. Unique abbreviations of level names are
-#	allowed. Errors in the actual logging command are *not*
-#	catched, but propagated to the caller, as they may indicate
-#	misconfigurations of the log facility or errors in the callers
-#	code itself.
-#
-# Arguments:
-#	level	The level of the message.
-#	text	The message to log.
-#
-# Side Effects:
-#	See above.
-#
-# Results:
-#	None.
-
-proc ::log::log {level text} {
-    variable cmdMap
-
-    if {[lvIsSuppressed $level]} {
-	# Ignore messages for suppressed levels.
-	return
-    }
-
-    set level [lv2longform $level]
-
-    set cmd $cmdMap($level)
-    if {$cmd == {}} {
-	# Ignore messages for levels without a command
-	return
-    }
-
-    # Delegate actual logging to the command.
-    # Handle multi-line messages correctly.
-
-    foreach line [split $text \n] {
-	eval [linsert $cmd end $level $line]
-    }
-    return
-}
-
-# log::logMsg --
-#
-#	Convenience wrapper around ::log::log. Equivalent to
-#	'::log::log info text'.
-#
-# Arguments:
-#	text	The message to log.
-#
-# Side Effects:
-#	See ::log::log.
-#
-# Results:
-#	None.
-
-proc ::log::logMsg {text} {
-    log info $text
-}
-
-# log::logError --
-#
-#	Convenience wrapper around ::log::log. Equivalent to
-#	'::log::log error text'.
-#
-# Arguments:
-#	text	The message to log.
-#
-# Side Effects:
-#	See ::log::log.
-#
-# Results:
-#	None.
-
-proc ::log::logError {text} {
-    log error $text
-}
-
-
-# log::Puts --
-#
-#	Standard log command, writing messages and levels to
-#	user-specified channels. Assumes that the supression checks
-#	were done by the caller. Expects full level names,
-#	abbreviations are *not allowed*.
-#
-# Arguments:
-#	level	The level of the message. 
-#	text	The message to log.
-#
-# Side Effects:
-#	Writes into channels.
-#
-# Results:
-#	None.
-
-proc ::log::Puts {level text} {
-    variable channelMap
-    variable fill
-
-    set chan $channelMap($level)
-    if {$chan == {}} {
-	# Ignore levels without channel.
-	return
-    }
-
-    puts $chan "$level$fill($level) $text"
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization code. Disable logging for the lower levels by
-## default.
-
-## log::lvSuppressLE emergency
-log::lvSuppressLE warning
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/logger.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/logger.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1206 +1,0 @@
-# logger.tcl --
-#
-#   Tcl implementation of a general logging facility.
-#
-# Copyright (c) 2003      by David N. Welton <davidw@dedasys.com>
-# Copyright (c) 2004-2007 by Michael Schlenker <mic42@users.sourceforge.net>
-# Copyright (c) 2006      by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file license.terms.
-
-# The logger package provides an 'object oriented' log facility that
-# lets you have trees of services, that inherit from one another.
-# This is accomplished through the use of Tcl namespaces.
-
-
-package require Tcl 8.2
-package provide logger 0.8
-
-namespace eval ::logger {
-    namespace eval tree {}
-    namespace export init enable disable services servicecmd import
-
-    # The active services.
-    variable services {}
-
-    # The log 'levels'.
-    variable levels [list debug info notice warn error critical alert emergency]
-    
-    # The default global log level used for new logging services
-    variable enabled "debug"
-
-    # Tcl return codes (in numeric order)
-    variable RETURN_CODES   [list "ok" "error" "return" "break" "continue"]
-}
-
-# ::logger::_nsExists --
-#
-#   Workaround for missing namespace exists in Tcl 8.2 and 8.3.
-#
-
-if {[package vcompare [package provide Tcl] 8.4] < 0} {
-    proc ::logger::_nsExists {ns} {
-        expr {![catch {namespace parent $ns}]}
-    }
-} else {
-    proc ::logger::_nsExists {ns} {
-        namespace exists $ns
-    }
-}
-
-# ::logger::_cmdPrefixExists --
-#
-# Utility function to check if a given callback prefix exists,
-# this should catch all oddities in prefix names, including spaces, 
-# glob patterns, non normalized namespaces etc.
-#
-# Arguments:
-#   prefix - The command prefix to check
-#   
-# Results:
-#   1 or 0 for yes or no
-#
-proc ::logger::_cmdPrefixExists {prefix} {
-    set cmd [lindex $prefix 0]
-    set full [namespace eval :: namespace which [list $cmd]]
-    if {[string equal $full ""]} {return 0} else {return 1}
-    # normalize namespaces
-    set ns [namespace qualifiers $cmd]
-    set cmd ${ns}::[namespace tail $cmd]
-    set matches [::info commands ${ns}::*]
-    if {[lsearch -exact $matches $cmd] != -1} {return 1}
-    return 0
-}
-
-# ::logger::walk --
-#
-#   Walk namespaces, starting in 'start', and evaluate 'code' in
-#   them.
-#
-# Arguments:
-#   start - namespace to start in.
-#   code - code to execute in namespaces walked.
-#
-# Side Effects:
-#   Side effects of code executed.
-#
-# Results:
-#   None.
-
-proc ::logger::walk { start code } {
-    set children [namespace children $start]
-    foreach c $children {
-    logger::walk $c $code
-    namespace eval $c $code
-    }
-}
-
-proc ::logger::init {service} {
-    variable levels
-    variable services
-    variable enabled
-        
-    # We create a 'tree' namespace to house all the services, so
-    # they are in a 'safe' namespace sandbox, and won't overwrite
-    # any commands.
-    namespace eval tree::${service} {
-        variable service
-        variable levels
-        variable oldname
-        variable enabled
-    }
-
-    lappend services $service
-
-    set [namespace current]::tree::${service}::service $service
-    set [namespace current]::tree::${service}::levels $levels
-    set [namespace current]::tree::${service}::oldname $service
-    set [namespace current]::tree::${service}::enabled $enabled
-    
-    namespace eval tree::${service} {
-    # Callback to use when the service in question is shut down.
-    variable delcallback [namespace current]::no-op
-
-    # Callback when the loglevel is changed
-    variable levelchangecallback [namespace current]::no-op
-    
-    # State variable to decide when to call levelcallback
-    variable inSetLevel 0
-    
-    # The currently configured levelcommands
-    variable lvlcmds 
-    array set lvlcmds {}
-
-    # List of procedures registered via the trace command
-    variable traceList ""
-
-    # Flag indicating whether or not tracing is currently enabled
-    variable tracingEnabled 0
-
-    # We use this to disable a service completely.  In Tcl 8.4
-    # or greater, by using this, disabled log calls are a
-    # no-op!
-
-    proc no-op args {}
-
-
-    proc stdoutcmd {level text} {
-        variable service
-        puts "\[[clock format [clock seconds]]\] \[$service\] \[$level\] \'$text\'"
-    }
-
-    proc stderrcmd {level text} {
-        variable service
-        puts stderr "\[[clock format [clock seconds]]\] \[$service\] \[$level\] \'$text\'"
-    }
-
-
-    # setlevel --
-    #
-    #   This command differs from enable and disable in that
-    #   it disables all the levels below that selected, and
-    #   then enables all levels above it, which enable/disable
-    #   do not do.
-    #
-    # Arguments:
-    #   lv - the level, as defined in $levels.
-    #
-    # Side Effects:
-    #   Runs disable for the level, and then enable, in order
-    #   to ensure that all levels are set correctly.
-    #
-    # Results:
-    #   None.
-
-
-    proc setlevel {lv} {
-        variable inSetLevel 1
-        set oldlvl [currentloglevel]
-        
-        # do not allow enable and disable to do recursion
-        if {[catch {
-            disable $lv 0
-            set newlvl [enable $lv 0]
-        } msg] == 1} {
-            return -code error -errorcode $::errorCode $msg
-        }
-        # do the recursion here
-        logger::walk [namespace current] [list setlevel $lv]
-        
-        set inSetLevel 0
-        lvlchangewrapper $oldlvl $newlvl
-        return
-    }
-
-    # enable --
-    #
-    #   Enable a particular 'level', and above, for the
-    #   service, and its 'children'.
-    #
-    # Arguments:
-    #   lv - the level, as defined in $levels.
-    #
-    # Side Effects:
-    #   Enables logging for the particular level, and all
-    #   above it (those more important).  It also walks
-    #   through all services that are 'children' and enables
-    #   them at the same level or above.
-    #
-    # Results:
-    #   None.
-
-    proc enable {lv {recursion 1}} {
-        variable levels
-        set lvnum [lsearch -exact $levels $lv]
-        if { $lvnum == -1 } {
-        return -code error "Invalid level '$lv' - levels are $levels"
-        }
-
-        variable enabled
-        set newlevel $enabled
-        set elnum [lsearch -exact $levels $enabled]
-        if {($elnum == -1) || ($elnum > $lvnum)} {
-            set newlevel $lv
-        }
-                
-        variable service
-        while { $lvnum <  [llength $levels] } {
-        interp alias {} [namespace current]::[lindex $levels $lvnum] \
-            {} [namespace current]::[lindex $levels $lvnum]cmd
-        incr lvnum
-        }
-        
-        if {$recursion} {
-            logger::walk [namespace current] [list enable $lv]
-        }
-        lvlchangewrapper $enabled $newlevel
-        set enabled $newlevel
-    }
-
-    # disable --
-    #
-    #   Disable a particular 'level', and below, for the
-    #   service, and its 'children'.
-    #
-    # Arguments:
-    #   lv - the level, as defined in $levels.
-    #
-    # Side Effects:
-    #   Disables logging for the particular level, and all
-    #   below it (those less important).  It also walks
-    #   through all services that are 'children' and disables
-    #   them at the same level or below.
-    #
-    # Results:
-    #   None.
-
-    proc disable {lv {recursion 1}} {
-        variable levels
-        set lvnum [lsearch -exact $levels $lv]
-        if { $lvnum == -1 } {
-        return -code error "Invalid level '$lv' - levels are $levels"
-        }
-
-        variable enabled
-        set newlevel $enabled
-        set elnum [lsearch -exact $levels $enabled]
-        if {($elnum > -1) && ($elnum <= $lvnum)} {
-            if {$lvnum+1 >= [llength $levels]} {
-                set newlevel "none"
-            } else {
-                set newlevel [lindex $levels [expr {$lvnum+1}]]
-            }
-        }
-        
-        while { $lvnum >= 0 } {
-        
-        interp alias {} [namespace current]::[lindex $levels $lvnum] {} \
-            [namespace current]::no-op
-        incr lvnum -1
-        }
-        if {$recursion} {
-            logger::walk [namespace current] [list disable $lv]
-        }
-        lvlchangewrapper $enabled $newlevel
-        set enabled $newlevel
-    }
-
-    # currentloglevel --
-    #
-    #   Get the currently enabled log level for this service.
-    #
-    # Arguments:
-    #   none
-    #
-    # Side Effects:
-    #   none
-    #
-    # Results:
-    #   current log level
-    #
-
-    proc currentloglevel {} {
-        variable enabled
-        return $enabled
-    }
-
-    # lvlchangeproc --
-    #
-    #   Set or introspect a callback for when the logger instance 
-    #   changes its loglevel.
-    #
-    # Arguments:
-    #   cmd - the Tcl command to call, it is called with two parameters, old and new log level.
-    #   or none for introspection
-    #
-    # Side Effects:
-    #   None.
-    #
-    # Results:
-    #   If no arguments are given return the current callback cmd.
-
-    proc lvlchangeproc {args} {
-        variable levelchangecallback
-        
-        switch -exact -- [llength [::info level 0]] {
-                1   {return $levelchangecallback}
-                2   {
-                     if {[::logger::_cmdPrefixExists [lindex $args 0]]} {
-                        set levelchangecallback [lindex $args 0]
-                     } else {
-                        return -code error "Invalid cmd '[lindex $args 0]' - does not exist"
-                     }    
-                    }
-                default {
-                    return -code error "Wrong # of arguments. Usage: \${log}::lvlchangeproc ?cmd?"
-                }
-        }
-    }
-
-    proc lvlchangewrapper {old new} {
-        variable inSetLevel
-        
-        # we are called after disable and enable are finished 
-        if {$inSetLevel} {return}
-        
-        # no action if level does not change
-        if {[string equal $old $new]} {return}
-        
-        variable levelchangecallback
-        # no action if levelchangecallback isn't a valid command
-        if {[::logger::_cmdPrefixExists $levelchangecallback]} {
-        catch {
-            uplevel \#0 [linsert $levelchangecallback end $old $new]
-        }
-        }
-    }
-    
-    # logproc --
-    #
-    #   Command used to create a procedure that is executed to
-    #   perform the logging.  This could write to disk, out to
-    #   the network, or something else.
-    #   If two arguments are given, use an existing command.
-    #   If three arguments are given, create a proc.
-    #
-    # Arguments:
-    #   lv - the level to log, which must be one of $levels.
-    #   args - either zero, one or two arguments.
-    #          if zero this returns the current command registered 
-    #          if one, this is a cmd name that is called for this level
-    #          if two, these are an argument and proc body
-    #
-    # Side Effects:
-    #   Creates a logging command to take care of the details
-    #   of logging an event.
-    #
-    # Results:
-    #   If called with zero length args, returns the name of the currently
-    #   configured logging procedure.
-    #   
-    #
-
-    proc logproc {lv args} {
-        variable levels
-        variable lvlcmds
-        
-        set lvnum [lsearch -exact $levels $lv]
-        if { ($lvnum == -1) && ($lv != "trace") } {
-        return -code error "Invalid level '$lv' - levels are $levels"
-        }
-        switch -exact -- [llength $args] {
-        0  {
-            return $lvlcmds($lv)
-           }
-        1  {
-            set cmd [lindex $args 0]
-            if {[string equal "[namespace current]::${lv}cmd" $cmd]} {return} 
-            if {[llength [::info commands $cmd]]} {
-                proc ${lv}cmd {args} "uplevel 1 \[list $cmd \[lindex \$args end\]\]"
-            } else {
-                return -code error "Invalid cmd '$cmd' - does not exist"
-            }
-            set lvlcmds($lv) $cmd
-        }
-        2  {
-            foreach {arg body} $args {break}
-            proc ${lv}cmd {args} "_setservicename \$args; 
-                                      set val \[${lv}customcmd \[lindex \$args end\]\] ; 
-                                      _restoreservice; set val"
-            proc ${lv}customcmd $arg $body
-            set lvlcmds($lv) [namespace current]::${lv}customcmd
-        }
-        default {
-            return -code error "Usage: \${log}::logproc level ?cmd?\nor \${log}::logproc level argname body"
-        }
-        }
-    }
-
-
-    # delproc --
-    #
-    #   Set or introspect a callback for when the logger instance 
-    #   is deleted.
-    #
-    # Arguments:
-    #   cmd - the Tcl command to call.
-    #   or none for introspection
-    #
-    # Side Effects:
-    #   None.
-    #
-    # Results:
-    #   If no arguments are given return the current callback cmd.
-
-    proc delproc {args} {
-        variable delcallback
-        
-        switch -exact -- [llength [::info level 0]] {
-                1   {return $delcallback}
-                2   { if {[::logger::_cmdPrefixExists [lindex $args 0]]} {
-                            set delcallback [lindex $args 0]
-                      } else {
-                        return -code error "Invalid cmd '[lindex $args 0]' - does not exist"                      
-                      }
-                    }
-                default {
-                    return -code error "Wrong # of arguments. Usage: \${log}::delproc ?cmd?"
-                }
-        }
-    }
-
-
-    # delete --
-    #
-    #   Delete the namespace and its children.
-
-    proc delete {} {
-        variable delcallback
-        variable service
-        
-        logger::walk [namespace current] delete
-        if {[::logger::_cmdPrefixExists $delcallback]} {
-             uplevel \#0 [lrange $delcallback 0 end]  
-        } 
-        # clean up the global services list
-        set idx [lsearch -exact [logger::services] $service]
-        if {$idx !=-1} {
-            set ::logger::services [lreplace [logger::services] $idx $idx]
-        }
-        
-        namespace delete [namespace current]
-        
-    }
-
-    # services --
-    #
-    #   Return all child services 
-    
-    proc services {} {
-        variable service
-        
-        set children [list]
-        foreach srv [logger::services] {
-            if {[string match "${service}::*" $srv]} {
-                lappend children $srv
-            }
-        }
-        return $children
-    }
-
-    # servicename --
-    #
-    #   Return the name of the service
-    
-    proc servicename {} {
-        variable service
-        return $service
-    }
-    
-    proc _setservicename {arg} {
-        variable service
-        variable oldname
-        if {[llength $arg] <= 1} {
-            return
-        } else {
-            set oldname $service
-            set service [lindex $arg end-1]
-        }
-    }
-        
-    proc _restoreservice {} {
-        variable service
-        variable oldname
-        set service $oldname
-        return
-    }
-    
-    proc trace { action args } {
-        variable service
-
-        # Allow other boolean values (true, false, yes, no, 0, 1) to be used
-        # as synonymns for "on" and "off".
-
-        if {[string is boolean $action]} {
-            set xaction [expr {($action && 1) ? "on" : "off"}]
-        } else {
-            set xaction $action
-        }
-
-        # Check for required arguments for actions/subcommands and dispatch
-        # to the appropriate procedure.
-
-        switch -- $xaction {
-            "status" {
-                return [uplevel 1 [list logger::_trace_status $service $args]]
-            }
-            "on" {
-                if {[llength $args]} {
-                    return -code error "wrong # args: should be \"trace on\""
-                }
-                return [logger::_trace_on $service]
-            }
-            "off" {
-                if {[llength $args]} {
-                    return -code error "wrong # args: should be \"trace off\""
-                }
-                return [logger::_trace_off $service]
-            }
-            "add" {
-                if {![llength $args]} {
-                    return -code error \
-                        "wrong # args: should be \"trace add ?-ns? <proc> ...\""
-                }
-                return [uplevel 1 [list ::logger::_trace_add $service $args]]
-            }
-            "remove" {
-                if {![llength $args]} {
-                    return -code error \
-                        "wrong # args: should be \"trace remove ?-ns? <proc> ...\""
-                }
-                return [uplevel 1 [list ::logger::_trace_remove $service $args]]
-            }
-
-            default {
-	        return -code error \
-                    "Invalid action \"$action\": must be status, add, remove,\
-                    on, or off"
-            }
-        }
-    }
-
-    # Walk the parent service namespaces to see first, if they
-    # exist, and if any are enabled, and then, as a
-    # consequence, enable this one
-    # too.
-
-    enable $enabled
-    variable parent [namespace parent]
-    while {[string compare $parent "::logger::tree"]} {
-        # If the 'enabled' variable doesn't exist, create the
-        # whole thing.
-        if { ! [::info exists ${parent}::enabled] } {
-        
-        logger::init [string range $parent 16 end]
-        }
-        set enabled [set ${parent}::enabled]
-        enable $enabled
-        set parent [namespace parent $parent]
-    }
-    }
-
-    # Now create the commands for different levels.
-
-    namespace eval tree::${service} {
-    set parent [namespace parent]
-
-    # We 'inherit' the commands from the parents.  This
-    # means that, if you want to share the same methods with
-    # children, they should be instantiated after the parent's
-    # methods have been defined.
-    if {[string compare $parent "::logger::tree"]} {
-        foreach lvl [::logger::levels] {
-            # OPTIMIZE: do not allow multiple aliases in the hierarchy
-            #           they can always be replaced by more efficient
-            #           direct aliases to the target procs.
-            interp alias {} [namespace current]::${lvl}cmd {} ${parent}::${lvl}cmd $service
-        }
-        # inherit the starting loglevel of the parent service
-        setlevel [${parent}::currentloglevel]
-
-    } else {
-        foreach lvl [concat [::logger::levels] "trace"] {
-            proc ${lvl}cmd {args} "_setservicename \$args ; 
-                                   set val \[stdoutcmd $lvl \[lindex \$args end\]\] ; 
-                                   _restoreservice; set val"
-            set lvlcmds($lvl) [namespace current]::${lvl}cmd
-        }
-    }
-    }
-    
-    
-    return ::logger::tree::${service}
-}
-
-# ::logger::services --
-#
-#   Returns a list of all active services.
-#
-# Arguments:
-#   None.
-#
-# Side Effects:
-#   None.
-#
-# Results:
-#   List of active services.
-
-proc ::logger::services {} {
-    variable services
-    return $services
-}
-
-# ::logger::enable --
-#
-#   Global enable for a certain level.  NOTE - this implementation
-#   isn't terribly effective at the moment, because it might hit
-#   children before their parents, who will then walk down the
-#   tree attempting to disable the children again.
-#
-# Arguments:
-#   lv - level above which to enable logging.
-#
-# Side Effects:
-#   Enables logging in a given level, and all higher levels.
-#
-# Results:
-#   None.
-
-proc ::logger::enable {lv} {
-    variable services
-    if {[catch {
-        foreach sv $services {
-        ::logger::tree::${sv}::enable $lv
-        }
-    } msg] == 1} {
-        return -code error -errorcode $::errorCode $msg
-    }
-}
-
-proc ::logger::disable {lv} {
-    variable services
-    if {[catch {
-        foreach sv $services {
-        ::logger::tree::${sv}::disable $lv
-        }
-    } msg] == 1} {
-        return -code error -errorcode $::errorCode $msg
-    }
-}
-
-proc ::logger::setlevel {lv} {
-    variable services
-    variable enabled
-    variable levels
-    if {[lsearch -exact $levels $lv] == -1} {
-        return -code error "Invalid level '$lv' - levels are $levels"
-    } 
-    set enabled $lv    
-    if {[catch {
-        foreach sv $services {
-        ::logger::tree::${sv}::setlevel $lv
-        }
-    } msg] == 1} {
-        return -code error -errorcode $::errorCode $msg
-    }
-}
-
-# ::logger::levels --
-#
-#   Introspect the available log levels.  Provided so a caller does
-#   not need to know implementation details or code the list
-#   himself.
-#
-# Arguments:
-#   None.
-#
-# Side Effects:
-#   None.
-#
-# Results:
-#   levels - The list of valid log levels accepted by enable and disable
-
-proc ::logger::levels {} {
-    variable levels
-    return $levels
-}
-
-# ::logger::servicecmd --
-#
-#   Get the command token for a given service name.
-#
-# Arguments:
-#   service - name of the service.
-#
-# Side Effects:
-#   none
-#
-# Results:
-#   log - namespace token for this service
-
-proc ::logger::servicecmd {service} {
-    variable services
-    if {[lsearch -exact $services $service] == -1} {
-        return -code error "Service \"$service\" does not exist."
-    }
-    return "::logger::tree::${service}"
-}
-
-# ::logger::import --
-#
-#   Import the logging commands.
-#
-# Arguments:
-#   service - name of the service.
-#
-# Side Effects:
-#   creates aliases in the target namespace
-#
-# Results:
-#   none
-
-proc ::logger::import {args} {
-    variable services
-    
-    if {[llength $args] == 0 || [llength $args] > 7} {
-    return -code error "Wrong # of arguments: \"logger::import ?-all?\
-                        ?-force?\
-                        ?-prefix prefix? ?-namespace namespace? service\""
-    }
-    
-    # process options
-    #
-    set import_all 0
-    set force 0
-    set prefix ""
-    set ns [uplevel 1 namespace current]
-    while {[llength $args] > 1} {
-        set opt [lindex $args 0]
-        set args [lrange $args 1 end]
-        switch  -exact -- $opt {
-            -all    { set import_all 1}
-            -prefix { set prefix [lindex $args 0]
-                      set args [lrange $args 1 end]        
-                    }
-            -namespace {
-                      set ns [lindex $args 0]
-                      set args [lrange $args 1 end]
-            }
-            -force {
-                     set force 1
-            }
-            default {
-                return -code error "Unknown argument: \"$opt\" :\nUsage:\
-                \"logger::import ?-all? ?-force?\
-                        ?-prefix prefix? ?-namespace namespace? service\""
-            }
-        }
-    }
-    
-    #
-    # build the list of commands to import
-    #
-    
-    set cmds [logger::levels]
-    lappend cmds "trace"
-    if {$import_all} {
-        lappend cmds setlevel enable disable logproc delproc services 
-        lappend cmds servicename currentloglevel delete
-    }
-    
-    #
-    # check the service argument
-    #
-    
-    set service [lindex $args 0]
-    if {[lsearch -exact $services $service] == -1} {
-            return -code error "Service \"$service\" does not exist."
-    }
-
-    #
-    # setup the namespace for the import
-    #
-
-    set sourcens [logger::servicecmd $service]     
-    set localns  [uplevel 1 namespace current]
-    
-    if {[string match ::* $ns]} {
-        set importns $ns
-    } else {
-        set importns ${localns}::$ns
-    }    
-
-    # fake namespace exists for Tcl 8.2 - 8.3
-    if {![_nsExists $importns]} {
-        namespace eval $importns {}
-    } 
-
-    
-    #
-    # prepare the import
-    #
-    
-    set imports ""
-    foreach cmd $cmds {
-        set cmdname ${importns}::${prefix}$cmd
-        set collision [llength [info commands $cmdname]]
-        if {$collision && !$force} {
-            return -code error "can't import command \"$cmdname\": already exists"
-        }
-        lappend imports ${importns}::${prefix}$cmd ${sourcens}::${cmd}
-    }
-    
-    #
-    # and execute the aliasing after checking all is well
-    #
-    
-    foreach {target source} $imports {
-        proc $target {args} "uplevel 1 \[linsert \$args 0 $source \]"
-    }
-}
-
-# ::logger::initNamespace --
-#
-#   Creates a logger for the specified namespace and makes the log
-#   commands available to said namespace as well. Allows the initial
-#   setting of a default log level.
-#
-# Arguments:
-#   ns    - Namespace to initialize, is also the service name, modulo a ::-prefix
-#   level - Initial log level, optional, defaults to 'warn'.
-#
-# Side Effects:
-#   creates aliases in the target namespace
-#
-# Results:
-#   none
-
-proc ::logger::initNamespace {ns {level warn}} {
-    set service [string trimleft $ns :]
-    namespace eval $ns [list ::logger::init $service]
-    namespace eval $ns [list ::logger::import -force -all -namespace log $service]
-    namespace eval $ns [list log::setlevel $level]
-    return
-}
-
-# This procedure handles the "logger::trace status" command.  Given no
-# arguments, returns a list of all procedures that have been registered
-# via "logger::trace add".  Given one or more procedure names, it will
-# return 1 if all were registered, or 0 if any were not.
-
-proc ::logger::_trace_status { service procList } {
-    upvar #0 ::logger::tree::${service}::traceList traceList
-
-    # If no procedure names were given, just return the registered list
-
-    if {![llength $procList]} {
-        return $traceList
-    }
-
-    # Get caller's namespace for qualifying unqualified procedure names
-
-    set caller_ns [uplevel 1 namespace current]
-    set caller_ns [string trimright $caller_ns ":"]
-
-    # Search for any specified proc names that are *not* registered
-
-    foreach procName $procList {
-        # Make sure the procedure namespace is qualified
-
-        if {![string match "::*" $procName]} {
-            set procName ${caller_ns}::$procName
-        }
-
-        # Check if the procedure has been registered for tracing
-
-        if {[lsearch -exact $traceList $procName] == -1} {
-	    return 0
-        }
-    }
-
-    return 1
-}
-
-# This procedure handles the "logger::trace on" command.  If tracing
-# is turned off, it will enable Tcl trace handlers for all of the procedures
-# registered via "logger::trace add".  Does nothing if tracing is already
-# turned on.
-
-proc ::logger::_trace_on { service } {
-    set tcl_version [package provide Tcl]
-
-    if {[package vcompare $tcl_version "8.4"] < 0} {
-        return -code error \
-            "execution tracing is not available in Tcl $tcl_version"
-    }
-
-    namespace eval ::logger::tree::${service} {
-        if {!$tracingEnabled} {
-            set tracingEnabled 1
-            ::logger::_enable_traces $service $traceList
-        }
-    }
-
-    return 1
-}
-
-# This procedure handles the "logger::trace off" command.  If tracing
-# is turned on, it will disable Tcl trace handlers for all of the procedures
-# registered via "logger::trace add", leaving them in the list so they
-# tracing on all of them can be enabled again with "logger::trace on".
-# Does nothing if tracing is already turned off.
-
-proc ::logger::_trace_off { service } {
-    namespace eval ::logger::tree::${service} {
-        if {$tracingEnabled} {
-            ::logger::_disable_traces $service $traceList
-            set tracingEnabled 0
-        }
-    }
-
-    return 1
-}
-
-# This procedure is used by the logger::trace add and remove commands to
-# process the arguments in a common fashion.  If the -ns switch is given
-# first, this procedure will return a list of all existing procedures in
-# all of the namespaces given in remaining arguments.  Otherwise, each
-# argument is taken to be either a pattern for a glob-style search of
-# procedure names or, failing that, a namespace, in which case this
-# procedure returns a list of all the procedures matching the given
-# pattern (or all in the named namespace, if no procedures match).
-
-proc ::logger::_trace_get_proclist { inputList } {
-    set procList ""
-
-    if {[string equal [lindex $inputList 0] "-ns"]} {
-	# Verify that at least one target namespace was supplied
-
-	set inputList [lrange $inputList 1 end]
-	if {![llength $inputList]} {
-	    return -code error "Must specify at least one namespace target"
-	}
-
-	# Rebuild the argument list to contain namespace procedures
-
-	foreach namespace $inputList {
-            # Don't allow tracing of the logger (or child) namespaces
-
-	    if {![string match "::logger::*" $namespace]} {
-		set nsProcList  [::info procs ${namespace}::*]
-                set procList    [concat $procList $nsProcList]
-            }
-	}
-    } else {
-        # Search for procs or namespaces matching each of the specified
-        # patterns.
-
-        foreach pattern $inputList {
-	    set matches [uplevel 1 ::info proc $pattern]
-
-	    if {![llength $matches]} {
-	        if {[uplevel 1 namespace exists $pattern]} {
-		    set matches [::info procs ${pattern}::*]
-	        }
-
-                # Matched procs will be qualified due to above pattern
-
-                set procList [concat $procList $matches]
-            } elseif {[string match "::*" $pattern]} {
-                # Patterns were pre-qualified - add them directly
-
-                set procList [concat $procList $matches]
-            } else {
-                # Qualify each proc with the namespace it was in
-
-                set ns [uplevel 1 namespace current]
-                if {$ns == "::"} {
-                    set ns ""
-                }
-                foreach proc $matches {
-                    lappend procList ${ns}::$proc
-                }
-            }
-        }
-    }
-
-    return $procList
-}
-
-# This procedure handles the "logger::trace add" command.  If the tracing
-# feature is enabled, it will enable the Tcl entry and leave trace handlers
-# for each procedure specified that isn't already being traced.  Each
-# procedure is added to the list of procedures that the logger trace feature
-# should log when tracing is enabled.
-
-proc ::logger::_trace_add { service procList } {
-    upvar #0 ::logger::tree::${service}::traceList traceList
-
-    # Handle -ns switch and glob search patterns for procedure names
-
-    set procList [uplevel 1 [list logger::_trace_get_proclist $procList]]
-
-    # Enable tracing for each procedure that has not previously been
-    # specified via logger::trace add.  If tracing is off, this will just
-    # store the name of the procedure for later when tracing is turned on.
-
-    foreach procName $procList {
-        if {[lsearch -exact $traceList $procName] == -1} {
-            lappend traceList $procName
-            ::logger::_enable_traces $service [list $procName]
-        }
-    }
-}
-
-# This procedure handles the "logger::trace remove" command.  If the tracing
-# feature is enabled, it will remove the Tcl entry and leave trace handlers
-# for each procedure specified.  Each procedure is removed from the list
-# of procedures that the logger trace feature should log when tracing is
-# enabled.
-
-proc ::logger::_trace_remove { service procList } {
-    upvar #0 ::logger::tree::${service}::traceList traceList
-
-    # Handle -ns switch and glob search patterns for procedure names
-
-    set procList [uplevel 1 [list logger::_trace_get_proclist $procList]]
-
-    # Disable tracing for each proc that previously had been specified
-    # via logger::trace add.  If tracing is off, this will just
-    # remove the name of the procedure from the trace list so that it
-    # will be excluded when tracing is turned on.
-
-    foreach procName $procList {
-        set index [lsearch -exact $traceList $procName]
-        if {$index != -1} {
-            set traceList [lreplace $traceList $index $index]
-            ::logger::_disable_traces $service [list $procName]
-        }
-    }
-}
-
-# This procedure enables Tcl trace handlers for all procedures specified.
-# It is used both to enable Tcl's tracing for a single procedure when
-# removed via "logger::trace add", as well as to enable all traces
-# via "logger::trace on".
-
-proc ::logger::_enable_traces { service procList } {
-    upvar #0 ::logger::tree::${service}::tracingEnabled tracingEnabled
-
-    if {$tracingEnabled} {
-        foreach procName $procList {
-            ::trace add execution $procName enter \
-                [list ::logger::_trace_enter $service]
-            ::trace add execution $procName leave \
-                [list ::logger::_trace_leave $service]
-        }
-    }
-}
-
-# This procedure disables Tcl trace handlers for all procedures specified.
-# It is used both to disable Tcl's tracing for a single procedure when
-# removed via "logger::trace remove", as well as to disable all traces
-# via "logger::trace off".
-
-proc ::logger::_disable_traces { service procList } {
-    upvar #0 ::logger::tree::${service}::tracingEnabled tracingEnabled
-
-    if {$tracingEnabled} {
-        foreach procName $procList {
-            ::trace remove execution $procName enter \
-                [list ::logger::_trace_enter $service]
-            ::trace remove execution $procName leave \
-                [list ::logger::_trace_leave $service]
-        }
-    }
-}
-
-########################################################################
-# Trace Handlers
-########################################################################
-
-# This procedure is invoked upon entry into a procedure being traced
-# via "logger::trace add" when tracing is enabled via "logger::trace on"
-# to log information about how the procedure was called.
-
-proc ::logger::_trace_enter { service cmd op } {
-    # Parse the command
-    set procName [uplevel 1 namespace origin [lindex $cmd 0]]
-    set args     [lrange $cmd 1 end]
-
-    # Display the message prefix
-    set callerLvl [expr {[::info level] - 1}]
-    set calledLvl [::info level]
-
-    lappend message "proc" $procName
-    lappend message "level" $calledLvl
-    lappend message "script" [uplevel ::info script]
-
-    # Display the caller information
-    set caller ""
-    if {$callerLvl >= 1} {
-	# Display the name of the caller proc w/prepended namespace
-	catch {
-	    set callerProcName [lindex [::info level $callerLvl] 0]
-	    set caller [uplevel 2 namespace origin $callerProcName]
-	}
-    }
-
-    lappend message "caller" $caller
-
-    # Display the argument names and values
-    set argSpec [uplevel 1 ::info args $procName]
-    set argList ""
-    if {[llength $argSpec]} {
-	foreach argName $argSpec {
-            lappend argList $argName
-
-	    if {$argName == "args"} {
-                lappend argList $args
-                break
-	    } else {
-	        lappend argList [lindex $args 0]
-	        set args [lrange $args 1 end]
-            }
-	}
-    }
-
-    lappend message "procargs" $argList
-    set message [list $op $message]
-
-    ::logger::tree::${service}::tracecmd $message
-}
-
-# This procedure is invoked upon leaving into a procedure being traced
-# via "logger::trace add" when tracing is enabled via "logger::trace on"
-# to log information about the result of the procedure call.
-
-proc ::logger::_trace_leave { service cmd status rc op } {
-    variable RETURN_CODES
-
-    # Parse the command
-    set procName [uplevel 1 namespace origin [lindex $cmd 0]]
-
-    # Gather the caller information
-    set callerLvl [expr {[::info level] - 1}]
-    set calledLvl [::info level]
-
-    lappend message "proc" $procName "level" $calledLvl
-    lappend message "script" [uplevel ::info script]
-
-    # Get the name of the proc being returned to w/prepended namespace
-    set caller ""
-    catch {
-        set callerProcName [lindex [::info level $callerLvl] 0]
-        set caller [uplevel 2 namespace origin $callerProcName]
-    }
-
-    lappend message "caller" $caller
-
-    # Convert the return code from numeric to verbal
-
-    if {$status < [llength $RETURN_CODES]} {
-        set status [lindex $RETURN_CODES $status]
-    }
-
-    lappend message "status" $status
-    lappend message "result" $rc
-
-    # Display the leave message
-
-    set message [list $op $message]
-    ::logger::tree::${service}::tracecmd $message
-
-    return 1
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/loggerAppender.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/loggerAppender.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,449 +1,0 @@
-##Library Header
-#
-# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::appender
-#
-# Purpose:
-#	collection of appenders for tcllib logger
-#
-# Author:
-#	 Aamer Akhter / aakhter@cisco.com
-#
-# Support Alias:
-#       aakhter@cisco.com
-#
-# Usage:
-#	package require logger::appender
-#
-# Description:
-#	set of logger templates
-#      
-# Requirements:
-#       package require logger
-#       package require md5
-#
-# Variables:
-#       namespace   ::loggerExtension::
-#       id:         CVS ID: keyword extraction
-#       version:    current version of package
-#       packageDir: directory where package is located
-#       log:        instance log
-#
-# Notes:
-#       1.	
-#
-# Keywords:
-#	
-#
-# Category: 
-#       
-#
-# End of Header
-
-package require md5
-
-namespace eval ::logger::appender {
-    variable  fgcolor
-    array set fgcolor {
-	red      {31m}
-	red-bold {1;31m}
-	black    {m}
-	blue     {1m}
-	green    {32m}
-	yellow   {33m}
-	cyan     {36m}
-    }
-
-    variable  levelToColor
-    array set levelToColor {
-	debug     cyan
-	info      blue
-	notice    black
-	warn      red
-	error     red
-	critical  red-bold
-	alert     red-bold
-	emergency red-bold
-    }
-}
-
-
-
-##Procedure Header
-# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::appender::console
-#
-# Purpose:
-#	 
-#
-# Synopsis:
-#       ::logger::appender::console -level <level> -service <service> [options]
-#
-# Arguments:
-#       -level <level>
-#            name of level to fill in as 'priority' in log proc
-#       -service <service>
-#            name of service to fill in as 'category' in log proc
-#       -appenderArgs <appenderArgs>
-#            any additional args in list form
-#       -conversionPattern <conversionPattern>
-#            log pattern to use (see genLogProc)
-#       -procName <procName>
-#            explicitly set the proc name
-#       -procNameVar <procNameVar>
-#            name of variable to set in the calling context
-#            variable has name of proc 
-#
-#
-# Return Values:
-#	a runnable command 
-#
-# Description:
-#         
-#
-# Examples:
-#	
-#
-# Notes:
-#	1.
-#
-# End of Procedure Header 
-
-
-proc ::logger::appender::console {args} {
-    set usage {console 
-	?-level level?
-	?-service service? 
-	?-appenderArgs appenderArgs?
-    }
-    set bargs $args
-    set conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}
-    while {[llength $args] > 1} {
-        set opt [lindex $args 0]
-        set args [lrange $args 1 end]
-        switch  -exact -- $opt {
-            -level { set level [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -service { set service [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -appenderArgs {
-		set appenderArgs [lindex $args 0]
-		set args [lrange $args 1 end]
-		set args [concat $args $appenderArgs]
-	    }
-	    -conversionPattern {
-		set conversionPattern [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procName {
-		set procName [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procNameVar {
-		set procNameVar [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-            default {
-                return -code error [msgcat::mc "Unknown argument: \"%s\" :\nUsage:\
-                %s" $opt $usage]
-            }
-        }
-    }
-    if {![info exists procName]} {
-	set procName [genProcName $bargs]
-    }
-    if {[info exists procNameVar]} {
-	upvar $procNameVar myProcNameVar
-    }
-    set procText \
-	[ ::logger::utils::createLogProc \
-	      -procName $procName \
-	      -conversionPattern $conversionPattern \
-	      -category $service \
-	      -priority $level ]
-    set myProcNameVar $procName
-    return $procText
-}
-
-
-
-##Procedure Header
-# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::appender::colorConsole
-#
-# Purpose:
-#	 
-#
-# Synopsis:
-#       ::logger::appender::console -level <level> -service <service> [options]
-#
-# Arguments:
-#       -level <level>
-#            name of level to fill in as 'priority' in log proc
-#       -service <service>
-#            name of service to fill in as 'category' in log proc
-#       -appenderArgs <appenderArgs>
-#            any additional args in list form
-#       -conversionPattern <conversionPattern>
-#            log pattern to use (see genLogProc)
-#       -procName <procName>
-#            explicitly set the proc name
-#       -procNameVar <procNameVar>
-#            name of variable to set in the calling context
-#            variable has name of proc 
-#
-#
-# Return Values:
-#	a runnable command 
-#
-# Description:
-#       provides colorized logs
-#
-# Examples:
-#	
-#
-# Notes:
-#	1.
-#
-# End of Procedure Header 
-
-
-proc ::logger::appender::colorConsole {args} {
-    variable fgcolor
-    set usage {console 
-	?-level level?
-	?-service service? 
-	?-appenderArgs appenderArgs?
-    }
-    set bargs $args
-    set conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}
-    upvar 0 ::logger::appender::levelToColor colorMap
-    while {[llength $args] > 1} {
-        set opt [lindex $args 0]
-        set args [lrange $args 1 end]
-        switch  -exact -- $opt {
-            -level { set level [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -service { set service [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -appenderArgs {
-		set appenderArgs [lindex $args 0]
-		set args [lrange $args 1 end]
-		set args [concat $args $appenderArgs]
-	    }
-	    -conversionPattern {
-		set conversionPattern [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procName {
-		set procName [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procNameVar {
-		set procNameVar [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-            default {
-                return -code error [msgcat::mc "Unknown argument: \"%s\" :\nUsage:\
-                %s" $opt $usage]
-            }
-        }
-    }
-    if {![info exists procName]} {
-	set procName [genProcName $bargs]
-    }
-    upvar $procNameVar myProcNameVar
-    if {[info exists level]} {
-	#apply color
-	set colorCode $colorMap($level)
-	append newCPattern {\033\[} $fgcolor($colorCode) $conversionPattern {\033\[0m}
-	set conversionPattern $newCPattern
-    }
-    set procText \
-	[ ::logger::utils::createLogProc \
-	      -procName $procName \
-	      -conversionPattern $conversionPattern \
-	      -category $service \
-	      -priority $level ]
-    set myProcNameVar $procName
-    return $procText
-}
-
-##Procedure Header
-# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#       ::logger::appender::fileAppend
-#
-# Purpose:
-#
-#
-# Synopsis:
-#       ::logger::appender::fileAppend -level <level> -service <service> -outputChannel <channel> [options]
-#
-# Arguments:
-#       -level <level>
-#            name of level to fill in as 'priority' in log proc
-#       -service <service>
-#            name of service to fill in as 'category' in log proc
-#       -appenderArgs <appenderArgs>
-#            any additional args in list form
-#       -conversionPattern <conversionPattern>
-#            log pattern to use (see genLogProc)
-#       -procName <procName>
-#            explicitly set the proc name
-#       -procNameVar <procNameVar>
-#            name of variable to set in the calling context
-#            variable has name of proc
-#       -outputChannel <channel>
-#            name of output channel (eg stdout, file handle)
-#
-#
-# Return Values:
-#       a runnable command
-#
-# Description:
-#
-#
-# Examples:
-#
-#
-# Notes:
-#       1.
-#
-# End of Procedure Header
-
-
-proc ::logger::appender::fileAppend {args} {
-    set usage {console
-	?-level level?
-	?-service service?
-	?-outputChannel channel?
-	?-appenderArgs appenderArgs?
-    }
-    set bargs $args
-    set conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}
-    while {[llength $args] > 1} {
-	set opt [lindex $args 0]
-	set args [lrange $args 1 end]
-	switch  -exact -- $opt {
-	    -level { set level [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -service { set service [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -appenderArgs {
-		set appenderArgs [lindex $args 0]
-		set args [lrange $args 1 end]
-		set args [concat $args $appenderArgs]
-	    }
-	    -conversionPattern {
-		set conversionPattern [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procName {
-		set procName [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -procNameVar {
-		set procNameVar [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -outputChannel {
-		set outputChannel [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    default {
-		return -code error [msgcat::mc "Unknown argument: \"%s\" :\nUsage:\
-  	                 %s" $opt $usage]
-	    }
-	}
-    }
-    if {![info exists procName]} {
-	set procName [genProcName $bargs]
-    }
-    if {[info exists procNameVar]} {
-	upvar $procNameVar myProcNameVar
-    }
-    set procText \
-	[ ::logger::utils::createLogProc \
-	      -procName $procName \
-	      -conversionPattern $conversionPattern \
-	      -category $service \
-	      -outputChannel $outputChannel \
-	      -priority $level ]
-    set myProcNameVar $procName
-    return $procText
-}
-  	 
-
-
-
-##Internal Procedure Header
-# $Id: loggerAppender.tcl,v 1.4 2007/02/08 22:09:54 mic42 Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#       ::logger::appender::genProcName
-#
-# Purpose:
-#        
-#
-# Synopsis:
-#       ::logger::appender::genProcName <args>
-#
-# Arguments:
-#       <formatString>
-#            string composed of formatting chars (see description)
-#
-#
-# Return Values:
-#       a runnable command 
-#
-# Description:
-#         
-#
-# Examples:
-#       ::loggerExtension::new param1
-#       ::loggerExtension::new param2
-#       ::loggerExtension::new param3 <option1>
-#
-#
-# Sample Input:
-#       (Optional) Sample of input to the proc provided by its argument values.
-#
-# Sample Output:
-#       (Optional) For procs that output to files, provide 
-#       sample of format of output produced.
-# Notes:
-#       1.
-#
-# End of Procedure Header 
-
-
-proc ::logger::appender::genProcName {args} {
-    set name [md5::md5 -hex $args]
-    return "::logger::appender::logProc-$name"
-}
-
-
-package provide logger::appender 1.3
-
-# ;;; Local Variables: ***
-# ;;; mode: tcl ***
-# ;;; End: ***
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/loggerUtils.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/loggerUtils.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,544 +1,0 @@
-##Library Header
-#
-# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::utils::
-#
-# Purpose:
-#	an extension to the tcllib logger module
-#
-# Author:
-#	 Aamer Akhter / aakhter@cisco.com
-#
-# Support Alias:
-#       aakhter@cisco.com
-#
-# Usage:
-#	package require logger::utils
-#
-# Description:
-#	this extension adds template based appenders
-#
-# Requirements:
-#       package require logger
-#
-# Variables:
-#       namespace   ::logger::utils::
-#       id:         CVS ID: keyword extraction
-#       version:    current version of package
-#       packageDir: directory where package is located
-#       log:        instance log
-#
-# Notes:
-#       1.
-#
-# Keywords:
-#
-#
-# Category:
-#
-#
-# End of Header
-
-package require Tcl 8.4
-package require logger
-package require logger::appender
-package require msgcat
-
-namespace eval ::logger::utils {
-
-    variable packageDir [file dirname [info script]]
-    variable log        [logger::init logger::utils]
-
-    logger::import -force -namespace log logger::utils
-
-    # @mdgen OWNER: msgs/*.msg
-    ::msgcat::mcload [file join $packageDir msgs]
-}
-
-##Internal Procedure Header
-# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::utils::createFormatCmd
-#
-# Purpose:
-#
-#
-# Synopsis:
-#       ::logger::utils::createFormatCmd <formatString>
-#
-# Arguments:
-#       <formatString>
-#            string composed of formatting chars (see description)
-#
-#
-# Return Values:
-#	a runnable command
-#
-# Description:
-#       createFormatCmd translates <formatString> into an expandable
-#       command string.
-#
-#       The following are the known substitutions (from log4perl):
-#            %c category of the logging event
-#            %C fully qualified name of logging event
-#            %d current date in yyyy/MM/dd hh:mm:ss
-#            %H hostname
-#            %m message to be logged
-#            %M method where logging event was issued
-#            %p priority of logging event
-#            %P pid of current process
-#
-#
-# Examples:
-#       ::logger::new param1
-#       ::logger::new param2
-#       ::logger::new param3 <option1>
-#
-#
-# Sample Input:
-#	(Optional) Sample of input to the proc provided by its argument values.
-#
-# Sample Output:
-#	(Optional) For procs that output to files, provide
-#	sample of format of output produced.
-# Notes:
-#	1.
-#
-# End of Procedure Header
-
-
-proc ::logger::utils::createFormatCmd {text args} {
-    variable log
-    array set opt $args
-
-    regsub -all -- \
-	{%P} \
-	$text \
-	[pid] \
-	text
-
-    regsub -all -- \
-	{%H} \
-	$text \
-	[info hostname] \
-	text
-
-
-    #the %d subst has to happen at the end
-    regsub -all -- \
-	{%d} \
-	$text \
-	{[clock format [clock seconds] -format {%Y/%m/%d %H:%M:%S}]} \
-	text
-
-    if {[info exists opt(-category)]} {
-	regsub -all -- \
-	    {%c} \
-	    $text \
-	    $opt(-category) \
-	    text
-
-	regsub -all -- \
-	    {%C} \
-	    $text \
-	    [lindex [split $opt(-category) :: ] 0] \
-	    text
-    }
-
-    if {[info exists opt(-priority)]} {
-	regsub -all -- \
-	    {%p} \
-	    $text \
-	    $opt(-priority) \
-	    text
-    }
-
-    return $text
-}
-
-
-
-##Procedure Header
-# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::utils::createLogProc
-#
-# Purpose:
-#
-#
-# Synopsis:
-#       ::logger::utils::createLogProc -procName <procName> [options]
-#
-# Arguments:
-#       -procName <procName>
-#            name of proc to create
-#       -conversionPattern <pattern>
-#            see createFormatCmd for <pattern>
-#       -category <category>
-#            the category (service)
-#       -priority <priority>
-#            the priority (level)
-#       -outputChannel <channel>
-#            channel to output on (default stdout)
-#
-#
-# Return Values:
-#	a runnable command
-#
-# Description:
-#       createFormatCmd translates <formatString> into an expandable
-#       command string.
-#
-#       The following are the known substitutions (from log4perl):
-#            %c category of the logging event
-#            %C fully qualified name of logging event
-#            %d current date in yyyy/MM/dd hh:mm:ss
-#            %H hostname
-#            %m message to be logged
-#            %M method where logging event was issued
-#            %p priority of logging event
-#            %P pid of current process
-#
-#
-# Examples:
-#
-#
-# Sample Input:
-#	(Optional) Sample of input to the proc provided by its argument values.
-#
-# Sample Output:
-#	(Optional) For procs that output to files, provide
-#	sample of format of output produced.
-# Notes:
-#	1.
-#
-# End of Procedure Header
-
-
-proc ::logger::utils::createLogProc {args} {
-    variable log
-    array set opt $args
-
-    set formatText ""
-    set methodText ""
-    if {[info exists opt(-conversionPattern)]} {
-	set text $opt(-conversionPattern)
-
-	regsub -all -- \
-	    {%P} \
-	    $text \
-	    [pid] \
-	    text
-
-	regsub -all -- \
-	    {%H} \
-	    $text \
-	    [info hostname] \
-	    text
-
-	if {[info exists opt(-category)]} {
-	    regsub -all -- \
-		{%c} \
-		$text \
-		$opt(-category) \
-		text
-
-	    regsub -all -- \
-		{%C} \
-		$text \
-		[lindex [split $opt(-category) :: ] 0] \
-		text
-	}
-
-	if {[info exists opt(-priority)]} {
-	    regsub -all -- \
-		{%p} \
-		$text \
-		$opt(-priority) \
-		text
-	}
-
-
-	if {[regexp {%M} $text]} {
-	    set methodText {
-		if {[info level] < 2} {
-		    set method "global"
-		} else {
-		    set method [lindex [info level -1] 0]
-		}
-
-	    }
-
-	    regsub -all -- \
-		{%M} \
-		$text \
-		{$method} \
-		text
-	}
-
-	regsub -all -- \
-	    {%m} \
-	    $text \
-	    {$text} \
-	    text
-
-	regsub -all -- \
-	    {%d} \
-	    $text \
-	    {[clock format [clock seconds] -format {%Y/%m/%d %H:%M:%S}]} \
-	    text
-
-    }
-
-    if {[info exists opt(-outputChannel)]} {
-	set outputChannel $opt(-outputChannel)
-    } else {
-	set outputChannel stdout
-    }
-
-    set formatText $text
-    set outputCommand puts
-
-    set procText {
-	proc $opt(-procName) {text} {
-	    $methodText
-	    $outputCommand $outputChannel \"$formatText\"
-	}
-    }
-
-    set procText [subst $procText]
-    return $procText
-}
-
-
-##Procedure Header
-# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::utils::applyAppender
-#
-# Purpose:
-#
-#
-# Synopsis:
-#       ::logger::utils::applyAppender -appender <appenderType> [options]
-#
-# Arguments:
-#       -service <logger service names>
-#       -serviceCmd <logger serviceCmds>
-#            name of logger instance to modify
-#            -serviceCmd takes as input the return of logger::init
-#
-#       -appender <appenderType>
-#            type of appender to use
-#             console|colorConsole...
-#
-#       -conversionPattern <pattern>
-#            see createLogProc for format
-#            if not provided the default pattern
-#            is used:
-#             {\[%d\] \[%c\] \[%M\] \[%p\] %m}
-#
-#       -levels <levels to apply to>
-#            list of levels to apply this appender to
-#            by default all levels are applied to
-#
-# Return Values:
-#
-#
-# Description:
-#       applyAppender will create an appender for the specified
-#       logger services. If not service is specified then the
-#       appender will be added as the default appender for
-#       the specified levels. If no levels are specified, then
-#       all levels are assumed.
-#
-#       The following are the known substitutions (from log4perl):
-#            %c category of the logging event
-#            %C fully qualified name of logging event
-#            %d current date in yyyy/MM/dd hh:mm:ss
-#            %H hostname
-#            %m message to be logged
-#            %M method where logging event was issued
-#            %p priority of logging event
-#            %P pid of current process
-#
-#
-# Examples:
-#        % set log [logger::init testLog]
-#        ::logger::tree::testLog
-#        % logger::utils::applyAppender -appender console -serviceCmd $log
-#        % ${log}::error "this is error"
-#        [2005/08/22 10:14:13] [testLog] [global] [error] this is error
-#
-#
-# End of Procedure Header
-
-
-proc ::logger::utils::applyAppender {args} {
-    set usage {logger::utils::applyAppender
-	-appender appender
-	?-instance?
-	?-levels levels?
-	?-appenderArgs appenderArgs?
-    }
-    set levels [logger::levels]
-    set appenderArgs {}
-    set bargs $args
-    while {[llength $args] > 1} {
-        set opt [lindex $args 0]
-        set args [lrange $args 1 end]
-        switch  -exact -- $opt {
-            -appender { set appender [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -serviceCmd { set serviceCmd [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -service { set serviceCmd [logger::servicecmd [lindex $args 0]]
-		set args [lrange $args 1 end]
-	    }
-            -levels { set levels [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-	    -appenderArgs {
-		set appenderArgs [lindex $args 0]
-		set args [lrange $args 1 end]
-	    }
-            default {
-                return -code error [msgcat::mc "Unknown argument: \"%s\" :\nUsage:\
-                %s" $opt $usage]
-            }
-        }
-    }
-
-    set appender ::logger::appender::${appender}
-    if {[info commands $appender] == {}} {
-	return -code error [msgcat::mc "could not find appender '%s'" $appender]
-    }
-
-    #if service is not specified make all future services with this appender
-    # spec
-    if {![info exists serviceCmd]} {
-	set ::logger::utils::autoApplyAppenderArgs $bargs
-	#add trace
-	#check to see if trace is already set
-	if {[lsearch [trace info execution logger::init] \
-		 {leave ::logger::utils::autoApplyAppender} ] == -1} {
-	    trace add execution ::logger::init leave ::logger::utils::autoApplyAppender
-	}
-	return
-    }
-
-
-    #foreach service specified, apply the appender for each of the levels
-    # specified
-    foreach srvCmd $serviceCmd {
-
-	foreach lvl $levels {
-	    set procText [$appender -appenderArgs $appenderArgs \
-			      -level $lvl \
-			      -service [${srvCmd}::servicename] \
-			      -procNameVar procName
-			 ]
-	    eval $procText
-	    ${srvCmd}::logproc $lvl $procName
-	}
-    }
-}
-
-
-##Internal Procedure Header
-# $Id: loggerUtils.tcl,v 1.6 2007/03/20 16:22:16 andreas_kupries Exp $
-# Copyright (c) 2005 Cisco Systems, Inc.
-#
-# Name:
-#	::logger::utils::autoApplyAppender
-#
-# Purpose:
-#
-#
-# Synopsis:
-#       ::logger::utils::autoApplyAppender <command> <command-string> <log> <op> <args>
-#
-# Arguments:
-#       <command>
-#       <command-string>
-#       <log>
-#            servicecmd generated by logger:init
-#       <op>
-#       <args>
-#
-# Return Values:
-#	<log>
-#
-# Description:
-#       autoApplyAppender is designed to be added via trace leave
-#       to logger::init calls
-#
-#       autoApplyAppender will look at preconfigred state (via applyAppender)
-#       to autocreate appenders for newly created logger instances
-#
-# Examples:
-#	logger::utils::applyAppender -appender console
-#	set log [logger::init applyAppender-3]
-#	${log}::error "this is error"
-#
-#
-# Sample Input:
-#
-# Sample Output:
-#
-# Notes:
-#	1.
-#
-# End of Procedure Header
-
-
-proc ::logger::utils::autoApplyAppender {command command-string log op args} {
-    variable autoApplyAppenderArgs
-    set bAppArgs $autoApplyAppenderArgs
-    set levels [logger::levels]
-    set appenderArgs {}
-    while {[llength $bAppArgs] > 1} {
-        set opt [lindex $bAppArgs 0]
-        set bAppArgs [lrange $bAppArgs 1 end]
-        switch  -exact -- $opt {
-            -appender { set appender [lindex $bAppArgs 0]
-		set bAppArgs [lrange $bAppArgs 1 end]
-	    }
-            -levels { set levels [lindex $bAppArgs 0]
-		set bAppArgs [lrange $bAppArgs 1 end]
-	    }
-	    -appenderArgs {
-		set appenderArgs [lindex $bAppArgs 0]
-		set bAppArgs [lrange $bAppArgs 1 end]
-	    }
-            default {
-                return -code error [msgcat::mc "Unknown argument: \"%s\" :\nUsage:\
-                %s" $opt $usage]
-            }
-        }
-    }
-    if {![info exists appender]} {
-	return -code error [msgcat::mc "need to specify -appender"]
-    }
-    logger::utils::applyAppender -appender $appender -serviceCmd $log \
-	-levels $levels -appenderArgs $appenderArgs
-    return $log
-}
-
-
-package provide logger::utils 1.3
-
-# ;;; Local Variables: ***
-# ;;; mode: tcl ***
-# ;;; End: ***
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/msgs/en.msg
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/msgs/en.msg	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-# -*- tcl -*-
-package require    msgcat
-namespace import ::msgcat::*
-
-mcset en "Unknown argument: \"%s\" :\nUsage: %s" "Unknown argument: \"%s\" :\nUsage: %s"
-mcset en "could not find appender '%s'"          "could not find appender '%s'"
-mcset en "need to specify -appender"             "need to specify -appender"
Index: tolsh/tolsh.vfs/lib/tcllib1.10/log/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/log/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,9 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8]} {return}
-package ifneeded log 1.2 [list source [file join $dir log.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded logger           0.8 [list source [file join $dir logger.tcl]]
-package ifneeded logger::appender 1.3   [list source [file join $dir loggerAppender.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded logger::utils    1.3   [list source [file join $dir loggerUtils.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/mapproj/mapproj.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/mapproj/mapproj.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1817 +1,0 @@
-# mapproj.tcl --
-#
-#	Package for map projections.
-#
-# Copyright (c) 2007 by Kevin B. Kenny.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: mapproj.tcl,v 1.1 2007/08/24 22:36:35 kennykb Exp $
-#------------------------------------------------------------------------------
-
-package require Tcl 8.4
-package require math::interpolate 1.0
-package require math::special 0.2.1
-
-package provide mapproj 1.0
-
-# ::mapproj --
-#
-#	Namespace holding the procedures and values.
-
-namespace eval ::mapproj {
-
-    # Cylindrical projections
-
-    namespace export toPlateCarree fromPlateCarree
-    namespace export toCassini fromCassini
-    namespace export toCylindricalEqualArea fromCylindricalEqualArea
-    namespace export toMercator fromMercator
-
-    # Named cylindric equal-area projections with specific
-    # standard parallels
-
-    namespace export toLambertCylindricalEqualArea \
-	fromLambertCylindricalEqualArea
-    namespace export toBehrmann fromBehrmann
-    namespace export toTrystanEdwards fromTrystanEdwards
-    namespace export toHoboDyer fromHoboDyer
-    namespace export toGallPeters fromGallPeters
-    namespace export toBalthasart fromBalthasart
-
-    # Pseudocylindrical projections - equal area
-
-    namespace export toSinusoidal fromSinusoidal
-    namespace export toMillerCylindrical fromMillerCylindrical
-    namespace export toMollweide fromMollweide
-    namespace export toEckertIV fromEckertIV toEckertVI fromEckertVI
-
-    # Pseudocylindrical projections - compromise
-
-    namespace export toRobinson fromRobinson
-
-    # Azimuthal projections
-
-    namespace export toAzimuthalEquidistant fromAzimuthalEquidistant
-    namespace export toLambertAzimuthalEqualArea fromLambertAzimuthalEqualArea
-    namespace export toStereographic fromStereographic
-    namespace export toOrthographic fromOrthographic
-    namespace export toGnomonic fromGnomonic
-
-    # Pseudo-azimuthal projections
-
-    namespace export toHammer fromHammer
-
-    # Conic projections
-
-    namespace export toConicEquidistant fromConicEquidistant
-    namespace export toLambertConformalConic fromLambertConformalConic
-    namespace export toAlbersEqualAreaConic fromAlbersEqualAreaConic
-
-    # Miscellaneous projections
-
-    namespace export toPeirceQuincuncial fromPeirceQuincuncial
-
-    # Fundamental constants
-
-    variable pi [expr {acos(-1.0)}]
-    variable twopi [expr {2.0 * $pi}]
-    variable halfpi [expr {0.5 * $pi}]
-    variable quarterpi [expr {0.25 * $pi}]
-    variable threequarterpi [expr {0.75 * $pi}]
-    variable mquarterpi [expr {-0.25 * $pi}]
-    variable mthreequarterpi [expr {-0.75 * $pi}]
-    variable radian [expr {180. / $pi}]
-    variable degree [expr {$pi / 180.}]
-    variable sqrt2 [expr {sqrt(2.)}]
-    variable sqrt8 [expr {2. * $sqrt2}]
-    variable halfSqrt3 [expr {sqrt(3.) / 2.}]
-    variable halfSqrt2 [expr {sqrt(2.) / 2.}]
-    variable EckertIVK1 [expr {2.0 / sqrt($pi * (4.0 + $pi))}]
-    variable EckertIVK2 [expr {2.0 * sqrt($pi / (4.0 + $pi))}]
-    variable EckertVIK1 [expr {sqrt(2.0 + $pi)}]
-    variable PeirceQuincuncialScale 3.7081493546027438 ;# 2*K(1/2)
-    variable PeirceQuincuncialLimit 1.8540746773013719 ;# K(1/2)
-
-    # Table of parallel length and distance from equator for the
-    # Robinson projection
-
-    variable RobinsonLatitude {
-	-90.0 	-85.0	-80.0	-75.0	-70.0	-65.0
-	-60.0	-55.0	-50.0	-45.0	-40.0	-35.0
-	-30.0	-25.0	-20.0	-15.0	-10.0	-5.0
-	0.0	5.0	10.0	15.0	20.0	25.0	30.0
-	35.0	40.0	45.0	50.0	55.0	60.0
-	65.0	70.0	75.0	80.0	85.0	90.0
-    }
-    variable RobinsonPLEN {
-	0.5322	0.5722	0.6213	0.6732	0.7186	0.7597
-	0.7986	0.8350	0.8679	0.8962	0.9216	0.9427
-	0.9600	0.9730	0.9822	0.9900	0.9954	0.9986
-	1.0000	0.9986	0.9954	0.9900	0.9822	0.9730	0.9600
-	0.9427	0.9216	0.8962	0.8679	0.8350	0.7986
-	0.7597	0.7186	0.6732	0.6213	0.5722	0.5322
-    }
-    variable RobinsonPDFE {
-	-1.0000	-0.9761	-0.9394	-0.8936	-0.8435	-0.7903
-	-0.7346	-0.6769	-0.6176	-0.5571	-0.4958	-0.4340
-	-0.3720	-0.3100	-0.2480	-0.1860	-0.1240	-0.0620
-	0.0000	0.0620	0.1240	0.1860	0.2480	0.3100	0.3720
-	0.4340	0.4958	0.5571	0.6176	0.6769	0.7346
-	0.7903	0.8435	0.8936	0.9394	0.9761	1.0000
-    }
-
-    # Interpolation tables for Robinson
-
-    variable RobinsonSplinePLEN \
-	[math::interpolate::prepare-cubic-splines \
-	     $RobinsonLatitude $RobinsonPLEN]
-    variable RobinsonSplinePDFE \
-	[math::interpolate::prepare-cubic-splines \
-	     $RobinsonLatitude $RobinsonPDFE]
-    variable RobinsonM [expr {0.5072 * $pi}]
-
-    namespace import ::math::special::cn
-
-}
-
-# ::mapproj::ellF - 
-#
-#	Computes the Legendre incomplete elliptic integral of the
-#	first kind:
-#
-#	F(phi, k) = \integral_0^phi dtheta/sqrt(1 - k**2 sin**2 theta)
-#
-#
-# Parameters:
-#	phi -- Limit of integration; angle around the ellipse
-#	k -- Eccentricity
-#
-# Results:
-#	Returns F(phi, k)
-#
-# Notes:
-#	We compute this integral in terms of the Carlson elliptic integral
-#	ellRF(x, y, z).
-
-proc ::mapproj::ellF {phi k} {
-    return [ellFaux [expr {cos($phi)}] [expr {sin($phi)}] $k]
-}
-
-# ::mapproj::ellFaux -
-#
-#	Computes the Legendre incomplete elliptic integral of the
-#	first kind when circular functions of the 'phi' argument
-#	are already available.
-#
-# Parameters:
-#	cos_phi - Cosine of the argument
-#	sin_phi - Sine of the argument
-#	k - Parameter
-#
-# Results:
-#	Returns F(atan(sin_phi/cos_phi), k)
-
-proc ::mapproj::ellFaux {cos_phi sin_phi k} {
-    set rf [ellRF [expr {$cos_phi * $cos_phi}] \
-	       [expr {1.0 - $k * $k * $sin_phi * $sin_phi}] \
-	       1.0]
-    return [expr {$sin_phi * $rf}]
-}
-
-# ::mapproj::ellRF --
-#
-#	Computes the Carlson incomplete elliptic integral of the
-#	first kind:
-#
-#	RF(x, y, z) = 1/2 * integral_0^inf dt/sqrt((t+x)*(t+y)*(t+z))
-#
-# Parameters:
-#	x, y, z -- Interchangeable parameters of the integral
-#
-# Results:
-#	Returns the value of RF
-
-proc ::mapproj::ellRF {x y z} {
-    if {$x < 0.0 || $y < 0.0 || $z < 0.0} {
-	return -code error "Negative argument to Carlson's ellRF" \
-	    -errorCode "ellRF negArgument"
-    }
-    set delx 1.0; set dely 1.0; set delz 1.0
-    while {abs($delx) > 0.0025 || abs($dely) > 0.0025 || abs($delz) > 0.0025} {
-	set sx [expr {sqrt($x)}]
-	set sy [expr {sqrt($y)}]
-	set sz [expr {sqrt($z)}]
-	set len [expr {$sx * ($sy + $sz) + $sy * $sz}]
-	set x [expr {0.25 * ($x + $len)}]
-	set y [expr {0.25 * ($y + $len)}]
-	set z [expr {0.25 * ($z + $len)}]
-	set mean [expr {($x + $y + $z) / 3.0}]
-	set delx [expr {($mean - $x) / $mean}]
-	set dely [expr {($mean - $y) / $mean}]
-	set delz [expr {($mean - $z) / $mean}]
-    }
-    set e2 [expr {$delx * $dely - $delz * $delz}]
-    set e3 [expr {$delx * $dely * $delz}]
-    return [expr {(1.0 + ($e2 / 24.0 - 0.1 - 3.0 * $e3 / 44.0) * $e2
-		   + $e3 / 14.) / sqrt($mean)}]
-}
-
-# ::mapproj::toPlateCarree --
-#
-#	Project a latitude and longitude onto the plate carrée.
-#
-# Parameters:
-#	phi_0 -- Latitude of the center of the sheet in degrees
-#	lambda_0 -- Longitude of the center of sheet in degrees
-#	lambda -- Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates.  Units of x and y are Earth radii;
-#	scale is true at the Equator.
-
-proc ::mapproj::toPlateCarree {lambda_0 phi_0 lambda phi} {
-    variable degree
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set x [expr {$lambda * $degree}]
-    set y [expr {($phi - $phi_0) * $degree}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromPlateCarree --
-#
-#	Solve a plate carrée projection for the
-#	latitude and longitude represented by a point on the map.
-#
-# Parameters:
-#	phi_0 -- Latitude of the center of the sheet in degrees
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromPlateCarree {phi_0 lambda_0 x y} {
-    variable radian
-    set lambda [expr {$lambda_0 + $x * $radian + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$y * $radian + $phi_0}]
-    return [list $lambda $phi]
-}
-
-# mapproj::toCylindricalEqualArea --
-#
-#	Project a latitude and longitude into cylindrical equal-area
-#	co-ordinates.
-#
-# Parameters:
-#	phi_1 --    Standard latitude in degrees
-#	phi_0 -- Latitude of the center of the sheet in degrees
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates.  Units of x and y are Earth radii;
-#	scale is true at the reference latitude
-
-proc ::mapproj::toCylindricalEqualArea {phi_1 lambda_0 phi_0 lambda phi} {
-    variable degree
-    set cos_phi_s [expr {cos($phi_1 * $degree)}]
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set x [expr {$lambda * $degree * $cos_phi_s}]
-    set y0 [expr {sin($phi_0 * $degree) / $cos_phi_s}]
-    set y [expr {sin($phi * $degree) / $cos_phi_s}]
-    return [list $x [expr {$y - $y0}]]
-}
-
-# ::mapproj::fromCylindricalEqualArea --
-#
-#	Solve a cylindrical equal area map projection for the
-#	latitude and longitude represented by a point on the map.
-#
-# Parameters:
-#	phi_1 -- Standard latitude in degrees
-#	phi_0 -- Latitude of the center of the sheet in degrees
-#	lambda_0 -- Longitude of the center of sheet in degrees
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromCylindricalEqualArea {phi_1 lambda_0 phi_0 x y} {
-    variable degree
-    variable radian
-    set cos_phi_s [expr {cos($phi_1 * $degree)}]
-    set lambda [expr {$lambda_0 + $x / $cos_phi_s * $radian + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set y0 [expr {sin($phi_0 * $degree) / $cos_phi_s}]
-    set phi [expr {asin(($y + $y0) * $cos_phi_s) * $radian}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toMercator --
-#
-#	Project a latitude and longitude into the Mercator projection
-#	co-ordinates.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	phi_0 -- Latitude of the center of sheet in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates in Earth radii. Scale is true
-#	at the Equator and increases without bounds toward the Poles.
-
-proc ::mapproj::toMercator {lambda_0 phi_0 lambda phi} {
-    variable trace; if {[info exists trace]} { puts [info level 0] }
-    variable degree
-    variable quarterpi
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set x [expr {$lambda * $degree}]
-    set y [expr {log(tan($quarterpi + 0.5 * $phi * $degree))}]
-    set y0 [expr {log(tan($quarterpi + 0.5 * $phi_0 * $degree))}]
-    if {[info exists trace]} { puts "[info level 0] -> $x [expr {$y - $y0}]" }
-    return [list $x [expr {$y - $y0}]]
-}
-
-# ::mapproj::fromMercator --
-#
-#	Converts Mercator map co-ordinates to latitude and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	phi_0 -- Latitude of the center of sheet in degrees
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromMercator {lambda_0 phi_0 x y} {
-    variable quarterpi
-    variable degree
-    variable radian
-    set y0 [expr {log(tan($quarterpi + 0.5 * $phi_0 * $degree))}]
-    set lambda [expr {$lambda_0 + $x  * $radian + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$radian * 2.0 * atan(exp($y + $y0)) - 90.0}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toMillerCylindrical --
-#
-#	Project a latitude and longitude into the Miller Cylindrical projection
-#	co-ordinates.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates.  The x co-ordinate ranges from
-#	-$pi to pi.
-
-proc ::mapproj::toMillerCylindrical {lambda_0 lambda phi} {
-    foreach {x y} [toMercator $lambda_0 0.0 \
-		       $lambda [expr {0.8 * $phi}]] break
-    set y [expr {1.25 * $y}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromMillerCylindrical --
-#
-#	Converts Miller Cylindrical projected  map co-ordinates 
-#	to latitude and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromMillerCylindrical {lambda_0 x y} {
-    foreach {lambda phi} [fromMercator $lambda_0 0.0 \
-			      $x [expr {0.8 * $y}]] break
-    return [list $lambda [expr {1.25 * $phi}]]
-}
-
-# ::mapproj::toSinusoidal --
-#
-#	Project a latitude and longitude into the sinusoidal
-#	(Sanson-Flamsteed) projection.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	phi_0 -- Latitude of the center of the sheet, in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates, in Earth radii. 
-#	Scale is true along the Equator and central meridian.
-
-proc ::mapproj::toSinusoidal {lambda_0 phi_0 lambda phi} {
-    variable degree
-    variable quarterpi
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set x [expr {$lambda * cos($phi)}]
-    set phi [expr {$phi - $phi_0 * $degree}]
-    return [list $x $phi]
-}
-
-# ::mapproj::fromSinusoidal --
-#
-#	Converts sinusoidal (Sanson-Flamsteed) map co-ordinates 
-#	to latitude and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	phi_0 -- Latitude of the center of the sheet, in degrees
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromSinusoidal {lambda_0 phi_0 x y} {
-    variable degree
-    variable radian
-    set y [expr {$y + $phi_0 * $degree}]
-    set phi [expr {$y * $radian}]
-    set lambda [expr {180. + $lambda_0 + $radian * $x / cos($y)}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toMollweide --
-#
-#	Project a latitude and longitude into the Mollweide projection
-#	co-ordinates.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates, in Earth radii. 
-#	Scale is true along the 40 deg 44 min parallels
-
-proc ::mapproj::toMollweide {lambda_0 lambda phi} {
-    variable degree
-    variable pi
-    variable halfpi
-    variable sqrt2
-    variable sqrt8
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set theta [expr {2.0 * asin(2.0 * $phi / $pi)}]
-    set diff 1.0
-    set pisinphi [expr {$pi * sin($phi)}]
-    while {abs($diff) >= 1.0e-4} {
-	set diff [expr {($theta + sin($theta) - $pisinphi)
-			/ (1.0 + cos($theta))}]
-	set theta [expr {$theta - $diff}]
-    }
-    set theta [expr {0.5 * $theta}]
-    set x [expr {$sqrt8 * $lambda * cos($theta) / $pi}]
-    set y [expr {$sqrt2 * sin($theta)}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromMollweide --
-#
-#	Converts Mollweide projected  map co-ordinates to latitude 
-#	and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromMollweide {lambda_0 x y} {
-    variable pi
-    variable radian
-    variable degree
-    variable halfpi
-    variable sqrt2
-    variable sqrt8
-    set theta [expr {asin($y / $sqrt2)}]
-    set lambda [expr {$lambda_0 + $radian * $pi * $x / 
-		      ($sqrt8 * cos($theta)) + 180.}]
-    set phi [expr {asin((2.0 * $theta + sin(2.0 * $theta)) / $pi)}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda [expr {$phi * $radian}]]
-}
-
-# ::mapproj::toEckertIV --
-#
-#	Project a latitude and longitude into the Eckert IV projection
-#	co-ordinates.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates.  Scale is true along the 40 deg 30 min
-#	parallels.
-
-proc ::mapproj::toEckertIV {lambda_0 lambda phi} {
-    variable degree
-    variable pi
-    variable halfpi
-    variable EckertIVK1
-    variable EckertIVK2
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set theta [expr {$phi / 2}]
-    set diff 1.0
-    set A [expr {(2.0 + $halfpi) * sin($phi)}]
-    while {abs($diff) >= 1.0e-4} {
-	set costheta [expr {cos($theta)}]
-	set sintheta [expr {sin($theta)}]
-	set diff \
-	    [expr {($theta + $sintheta * $costheta + 2.0 * sin($theta) - $A)
-		   / (2.0 * $costheta * (1.0 + $costheta))}]
-	set theta [expr {$theta - $diff}]
-    }
-    set x [expr {$EckertIVK1 * $lambda * (1.0 + cos($theta))}]
-    set y [expr {$EckertIVK2 * sin($theta)}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromEckertIV --
-#
-#	Converts Eckert IV projected  map co-ordinates to latitude 
-#	and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromEckertIV {lambda_0 x y} {
-    variable pi
-    variable radian
-    variable degree
-    variable halfpi
-    variable sqrt2
-    variable EckertIVK1
-    variable EckertIVK2
-    set sintheta [expr {$y / $EckertIVK2}]
-    set costheta [expr {sqrt(1.0 - $sintheta * $sintheta)}]
-    set theta [expr {atan2($sintheta, $costheta)}]
-    set phi [expr {asin(($theta + $sintheta*$costheta + 2.*$sintheta)
-			/ (2. + $halfpi))}]
-    set lambda [expr {180.0 + $lambda_0
-		      + $radian / $EckertIVK1 * $x / (1.0 + $costheta)}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda [expr {$phi * $radian}]]
-}
-
-# ::mapproj::toEckertVI --
-#
-#	Project a latitude and longitude into the Eckert IV projection
-#	co-ordinates.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates.  Scale is true along the 40 deg 30 min
-#	parallels.
-
-proc ::mapproj::toEckertVI {lambda_0 lambda phi} {
-    variable degree
-    variable pi
-    variable halfpi
-    variable EckertVIK1
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set theta [expr {$phi / 2}]
-    set diff 1.0
-    set A [expr {(1.0 + $halfpi) * sin($phi)}]
-    while {abs($diff) >= 1.0e-4} {
-	set costheta [expr {cos($theta)}]
-	set sintheta [expr {sin($theta)}]
-	set diff \
-	    [expr {($theta + $sintheta - $A)
-		   / (1.0 + $costheta)}]
-	set theta [expr {$theta - $diff}]
-    }
-    set x [expr {$lambda * (1.0 + cos($theta)) / $EckertVIK1}]
-    set y [expr {2.0 * $theta / $EckertVIK1}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromEckertVI --
-#
-#	Converts Eckert IV projected  map co-ordinates to latitude 
-#	and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromEckertVI {lambda_0 x y} {
-    variable pi
-    variable radian
-    variable degree
-    variable halfpi
-    variable sqrt2
-    variable EckertVIK1
-    puts [info level 0]
-    set theta [expr {0.5 * $EckertVIK1 * $y}]
-    puts [list theta = $theta]
-    set phi [expr {asin(($theta + sin($theta)) / (1.0 + $halfpi))}]
-    puts [list phi = $phi]
-    set lambda [expr {180.0 + $lambda_0 + $radian * $EckertVIK1 * $x
-		      / (1 + cos($theta))}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda [expr {$phi * $radian}]]
-}
-
-# ::mapproj::toRobinson --
-#
-#	Project a latitude and longitude into the Robinson projection.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates, in Earth radii. 
-#	Scale is true along the Equator.
-
-proc ::mapproj::toRobinson {lambda_0 lambda phi} {
-    variable RobinsonLatitude
-    variable RobinsonSplinePLEN
-    variable RobinsonSplinePDFE
-    variable RobinsonM
-    variable pi
-    variable degree
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set y [math::interpolate::interp-cubic-splines $RobinsonSplinePDFE $phi]
-    set y [expr {$RobinsonM * $y}]
-    set s [math::interpolate::interp-cubic-splines $RobinsonSplinePLEN $phi]
-    set x [expr {$degree * $s * $lambda}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromRobinson --
-#
-#	Solve the Robinson projection for the
-#	latitude and longitude represented by a point on the map.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromRobinson {lambda_0 x y} {
-    variable RobinsonLatitude
-    variable RobinsonPDFE
-    variable RobinsonSplinePLEN
-    variable RobinsonSplinePDFE
-    variable RobinsonM
-    variable radian
-
-    # We know that Robinson latitudes are equally spaced from [-90..90]
-    # at 5-degree intervals.  Find the values for RobinsonPDFE that
-    # bracket the y co-ordinate.
-
-    set y [expr {$y / $RobinsonM}]
-    set l 0
-    set u [expr {[llength $RobinsonPDFE] - 1}]
-    while {$l < $u} {
-	set m [expr {($l + $u + 1) / 2}]
-	if {$y >= [lindex $RobinsonPDFE $m]} {
-	    set l $m
-	} else {
-	    set u [expr {$m - 1}]
-	}
-    }
-    set u [lindex $RobinsonLatitude [expr {$l+1}]]
-    set l [lindex $RobinsonLatitude $l]
-    for {set i 0} {$i < 12} {incr i} {
-	set m [expr {0.5 * ($u + $l)}]
-	set ystar [math::interpolate::interp-cubic-splines \
-		       $RobinsonSplinePDFE $m]
-	if {$ystar < $y} {
-	    set l $m
-	} else {
-	    set u $m
-	}
-    }
-    puts "latitude $m"
-    set s [math::interpolate::interp-cubic-splines $RobinsonSplinePLEN $m]
-    puts "parallel length $s"
-    set lambda [expr {180.0 + $lambda_0 + $radian * $x / $s}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $m]
-}
-
-# ::mapproj::toCassini --
-#
-#	Project a latitude and longitude into the Cassini projection.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection in degrees
-#	phi_0 -- Latitude of the center of the sheet
-#	lambda --   Longitude of the point to be projected in degrees
-#	phi -- Latitude of the point to be projected in degrees
-#
-# Results:
-#	Returns x and y co-ordinates, in Earth radii. 
-#	Scale is true along the central meridian.
-
-proc ::mapproj::toCassini {lambda_0 phi_0 lambda phi} {
-    variable degree
-    variable pi
-    variable twopi
-    variable quarterpi
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set x [expr {asin(cos($phi) * sin($lambda))}]
-    set y [expr {atan2(tan($phi), cos($lambda)) - $degree * $phi_0}]
-    if {$y < -$pi} {
-	set y [expr {$y + $twopi}]
-    } elseif {$y > $pi} {
-	set y [expr {$y - $twopi}]
-    }
-    return [list $x $y]
-}
-
-# ::mapproj::fromCassini --
-#
-#	Converts Cassini map co-ordinates to latitude and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	phi_0 -- Latitude of the center of the sheet
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromCassini {lambda_0 phi_0 x y} {
-    variable degree
-    variable radian
-    set y [expr {$y + $degree * $phi_0}]
-    set phi [expr {$radian * asin(cos($x) * sin($y))}]
-    set lambda [expr {180. + $lambda_0 + $radian * atan2(tan($x), cos($y))}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toPeirceQuincuncial
-#
-#	Converts geodetic co-ordinates to the Peirce Quincuncial projection.
-#
-# Parameters:
-#	lambda_0 - Longitude of the central meridian.  (Conventionally, 20.0).
-#	lambda - Longitude of the point to be projected in degrees
-#	phi - Latitude of the point to be projected in degrees.
-#
-# Results:
-#	Returns a list of the x and y co-ordinates.
-
-proc ::mapproj::toPeirceQuincuncial {lambda_0 lambda phi} {
-    variable degree
-    variable halfSqrt2
-    variable pi
-    variable quarterpi
-    variable mquarterpi
-    variable threequarterpi
-    variable mthreequarterpi
-    variable PeirceQuincuncialScale
-
-    # Convert latitude and longitude to radians relative to the
-    # central meridian
-
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.) * $degree}]
-    set phi [expr {$phi * $degree}]
-
-    # Compute the auxiliary quantities 'm' and 'n'. Set 'm' to match
-    # the sign of 'lambda' and 'n' to be positive if |lambda| > pi/2
-
-    set cos_phiosqrt2 [expr {$halfSqrt2 * cos($phi)}]
-    set cos_lambda [expr {cos($lambda)}]
-    set sin_lambda [expr {sin($lambda)}]
-    set cos_a [expr {$cos_phiosqrt2 * ($sin_lambda + $cos_lambda)}]
-    set cos_b [expr {$cos_phiosqrt2 * ($sin_lambda - $cos_lambda)}]
-    set sin_a [expr {sqrt(1.0 - $cos_a * $cos_a)}]
-    set sin_b [expr {sqrt(1.0 - $cos_b * $cos_b)}]
-    set cos_a_cos_b [expr {$cos_a * $cos_b}]
-    set sin_a_sin_b [expr {$sin_a * $sin_b}]
-    set sin2_m [expr {1.0 + $cos_a_cos_b - $sin_a_sin_b}]
-    set sin2_n [expr {1.0 - $cos_a_cos_b - $sin_a_sin_b}]
-    if {$sin2_m < 0.0} {set sin2_m 0.0}
-    set sin_m [expr {sqrt($sin2_m)}]
-    if {$sin2_m > 1.0} { set sin2_m 1.0 }
-    set cos_m [expr {sqrt(1.0 - $sin2_m)}]
-    if {$sin_lambda < 0.0} {
-	set sin_m [expr {-$sin_m}]
-    }
-   if {$sin2_n < 0.0} { set sin2_n 0.0 }
-    set sin_n [expr {sqrt($sin2_n)}]
-    if {$sin2_n > 1.0} { set sin2_n 1.0 }
-    set cos_n [expr {sqrt(1.0 - $sin2_n)}]
-    if {$cos_lambda > 0.0} {
-	set sin_n [expr {-$sin_n}]
-    }
-
-    # Compute elliptic integrals to map the disc to the square
-
-    set x [ellFaux $cos_m $sin_m $halfSqrt2]
-    set y [ellFaux $cos_n $sin_n $halfSqrt2]
-
-    # Reflect the Southern Hemisphere outward
-
-    if {$phi < 0} {
-	if {$lambda < $mthreequarterpi} {
-	    set y [expr {$PeirceQuincuncialScale - $y}]
-	} elseif {$lambda < $mquarterpi} {
-	    set x [expr {-$PeirceQuincuncialScale - $x}]
-	} elseif {$lambda < $quarterpi} {
-	    set y [expr {-$PeirceQuincuncialScale - $y}]
-	} elseif {$lambda < $threequarterpi} {
-	    set x [expr {$PeirceQuincuncialScale - $x}]
-	} else {
-	    set y [expr {$PeirceQuincuncialScale - $y}]
-	}
-    }
-
-    # Rotate the square by 45 degrees to fit the screen better
-
-    set X [expr {($x - $y) * $halfSqrt2}]
-    set Y [expr {($x + $y) * $halfSqrt2}]
-
-    return [list $X $Y]
-}
-
-# ::mapproj::fromPeirceQuincuncial --
-#
-#	Converts Peirce Quincuncial map co-ordinates to latitude and longitude.
-#
-# Parameters:
-#	lambda_0 -- Longitude of the center of projection
-#	x,y -- normalized x and y co-ordinates of a point on the map
-#
-# Results:
-#	Returns a list consisting of the longitude and latitude in degrees.
-
-proc ::mapproj::fromPeirceQuincuncial {lambda_0 x y} {
-    variable halfSqrt2
-    variable radian
-    variable pi
-    variable halfpi
-    variable quarterpi
-    variable PeirceQuincuncialScale
-    variable PeirceQuincuncialLimit
-
-    # Rotate x and y 45 degrees
-
-    set X [expr {($x + $y) * $halfSqrt2}]
-    set Y [expr {($y - $x) * $halfSqrt2}]
-
-    # Reflect Southern Hemisphere into the Northern
-
-    set southern 0
-    if {$X < -$PeirceQuincuncialLimit} {
-	set X [expr {-$PeirceQuincuncialScale - $X}]
-	set southern 1
-    } elseif {$X > $PeirceQuincuncialLimit} {
-	set X [expr {$PeirceQuincuncialScale - $X}]
-	set southern 1
-    } elseif {$Y < -$PeirceQuincuncialLimit} {
-	set Y [expr {-$PeirceQuincuncialScale - $Y}]
-	set southern 1
-    } elseif {$Y > $PeirceQuincuncialLimit} {
-	set Y [expr {$PeirceQuincuncialScale - $Y}]
-	set southern 1
-    }
-
-    # Now we know that latitude will be positive.  If X is negative, then
-    # longitude will be negative; reflect the Western Hemisphere into the
-    # Eastern.
-
-    set western 0
-    if {$X < 0.0} {
-	set western 1
-	set X [expr {-$X}]
-    }
-
-    # If Y is positive, the point is in the back hemisphere.  Reflect
-    # it to the front.
-
-    set back 0
-    if {$Y > 0.0} {
-	set back 1
-	set Y [expr {-$Y}]
-    }
-
-    # Finally, constrain longitude to be less than pi/4, by reflecting across
-    # the 45 degree meridian.
-
-    set complement 0
-    if {$X > -$Y} {
-	set complement 1
-	set t [expr {-$X}]
-	set X [expr {-$Y}]
-	set Y $t
-    }
-
-    # Compute the elliptic functions to map the plane onto the sphere
-
-    set cnx [cn $X $halfSqrt2]
-    set cny [cn $Y $halfSqrt2]
-
-    # Undo the mapping to latitude and longitude
-
-    set a1 [expr {acos(-$cnx * $cnx)}]
-    set a2 [expr {acos($cny * $cny)}]
-    set b [expr {0.5 * ($a1 + $a2)}]
-    set a [expr {0.5 * ($a1 - $a2)}]
-    set cos_a [expr {cos($a)}]
-    set cos_b [expr {-cos($b)}]
-    set lambda [expr {$quarterpi - atan2($cos_b, $cos_a)}]
-    set phi [expr {acos(hypot($cos_b, $cos_a))}]
-
-    # Undo the reflections that were done above, to get correct latitude
-    # and longitude
-
-    if {$complement} {
-	set lambda [expr {$halfpi - $lambda}]
-    }
-    if {$back} {
-	set lambda [expr {$pi - $lambda}]
-    }
-    if {$western} {
-	set lambda [expr {-$lambda}]
-    }
-    if {$southern} {
-	set phi [expr {-$phi}]
-    }
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::RotateCartesianY
-#
-#	Rotates Cartesian co-ordinates about the y axis
-#
-# Parameters:
-#	phi - Angle (in degrees) about which to rotate.
-#	x,y,z - Cartesian co-ordinates
-#
-# Results:
-#	Returns a three-element list giving the rotated co-ordinates.
-
-proc ::mapproj::RotateCartesianY {phi x y z} {
-    variable degree
-    set phi [expr {$degree * $phi}]
-    set cos_phi [expr {cos($phi)}]
-    set sin_phi [expr {sin($phi)}]
-    return [list [expr {$x * $cos_phi - $z * $sin_phi}] \
-		$y \
-		[expr {$z * $cos_phi + $x * $sin_phi}]]
-}
-
-# ::mapproj::ToCartesian --
-#
-#	Converts geodetic co-ordinates to Cartesian
-#
-# Parameters:
-#	lambda - Longitude of the point to be projected, in degrees
-#	phi - Latitude of the point to be projected, in degrees
-#
-# Results:
-#	Returns a three-element list, x, y, z where x is the component
-#	in the direction of longitude 0, latitude 0, y is the component
-#	in the direction of longitude 90 East, latitude 0, and
-#	z is the component in the direction of the North Pole
-#
-# Auxiliary procedure used in several projections to convert
-# geodetic coordinates to Cartesian range and bearing.
-
-proc ::mapproj::ToCartesian {lambda phi} {
-    variable degree
-    set lambda [expr {$degree * $lambda}]
-    set phi [expr {$degree * $phi}]
-    set cos_phi [expr cos($phi)]
-    return [list [expr {$cos_phi * cos($lambda)}] \
-		[expr {$cos_phi * sin($lambda)}] \
-		[expr {sin($phi)}]]
-}
-
-# ::mapproj::CartesianToRangeAndBearing
-#
-#	Transforms view-relative Cartesian co-ordinates to range and
-#	bearing.
-#
-# Parameters:
-#	x,y,z - Cartesian co-ordinates relative to center of Earth;
-#	+x points to the viewer and +z to the "view-up" direction.
-#
-# Results:
-#	Returns a three-element list containing, in order,
-#	the cosine (easting) of the bearing, the sine (northing) of the
-#	bearing, and the range.
-
-proc ::mapproj::CartesianToRangeAndBearing {x y z} {
-    set c [expr {hypot($z, $y)}]
-    if {$c == 0} {
-	set cos_b 1.0
-	set sin_b 0.0
-    } else {
-	set cos_b [expr {$y / $c}]
-	set sin_b [expr {$z / $c}]
-    }
-    set range [expr {atan2($c, $x)}]
-    return [list $cos_b $sin_b $range]
-}
-
-# ::mapproj::RangeAndBearingToCartesian --
-#
-#	Converts range and bearing to Cartesian co-ordinates.
-#
-# Parameters:
-#	cos_b, sin_b -- Cosine (easting) and sine (northing) of the bearing
-#	range - Range, in Earth radii
-#
-# Results:
-#	Returns Cartesian co-ordinates relative to center of Earth.
-#	x is toward the station, and z is "view up"
-
-proc ::mapproj::RangeAndBearingToCartesian {cos_b sin_b range} {
-    set c [expr {sin($range)}]
-    set x [expr {cos($range)}]
-    set y [expr {$cos_b * $c}]
-    set z [expr {$sin_b * $c}]
-    return [list $x $y $z]
-}
-    
-
-# ::mapproj::CartesianToSpherical --
-#
-#	Transforms Cartesian x, y, z to spherical co-ordinates
-#
-# Parameters:
-#	x, y, z -- Coordinates of a point on the surface of the Earth,
-#	           in Earth radii
-#
-# Results:
-#	Returns a two-element list comprising longitude and latitude
-#	in radians
-
-proc ::mapproj::CartesianToSpherical {x y z} {
-    return [list [expr {atan2($y, $x)}] [expr {atan2($z, hypot($y, $x))}]]
-}
-
-# ::mapproj::toOrthographic --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toOrthographic {lambda_0 phi_0 lambda phi} {
-    foreach {x y z} [ToCartesian [expr {$lambda-$lambda_0}] $phi] \
-	break
-    foreach {x y z} [RotateCartesianY [expr {-$phi_0}] $x $y $z] \
-	break
-    if {$x < 0} {
-	return {}
-    } else {
-	return [list $y $z]
-    }
-}
-
-# ::mapproj::fromOrthographic --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromOrthographic {lambda_0 phi_0 x y} {
-    variable radian
-    set r [expr {hypot($x, $y)}]
-    set alpha [expr {asin($r)}]
-    set z [expr {sqrt(1.0 - $r*$r)}]
-    foreach {x y z} [RotateCartesianY $phi_0 $z $x $y] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toStereographic --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toStereographic {lambda_0 phi_0 lambda phi} {
-    foreach {x y z} [ToCartesian [expr {$lambda-$lambda_0}] $phi] \
-	break
-    foreach {x y z} [RotateCartesianY [expr {-$phi_0}] $x $y $z] \
-	break
-    if {$x < -0.5} {
-	return {}
-    } else {
-	set y [expr {2. * $y / (1. + $x)}]
-	set z [expr {2. * $z / (1. + $x)}]
-	return [list $y $z]
-    }
-}
-
-# ::mapproj::fromStereographic --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromStereographic {lambda_0 phi_0 x y} {
-    variable radian
-    variable halfpi
-    set denom [expr {4.0 + $x*$x + $y*$y}]
-    foreach {x y z} [list \
-			 [expr {(4.0 - $x*$x - $y*$y) / $denom}] \
-			 [expr {4. * $x / $denom}] \
-			 [expr {4. * $y / $denom}]] break
-    
-    foreach {x y z} [RotateCartesianY $phi_0 $x $y $z] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toGnomonic --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toGnomonic {lambda_0 phi_0 lambda phi} {
-    foreach {x y z} [ToCartesian [expr {$lambda-$lambda_0}] $phi] \
-	break
-    foreach {x y z} [RotateCartesianY [expr {-$phi_0}] $x $y $z] \
-	break
-    if {$x < 0.01} {
-	return {}
-    } else {
-	set y [expr {$y / $x}]
-	set z [expr {$z / $x}]
-	return [list $y $z]
-    }
-}
-
-# ::mapproj::fromGnomonic --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromGnomonic {lambda_0 phi_0 x y} {
-    variable radian
-    variable halfpi
-    set denom [expr {hypot(1.0, hypot($x, $y))}]
-    foreach {x y z} [list \
-			 [expr {1.0 / $denom}] \
-			 [expr {$x / $denom}] \
-			 [expr {$y / $denom}]] break
-    
-    foreach {x y z} [RotateCartesianY $phi_0 $x $y $z] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toAzimuthalEquidistant --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toAzimuthalEquidistant {lambda_0 phi_0 lambda phi} {
-    foreach {x y z} [ToCartesian [expr {$lambda-$lambda_0}] $phi] \
-	break
-    foreach {x y z} [RotateCartesianY [expr {-$phi_0}] $x $y $z] \
-	break
-    foreach {cs sn range} [CartesianToRangeAndBearing $x $y $z] break
-    return [list [expr {$cs * $range}] [expr {$sn * $range}]]
-}
-
-# ::mapproj::fromAzimuthalEquidistant --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromAzimuthalEquidistant {lambda_0 phi_0 x y} {
-    variable radian
-    variable halfpi
-
-    set range [expr {hypot($y, $x)}]
-    set cos_b [expr {$x / $range}]
-    set sin_b [expr {$y / $range}]
-    foreach {x y z} [RangeAndBearingToCartesian $cos_b $sin_b $range] break
-    foreach {x y z} [RotateCartesianY $phi_0 $x $y $z] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toLambertAzimuthalEqualArea --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toLambertAzimuthalEqualArea {lambda_0 phi_0 lambda phi} {
-    foreach {x y z} [ToCartesian [expr {$lambda-$lambda_0}] $phi] \
-	break
-    foreach {x y z} [RotateCartesianY [expr {-$phi_0}] $x $y $z] \
-	break
-    foreach {cs sn range} [CartesianToRangeAndBearing $x $y $z] break
-    set range [expr {2.0 * sin(0.5 * $range)}]
-    return [list [expr {$cs * $range}] [expr {$sn * $range}]]
-}
-
-# ::mapproj::fromLambertAzimuthalEqualArea --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromLambertAzimuthalEqualArea {lambda_0 phi_0 x y} {
-    variable radian
-    variable halfpi
-
-    set range [expr {hypot($y, $x)}]
-    set cos_b [expr {$x / $range}]
-    set sin_b [expr {$y / $range}]
-    set range [expr {2.0 * asin(0.5 * $range)}]
-    foreach {x y z} [RangeAndBearingToCartesian $cos_b $sin_b $range] break
-    foreach {x y z} [RotateCartesianY $phi_0 $x $y $z] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {$lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toHammer --
-#
-#	Transforms latitude and longitude to x and y co-ordinates
-#	on an orthographic projection.  Scale is true only at the
-#	point of projection.
-#
-# Parameters:
-#	lambda_0-- Longitude of the center of projection
-#			   in degrees
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#		       in degrees
-#
-# Results:
-#	Returns map x and y co-ordinates, in Earth radii.
-
-proc ::mapproj::toHammer {lambda_0 lambda phi} {
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.0}]
-    foreach {x y z} [ToCartesian [expr {$lambda/2.}] $phi] \
-	break
-    foreach {cs sn range} [CartesianToRangeAndBearing $x $y $z] break
-    set range [expr {2.0 * sin(0.5 * $range)}]
-    return [list [expr {2.0 * $cs * $range}] [expr {$sn * $range}]]
-}
-
-# ::mapproj::fromHammer --
-#
-#	Transforms x and y on an orthographic projection to latitude
-#	and longitude.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of projection
-#			   in degrees
-#	x, y -- Co-ordinates of the projected point, in Earth radii
-#
-# Results:
-#	Returns a two element list containing longitude and latitude
-#	in degrees.
-
-proc ::mapproj::fromHammer {lambda_0 x y} {
-    variable radian
-    variable halfpi
-
-    set x [expr {0.5 * $x}]
-    set range [expr {hypot($y, $x)}]
-    set cos_b [expr {$x / $range}]
-    set sin_b [expr {$y / $range}]
-    set range [expr {2.0 * asin(0.5 * $range)}]
-    foreach {x y z} [RangeAndBearingToCartesian $cos_b $sin_b $range] break
-    foreach {lambda phi} [CartesianToSpherical $x $y $z] break
-
-    # Convert latitude and longitude to degrees
-
-    set lambda [expr {2.0 * $lambda * $radian + 180. + $lambda_0}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    set phi [expr {$phi * $radian}]
-
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toConicEquidistant
-#
-#	Converts latitude and longitude to map co-ordinates on a
-#	conic equidistant projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#
-# Results:
-#	Returns a list of map x and y measured in Earth radii.
-
-proc ::mapproj::toConicEquidistant {lambda_0 phi_0 phi_1 phi_2 lambda phi} {
-    variable degree
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.0) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set n [expr {($cos_phi_1 - cos($phi_2)) / ($phi_2 - $phi_1)}]
-    set G [expr {$cos_phi_1 / $n + $phi_1}]
-    set rho_0 [expr {$G - $phi_0}]
-    set theta [expr {$n * $lambda}]
-    set rho [expr {$G - $phi}]
-    set x [expr {$rho * sin($theta)}]
-    set y [expr {$rho_0 - $rho * cos($theta)}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromConicEquidistant --
-#
-#	Unprojects map x and y in a conic equidistant projection to
-#	latitude and longitude
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	x, y -- Map co-ordinates in Earth radii
-#
-# Results:
-#	Returns a list of longitude and latitude in degrees.
-
-proc ::mapproj::fromConicEquidistant {lambda_0 phi_0 phi_1 phi_2 x y} {
-    variable degree
-    variable radian
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set n [expr {($cos_phi_1 - cos($phi_2)) / ($phi_2 - $phi_1)}]
-    set G [expr {$cos_phi_1 / $n + $phi_1}]
-    set rho_0 [expr {$G - $phi_0}]
-    set rho_0my [expr {$rho_0 - $y}]
-    set theta [expr {atan2($x, $rho_0my)}]
-    set rho [expr {sqrt($x*$x + $rho_0my * $rho_0my)}]
-    if {$n < 0.0} {set rho [expr {-$rho}]}
-    set phi [expr {($G - $rho) * $radian}]
-    set lambda [expr {($theta / $n * $radian) + $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toAlbersEqualAreaConic
-#
-#	Converts latitude and longitude to map co-ordinates on a
-#	conic equal-area projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#
-# Results:
-#	Returns a list of map x and y measured in Earth radii.
-
-proc ::mapproj::toAlbersEqualAreaConic {lambda_0 phi_0 phi_1 phi_2 lambda phi} {
-    variable degree
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.0) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set sin_phi_1 [expr {sin($phi_1)}]
-    set n [expr {0.5 * ($sin_phi_1 + sin($phi_2))}]
-    set theta [expr {$n * $lambda}]
-    set C [expr {$cos_phi_1 * $cos_phi_1 + 2.0 * $n * $sin_phi_1}]
-    set rho [expr {sqrt($C - 2.0 * $n * sin($phi)) / $n}]
-    set rho_0 [expr {sqrt($C - 2.0 * $n * sin($phi_0)) / $n}]
-    set x [expr {$rho * sin($theta)}]
-    set y [expr {$rho_0 - $rho * cos($theta)}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromAlbersEqualAreaConic --
-#
-#	Unprojects map x and y in a conic equal-area projection to
-#	latitude and longitude
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	x, y -- Map co-ordinates in Earth radii
-#
-# Results:
-#	Returns a list of longitude and latitude in degrees.
-
-proc ::mapproj::fromAlbersEqualAreaConic {lambda_0 phi_0 phi_1 phi_2 x y} {
-    variable degree
-    variable radian
-    variable twopi
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set sin_phi_1 [expr {sin($phi_1)}]
-    set n [expr {0.5 * ($sin_phi_1 + sin($phi_2))}]
-    set C [expr {$cos_phi_1 * $cos_phi_1 + 2.0 * $n * $sin_phi_1}]
-    set rho_0 [expr {sqrt($C - 2.0 * $n * sin($phi_0)) / $n}]
-    set theta [expr {atan2($x, $rho_0 - $y)}]
-    set rho [expr {hypot($x, $rho_0 - $y)}]
-    set phi [expr {$radian * asin(($C - $rho*$rho*$n*$n) / (2.0 * $n))}]
-    set lambda [expr {($theta / $n * $radian) + $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $phi]
-}
-
-# ::mapproj::toLambertConformalConic
-#
-#	Converts latitude and longitude to map co-ordinates on a
-#	conformal conic projection.
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	lambda, phi -- Longitude and latitude of the point to be projected
-#
-# Results:
-#	Returns a list of map x and y measured in Earth radii.
-
-proc ::mapproj::toLambertConformalConic {lambda_0 phi_0 phi_1 phi_2 lambda phi} {
-    variable degree
-    variable quarterpi
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set lambda [expr {$lambda - $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {($lambda - 180.0) * $degree}]
-    set phi [expr {$phi * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set sin_phi_1 [expr {sin($phi_1)}]
-    set tan1 [expr {tan($quarterpi + 0.5 * $phi_1)}]
-    set n [expr {log($cos_phi_1 / cos($phi_2))
-		 / log(tan($quarterpi + 0.5 * $phi_2) / $tan1)}]
-    set F [expr {$cos_phi_1 * pow($tan1, $n) / $n}]
-    set rho [expr {$F * pow(tan($quarterpi + 0.5 * $phi), -$n)}]
-    set rho_0 [expr {$F * pow(tan($quarterpi + 0.5 * $phi_0), -$n)}]
-    set x [expr {$rho * sin($n * $lambda)}]
-    set y [expr {$rho_0 - $rho * cos($n * $lambda)}]
-    return [list $x $y]
-}
-
-# ::mapproj::fromLambertConformalConic --
-#
-#	Unprojects map x and y in a conformal conic projection to
-#	latitude and longitude
-#
-# Parameters:
-#	lambda_0, phi_0 -- Longitude and latitude of the center of the sheet.
-#	phi_1, phi_2 -- Latitudes of the two standard parallels at which scale
-#			is true
-#	x, y -- Map co-ordinates in Earth radii
-#
-# Results:
-#	Returns a list of longitude and latitude in degrees.
-
-proc ::mapproj::fromLambertConformalConic {lambda_0 phi_0 phi_1 phi_2 x y} {
-    variable degree
-    variable radian
-    variable quarterpi
-    set phi_0 [expr {$phi_0 * $degree}]
-    set phi_1 [expr {$phi_1 * $degree}]
-    set phi_2 [expr {$phi_2 * $degree}]
-    set cos_phi_1 [expr {cos($phi_1)}]
-    set sin_phi_1 [expr {sin($phi_1)}]
-    set tan1 [expr {tan($quarterpi + 0.5 * $phi_1)}]
-    set n [expr {log($cos_phi_1 / cos($phi_2))
-		 / log(tan($quarterpi + 0.5 * $phi_2) / $tan1)}]
-    set F [expr {$cos_phi_1 * pow($tan1, $n) / $n}]
-    set rho_0 [expr {$F * pow(tan($quarterpi + 0.5 * $phi_0), -$n)}]
-    set y [expr {$rho_0 - $y}]
-    set rho [expr {sqrt($x*$x + $y*$y)}]
-    if {$n < 0} { set rho [expr {-$rho}] }
-    set theta [expr {atan2($x, $y)}]
-    set phi [expr {$radian * 2 * atan(pow($F / $rho, 1.0 / $n)) - 90.}]
-    set lambda [expr {($theta / $n * $radian) + $lambda_0 + 180.}]
-    if {$lambda < 0.0 || $lambda > 360.0} {
-	set lambda [expr {$lambda - 360. * floor($lambda / 360.)}]
-    }
-    set lambda [expr {$lambda - 180.}]
-    return [list $lambda $phi]
-}
-
-# Define commonly used cylindrical equal-area projections
-
-proc ::mapproj::toLambertCylindricalEqualArea {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 0.0 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromLambertCylindricalEqualArea {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 0.0 $lambda_0 $phi_0 $x $y
-}
-proc ::mapproj::toBehrmann {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 30.0 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromBehrmann {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 30.0 $lambda_0 $phi_0 $x $y
-}
-proc ::mapproj::toTrystanEdwards {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 37.4 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromTrystanEdwards {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 37.4 $lambda_0 $phi_0 $x $y
-}
-proc ::mapproj::toHoboDyer {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 37.5 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromHoboDyer {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 37.5 $lambda_0 $phi_0 $x $y
-}
-proc ::mapproj::toGallPeters {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 45.0 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromGallPeters {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 45.0 $lambda_0 $phi_0 $x $y
-}
-proc ::mapproj::toBalthasart {lambda_0 phi_0 lambda phi} {
-    toCylindricalEqualArea 50.0 $lambda_0 $phi_0 $lambda $phi
-}
-proc ::mapproj::fromBalthasart {lambda_0 phi_0 x y} {
-    fromCylindricalEqualArea 50.0 $lambda_0 $phi_0 $x $y
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/mapproj/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/mapproj/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded mapproj 1.0 [list source [file join $dir mapproj.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/bessel.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/bessel.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,186 +1,0 @@
-# bessel.tcl --
-#    Evaluate the most common Bessel functions
-#
-# TODO:
-#    Yn - finding decent approximations seems tough
-#    Jnu - for arbitrary values of the parameter
-#    J'n - first derivative (from recurrence relation)
-#    Kn - forward application of recurrence relation?
-#
-
-# namespace special
-#    Create a convenient namespace for the "special" mathematical functions
-#
-namespace eval ::math::special {
-    #
-    # Define a number of common mathematical constants
-    #
-    ::math::constants::constants pi
-
-    #
-    # Export the functions
-    #
-    namespace export J0 J1 Jn J1/2 J-1/2 I_n
-}
-
-# J0 --
-#    Zeroth-order Bessel function
-#
-# Arguments:
-#    x         Value of the x-coordinate
-# Result:
-#    Value of J0(x)
-#
-proc ::math::special::J0 {x} {
-    Jn 0 $x
-}
-
-# J1 --
-#    First-order Bessel function
-#
-# Arguments:
-#    x         Value of the x-coordinate
-# Result:
-#    Value of J1(x)
-#
-proc ::math::special::J1 {x} {
-    Jn 1 $x
-}
-
-# Jn --
-#    Compute the Bessel function of the first kind of order n
-# Arguments:
-#    n       Order of the function (must be integer)
-#    x       Value of the argument
-# Result:
-#    Jn(x)
-# Note:
-#    This relies on the integral representation for
-#    the Bessel functions of integer order:
-#             1     I pi
-#    Jn(x) = --     I   cos(x sin t - nt) dt
-#            pi   0 I
-#
-#    For this kind of integrands the trapezoidal rule is
-#    very efficient according to Davis and Rabinowitz
-#    (Methods of numerical integration, 1984).
-#
-proc ::math::special::Jn {n x} {
-    variable pi
-
-    if { ![string is integer -strict $n] } {
-         return -code error "Order argument must be integer"
-    }
-
-    #
-    # Integrate over the interval [0,pi] using a small
-    # enough step - 40 points should do a good job
-    # with |x| < 20, n < 20 (an accuracy of 1.0e-8
-    # is reported by Davis and Rabinowitz)
-    #
-    set number 40
-    set step   [expr {$pi/double($number)}]
-    set result 0.0
-
-    for { set i 0 } { $i <= $number } { incr i } {
-        set t [expr {double($i)*$step}]
-        set f [expr {cos($x * sin($t) - $n * $t)}]
-        if { $i == 0 || $i == $number } {
-            set f [expr {$f/2.0}]
-        }
-        set result [expr {$result+$f}]
-    }
-
-    expr {$result*$step/$pi}
-}
-
-# J1/2 --
-#    Half-order Bessel function
-#
-# Arguments:
-#    x         Value of the x-coordinate
-# Result:
-#    Value of J1/2(x)
-#
-proc ::math::special::J1/2 {x} {
-    variable pi
-    #
-    # This Bessel function can be expressed in terms of elementary
-    # functions. Therefore use the explicit formula
-    #
-    if { $x != 0.0 } {
-        expr {sqrt(2.0/$pi/$x)*sin($x)}
-    } else {
-        return 0.0
-    }
-}
-
-# J-1/2 --
-#    Compute the Bessel function of the first kind of order -1/2
-# Arguments:
-#    x       Value of the argument (!= 0.0)
-# Result:
-#    J-1/2(x)
-#
-proc ::math::special::J-1/2 {x} {
-    variable pi
-    if { $x == 0.0 } {
-        return -code error "Argument must not be zero (singularity)"
-    } else {
-        return [expr {-cos($x)/sqrt($pi*$x/2.0)}]
-    }
-}
-
-# I_n --
-#    Compute the modified Bessel function of the first kind
-#
-# Arguments:
-#    n            Order of the function (must be positive integer or zero)
-#    x            Abscissa at which to compute it
-# Result:
-#    Value of In(x)
-# Note:
-#    This relies on Miller's algorithm for finding minimal solutions
-#
-namespace eval ::math::special {}
-
-proc ::math::special::I_n {n x} {
-    if { ! [string is integer $n] || $n < 0 } {
-        error "Wrong order: must be positive integer or zero"
-    }
-
-    set n2 [expr {$n+8}]  ;# Note: just a guess that this will be enough
-
-    set ynp1 0.0
-    set yn   1.0
-    set sum  1.0
-
-    while { $n2 > 0 } {
-        set ynm1 [expr {$ynp1+2.0*$n2*$yn/$x}]
-        set sum  [expr {$sum+$ynm1}]
-        if { $n2 == $n+1 } {
-           set result $ynm1
-        }
-        set ynp1 $yn
-        set yn   $ynm1
-        incr n2 -1
-    }
-
-    set quotient [expr {(2.0*$sum-$ynm1)/exp($x)}]
-
-    expr {$result/$quotient}
-}
-
-#
-# some tests --
-#
-if { 0 } {
-set tcl_precision 17
-foreach x {0.0 2.0 4.4 6.0 10.0 11.0 12.0 13.0 14.0} {
-    puts "J0($x) = [::math::special::J0 $x] - J1($x) = [::math::special::J1 $x] \
-- J1/2($x) = [::math::special::J1/2 $x]"
-}
-foreach n {0 1 2 3 4 5} {
-    puts [::math::special::I_n $n 1.0]
-}
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/bigfloat.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/bigfloat.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2297 +1,0 @@
-########################################################################
-# BigFloat for Tcl
-# Copyright (C) 2003-2005  ARNOLD Stephane
-#
-# BIGFLOAT LICENSE TERMS
-#
-# This software is copyrighted by Stephane ARNOLD, (stephanearnold <at> yahoo.fr).
-# The following terms apply to all files associated
-# with the software unless explicitly disclaimed in individual files.
-#
-# The authors hereby grant permission to use, copy, modify, distribute,
-# and license this software and its documentation for any purpose, provided
-# that existing copyright notices are retained in all copies and that this
-# notice is included verbatim in any distributions. No written agreement,
-# license, or royalty fee is required for any of the authorized uses.
-# Modifications to this software may be copyrighted by their authors
-# and need not follow the licensing terms described here, provided that
-# the new terms are clearly indicated on the first page of each file where
-# they apply.
-#
-# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-# MODIFICATIONS.
-#
-# GOVERNMENT USE: If you are acquiring this software on behalf of the
-# U.S. government, the Government shall have only "Restricted Rights"
-# in the software and related documentation as defined in the Federal
-# Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
-# are acquiring the software on behalf of the Department of Defense, the
-# software shall be classified as "Commercial Computer Software" and the
-# Government shall have only "Restricted Rights" as defined in Clause
-# 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
-# authors grant the U.S. Government and others acting in its behalf
-# permission to use and distribute the software in accordance with the
-# terms specified in this license.
-#
-########################################################################
-
-package require Tcl 8.4
-package require math::bignum
-
-# this line helps when I want to source this file again and again
-catch {namespace delete ::math::bigfloat}
-
-# private namespace
-# this software works only with Tcl v8.4 and higher
-# it is using the package math::bignum
-namespace eval ::math::bigfloat {
-    # cached constants
-    # ln(2) with arbitrary precision
-    variable Log2
-    # Pi with arb. precision
-    variable Pi
-    variable _pi0
-    # some constants (bignums) : {0 1 2 3 4 5 10}
-    variable zero
-    set zero [::math::bignum::fromstr 0]
-    variable one
-    set one [::math::bignum::fromstr 1]
-    variable two
-    set two [::math::bignum::fromstr 2]
-    variable three
-    set three [::math::bignum::fromstr 3]
-    variable four
-    set four [::math::bignum::fromstr 4]
-    variable five
-    set five [::math::bignum::fromstr 5]
-    variable ten
-    set ten [::math::bignum::fromstr 10]
-}
-
-
-
-
-################################################################################
-# procedures that handle floating-point numbers
-# these procedures are sorted by name (after eventually removing the underscores)
-# 
-# BigFloats are internally represented as a list :
-# {"F" Mantissa Exponent Delta} where "F" is a character which determins
-# the datatype, Mantissa and Delta are two Big integers and Exponent a raw integer.
-#
-# The BigFloat value equals to (Mantissa +/- Delta)*2^Exponent
-# So the internal representation is binary, but trying to get as close as possible to
-# the decimal one.
-# When calling fromstr, the Delta parameter is set to the value of the last decimal digit.
-# Example : 1.50 belongs to [1.49,1.51], but internally Delta is probably not equal to 1,
-# because of the binary representation.
-# 
-# So Mantissa and Delta are not limited in size, but in practice Delta is kept under
-# 2^32 by the 'normalize' procedure, to avoid a never-ended growth of memory used.
-# Indeed, when you perform some computations, the Delta parameter (which represent
-# the uncertainty on the value of the Mantissa) may increase.
-# Exponent, as a classic integer, is limited to the interval [-2147483648,2147483647]
-
-# Retrieving the parameters of a BigFloat is often done with that command :
-# foreach {dummy int exp delta} $bigfloat {break}
-# (dummy is not used, it is just used to get the "F" marker).
-# The isInt, isFloat, checkNumber and checkFloat procedures are used
-# to check data types
-#
-# Taylor development are often used to compute the analysis functions (like exp(),log()...)
-# To learn how it is done in practice, take a look at ::math::bigfloat::_asin
-# While doing computation on Mantissas, we do not care about the last digit,
-# because if we compute wisely Deltas, the digits that remain will be exact.
-################################################################################
-
-
-################################################################################
-# returns the absolute value
-################################################################################
-proc ::math::bigfloat::abs {number} {
-    checkNumber number
-    if {[isInt $number]} {
-        # set sign to positive for a BigInt
-        return [::math::bignum::abs $number]
-    }
-    # set sign to positive for a BigFloat into the Mantissa (index 1)
-    lset number 1 [::math::bignum::abs [lindex $number 1]]
-    return $number
-}
-
-
-################################################################################
-# arccosinus of a BigFloat
-################################################################################
-proc ::math::bigfloat::acos {x} {
-    # handy proc for checking datatype
-    checkFloat x
-    foreach {dummy entier exp delta} $x {break}
-    set precision [expr {($exp<0)?(-$exp):1}]
-    # acos(0.0)=Pi/2
-    # 26/07/2005 : changed precision from decimal to binary
-    # with the second parameter of pi command
-    set piOverTwo [floatRShift [pi $precision 1]]
-    if {[iszero $x]} {
-        # $x is too close to zero -> acos(0)=PI/2
-        return $piOverTwo
-    }
-    # acos(-x)= Pi/2 + asin(x)
-    if {[::math::bignum::sign $entier]} {
-        return [add $piOverTwo [asin [abs $x]]]
-    }
-    # we always use _asin to compute the result
-    # but as it is a Taylor development, the value given to [_asin]
-    # has to be a bit smaller than 1 ; by using that trick : acos(x)=asin(sqrt(1-x^2))
-    # we can limit the entry of the Taylor development below 1/sqrt(2)
-    if {[compare $x [fromstr 0.7071]]>0} {
-        # x > sqrt(2)/2 : trying to make _asin converge quickly 
-        # creating 0 and 1 with the same precision as the entry
-        variable one
-        variable zero
-        set fzero [list F $zero -$precision $one]
-        set fone [list F [::math::bignum::lshift 1 $precision] \
-                -$precision $one]
-        # when $x is close to 1 (acos(1.0)=0.0)
-        if {[equal $fone $x]} {
-            return $fzero
-        }
-        if {[compare $fone $x]<0} {
-            # the behavior assumed because acos(x) is not defined
-            # when |x|>1
-            error "acos on a number greater than 1"
-        }
-        # acos(x) = asin(sqrt(1 - x^2))
-        # since 1 - cos(x)^2 = sin(x)^2
-        # x> sqrt(2)/2 so x^2 > 1/2 so 1-x^2<1/2
-        set x [sqrt [sub $fone [mul $x $x]]]
-        # the parameter named x is smaller than sqrt(2)/2
-        return [_asin $x]
-    }
-    # acos(x) = Pi/2 - asin(x)
-    # x<sqrt(2)/2 here too
-    return [sub $piOverTwo [_asin $x]]
-}
-
-
-################################################################################
-# returns A + B
-################################################################################
-proc ::math::bigfloat::add {a b} {
-    checkNumber a b
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            # intAdd adds two BigInts
-            return [::math::bignum::add $a $b]
-        }
-        # adds the BigInt a to the BigFloat b
-        return [addInt2Float $b $a]
-    }
-    if {[isInt $b]} {
-        # ... and vice-versa
-        return [addInt2Float $a $b]
-    }
-    # retrieving parameters from A and B
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    # when we add two numbers which have different digit numbers (after the dot)
-    # for example : 1.0 and 0.00001
-    # We promote the one with the less number of digits (1.0) to the same level as
-    # the other : so 1.00000. 
-    # that is why we shift left the number which has the greater exponent
-    # But we do not forget the Delta parameter, which is lshift'ed too.
-    if {$expA>$expB} {
-        set diff [expr {$expA-$expB}]
-        set integerA [::math::bignum::lshift $integerA $diff]
-        set deltaA [::math::bignum::lshift $deltaA $diff]
-        set integerA [::math::bignum::add $integerA $integerB]
-        set deltaA [::math::bignum::add $deltaA $deltaB]
-        return [normalize [list F $integerA $expB $deltaA]]
-    } elseif {$expA==$expB} {
-        # nothing to shift left
-        return [normalize [list F [::math::bignum::add $integerA $integerB] \
-                $expA [::math::bignum::add $deltaA $deltaB]]]
-    } else {
-        set diff [expr {$expB-$expA}]
-        set integerB [::math::bignum::lshift $integerB $diff]
-        set deltaB [::math::bignum::lshift $deltaB $diff]
-        set integerB [::math::bignum::add $integerA $integerB]
-        set deltaB [::math::bignum::add $deltaB $deltaA]
-        return [normalize [list F $integerB $expA $deltaB]]
-    }
-}
-
-################################################################################
-# returns the sum A(BigFloat) + B(BigInt)
-# the greatest advantage of this method is that the uncertainty
-# of the result remains unchanged, in respect to the entry's uncertainty (deltaA)
-################################################################################
-proc ::math::bigfloat::addInt2Float {a b} {
-    # type checking
-    checkFloat a
-    if {![isInt $b]} {
-        error "'$b' is not a BigInt"
-    }
-    # retrieving data from $a
-    foreach {dummy integerA expA deltaA} $a {break}
-    # to add an int to a BigFloat,...
-    if {$expA>0} {
-        # we have to put the integer integerA
-        # to the level of zero exponent : 1e8 --> 100000000e0
-        set shift $expA
-        set integerA [::math::bignum::lshift $integerA $shift]
-        set deltaA [::math::bignum::lshift $deltaA $shift]
-        set integerA [::math::bignum::add $integerA $b]
-        # we have to normalize, because we have shifted the mantissa
-        # and the uncertainty left
-        return [normalize [list F $integerA 0 $deltaA]]
-    } elseif {$expA==0} {
-        # integerA is already at integer level : float=(integerA)e0
-        return [normalize [list F [::math::bignum::add $integerA $b] \
-                0 $deltaA]]
-    } else {
-        # here we have something like 234e-2 + 3
-        # we have to shift the integer left by the exponent |$expA|
-        set b [::math::bignum::lshift $b [expr {-$expA}]]
-        set integerA [::math::bignum::add $integerA $b]
-        return [normalize [list F $integerA $expA $deltaA]]
-    }
-}
-
-
-################################################################################
-# arcsinus of a BigFloat
-################################################################################
-proc ::math::bigfloat::asin {x} {
-    # type checking
-    checkFloat x
-    foreach {dummy entier exp delta} $x {break}
-    if {$exp>-1} {
-        error "not enough precision on input (asin)"
-    }
-    set precision [expr {-$exp}]
-    # when x=0, return 0 at the same precision as the input was
-    if {[iszero $x]} {
-        variable one
-        variable zero
-        return [list F $zero -$precision $one]
-    }
-    # asin(-x)=-asin(x)
-    if {[::math::bignum::sign $entier]} {
-        return [opp [asin [abs $x]]]
-    }
-    # 26/07/2005 : changed precision from decimal to binary
-    set piOverTwo [floatRShift [pi $precision 1]]
-    # now a little trick : asin(x)=Pi/2-asin(sqrt(1-x^2))
-    # so we can limit the entry of the Taylor development
-    # to 1/sqrt(2)~0.7071
-    # the comparison is : if x>0.7071 then ...
-    if {[compare $x [fromstr 0.7071]]>0} {
-        variable one
-        set fone [list F [::math::bignum::lshift 1 $precision] \
-                -$precision $one]
-        # asin(1)=Pi/2 (with the same precision as the entry has)
-        if {[equal $fone $x]} {
-            return $piOverTwo
-        }
-        if {[compare $x $fone]>0} {
-            error "asin on a number greater than 1"
-        }
-        # asin(x)=Pi/2-asin(sqrt(1-x^2))
-        set x [sqrt [sub $fone [mul $x $x]]]
-        return [sub $piOverTwo [_asin $x]]
-    }
-    return [normalize [_asin $x]]
-}
-
-################################################################################
-# _asin : arcsinus of numbers between 0 and +1
-################################################################################
-proc ::math::bigfloat::_asin {x} {
-    # Taylor development
-    # asin(x)=x + 1/2 x^3/3 + 3/2.4 x^5/5 + 3.5/2.4.6 x^7/7 + ...
-    # into this iterative form :
-    # asin(x)=x * (1 + 1/2 * x^2 * (1/3 + 3/4 *x^2 * (...
-    # ...* (1/(2n-1) + (2n-1)/2n * x^2 / (2n+1))...)))
-    # we show how is really computed the development : 
-    # we don't need to set a var with x^n or a product of integers
-    # all we need is : x^2, 2n-1, 2n, 2n+1 and a few variables
-    foreach {dummy mantissa exp delta} $x {break}
-    set precision [expr {-$exp}]
-    if {$precision+1<[::math::bignum::bits $mantissa]} {
-        error "sinus greater than 1"
-    }
-    # precision is the number of after-dot digits
-    set result $mantissa
-    set delta_final $delta
-    # resultat is the final result, and delta_final
-    # will contain the uncertainty of the result
-    # square is the square of the mantissa
-    set square [intMulShift $mantissa $mantissa $precision]
-    # dt is the uncertainty of Mantissa
-    set dt [::math::bignum::add 1 [intMulShift $mantissa $delta [expr {$precision-1}]]]
-    # these three are required to compute the fractions implicated into
-    # the development (of Taylor, see former)
-    variable one
-    set num $one
-    # two will be used into the loop
-    variable two
-    variable three
-    set i $three
-    set denom $two
-    # the nth factor equals : $num/$denom* $mantissa/$i
-    set delta [::math::bignum::add [::math::bignum::mul $delta $square] \
-            [::math::bignum::mul $dt [::math::bignum::add $delta $mantissa]]]
-    set delta [::math::bignum::add 1 [::math::bignum::rshift [::math::bignum::div \
-            [::math::bignum::mul $delta $num] $denom] $precision]]
-    # we do not multiply the Mantissa by $num right now because it is 1 !
-    # but we have Mantissa=$x
-    # and we want Mantissa*$x^2 * $num / $denom / $i
-    set mantissa [intMulShift $mantissa $square $precision]
-    set mantissa [::math::bignum::div $mantissa $denom]
-    # do not forget the modified Taylor development :
-    # asin(x)=x * (1 + 1/2*x^2*(1/3 + 3/4*x^2*(...*(1/(2n-1) + (2n-1)/2n*x^2/(2n+1))...)))
-    # all we need is : x^2, 2n-1, 2n, 2n+1 and a few variables
-    # $num=2n-1 $denom=2n $square=x^2 and $i=2n+1
-    set mantissa_temp [::math::bignum::div $mantissa $i]
-    set delta_temp [::math::bignum::add 1 [::math::bignum::div $delta $i]]
-    # when the Mantissa increment is smaller than the Delta increment,
-    # we would not get much precision by continuing the development
-    while {![::math::bignum::iszero $mantissa_temp]} {
-        # Mantissa = Mantissa * $num/$denom * $square
-        # Add Mantissa/$i, which is stored in $mantissa_temp, to the result
-        set result [::math::bignum::add $result $mantissa_temp]
-        set delta_final [::math::bignum::add $delta_final $delta_temp]
-        # here we have $two instead of [fromstr 2] (optimization)
-        # num=num+2,i=i+2,denom=denom+2
-        # because num=2n-1 denom=2n and i=2n+1
-        set num [::math::bignum::add $num $two]
-        set i [::math::bignum::add $i $two]
-        set denom [::math::bignum::add $denom $two]
-        # computes precisly the future Delta parameter
-        set delta [::math::bignum::add [::math::bignum::mul $delta $square] \
-                [::math::bignum::mul $dt [::math::bignum::add $delta $mantissa]]]
-        set delta [::math::bignum::add 1 [::math::bignum::rshift [::math::bignum::div \
-                [::math::bignum::mul $delta $num] $denom] $precision]]
-        set mantissa [intMulShift $mantissa $square $precision]
-        set mantissa [::math::bignum::div [::math::bignum::mul $mantissa $num] $denom]
-        set mantissa_temp [::math::bignum::div $mantissa $i]
-        set delta_temp [::math::bignum::add 1 [::math::bignum::div $delta $i]]
-    }
-    return [list F $result $exp $delta_final]
-}
-
-################################################################################
-# arctangent : returns atan(x)
-################################################################################
-proc ::math::bigfloat::atan {x} {
-    checkFloat x
-    variable one
-    variable two
-    variable three
-    variable four
-    variable zero
-    foreach {dummy mantissa exp delta} $x {break}
-    if {$exp>=0} {
-        error "not enough precision to compute atan"
-    }
-    set precision [expr {-$exp}]
-    # atan(0)=0
-    if {[iszero $x]} {
-        return [list F $zero -$precision $one]
-    }
-    # atan(-x)=-atan(x)
-    if {[::math::bignum::sign $mantissa]} {
-        return [opp [atan [abs $x]]]
-    }
-    # now x is strictly positive
-    # at this moment, we are trying to limit |x| to a fair acceptable number
-    # to ensure that Taylor development will converge quickly
-    set float1 [list F [::math::bignum::lshift 1 $precision] -$precision $one]
-    if {[compare $float1 $x]<0} {
-        # compare x to 2.4142
-        if {[compare $x [fromstr 2.4142]]<0} {
-            # atan(x)=Pi/4 + atan((x-1)/(x+1))
-            # as 1<x<2.4142 : (x-1)/(x+1)=1-2/(x+1) belongs to
-            # the range :  ]0,1-2/3.414[
-            # that equals  ]0,0.414[
-            set pi_sur_quatre [div [pi $precision 1] $four]
-            return [add $pi_sur_quatre [atan \
-                    [div [sub $x $float1] [add $x $float1]]]]
-        }
-        # atan(x)=Pi/2-atan(1/x)
-        # 1/x < 1/2.414 so the argument is lower than 0.414
-        set pi_over_two [div [pi $precision 1] $two]
-        return [sub $pi_over_two [atan [div $float1 $x]]]
-    }
-    if {[compare $x [fromstr 0.4142]]>0} {
-        # atan(x)=Pi/4 + atan((x-1)/(x+1))
-        # x>0.420 so (x-1)/(x+1)=1 - 2/(x+1) > 1-2/1.414
-        #                                    > -0.414
-        # x<1 so (x-1)/(x+1)<0
-        set pi_sur_quatre [div [pi $precision 1] $four]
-        return [add $pi_sur_quatre [atan \
-                [div [sub $x $float1] [add $x $float1]]]]
-    }
-    # precision increment : to have less uncertainty
-    # we add a little more precision so that the result would be more accurate
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # when we have n steps in Taylor development : the nth term is :
-    # x^(2n-1)/(2n-1)
-    # and the loss of precision is of 2n (n sums and n divisions)
-    # this command is called with x<sqrt(2)-1
-    # if we add an increment to the precision, say n:
-    # (sqrt(2)-1)^(2n-1)/(2n-1) has to be lower than 2^(-precision-n-1)
-    # (2n-1)*log(sqrt(2)-1)-log(2n-1)<-(precision+n+1)*log(2)
-    # 2n(log(sqrt(2)-1)-log(sqrt(2)))<-(precision-1)*log(2)+log(2n-1)+log(sqrt(2)-1)
-    # 2n*log(1-1/sqrt(2))<-(precision-1)*log(2)+log(2n-1)+log(2)/2
-    # 2n/sqrt(2)>(precision-3/2)*log(2)-log(2n-1)
-    # hence log(2n-1)<2n-1
-    # n*sqrt(2)>(precision-1.5)*log(2)+1-2n
-    # n*(sqrt(2)+2)>(precision-1.5)*log(2)+1
-    set n [expr {int((log(2)*($precision-1.5)+1)/(sqrt(2)+2)+1)}]
-    incr precision $n
-    set mantissa [::math::bignum::lshift $mantissa $n]
-    set delta [::math::bignum::lshift $delta $n]
-    # end of adding precision increment
-    # now computing Taylor development :
-    # atan(x)=x - x^3/3 + x^5/5 - x^7/7 ... + (-1)^n*x^(2n+1)/(2n+1)
-    # atan(x)=x * (1 - x^2 * (1/3 - x^2 * (1/5 - x^2 * (...*(1/(2n-1) - x^2 / (2n+1))...))))
-    # what do we need to compute this ?
-    # x^2 ($square), 2n+1 ($divider), $result, the nth term of the development ($t)
-    # and the nth term multiplied by 2n+1 ($temp)
-    # then we do this (with care keeping as much precision as possible):
-    # while ($t <>0) :
-    #     $result=$result+$t
-    #     $temp=$temp * $square
-    #     $divider = $divider+2
-    #     $t=$temp/$divider
-    # end-while
-    set result $mantissa
-    set delta_end $delta
-    # we store the square of the integer (mantissa)
-    set delta_square [::math::bignum::lshift $delta 1]
-    set square [intMulShift $mantissa $mantissa $precision]
-    # the (2n+1) divider
-    set divider $three
-    # computing precisely the uncertainty
-    set delta [::math::bignum::add 1 [::math::bignum::rshift [::math::bignum::add \
-            [::math::bignum::mul $delta_square $mantissa] \
-            [::math::bignum::mul $delta $square]] $precision]]
-    # temp contains (-1)^n*x^(2n+1)
-    set temp [opp [intMulShift $mantissa $square $precision]]
-    set t [::math::bignum::div $temp $divider]
-    set dt [::math::bignum::add 1 [::math::bignum::div $delta $divider]]
-    while {![::math::bignum::iszero $t]} {
-        set result [::math::bignum::add $result $t]
-        set delta_end [::math::bignum::add $delta_end $dt]
-        set divider [::math::bignum::add $divider $two]
-        set delta [::math::bignum::add 1 [::math::bignum::rshift [::math::bignum::add \
-                [::math::bignum::mul $delta_square [abs $temp]] [::math::bignum::mul $delta \
-                [::math::bignum::add $delta_square $square]]] $precision]]
-        set temp [opp [intMulShift $temp $square $precision]]
-        set t [::math::bignum::div $temp $divider]
-        set dt [::math::bignum::add [::math::bignum::div $delta $divider] $one]
-    }
-    # we have to normalize because the uncertainty might be greater than 99
-    # moreover it is the most often case
-    return [normalize [list F $result [expr {$exp-$n}] $delta_end]]
-}
-
-
-################################################################################
-# compute atan(1/integer) at a given precision
-# this proc is only used to compute Pi
-# it is using the same Taylor development as [atan]
-################################################################################
-proc ::math::bigfloat::_atanfract {integer precision} {
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # when we have n steps in Taylor development : the nth term is :
-    # 1/denom^(2n+1)/(2n+1)
-    # and the loss of precision is of 2n (n sums and n divisions)
-    # this command is called with integer>=5
-    #
-    # We do not want to compute the Delta parameter, so we just
-    # can increment precision (with lshift) in order for the result to be precise.
-    # Remember : we compute atan2(1,$integer) with $precision bits
-    # $integer has no Delta parameter as it is a BigInt, of course, so
-    # theorically we could compute *any* number of digits.
-    #
-    # if we add an increment to the precision, say n:
-    # (1/5)^(2n-1)/(2n-1)     has to be lower than (1/2)^(precision+n-1)
-    # Calculus :
-    # log(left term) < log(right term)
-    # log(1/left term) > log(1/right term)
-    # (2n-1)*log(5)+log(2n-1)>(precision+n-1)*log(2)
-    # n(2log(5)-log(2))>(precision-1)*log(2)-log(2n-1)+log(5)
-    # -log(2n-1)>-(2n-1)
-    # n(2log(5)-log(2)+2)>(precision-1)*log(2)+1+log(5)
-    set n [expr {int((($precision-1)*log(2)+1+log(5))/(2*log(5)-log(2)+2)+1)}]
-    incr precision $n
-    # first term of the development : 1/integer
-    set a [::math::bignum::div [::math::bignum::lshift 1 $precision] $integer]
-    # 's' will contain the result
-    set s $a
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # equals x (1 - x^2 * (1/3 + x^2 * (... * (1/(2n-3) + (-1)^(n+1) * x^2 / (2n-1))...)))
-    # all we need to store is : 2n-1 ($denom), x^(2n+1) and x^2 ($square) and two results :
-    # - the nth term => $u
-    # - the nth term * (2n-1) => $t
-    # + of course, the result $s
-    set square [::math::bignum::mul $integer $integer]
-    variable two
-    variable three
-    set denom $three
-    # $t is (-1)^n*x^(2n+1)
-    set t [opp [::math::bignum::div $a $square]]
-    set u [::math::bignum::div $t $denom]
-    # we break the loop when the current term of the development is null
-    while {![::math::bignum::iszero $u]} {
-        set s [::math::bignum::add $s $u]
-        # denominator= (2n+1)
-        set denom [::math::bignum::add $denom $two]
-        # div $t by x^2
-        set t [opp [::math::bignum::div $t $square]]
-        set u [::math::bignum::div $t $denom]
-    }
-    # go back to the initial precision
-    return [::math::bignum::rshift $s $n]
-}
-
-    
-################################################################################
-# returns the integer part of a BigFloat, as a BigInt
-# the result is the same one you would have
-# if you had called [expr {ceil($x)}]
-################################################################################
-proc ::math::bigfloat::ceil {number} {
-    checkFloat number
-    set number [normalize $number]
-    if {[iszero $number]} {
-        # returns the BigInt 0
-        variable zero
-        return $zero
-    }
-    foreach {dummy integer exp delta} $number {break}
-    if {$exp>=0} {
-        error "not enough precision to perform rounding (ceil)"
-    }
-    # saving the sign ...
-    set sign [::math::bignum::sign $integer]
-    set integer [abs $integer]
-    # integer part
-    set try [::math::bignum::rshift $integer [expr {-$exp}]]
-    if {$sign} {
-        return [opp $try]
-    }
-    # fractional part
-    if {![equal [::math::bignum::lshift $try [expr {-$exp}]] $integer]} {
-        return [::math::bignum::add 1 $try]
-    }
-    return $try
-}
-
-
-################################################################################
-# checks each variable to be a BigFloat
-# arguments : each argument is the name of a variable to be checked
-################################################################################
-proc ::math::bigfloat::checkFloat {args} {
-    foreach x $args {
-        upvar $x n
-        if {![isFloat $n]} {
-            error "BigFloat expected : received '$n'"
-        }
-    }
-}
-
-################################################################################
-# checks if each number is either a BigFloat or a BigInt
-# arguments : each argument is the name of a variable to be checked
-################################################################################
-proc ::math::bigfloat::checkNumber {args} {
-    foreach i $args {
-        upvar $i x
-        if {![isInt $x] && ![isFloat $x]} {
-            error "'$x' is not a number"
-        }
-    }
-}
-
-
-################################################################################
-# returns 0 if A and B are equal, else returns 1 or -1
-# accordingly to the sign of (A - B)
-################################################################################
-proc ::math::bigfloat::compare {a b} {
-    if {[isInt $a] && [isInt $b]} {
-        return [::math::bignum::cmp $a $b]
-    }
-    checkFloat a b
-    if {[equal $a $b]} {return 0}
-    return [expr {([::math::bignum::sign [lindex [sub $a $b] 1]])?-1:1}]
-}
-
-
-
-
-################################################################################
-# gets cos(x)
-# throws an error if there is not enough precision on the input
-################################################################################
-proc ::math::bigfloat::cos {x} {
-    checkFloat x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>-2} {
-        error "not enough precision on floating-point number"
-    }
-    set precision [expr {-$exp}]
-    # cos(2kPi+x)=cos(x)
-    foreach {n integer} [divPiQuarter $integer $precision] {break}
-    # now integer>=0 and <Pi/2
-    set d [expr {[tostr $n]%4}]
-    # add trigonometric circle turns number to delta
-    set delta [::math::bignum::add [abs $n] $delta]
-    set signe 0
-    # cos(Pi-x)=-cos(x)
-    # cos(-x)=cos(x)
-    # cos(Pi/2-x)=sin(x)
-    switch -- $d {
-        1 {set signe 1;set l [_sin2 $integer $precision $delta]}
-        2 {set signe 1;set l [_cos2 $integer $precision $delta]}
-        0 {set l [_cos2 $integer $precision $delta]}
-        3 {set l [_sin2 $integer $precision $delta]}
-        default {error "internal error"}
-    }
-    # precision -> exp (multiplied by -1)
-    lset l 1 [expr {-([lindex $l 1])}]
-    # set the sign
-    set integer [lindex $l 0]
-    ::math::bignum::setsign integer $signe
-    lset l 0 $integer
-    return [normalize [linsert $l 0 F]]
-}
-
-################################################################################
-# compute cos(x) where 0<=x<Pi/2
-# returns : a list formed with :
-# 1. the mantissa
-# 2. the precision (opposite of the exponent)
-# 3. the uncertainty (doubt range)
-################################################################################
-proc ::math::bigfloat::_cos2 {x precision delta} {
-    # precision bits after the dot
-    set pi [_pi $precision]
-    set pis4 [::math::bignum::rshift $pi 2]
-    set pis2 [::math::bignum::rshift $pi 1]
-    if {[::math::bignum::cmp $x $pis4]>=0} {
-        # cos(Pi/2-x)=sin(x)
-        set x [::math::bignum::sub $pis2 $x]
-        set delta [::math::bignum::add 1 $delta]
-        return [_sin $x $precision $delta]
-    }
-    return [_cos $x $precision $delta]
-}
-
-################################################################################
-# compute cos(x) where 0<=x<Pi/4
-# returns : a list formed with :
-# 1. the mantissa
-# 2. the precision (opposite of the exponent)
-# 3. the uncertainty (doubt range)
-################################################################################
-proc ::math::bigfloat::_cos {x precision delta} {
-    variable zero
-    variable one
-    variable two
-    set float1 [::math::bignum::lshift $one $precision]
-    # Taylor development follows :
-    # cos(x)=1-x^2/2 + x^4/4! ... + (-1)^(2n)*x^(2n)/2n!
-    # cos(x)= 1 - x^2/1.2 * (1 - x^2/3.4 * (... * (1 - x^2/(2n.(2n-1))...))
-    # variables : $s (the Mantissa of the result)
-    # $denom1 & $denom2 (2n-1 & 2n)
-    # $x as the square of what is named x in 'cos(x)'
-    set s $float1
-    # 'd' is the uncertainty on x^2
-    set d [::math::bignum::mul $x [::math::bignum::lshift $delta 1]]
-    set d [::math::bignum::add 1 [::math::bignum::rshift $d $precision]]
-    # x=x^2 (because in this Taylor development, there are only even powers of x)
-    set x [intMulShift $x $x $precision]
-    set denom1 $one
-    set denom2 $two
-    set t [opp [::math::bignum::rshift $x 1]]
-    set delta $zero
-    set dt $d
-    while {![::math::bignum::iszero $t]} {
-        set s [::math::bignum::add $s $t]
-        set delta [::math::bignum::add $delta $dt]
-        set denom1 [::math::bignum::add $denom1 $two]
-        set denom2 [::math::bignum::add $denom2 $two]
-        set dt [::math::bignum::rshift [::math::bignum::add [::math::bignum::mul $x $dt]\
-                [::math::bignum::mul [::math::bignum::add $t $dt] $d]] $precision]
-        set dt [::math::bignum::add 1 $dt]
-        set t [intMulShift $x $t $precision]
-        set t [opp [::math::bignum::div $t [::math::bignum::mul $denom1 $denom2]]]
-    }
-    return [list $s $precision $delta]
-}
-
-################################################################################
-# cotangent : the trivial algorithm is used
-################################################################################
-proc ::math::bigfloat::cotan {x} {
-    return [::math::bigfloat::div [::math::bigfloat::cos $x] [::math::bigfloat::sin $x]]
-}
-
-################################################################################
-# converts angles from degrees to radians
-# deg/180=rad/Pi
-################################################################################
-proc ::math::bigfloat::deg2rad {x} {
-    checkFloat x
-    set xLen [expr {-[lindex $x 2]}]
-    if {$xLen<3} {
-        error "number too loose to convert to radians"
-    }
-    set pi [pi $xLen 1]
-    return [div [mul $x $pi] [::math::bignum::fromstr 180]]
-}
-
-
-
-################################################################################
-# private proc to get : x modulo Pi/2
-# and the quotient (x divided by Pi/2)
-# used by cos , sin & others
-################################################################################
-proc ::math::bigfloat::divPiQuarter {integer precision} {
-    incr precision 2
-    set integer [::math::bignum::lshift $integer 1]
-    set dpi [_pi $precision]
-    # modulo 2Pi
-    foreach {n integer} [::math::bignum::divqr $integer $dpi] {break}
-    # end modulo 2Pi
-    set pi [::math::bignum::rshift $dpi 1]
-    foreach {n integer} [::math::bignum::divqr $integer $pi] {break}
-    # now divide by Pi/2
-    # multiply n by 2
-    set n [::math::bignum::lshift $n 1]
-    # pis2=pi/2
-    set pis2 [::math::bignum::rshift $pi 1]
-    foreach {m integer} [::math::bignum::divqr $integer $pis2] {break}
-    return [list [::math::bignum::add $n $m] [::math::bignum::rshift $integer 1]]
-}
-
-
-################################################################################
-# divide A by B and returns the result
-# throw error : divide by zero
-################################################################################
-proc ::math::bigfloat::div {a b} {
-    variable one
-    checkNumber a b
-    # dispatch to an appropriate procedure 
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            return [::math::bignum::div $a $b]
-        }
-        error "trying to divide a BigInt by a BigFloat"
-    }
-    if {[isInt $b]} {return [divFloatByInt $a $b]}
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    # computes the limits of the doubt (or uncertainty) interval
-    set BMin [::math::bignum::sub $integerB $deltaB]
-    set BMax [::math::bignum::add $integerB $deltaB]
-    if {[::math::bignum::cmp $BMin $BMax]>0} {
-        # swap BMin and BMax
-        set temp $BMin
-        set BMin $BMax
-        set BMax $temp
-    }
-    # multiply by zero gives zero
-    if {[::math::bignum::iszero $integerA]} {
-        # why not return any number or the integer 0 ?
-        # because there is an exponent that might be different between two BigFloats
-        # 0.00 --> exp = -2, 0.000000 -> exp = -6
-        return $a 
-    }
-    # test of the division by zero
-    if {[::math::bignum::sign $BMin]+[::math::bignum::sign $BMax]==1 || \
-                [::math::bignum::iszero $BMin] || [::math::bignum::iszero $BMax]} {
-        error "divide by zero"
-    }
-    # shift A because we need accuracy
-    set l [math::bignum::bits $integerB]
-    set integerA [::math::bignum::lshift $integerA $l]
-    set deltaA [::math::bignum::lshift $deltaA $l]
-    set exp [expr {$expA-$l-$expB}]
-    # relative uncertainties (dX/X) are added
-    # to give the relative uncertainty of the result
-    # i.e. 3% on A + 2% on B --> 5% on the quotient
-    # d(A/B)/(A/B)=dA/A + dB/B
-    # Q=A/B
-    # dQ=dA/B + dB*A/B*B
-    # dQ is "delta"
-    set delta [::math::bignum::div [::math::bignum::mul $deltaB \
-            [abs $integerA]] [abs $integerB]]
-    set delta [::math::bignum::div [::math::bignum::add\
-            [::math::bignum::add 1 $delta]\
-            $deltaA] [abs $integerB]]
-    set quotient [::math::bignum::div $integerA $integerB]
-    if {[::math::bignum::sign $integerB]+[::math::bignum::sign $integerA]==1} {
-        set quotient [::math::bignum::sub $quotient 1]
-    }
-    return [normalize [list F $quotient $exp [::math::bignum::add $delta 1]]]
-}
-
-
-
-
-################################################################################
-# divide a BigFloat A by a BigInt B
-# throw error : divide by zero
-################################################################################
-proc ::math::bigfloat::divFloatByInt {a b} {
-    variable one
-    # type check
-    checkFloat a
-    if {![isInt $b]} {
-        error "'$b' is not a BigInt"
-    }
-    foreach {dummy integer exp delta} $a {break}
-    # zero divider test
-    if {[::math::bignum::iszero $b]} {
-        error "divide by zero"
-    }
-    # shift left for accuracy ; see other comments in [div] procedure
-    set l [::math::bignum::bits $b]
-    set integer [::math::bignum::lshift $integer $l]
-    set delta [::math::bignum::lshift $delta $l]
-    incr exp -$l
-    set integer [::math::bignum::div $integer $b]
-    # the uncertainty is always evaluated to the ceil value
-    # and as an absolute value
-    set delta [::math::bignum::add 1 [::math::bignum::div $delta [abs $b]]]
-    return [normalize [list F $integer $exp $delta]]
-}
-
-
-
-
-
-################################################################################
-# returns 1 if A and B are equal, 0 otherwise
-# IN : a, b (BigFloats)
-################################################################################
-proc ::math::bigfloat::equal {a b} {
-    if {[isInt $a] && [isInt $b]} {
-        return [expr {[::math::bignum::cmp $a $b]==0}]
-    }
-    # now a & b should only be BigFloats
-    checkFloat a b
-    foreach {dummy aint aexp adelta} $a {break}
-    foreach {dummy bint bexp bdelta} $b {break}
-    # set all Mantissas and Deltas to the same level (exponent)
-    # with lshift
-    set diff [expr {$aexp-$bexp}]
-    if {$diff<0} {
-        set diff [expr {-$diff}]
-        set bint [::math::bignum::lshift $bint $diff]
-        set bdelta [::math::bignum::lshift $bdelta $diff]
-    } elseif {$diff>0} {
-        set aint [::math::bignum::lshift $aint $diff]
-        set adelta [::math::bignum::lshift $adelta $diff]
-    }
-    # compute limits of the number's doubt range
-    set asupInt [::math::bignum::add $aint $adelta]
-    set ainfInt [::math::bignum::sub $aint $adelta]
-    set bsupInt [::math::bignum::add $bint $bdelta]
-    set binfInt [::math::bignum::sub $bint $bdelta]
-    # A & B are equal
-    # if their doubt ranges overlap themselves
-    if {[::math::bignum::cmp $bint $aint]==0} {
-        return 1
-    }
-    if {[::math::bignum::cmp $bint $aint]>0} {
-        set r [expr {[::math::bignum::cmp $asupInt $binfInt]>=0}]
-    } else {
-        set r [expr {[::math::bignum::cmp $bsupInt $ainfInt]>=0}]
-    }
-    return $r
-}
-
-################################################################################
-# returns exp(X) where X is a BigFloat
-################################################################################
-proc ::math::bigfloat::exp {x} {
-    checkFloat x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>=0} {
-        # shift till exp<0 with respect to the internal representation
-        # of the number
-        incr exp
-        set integer [::math::bignum::lshift $integer $exp]
-        set delta [::math::bignum::lshift $delta $exp]
-        set exp -1
-    }
-    set precision [expr {-$exp}]
-    # add 8 bits of precision for safety
-    incr precision 8
-    set integer [::math::bignum::lshift $integer 8]
-    set delta [::math::bignum::lshift $delta 8]
-    set Log2 [_log2 $precision]
-    foreach {new_exp integer} [::math::bignum::divqr $integer $Log2] {break}
-    # new_exp = integer part of x/log(2)
-    # integer = remainder
-    # exp(K.log(2)+r)=2^K.exp(r)
-    # so we just have to compute exp(r), r is small so
-    # the Taylor development will converge quickly
-    set delta [::math::bignum::add $delta $new_exp]
-    foreach {integer delta} [_exp $integer $precision $delta] {break}
-    set delta [::math::bignum::rshift $delta 8]
-    incr precision -8
-    # multiply by 2^K , and take care of the sign
-    # example : X=-6.log(2)+0.01
-    # exp(X)=exp(0.01)*2^-6
-    if {![::math::bignum::iszero [::math::bignum::rshift [abs $new_exp] 30]]} {
-        error "floating-point overflow due to exp"
-    }
-    set new_exp [tostr $new_exp]
-    set exp [expr {$new_exp-$precision}]
-    set delta [::math::bignum::add 1 $delta]
-    return [normalize [list F [::math::bignum::rshift $integer 8] $exp $delta]]
-}
-
-
-################################################################################
-# private procedure to compute exponentials
-# using Taylor development of exp(x) :
-# exp(x)=1+ x + x^2/2 + x^3/3! +...+x^n/n!
-# input : integer (the mantissa)
-#         precision (the number of decimals)
-#         delta (the doubt limit, or uncertainty)
-# returns a list : 1. the mantissa of the result
-#                  2. the doubt limit, or uncertainty
-################################################################################
-proc ::math::bigfloat::_exp {integer precision delta} {
-    set oneShifted [::math::bignum::lshift 1 $precision]
-    if {[::math::bignum::iszero $integer]} {
-        # exp(0)=1
-        return [list $oneShifted $delta]
-    }
-    set s [::math::bignum::add $oneShifted $integer]
-    variable two
-    set d [::math::bignum::add 1 [::math::bignum::div $delta $two]]
-    set delta [::math::bignum::add $delta $delta]
-    # dt = uncertainty on x^2
-    set dt [::math::bignum::add 1 [intMulShift $d $integer $precision]]
-    # t= x^2/2
-    set t [intMulShift $integer $integer $precision]
-    set t [::math::bignum::div $t $two]
-    set denom $two
-    while {![::math::bignum::iszero $t]} {
-        # the sum is called 's'
-        set s [::math::bignum::add $s $t]
-        set delta [::math::bignum::add $delta $dt]
-        # we do not have to keep trace of the factorial, we just iterate divisions
-        set denom [::math::bignum::add 1 $denom]
-        # add delta
-        set d [::math::bignum::add 1 [::math::bignum::div $d $denom]]
-        set dt [::math::bignum::add $dt $d]
-        # get x^n from x^(n-1)
-        set t [intMulShift $integer $t $precision]
-        # here we divide
-        set t [::math::bignum::div $t $denom]
-    }
-    return [list $s $delta]
-}
-################################################################################
-# divide a BigFloat by 2 power 'n'
-################################################################################
-proc ::math::bigfloat::floatRShift {float {n 1}} {
-    return [lset float 2 [expr {[lindex $float 2]-$n}]]
-}
-
-
-
-################################################################################
-# procedure floor : identical to [expr floor($x)] in functionality
-# arguments : number IN (a BigFloat)
-# returns : the floor value as a BigInt
-################################################################################
-proc ::math::bigfloat::floor {number} {
-    variable zero
-    checkFloat number
-    set number [normalize $number]
-    if {[::math::bignum::iszero $number]} {
-        # returns the BigInt 0
-        return $zero
-    }
-    foreach {dummy integer exp delta} $number {break}
-    if {$exp>=0} {
-        error "not enough precision to perform rounding (floor)"
-    }
-    # saving the sign ...
-    set sign [::math::bignum::sign $integer]
-    set integer [abs $integer]
-    # integer part
-    set try [::math::bignum::rshift $integer [expr {-$exp}]]
-    # floor(n.xxxx)=n
-    if {!$sign} {
-        return $try
-    }
-    # floor(-n.xxxx)=-(n+1) when xxxx!=0
-    if {![equal [::math::bignum::lshift $try [expr {-$exp}]] $integer]} {
-        set try [::math::bignum::add 1 $try]
-    }
-    ::math::bignum::setsign try $sign
-    return $try
-}
-
-
-################################################################################
-# returns a list formed by an integer and an exponent
-# x = (A +/- C) * 10 power B
-# return [list "F" A B C] (where F is the BigFloat tag)
-# A and C are BigInts, B is a raw integer
-# return also a BigInt when there is neither a dot, nor a 'e' exponent
-#
-# arguments : -base base integer
-#          or integer
-#          or float
-#          or float trailingZeros
-################################################################################
-proc ::math::bigfloat::fromstr {args} {
-    if {[set string [lindex $args 0]]=="-base"} {
-        if {[llength $args]!=3} {
-            error "should be : fromstr -base base number"
-        }
-        # converts an integer i expressed in base b with : [fromstr b i]
-        return [::math::bignum::fromstr [lindex $args 2] [lindex $args 1]]
-    }
-    # trailingZeros are zeros appended to the Mantissa (it is optional)
-    set trailingZeros 0
-    if {[llength $args]==2} {
-        set trailingZeros [lindex $args 1]
-    }
-    if {$trailingZeros<0} {
-        error "second argument has to be a positive integer"
-    }
-    # eliminate the sign problem
-    # added on 05/08/2005
-    # setting '$signe' to the sign of the number
-    set string [string trimleft $string +]
-    if {[string index $string 0]=="-"} {
-        set signe 1
-        set string2 [string range $string 1 end]
-    } else  {
-        set signe 0
-        set string2 $string
-    }
-    # integer case (not a floating-point number)
-    if {[string is digit $string2]} {
-        if {$trailingZeros!=0} {
-            error "second argument not allowed with an integer"
-        }
-        # we have completed converting an integer to a BigInt
-        # please note that most math::bigfloat procs accept BigInts as arguments
-        return [::math::bignum::fromstr $string]
-    }
-    set string $string2
-    # floating-point number : check for an exponent
-    # scientific notation
-    set tab [split $string e]
-    if {[llength $tab]>2} {
-        # there are more than one 'e' letter in the number
-        error "syntax error in number : $string"
-    }
-    if {[llength $tab]==2} {
-        set exp [lindex $tab 1]
-        # now exp can look like +099 so you need to handle octal numbers
-        # too bad...
-        # find the sign (if any?)
-        regexp {^[\+\-]?} $exp expsign
-        # trim the number with left-side 0's
-        set found [string length $expsign]
-        set exp $expsign[string trimleft [string range $exp $found end] 0]
-        set number [lindex $tab 0]
-    } else {
-        set exp 0
-        set number [lindex $tab 0]
-    }
-    # a floating-point number may have a dot
-    set tab [split $number .]
-    if {[llength $tab]>2} {error "syntax error in number : $string"}
-    if {[llength $tab]==2} {
-        set number [join $tab ""]
-        # increment by the number of decimals (after the dot)
-        incr exp -[string length [lindex $tab 1]]
-    }
-    # this is necessary to ensure we can call fromstr (recursively) with
-    # the mantissa ($number)
-    if {![string is digit $number]} {
-        error "$number is not a number"
-    }
-    # take account of trailing zeros 
-    incr exp -$trailingZeros
-    # multiply $number by 10^$trailingZeros
-    set number [::math::bignum::mul [::math::bignum::fromstr $number]\
-            [tenPow $trailingZeros]]
-    ::math::bignum::setsign number $signe
-    # the F tags a BigFloat
-    # a BigInt in internal representation begins by the sign
-    # delta is 1 as a BigInt
-    return [_fromstr $number $exp]
-}
-
-################################################################################
-# private procedure to transform decimal floats into binary ones
-# IN :
-#     - number : a BigInt representing the Mantissa
-#     - exp : the decimal exponent (a simple integer)
-# OUT :
-#     $number * 10^$exp, as the internal binary representation of a BigFloat
-################################################################################
-proc ::math::bigfloat::_fromstr {number exp} {
-    variable one
-    variable five
-    if {$exp==0} {
-        return [list F $number 0 $one]
-    }
-    if {$exp>0} {
-        # mul by 10^exp, and by 2^4, then normalize
-        set number [::math::bignum::lshift $number 4]
-        set exponent [tenPow $exp]
-        set number [::math::bignum::mul $number $exponent]
-        # normalize number*2^-4 +/- 2^4*10^exponent
-        return [normalize [list F $number -4 [::math::bignum::lshift $exponent 4]]]
-    }
-    # now exp is negative or null
-    # the closest power of 2 to the 'exp'th power of ten, but greater than it
-    set binaryExp [expr {int(ceil(-$exp*log(10)/log(2)))+4}]
-    # then compute n * 2^binaryExp / 10^(-exp)
-    # (exp is negative)
-    # equals n * 2^(binaryExp+exp) / 5^(-exp)
-    set diff [expr {$binaryExp+$exp}]
-    if {$diff<0} {
-        error "internal error"
-    }
-    set fivePow [::math::bignum::pow $five [::math::bignum::fromstr [expr {-$exp}]]]
-    set number [::math::bignum::div [::math::bignum::lshift $number \
-            $diff] $fivePow]
-    set delta [::math::bignum::div [::math::bignum::lshift 1 \
-            $diff] $fivePow]
-    return [normalize [list F $number [expr {-$binaryExp}] [::math::bignum::add $delta 1]]]
-}
-
-
-################################################################################
-# fromdouble :
-# like fromstr, but for a double scalar value
-# arguments :
-# double - the number to convert to a BigFloat
-# exp (optional) - the total number of digits
-################################################################################
-proc ::math::bigfloat::fromdouble {double {exp {}}} {
-    set mantissa [lindex [split $double e] 0]
-    # line added by SArnold on 05/08/2005
-    set mantissa [string trimleft [string map {+ "" - ""} $mantissa] 0]
-    set precision [string length [string map {. ""} $mantissa]]
-    if { $exp != {} && [incr exp]>$precision } {
-        return [fromstr $double [expr {$exp-$precision}]]
-    } else {
-        # tests have failed : not enough precision or no exp argument
-        return [fromstr $double]
-    }
-}
-
-
-################################################################################
-# converts a BigInt into a BigFloat with a given decimal precision
-################################################################################
-proc ::math::bigfloat::int2float {int {decimals 1}} {
-    # it seems like we need some kind of type handling
-    # very odd in this Tcl world :-(
-    if {![isInt $int]} {
-        error "first argument is not an integer"
-    }
-    if {$decimals<1} {
-        error "non-positive decimals number"
-    }
-    # the lowest number of decimals is 1, because
-    # [tostr [fromstr 10.0]] returns 10.
-    # (we lose 1 digit when converting back to string)
-    set int [::math::bignum::mul $int [tenPow $decimals]]
-    return [_fromstr $int [expr {-$decimals}]]
-    
-}
-
-
-
-################################################################################
-# multiplies 'leftop' by 'rightop' and rshift the result by 'shift'
-################################################################################
-proc ::math::bigfloat::intMulShift {leftop rightop shift} {
-    return [::math::bignum::rshift [::math::bignum::mul $leftop $rightop] $shift]
-}
-
-################################################################################
-# returns 1 if x is a BigFloat, 0 elsewhere
-################################################################################
-proc ::math::bigfloat::isFloat {x} {
-    # a BigFloat is a list of : "F" mantissa exponent delta
-    if {[llength $x]!=4} {
-        return 0
-    }
-    # the marker is the letter "F"
-    if {[string equal [lindex $x 0] F]} {
-        return 1
-    }
-    return 0
-}
-
-################################################################################
-# checks that n is a BigInt (a number create by math::bignum::fromstr)
-################################################################################
-proc ::math::bigfloat::isInt {n} {
-    if {[llength $n]<3} {
-        return 0
-    }
-    if {[string equal [lindex $n 0] bignum]} {
-        return 1
-    }
-    return 0
-}
-
-
-
-################################################################################
-# returns 1 if x is null, 0 otherwise
-################################################################################
-proc ::math::bigfloat::iszero {x} {
-    if {[isInt $x]} {
-        return [::math::bignum::iszero $x]
-    }
-    checkFloat x
-    # now we do some interval rounding : if a number's interval englobs 0,
-    # it is considered to be equal to zero
-    foreach {dummy integer exp delta} $x {break}
-    set integer [::math::bignum::abs $integer]
-    if {[::math::bignum::cmp $delta $integer]>=0} {return 1}
-    return 0
-}
-
-
-################################################################################
-# compute log(X)
-################################################################################
-proc ::math::bigfloat::log {x} {
-    checkFloat x
-    foreach {dummy integer exp delta} $x {break}
-    if {[::math::bignum::iszero $integer]||[::math::bignum::sign $integer]} {
-        error "zero logarithm error"
-    }
-    if {[iszero $x]} {
-        error "number is null"
-    }
-    set precision [::math::bignum::bits $integer]
-    # uncertainty of the logarithm
-    set delta [::math::bignum::add 1 [_logOnePlusEpsilon $delta $integer $precision]]
-    # we got : x = 1xxxxxx (binary number with 'precision' bits) * 2^exp
-    # we need : x = 0.1xxxxxx(binary) *2^(exp+precision)
-    incr exp $precision
-    foreach {integer deltaIncr} [_log $integer] {break}
-    set delta [::math::bignum::add $delta $deltaIncr]
-    # log(a * 2^exp)= log(a) + exp*log(2)
-    # result = log(x) + exp*log(2)
-    # as x<1 log(x)<0 but 'integer' (result of '_log') is the absolute value
-    # that is why we substract $integer to log(2)*$exp
-    set integer [::math::bignum::sub [::math::bignum::mul [_log2 $precision] \
-            [set exp [::math::bignum::fromstr $exp]]] $integer]
-    set delta [::math::bignum::add $delta [abs $exp]]
-    return [normalize [list F $integer -$precision $delta]]
-}
-
-
-################################################################################
-# compute log(1-epsNum/epsDenom)=log(1-'epsilon')
-# Taylor development gives -x -x^2/2 -x^3/3 -x^4/4 ...
-# used by 'log' command because log(x+/-epsilon)=log(x)+log(1+/-(epsilon/x))
-# so the uncertainty equals abs(log(1-epsilon/x))
-# ================================================
-# arguments :
-# epsNum IN (the numerator of epsilon)
-# epsDenom IN (the denominator of epsilon)
-# precision IN (the number of bits after the dot)
-#
-# 'epsilon' = epsNum*2^-precision/epsDenom
-################################################################################
-proc ::math::bigfloat::_logOnePlusEpsilon {epsNum epsDenom precision} {
-    if {[::math::bignum::cmp $epsNum $epsDenom]>=0} {
-        error "number is null"
-    }
-    set s [::math::bignum::lshift $epsNum $precision]
-    set s [::math::bignum::div $s $epsDenom]
-    variable two
-    set divider $two
-    set t [::math::bignum::div [::math::bignum::mul $s $epsNum] $epsDenom]
-    set u [::math::bignum::div $t $divider]
-    # when u (the current term of the development) is zero, we have reached our goal
-    # it has converged
-    while {![::math::bignum::iszero $u]} {
-        set s [::math::bignum::add $s $u]
-        # divider = order of the term = 'n'
-        set divider [::math::bignum::add 1 $divider]
-        # t = (epsilon)^n
-        set t [::math::bignum::div [::math::bignum::mul $t $epsNum] $epsDenom]
-        # u = t/n = (epsilon)^n/n and is the nth term of the Taylor development
-        set u [::math::bignum::div $t $divider]
-    }
-    return $s
-}
-
-
-################################################################################
-# compute log(0.xxxxxxxx) : log(1-epsilon)=-eps-eps^2/2-eps^3/3...-eps^n/n
-################################################################################
-proc ::math::bigfloat::_log {integer} {
-    # the uncertainty is nbSteps with nbSteps<=nbBits
-    # take nbSteps=nbBits (the worse case) and log(nbBits+increment)=increment
-    set precision [::math::bignum::bits $integer]
-    set n [expr {int(log($precision+2*log($precision)))}]
-    set integer [::math::bignum::lshift $integer $n]
-    incr precision $n
-    variable three
-    set delta $three
-    # 1-epsilon=integer
-    set integer [::math::bignum::sub [::math::bignum::lshift 1 $precision] $integer]
-    set s $integer
-    # t=x^2
-    set t [intMulShift $integer $integer $precision]
-    variable two
-    set denom $two
-    # u=x^2/2 (second term)
-    set u [::math::bignum::div $t $denom]
-    while {![::math::bignum::iszero $u]} {
-        # while the current term is not zero, it has not converged
-        set s [::math::bignum::add $s $u]
-        set delta [::math::bignum::add 1 $delta]
-        # t=x^n
-        set t [intMulShift $t $integer $precision]
-        # denom = n (the order of the current development term)
-        set denom [::math::bignum::add 1 $denom]
-        # u = x^n/n (the nth term of Taylor development)
-        set u [::math::bignum::div $t $denom]
-    }
-    # shift right to restore the precision
-    set delta [::math::bignum::add 1 [::math::bignum::rshift $delta $n]]
-    return [list [::math::bignum::rshift $s $n] $delta]
-}
-
-################################################################################
-# computes log(num/denom) with 'precision' bits
-# used to compute some analysis constants with a given accuracy
-# you might not call this procedure directly : it assumes 'num/denom'>4/5
-# and 'num/denom'<1
-################################################################################
-proc ::math::bigfloat::__log {num denom precision} {
-    # Please Note : we here need a precision increment, in order to
-    # keep accuracy at $precision digits. If we just hold $precision digits,
-    # each number being precise at the last digit +/- 1,
-    # we would lose accuracy because small uncertainties add to themselves.
-    # Example : 0.0001 + 0.0010 = 0.0011 +/- 0.0002
-    # This is quite the same reason that made tcl_precision defaults to 12 :
-    # internally, doubles are computed with 17 digits, but to keep precision
-    # we need to limit our results to 12.
-    # The solution : given a precision target, increment precision with a
-    # computed value so that all digits of he result are exacts.
-    # 
-    # p is the precision
-    # pk is the precision increment
-    # 2 power pk is also the maximum number of iterations
-    # for a number close to 1 but lower than 1,
-    # (denom-num)/denum is (in our case) lower than 1/5
-    # so the maximum nb of iterations is for:
-    # 1/5*(1+1/5*(1/2+1/5*(1/3+1/5*(...))))
-    # the last term is 1/n*(1/5)^n
-    # for the last term to be lower than 2^(-p-pk)
-    # the number of iterations has to be
-    # 2^(-pk).(1/5)^(2^pk) < 2^(-p-pk)
-    # log(1/5).2^pk < -p
-    # 2^pk > p/log(5)
-    # pk > log(2)*log(p/log(5))
-    # now set the variable n to the precision increment i.e. pk
-    set n [expr {int(log(2)*log($precision/log(5)))+1}]
-    incr precision $n
-    # log(num/denom)=log(1-(denom-num)/denom)
-    # log(1+x) = x + x^2/2 + x^3/3 + ... + x^n/n
-    #          = x(1 + x(1/2 + x(1/3 + x(...+ x(1/(n-1) + x/n)...))))
-    set num [::math::bignum::fromstr [expr {$denom-$num}]]
-    set denom [::math::bignum::fromstr $denom]
-    # $s holds the result
-    set s [::math::bignum::div [::math::bignum::lshift $num $precision] $denom]
-    # $t holds x^n
-    set t [::math::bignum::div [::math::bignum::mul $s $num] $denom]
-    variable two
-    set d $two
-    # $u holds x^n/n
-    set u [::math::bignum::div $t $d]
-    while {![::math::bignum::iszero $u]} {
-        set s [::math::bignum::add $s $u]
-        # get x^n * x
-        set t [::math::bignum::div [::math::bignum::mul $t $num] $denom]
-        # get n+1
-        set d [::math::bignum::add 1 $d]
-        # then : $u = x^(n+1)/(n+1)
-        set u [::math::bignum::div $t $d]
-    }
-    # see head of the proc : we return the value with its target precision
-    return [::math::bignum::rshift $s $n]
-}
-
-################################################################################
-# computes log(2) with 'precision' bits and caches it into a namespace variable
-################################################################################
-proc ::math::bigfloat::__logbis {precision} {
-    set increment [expr {int(log($precision)/log(2)+1)}]
-    incr precision $increment
-    # ln(2)=3*ln(1-4/5)+ln(1-125/128)
-    set a [__log 125 128 $precision]
-    set b [__log 4 5 $precision]
-    variable three
-    set r [::math::bignum::add [::math::bignum::mul $b $three] $a]
-    set ::math::bigfloat::Log2 [::math::bignum::rshift $r $increment]
-    # formerly (when BigFloats were stored in ten radix) we had to compute log(10)
-    # ln(10)=10.ln(1-4/5)+3*ln(1-125/128)
-}
-
-
-################################################################################
-# retrieves log(2) with 'precision' bits ; the result is cached
-################################################################################
-proc ::math::bigfloat::_log2 {precision} {
-    variable Log2
-    if {![info exists Log2]} {
-        __logbis $precision
-    } else {
-        # the constant is cached and computed again when more precision is needed
-        set l [::math::bignum::bits $Log2]
-        if {$precision>$l} {
-            __logbis $precision
-        }
-    }
-    # return log(2) with 'precision' bits even when the cached value has more bits
-    return [_round $Log2 $precision]
-}
-
-
-################################################################################
-# returns A modulo B (like with fmod() math function)
-################################################################################
-proc ::math::bigfloat::mod {a b} {
-    checkNumber a b
-    if {[isInt $a] && [isInt $b]} {return [::math::bignum::mod $a $b]}
-    if {[isInt $a]} {error "trying to divide a BigInt by a BigFloat"}
-    set quotient [div $a $b]
-    # examples : fmod(3,2)=1 quotient=1.5
-    # fmod(1,2)=1 quotient=0.5
-    # quotient>0 and b>0 : get floor(quotient)
-    # fmod(-3,-2)=-1 quotient=1.5
-    # fmod(-1,-2)=-1 quotient=0.5
-    # quotient>0 and b<0 : get floor(quotient)
-    # fmod(-3,2)=-1 quotient=-1.5
-    # fmod(-1,2)=-1 quotient=-0.5
-    # quotient<0 and b>0 : get ceil(quotient)
-    # fmod(3,-2)=1 quotient=-1.5
-    # fmod(1,-2)=1 quotient=-0.5
-    # quotient<0 and b<0 : get ceil(quotient)
-    if {[sign $quotient]} {
-        set quotient [ceil $quotient]
-    } else  {
-        set quotient [floor $quotient]
-    }
-    return [sub $a [mul $quotient $b]]
-}
-
-################################################################################
-# returns A times B
-################################################################################
-proc ::math::bigfloat::mul {a b} {
-    checkNumber a b
-    # dispatch the command to appropriate commands regarding types (BigInt & BigFloat)
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            return [::math::bignum::mul $a $b]
-        }
-        return [mulFloatByInt $b $a]
-    }
-    if {[isInt $b]} {return [mulFloatByInt $a $b]}
-    # now we are sure that 'a' and 'b' are BigFloats
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    # 2^expA * 2^expB = 2^(expA+expB)
-    set exp [expr {$expA+$expB}]
-    # mantissas are multiplied
-    set integer [::math::bignum::mul $integerA $integerB]
-    # compute precisely the uncertainty
-    set deltaAB [::math::bignum::mul $deltaA $deltaB]
-    set deltaA [::math::bignum::mul [abs $integerB] $deltaA]
-    set deltaB [::math::bignum::mul [abs $integerA] $deltaB]
-    set delta [::math::bignum::add [::math::bignum::add $deltaA $deltaB] \
-            [::math::bignum::add 1 $deltaAB]]
-    # we have to normalize because 'delta' may be too big
-    return [normalize [list F $integer $exp $delta]]
-}
-
-################################################################################
-# returns A times B, where B is a positive integer
-################################################################################
-proc ::math::bigfloat::mulFloatByInt {a b} {
-    checkFloat a
-    foreach {dummy integer exp delta} $a {break}
-    if {![isInt $b]} {
-        error "second argument expected to be a BigInt"
-    }
-    # Mantissa and Delta are simply multplied by $b
-    set integer [::math::bignum::mul $integer $b]
-    set delta [::math::bignum::mul $delta $b]
-    # We normalize because Delta could have seriously increased
-    return [normalize [list F $integer $exp $delta]]
-}
-
-################################################################################
-# normalizes a number : Delta (accuracy of the BigFloat)
-# has to be limited, because the memory use increase
-# quickly when we do some computations, as the Mantissa and Delta
-# increase together
-# The solution : keep the size of Delta under 9 bits
-################################################################################
-proc ::math::bigfloat::normalize {number} {
-    checkFloat number
-    foreach {dummy integer exp delta} $number {break}
-    set l [::math::bignum::bits $delta]
-    if {$l>8} {
-        # next line : $l holds the supplementary size (in bits)
-        incr l -8
-        # now we can shift right by $l bits
-        # always round upper the Delta
-        set delta [::math::bignum::add 1 [::math::bignum::rshift $delta $l]]
-        set integer [::math::bignum::rshift $integer $l]
-        incr exp $l
-    }
-    return [list F $integer $exp $delta]
-}
-
-
-
-################################################################################
-# returns -A (the opposite)
-################################################################################
-proc ::math::bigfloat::opp {a} {
-    checkNumber a
-    if {[iszero $a]} {
-        return $a
-    }
-    if {[isInt $a]} {
-        ::math::bignum::setsign a [expr {![::math::bignum::sign $a]}]
-        return $a
-    }
-    # recursive call
-    lset a 1 [opp [lindex $a 1]] 
-    return $a
-}
-
-################################################################################
-# gets Pi with precision bits
-# after the dot (after you call [tostr] on the result)
-################################################################################
-proc ::math::bigfloat::pi {precision {binary 0}} {
-    if {[llength $precision]>1} {
-        if {[isInt $precision]} {
-            set precision [tostr $precision]
-        } else {
-            error "'$precision' expected to be an integer"
-        }
-    }
-    if {!$binary} {
-        # convert decimal digit length into bit length
-        set precision [expr {int(ceil($precision*log(10)/log(2)))}]
-    }
-    variable one
-    return [list F [_pi $precision] -$precision $one]
-}
-
-
-proc ::math::bigfloat::_pi {precision} {
-    # the constant Pi begins with 3.xxx
-    # so we need 2 digits to store the digit '3'
-    # and then we will have precision+2 bits in the mantissa
-    variable _pi0
-    if {![info exists _pi0]} {
-        set _pi0 [__pi $precision]
-    }
-    set lenPiGlobal [::math::bignum::bits $_pi0]
-    if {$lenPiGlobal<$precision} {
-        set _pi0 [__pi $precision]
-    }
-    return [::math::bignum::rshift $_pi0 [expr {[::math::bignum::bits $_pi0]-2-$precision}]]
-}
-
-################################################################################
-# computes an integer representing Pi in binary radix, with precision bits
-################################################################################
-proc ::math::bigfloat::__pi {precision} {
-    set safetyLimit 8
-    # for safety and for the better precision, we do so ...
-    incr precision $safetyLimit
-    # formula found in the Math litterature
-    # Pi/4 = 6.atan(1/18) + 8.atan(1/57) - 5.atan(1/239)
-    set a [::math::bignum::mul [_atanfract [::math::bignum::fromstr 18] $precision] \
-            [::math::bignum::fromstr 48]]
-    set a [::math::bignum::add $a [::math::bignum::mul \
-            [_atanfract [::math::bignum::fromstr 57] $precision] [::math::bignum::fromstr 32]]]
-    set a [::math::bignum::sub $a [::math::bignum::mul \
-            [_atanfract [::math::bignum::fromstr 239] $precision] [::math::bignum::fromstr 20]]]
-    return [::math::bignum::rshift $a $safetyLimit]
-}
-
-################################################################################
-# shift right an integer until it haves $precision bits
-# round at the same time
-################################################################################
-proc ::math::bigfloat::_round {integer precision} {
-    set shift [expr {[::math::bignum::bits $integer]-$precision}]
-    # $result holds the shifted integer
-    set result [::math::bignum::rshift $integer $shift]
-    # $shift-1 is the bit just rights the last bit of the result
-    # Example : integer=1000010 shift=2
-    # => result=10000 and the tested bit is '1'
-    if {[::math::bignum::testbit $integer [expr {$shift-1}]]} {
-        # we round to the upper limit
-        return [::math::bignum::add 1 $result]
-    }
-    return $result
-}
-
-################################################################################
-# returns A power B, where B is a positive integer
-################################################################################
-proc ::math::bigfloat::pow {a b} {
-    checkNumber a
-    if {![isInt $b]} {
-        error "pow : exponent is not a positive integer"
-    }
-    # case where it is obvious that we should use the appropriate command
-    # from math::bignum (added 5th March 2005)
-    if {[isInt $a]} {
-        return [::math::bignum::pow $a $b]
-    }
-    # algorithm : exponent=$b = Sum(i=0..n) b(i)2^i
-    # $a^$b = $a^( b(0) + 2b(1) + 4b(2) + ... + 2^n*b(n) )
-    # we have $a^(x+y)=$a^x * $a^y
-    # then $a^$b = Product(i=0...n) $a^(2^i*b(i))
-    # b(i) is boolean so $a^(2^i*b(i))= 1 when b(i)=0 and = $a^(2^i) when b(i)=1
-    # then $a^$b = Product(i=0...n and b(i)=1) $a^(2^i) and 1 when $b=0
-    variable one
-    if {[::math::bignum::iszero $b]} {return $one}
-    # $res holds the result
-    set res $one
-    while {1} {
-        # at the beginning i=0
-        # $remainder is b(i)
-        set remainder [::math::bignum::testbit $b 0]
-        # $b 'rshift'ed by 1 bit : i=i+1
-        # so next time we will test bit b(i+1)
-        set b [::math::bignum::rshift $b 1]
-        # if b(i)=1
-        if {$remainder} {
-            # mul the result by $a^(2^i)
-            # if i=0 we multiply by $a^(2^0)=$a^1=$a
-            set res [mul $res $a]
-        }
-        # no more bits at '1' in $b : $res is the result
-        if {[::math::bignum::iszero $b]} {
-            if {[isInt $res]} {
-                # we cannot (and should not) normalize an integer
-                return $res
-            }
-            return [normalize $res]
-        }
-        # i=i+1 : $a^(2^(i+1)) = square of $a^(2^i)
-        set a [mul $a $a]
-    }
-}
-
-################################################################################
-# converts angles for radians to degrees
-################################################################################
-proc ::math::bigfloat::rad2deg {x} {
-    checkFloat x
-    set xLen [expr {-[lindex $x 2]}]
-    if {$xLen<3} {
-        error "number too loose to convert to degrees"
-    }
-    set pi [pi $xLen 1]
-    # $rad/Pi=$deg/180
-    # so result in deg = $radians*180/Pi
-    return [div [mul $x [::math::bignum::fromstr 180]] $pi]
-}
-
-################################################################################
-# retourne la partie entière (ou 0) du nombre "number"
-################################################################################
-proc ::math::bigfloat::round {number} {
-    checkFloat number
-    #set number [normalize $number]
-    # fetching integers (or BigInts) from the internal representation
-    foreach {dummy integer exp delta} $number {break}
-    if {[::math::bignum::iszero $integer]} {
-        # returns the BigInt 0
-        variable zero
-        return $zero
-    }
-    if {$exp>=0} {
-        error "not enough precision to round (in round)"
-    }
-    set exp [expr {-$exp}]
-    # saving the sign, ...
-    set sign [::math::bignum::sign $integer]
-    set integer [abs $integer]
-    # integer part of the number
-    set try [::math::bignum::rshift $integer $exp]
-    # first bit after the dot
-    set way [::math::bignum::testbit $integer [expr {$exp-1}]]
-    # delta is shifted so it gives the integer part of 2*delta
-    set delta [::math::bignum::rshift $delta [expr {$exp-1}]]
-    # when delta is too big to compute rounded value (
-    if {![::math::bignum::iszero $delta]} {
-        error "not enough precision to round (in round)"
-    }
-    if {$way} {
-        set try [::math::bignum::add 1 $try]
-    }
-    # ... restore the sign now
-    ::math::bignum::setsign try $sign
-    return $try
-}
-
-################################################################################
-# round and divide by 10^n
-################################################################################
-proc ::math::bigfloat::roundshift {integer n} {
-    # $exp= 10^$n
-    set exp [tenPow $n]
-    foreach {result remainder} [::math::bignum::divqr $integer $exp] {}
-    # $remainder belongs to the interval [0, $exp-1]
-    # $remainder >= $exp/2 is the rounding condition
-    # that is better expressed in this form :
-    # $remainder*2 >= $exp , as we are treating integers, not rationals
-    # left shift $remainder by 1 equals to multiplying by 2 and is much faster
-    if {[::math::bignum::cmp $exp [::math::bignum::lshift $remainder 1]]<=0} {
-        return [::math::bignum::add 1 $result]
-    }
-    return $result
-}
-
-################################################################################
-# gets the sign of either a bignum, or a BitFloat
-# we keep the bignum convention : 0 for positive, 1 for negative
-################################################################################
-proc ::math::bigfloat::sign {n} {
-    if {[isInt $n]} {
-        return [::math::bignum::sign $n]
-    }
-    # sign of 0=0
-    if {[iszero $n]} {return 0}
-    # the sign of the Mantissa, which is a BigInt
-    return [::math::bignum::sign [lindex $n 1]]
-}
-
-
-################################################################################
-# gets sin(x)
-################################################################################
-proc ::math::bigfloat::sin {x} {
-    checkFloat x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>-2} {
-        error "sin : not enough precision"
-    }
-    set precision [expr {-$exp}]
-    # sin(2kPi+x)=sin(x)
-    # $integer is now the modulo of the division of the mantissa by Pi/4
-    # and $n is the quotient
-    foreach {n integer} [divPiQuarter $integer $precision] {break}
-    set delta [::math::bignum::add $delta $n]
-    variable four
-    set d [::math::bignum::mod $n $four]
-    # now integer>=0
-    # x = $n*Pi/4 + $integer and $n belongs to [0,3]
-    # sin(2Pi-x)=-sin(x)
-    # sin(Pi-x)=sin(x)
-    # sin(Pi/2+x)=cos(x)
-    set sign 0
-    switch  -- [tostr $d] {
-        0 {set l [_sin2 $integer $precision $delta]}
-        1 {set l [_cos2 $integer $precision $delta]}
-        2 {set sign 1;set l [_sin2 $integer $precision $delta]}
-        3 {set sign 1;set l [_cos2 $integer $precision $delta]}
-        default {error "internal error"}
-    }
-    # $l is a list : {Mantissa Precision Delta}
-    # precision --> the opposite of the exponent
-    # 1.000 = 1000*10^-3 so exponent=-3 and precision=3 digits
-    lset l 1 [expr {-([lindex $l 1])}]
-    set integer [lindex $l 0]
-    # the sign depends on the switch statement below
-    ::math::bignum::setsign integer $sign
-    lset l 0 $integer
-    # we insert the Bigfloat tag (F) and normalize the final result
-    return [normalize [linsert $l 0 F]]
-}
-
-proc ::math::bigfloat::_sin2 {x precision delta} {
-    set pi [_pi $precision]
-    # shift right by 1 = divide by 2
-    # shift right by 2 = divide by 4
-    set pis2 [::math::bignum::rshift $pi 1]
-    set pis4 [::math::bignum::rshift $pi 2]
-    if {[::math::bignum::cmp $x $pis4]>=0} {
-        # sin(Pi/2-x)=cos(x)
-        set delta [::math::bignum::add 1 $delta]
-        set x [::math::bignum::sub $pis2 $x]
-        return [_cos $x $precision $delta]
-    }
-    return [_sin $x $precision $delta]
-}
-
-################################################################################
-# sin(x) with 'x' lower than Pi/4 and positive
-# 'x' is the Mantissa - 'delta' is Delta
-# 'precision' is the opposite of the exponent
-################################################################################
-proc ::math::bigfloat::_sin {x precision delta} {
-    # $s holds the result
-    set s $x
-    # sin(x) = x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)!
-    #        = x * (1 - x^2/(2*3) * (1 - x^2/(4*5) * (...* (1 - x^2/(2n*(2n+1)) )...)))
-    # The second expression allows us to compute the less we can
-    
-    # $double holds the uncertainty (Delta) of x^2 : 2*(Mantissa*Delta) + Delta^2
-    # (Mantissa+Delta)^2=Mantissa^2 + 2*Mantissa*Delta + Delta^2
-    set double [::math::bignum::rshift [::math::bignum::mul $x $delta] [expr {$precision-1}]]
-    set double [::math::bignum::add [::math::bignum::add 1 $double] [::math::bignum::rshift \
-            [::math::bignum::mul $delta $delta] $precision]]
-    # $x holds the Mantissa of x^2
-    set x [intMulShift $x $x $precision]
-    set dt [::math::bignum::rshift [::math::bignum::add [::math::bignum::mul $x $delta] \
-            [::math::bignum::mul [::math::bignum::add $s $delta] $double]] $precision]
-    set dt [::math::bignum::add 1 $dt]
-    # $t holds $s * -(x^2) / (2n*(2n+1))
-    # mul by x^2
-    set t [intMulShift $s $x $precision]
-    variable two
-    set denom2 $two
-    variable three
-    set denom3 $three
-    # mul by -1 (opp) and divide by 2*3
-    set t [opp [::math::bignum::div $t [::math::bignum::mul $denom2 $denom3]]]
-    while {![::math::bignum::iszero $t]} {
-        set s [::math::bignum::add $s $t]
-        set delta [::math::bignum::add $delta $dt]
-        # incr n => 2n --> 2n+2 and 2n+1 --> 2n+3
-        set denom2 [::math::bignum::add $denom2 $two]
-        set denom3 [::math::bignum::add $denom3 $two]
-        # $dt is the Delta corresponding to $t
-        # $double ""     ""    ""     ""    $x (x^2)
-        # ($t+$dt) * ($x+$double) = $t*$x + ($dt*$x + $t*$double) + $dt*$double
-        #                   Mantissa^        ^--------Delta-------------------^
-        set dt [::math::bignum::rshift [::math::bignum::add [::math::bignum::mul $x $dt] \
-                [::math::bignum::mul [::math::bignum::add $t $dt] $double]] $precision]
-        set t [intMulShift $t $x $precision]
-        # removed 2005/08/31 by sarnold75
-        #set dt [::math::bignum::add $dt $double]
-        set denom [::math::bignum::mul $denom2 $denom3]
-        # now computing : div by -2n(2n+1)
-        set dt [::math::bignum::add 1 [::math::bignum::div $dt $denom]]
-        set t [opp [::math::bignum::div $t $denom]]
-    }
-    return [list $s $precision $delta]
-}
-
-
-################################################################################
-# procedure for extracting the square root of a BigFloat
-################################################################################
-proc ::math::bigfloat::sqrt {x} {
-    variable one
-    checkFloat x
-    foreach {dummy integer exp delta} $x {break}
-    # if x=0, return 0
-    if {[iszero $x]} {
-        variable zero
-        # return zero, taking care of its precision ($exp)
-        return [list F $zero $exp $one]
-    }
-    # we cannot get sqrt(x) if x<0
-    if {[lindex $integer 0]<0} {
-        error "negative sqrt input"
-    }
-    # (1+epsilon)^p = 1 + epsilon*(p-1) + epsilon^2*(p-1)*(p-2)/2! + ...
-    #                   + epsilon^n*(p-1)*...*(p-n)/n!
-    # sqrt(1 + epsilon) = (1 + epsilon)^(1/2)
-    #                   = 1 - epsilon/2 - epsilon^2*3/(4*2!) - ...
-    #                       - epsilon^n*(3*5*..*(2n-1))/(2^n*n!)
-    # sqrt(1 - epsilon) = 1 + Sum(i=1..infinity) epsilon^i*(3*5*...*(2i-1))/(i!*2^i)
-    # sqrt(n +/- delta)=sqrt(n) * sqrt(1 +/- delta/n)
-    # so the uncertainty on sqrt(n +/- delta) equals sqrt(n) * (sqrt(1 - delta/n) - 1)
-    #         sqrt(1+eps) < sqrt(1-eps) because their logarithm compare as :
-    #       -ln(2)(1+eps) < -ln(2)(1-eps)
-    # finally :
-    # Delta = sqrt(n) * Sum(i=1..infinity) (delta/n)^i*(3*5*...*(2i-1))/(i!*2^i)
-    # here we compute the second term of the product by _sqrtOnePlusEpsilon
-    set delta [_sqrtOnePlusEpsilon $delta $integer]
-    set intLen [::math::bignum::bits $integer]
-    # removed 2005/08/31 by sarnold75, readded 2005/08/31
-    set precision $intLen
-    # intLen + exp = number of bits before the dot
-    #set precision [expr {-$exp}]
-    # square root extraction
-    set integer [::math::bignum::lshift $integer $intLen]
-    incr exp -$intLen
-    incr intLen $intLen
-    # there is an exponent 2^$exp : when $exp is odd, we would need to compute sqrt(2)
-    # so we decrement $exp, in order to get it even, and we do not need sqrt(2) anymore !
-    if {$exp&1} {
-        incr exp -1
-        set integer [::math::bignum::lshift $integer 1]
-        incr intLen
-        incr precision
-    }
-    # using a low-level (in math::bignum) root extraction procedure
-    set integer [::math::bignum::sqrt $integer]
-    # delta has to be multiplied by the square root
-    set delta [::math::bignum::rshift [::math::bignum::mul $delta $integer] $precision]
-    # round to the ceiling the uncertainty (worst precision, the fastest to compute)
-    set delta [::math::bignum::add 1 $delta]
-    # we are sure that $exp is even, see above
-    return [normalize [list F $integer [expr {$exp/2}] $delta]]
-}
-
-
-
-################################################################################
-# compute abs(sqrt(1-delta/integer)-1)
-# the returned value is a relative uncertainty
-################################################################################
-proc ::math::bigfloat::_sqrtOnePlusEpsilon {delta integer} {
-    # sqrt(1-x) - 1 = x/2 + x^2*3/(2^2*2!) + x^3*3*5/(2^3*3!) + ...
-    #               = x/2 * (1 + x*3/(2*2) * ( 1 + x*5/(2*3) *
-    #                     (...* (1 + x*(2n-1)/(2n) ) )...)))
-    variable one
-    set l [::math::bignum::bits $integer]
-    # to compute delta/integer we have to shift left to keep the same precision level
-    # we have a better accuracy computing (delta << lg(integer))/integer
-    # than computing (delta/integer) << lg(integer)
-    set x [::math::bignum::div [::math::bignum::lshift $delta $l] $integer]
-    variable four
-    variable two
-    # denom holds 2n
-    set denom $four
-    # x/2
-    set result [::math::bignum::div $x $two]
-    # x^2*3/(2!*2^2)
-    variable three
-    # numerator holds 2n-1
-    set numerator $three
-    set temp [::math::bignum::mul $result $delta]
-    set temp [::math::bignum::div [::math::bignum::mul $temp $numerator] $integer]
-    set temp [::math::bignum::add 1 [::math::bignum::div $temp $denom]]
-    while {![::math::bignum::iszero $temp]} {
-        set result [::math::bignum::add $result $temp]
-        set numerator [::math::bignum::add $numerator $two]
-        set denom [::math::bignum::add $two $denom]
-        # n = n+1 ==> num=num+2 denom=denom+2
-        # num=2n+1 denom=2n+2
-        set temp [::math::bignum::mul [::math::bignum::mul $temp $delta] $numerator]
-        set temp [::math::bignum::div [::math::bignum::div $temp $denom] $integer]
-    }
-    return $result
-}
-
-################################################################################
-# substracts B to A
-################################################################################
-proc ::math::bigfloat::sub {a b} {
-    checkNumber a b
-    if {[isInt $a] && [isInt $b]} {
-        # the math::bignum::sub proc is designed to work with BigInts
-        return [::math::bignum::sub $a $b]
-    }
-    return [add $a [opp $b]]
-}
-
-################################################################################
-# tangent (trivial algorithm)
-################################################################################
-proc ::math::bigfloat::tan {x} {
-    return [::math::bigfloat::div [::math::bigfloat::sin $x] [::math::bigfloat::cos $x]]
-}
-
-################################################################################
-# returns a power of ten
-################################################################################
-proc ::math::bigfloat::tenPow {n} {
-    variable ten
-    return [::math::bignum::pow $ten [::math::bignum::fromstr $n]]
-}
-
-
-################################################################################
-# converts a BigInt to a double (basic floating-point type)
-# with respect to the global variable 'tcl_precision'
-################################################################################
-proc ::math::bigfloat::todouble {x} {
-    global tcl_precision
-    checkFloat x
-    # get the string repr of x without the '+' sign
-    set result [string trimleft [tostr $x] +]
-    set minus ""
-    if {[string index $result 0]=="-"} {
-        set minus -
-        set result [string range $result 1 end]
-    }
-    set l [split $result e]
-    set exp 0
-    if {[llength $l]==2} {
-        # exp : x=Mantissa*10^Exp
-        set exp [lindex $l 1]
-    }
-    # Mantissa = integerPart.fractionalPart
-    set l [split [lindex $l 0] .]
-    set integerPart [lindex $l 0]
-    set integerLen [string length $integerPart]
-    set fractionalPart [lindex $l 1]
-    # The number of digits in Mantissa, excluding the dot and the leading zeros, of course
-    set len [string length [set integer $integerPart$fractionalPart]]
-    # Now Mantissa is stored in $integer
-    if {$len>$tcl_precision} {
-        set lenDiff [expr {$len-$tcl_precision}]
-        # true when the number begins with a zero
-        set zeroHead 0
-        if {[string index $integer 0]==0} {
-            incr lenDiff -1
-            set zeroHead 1
-        }
-        set integer [tostr [roundshift [::math::bignum::fromstr $integer] $lenDiff]]
-        if {$zeroHead} {
-            set integer 0$integer
-        }
-        set len [string length $integer]
-        if {$len<$integerLen} {
-            set exp [expr {$integerLen-$len}]
-            # restore the true length
-            set integerLen $len
-        }
-    }
-    # number = 'sign'*'integer'*10^'exp'
-    if {$exp==0} {
-        # no scientific notation
-        set exp ""
-    } else {
-        # scientific notation
-        set exp e$exp
-    }
-    # place the dot just before the index $integerLen in the Mantissa
-    set result [string range $integer 0 [expr {$integerLen-1}]]
-    append result .[string range $integer $integerLen end]
-    # join the Mantissa with the sign before and the exponent after
-    return $minus$result$exp
-}
-
-################################################################################
-# converts a number stored as a list to a string in which all digits are true
-################################################################################
-proc ::math::bigfloat::tostr {number} {
-    variable five
-    if {[isInt $number]} {
-        return [::math::bignum::tostr $number]
-    }
-    checkFloat number
-    foreach {dummy integer exp delta} $number {break}
-    if {[iszero $number]} {
-        # we do not matter how much precision $number has :
-        # it can be 0.0000000 or 0.0, the result is still the same : the "0" string
-	# not anymore : 0.000 is not 0.0 !
-    #    return 0
-    }
-    if {$exp>0} {
-        # the power of ten the closest but greater than 2^$exp
-        # if it was lower than the power of 2, we would have more precision
-        # than existing in the number
-        set newExp [expr {int(ceil($exp*log(2)/log(10)))}]
-        # 'integer' <- 'integer' * 2^exp / 10^newExp
-        # equals 'integer' * 2^(exp-newExp) / 5^newExp
-        set binExp [expr {$exp-$newExp}]
-        if {$binExp<0} {
-            # it cannot happen
-            error "internal error"
-        }
-        # 5^newExp
-        set fivePower [::math::bignum::pow $five [::math::bignum::fromstr $newExp]]
-        # 'lshift'ing $integer by $binExp bits is like multiplying it by 2^$binExp
-        # but much, much faster
-        set integer [::math::bignum::div [::math::bignum::lshift $integer $binExp] \
-                $fivePower]
-        # $integer is the Mantissa - Delta should follow the same operations
-        set delta [::math::bignum::div [::math::bignum::lshift $delta $binExp] $fivePower]
-        set exp $newExp
-    } elseif {$exp<0} {
-        # the power of ten the closest but lower than 2^$exp
-        # same remark about the precision
-        set newExp [expr {int(floor(-$exp*log(2)/log(10)))}]
-        # 'integer' <- 'integer' * 10^newExp / 2^(-exp)
-        # equals 'integer' * 5^(newExp) / 2^(-exp-newExp)
-        set fivePower [::math::bignum::pow $five \
-                [::math::bignum::fromstr $newExp]]
-        set binShift [expr {-$exp-$newExp}]
-        # rshifting is like dividing by 2^$binShift, but faster as we said above about lshift
-        set integer [::math::bignum::rshift [::math::bignum::mul $integer $fivePower] \
-                $binShift]
-        set delta [::math::bignum::rshift [::math::bignum::mul $delta $fivePower] \
-                $binShift]
-        set exp -$newExp
-    }
-    # saving the sign, to restore it into the result
-    set sign [::math::bignum::sign $integer]
-    set result [::math::bignum::abs $integer]
-    # rounded 'integer' +/- 'delta'
-    set up [::math::bignum::add $result $delta]
-    set down [::math::bignum::sub $result $delta]
-    if {[sign $up]^[sign $down]} {
-        # $up>0 and $down<0 and vice-versa : then the number is considered equal to zero
-	# delta <= 2**n (n = bits(delta))
-	# 2**n  <= 10**exp , then 
-	# exp >= n.log(2)/log(10)
-	# delta <= 10**(n.log(2)/log(10))
-        incr exp [expr {int(ceil([::math::bignum::bits $delta]*log(2)/log(10)))}]
-        set result 0
-        set isZero yes
-    } else {
-	# iterate until the convergence of the rounding
-	# we incr $shift until $up and $down are rounded to the same number
-	# at each pass we lose one digit of precision, so necessarly it will success
-	for {set shift 1} {
-	    [::math::bignum::cmp [roundshift $up $shift] [roundshift $down $shift]]
-	} {
-	    incr shift
-	} {}
-	incr exp $shift
-	set result [::math::bignum::tostr [roundshift $up $shift]]
-	set isZero no
-    }
-    set l [string length $result]
-    # now formatting the number the most nicely for having a clear reading
-    # would'nt we allow a number being constantly displayed
-    # as : 0.2947497845e+012 , would we ?
-    if {$exp>0} {
-        # we display 423*10^6 as : 4.23e+8
-        # Length of mantissa : $l
-        # Increment exp by $l-1 because the first digit is placed before the dot,
-        # the other ($l-1) digits following the dot.
-        incr exp [incr l -1]
-        set result [string index $result 0].[string range $result 1 end]
-        append result "e+$exp"
-    } elseif {$exp==0} {
-        # it must have a dot to be a floating-point number (syntaxically speaking)
-        append result .
-    } else {
-        set exp [expr {-$exp}]
-        if {$exp < $l} {
-            # we can display the number nicely as xxxx.yyyy*
-            # the problem of the sign is solved finally at the bottom of the proc
-            set n [string range $result 0 end-$exp]
-            incr exp -1
-            append n .[string range $result end-$exp end]
-            set result $n
-        } elseif {$l==$exp} {
-            # we avoid to use the scientific notation
-            # because it is harder to read
-            set result "0.$result"
-        } else  {
-            # ... but here there is no choice, we should not represent a number
-            # with more than one leading zero
-            set result [string index $result 0].[string range $result 1 end]e-[expr {$exp-$l+1}]
-        }
-    }
-    # restore the sign : we only put a minus on numbers that are different from zero
-    if {$sign==1 && !$isZero} {set result "-$result"}
-    return $result
-}
-
-################################################################################
-# PART IV
-# HYPERBOLIC FUNCTIONS
-################################################################################
-
-################################################################################
-# hyperbolic cosinus
-################################################################################
-proc ::math::bigfloat::cosh {x} {
-    # cosh(x) = (exp(x)+exp(-x))/2
-    # dividing by 2 is done faster by 'rshift'ing
-    return [floatRShift [add [exp $x] [exp [opp $x]]] 1]
-}
-
-################################################################################
-# hyperbolic sinus
-################################################################################
-proc ::math::bigfloat::sinh {x} {
-    # sinh(x) = (exp(x)-exp(-x))/2
-    # dividing by 2 is done faster by 'rshift'ing
-    return [floatRShift [sub [exp $x] [exp [opp $x]]] 1]
-}
-
-################################################################################
-# hyperbolic tangent
-################################################################################
-proc ::math::bigfloat::tanh {x} {
-    set up [exp $x]
-    set down [exp [opp $x]]
-    # tanh(x)=sinh(x)/cosh(x)= (exp(x)-exp(-x))/2/ [(exp(x)+exp(-x))/2]
-    #        =(exp(x)-exp(-x))/(exp(x)+exp(-x))
-    #        =($up-$down)/($up+$down)
-    return [div [sub $up $down] [add $up $down]]
-}
-
-# exporting public interface
-namespace eval ::math::bigfloat {
-    foreach function {
-        add mul sub div mod pow
-        iszero compare equal
-        fromstr tostr fromdouble todouble
-        int2float isInt isFloat
-        exp log sqrt round ceil floor
-        sin cos tan cotan asin acos atan
-        cosh sinh tanh abs opp
-        pi deg2rad rad2deg
-    } {
-        namespace export $function
-    }
-}
-
-# (AM) No "namespace import" - this should be left to the user!
-#namespace import ::math::bigfloat::*
-
-package provide math::bigfloat 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/bigfloat2.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/bigfloat2.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2202 +1,0 @@
-########################################################################
-# BigFloat for Tcl
-# Copyright (C) 2003-2005  ARNOLD Stephane
-# It is published with the terms of tcllib's BSD-style license.
-# See the file named license.terms.
-########################################################################
-
-package require Tcl 8.5
-
-# this line helps when I want to source this file again and again
-catch {namespace delete ::math::bigfloat}
-
-# private namespace
-# this software works only with Tcl v8.4 and higher
-# it is using the package math::bignum
-namespace eval ::math::bigfloat {
-    # cached constants
-    # ln(2) with arbitrary precision
-    variable Log2
-    # Pi with arb. precision
-    variable Pi
-    variable _pi0
-}
-
-
-
-
-################################################################################
-# procedures that handle floating-point numbers
-# these procedures are sorted by name (after eventually removing the underscores)
-# 
-# BigFloats are internally represented as a list :
-# {"F" Mantissa Exponent Delta} where "F" is a character which determins
-# the datatype, Mantissa and Delta are two big integers and Exponent another integer.
-#
-# The BigFloat value equals to (Mantissa +/- Delta)*2^Exponent
-# So the internal representation is binary, but trying to get as close as possible to
-# the decimal one when converted to a string.
-# When calling [fromstr], the Delta parameter is set to the value of 1 at the position
-# of the last decimal digit.
-# Example : 1.50 belongs to [1.49,1.51], but internally Delta may not equal to 1.
-# Because of the binary representation, it is between 1 and 1+(2^-15).
-# 
-# So Mantissa and Delta are not limited in size, but in practice Delta is kept under
-# 2^32 by the 'normalize' procedure, to avoid a never-ended growth of memory used.
-# Indeed, when you perform some computations, the Delta parameter (which represent
-# the uncertainty on the value of the Mantissa) may increase.
-# Exponent, as an integer, is limited to 32 bits, and this limit seems fair.
-# The exponent is indeed involved in logarithmic computations, so it may be
-# a mistake to give it a too large value.
-
-# Retrieving the parameters of a BigFloat is often done with that command :
-# foreach {dummy int exp delta} $bigfloat {break}
-# (dummy is not used, it is just used to get the "F" marker).
-# The isInt, isFloat, checkNumber and checkFloat procedures are used
-# to check data types
-#
-# Taylor development are often used to compute the analysis functions (like exp(),log()...)
-# To learn how it is done in practice, take a look at ::math::bigfloat::_asin
-# While doing computation on Mantissas, we do not care about the last digit,
-# because if we compute correctly Deltas, the digits that remain will be exact.
-################################################################################
-
-
-################################################################################
-# returns the absolute value
-################################################################################
-proc ::math::bigfloat::abs {number} {
-    checkNumber $number
-    if {[isInt $number]} {
-        # set sign to positive for a BigInt
-        return [expr {abs($number)}]
-    }
-    # set sign to positive for a BigFloat into the Mantissa (index 1)
-    lset number 1 [expr {abs([lindex $number 1])}]
-    return $number
-}
-
-
-################################################################################
-# arccosinus of a BigFloat
-################################################################################
-proc ::math::bigfloat::acos {x} {
-    # handy proc for checking datatype
-    checkFloat $x
-    foreach {dummy entier exp delta} $x {break}
-    set precision [expr {($exp<0)?(-$exp):1}]
-    # acos(0.0)=Pi/2
-    # 26/07/2005 : changed precision from decimal to binary
-    # with the second parameter of pi command
-    set piOverTwo [floatRShift [pi $precision 1]]
-    if {[iszero $x]} {
-        # $x is too close to zero -> acos(0)=PI/2
-        return $piOverTwo
-    }
-    # acos(-x)= Pi/2 + asin(x)
-    if {$entier<0} {
-        return [add $piOverTwo [asin [abs $x]]]
-    }
-    # we always use _asin to compute the result
-    # but as it is a Taylor development, the value given to [_asin]
-    # has to be a bit smaller than 1 ; by using that trick : acos(x)=asin(sqrt(1-x^2))
-    # we can limit the entry of the Taylor development below 1/sqrt(2)
-    if {[compare $x [fromstr 0.7071]]>0} {
-        # x > sqrt(2)/2 : trying to make _asin converge quickly 
-        # creating 0 and 1 with the same precision as the entry
-        set fzero [list F 0 -$precision 1]
-        # 1.000 with $precision zeros
-        set fone [list F [expr {1<<$precision}] -$precision 1]
-        # when $x is close to 1 (acos(1.0)=0.0)
-        if {[equal $fone $x]} {
-            return $fzero
-        }
-        if {[compare $fone $x]<0} {
-            # the behavior assumed because acos(x) is not defined
-            # when |x|>1
-            error "acos on a number greater than 1"
-        }
-        # acos(x) = asin(sqrt(1 - x^2))
-        # since 1 - cos(x)^2 = sin(x)^2
-        # x> sqrt(2)/2 so x^2 > 1/2 so 1-x^2<1/2
-        set x [sqrt [sub $fone [mul $x $x]]]
-        # the parameter named x is smaller than sqrt(2)/2
-        return [_asin $x]
-    }
-    # acos(x) = Pi/2 - asin(x)
-    # x<sqrt(2)/2 here too
-    return [sub $piOverTwo [_asin $x]]
-}
-
-
-################################################################################
-# returns A + B
-################################################################################
-proc ::math::bigfloat::add {a b} {
-    checkNumber $a
-    checkNumber $b
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            # intAdd adds two BigInts
-            return [incr a $b]
-        }
-        # adds the BigInt a to the BigFloat b
-        return [addInt2Float $b $a]
-    }
-    if {[isInt $b]} {
-        # ... and vice-versa
-        return [addInt2Float $a $b]
-    }
-    # retrieving parameters from A and B
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    if {$expA<$expB} {
-        foreach {dummy integerA expA deltaA} $b {break}
-        foreach {dummy integerB expB deltaB} $a {break}
-    }
-    # when we add two numbers which have different digit numbers (after the dot)
-    # for example : 1.0 and 0.00001
-    # We promote the one with the less number of digits (1.0) to the same level as
-    # the other : so 1.00000. 
-    # that is why we shift left the number which has the greater exponent
-    # But we do not forget the Delta parameter, which is lshift'ed too.
-    if {$expA>$expB} {
-        set diff [expr {$expA-$expB}]
-        set integerA [expr {$integerA<<$diff}]
-        set deltaA [expr {$deltaA<<$diff}]
-        incr integerA $integerB
-        incr deltaA $deltaB
-        return [normalize [list F $integerA $expB $deltaA]]
-    } elseif {$expA==$expB} {
-        # nothing to shift left
-        return [normalize [list F [incr integerA $integerB] $expA [incr deltaA $deltaB]]]
-    } else  {
-        error "internal error"
-    }
-}
-
-################################################################################
-# returns the sum A(BigFloat) + B(BigInt)
-# the greatest advantage of this method is that the uncertainty
-# of the result remains unchanged, in respect to the entry's uncertainty (deltaA)
-################################################################################
-proc ::math::bigfloat::addInt2Float {a b} {
-    # type checking
-    checkFloat $a
-    if {![isInt $b]} {
-        error "second argument is not an integer"
-    }
-    # retrieving data from $a
-    foreach {dummy integerA expA deltaA} $a {break}
-    # to add an int to a BigFloat,...
-    if {$expA>0} {
-        # we have to put the integer integerA
-        # to the level of zero exponent : 1e8 --> 100000000e0
-        set shift $expA
-        set integerA [expr {($integerA<<$shift)+$b}]
-        set deltaA [expr {$deltaA<<$shift}]
-        # we have to normalize, because we have shifted the mantissa
-        # and the uncertainty left
-        return [normalize [list F $integerA 0 $deltaA]]
-    } elseif {$expA==0} {
-        # integerA is already at integer level : float=(integerA)e0
-        return [normalize [list F [incr integerA $b] \
-                0 $deltaA]]
-    } else {
-        # here we have something like 234e-2 + 3
-        # we have to shift the integer left by the exponent |$expA|
-        incr integerA [expr {$b<<(-$expA)}]
-        return [normalize [list F $integerA $expA $deltaA]]
-    }
-}
-
-
-################################################################################
-# arcsinus of a BigFloat
-################################################################################
-proc ::math::bigfloat::asin {x} {
-    # type checking
-    checkFloat $x
-    foreach {dummy entier exp delta} $x {break}
-    if {$exp>-1} {
-        error "not enough precision on input (asin)"
-    }
-    set precision [expr {-$exp}]
-    # when x=0, return 0 at the same precision as the input was
-    if {[iszero $x]} {
-        return [list F 0 -$precision 1]
-    }
-    # asin(-x)=-asin(x)
-    if {$entier<0} {
-        return [opp [asin [abs $x]]]
-    }
-    # 26/07/2005 : changed precision from decimal to binary
-    set piOverTwo [floatRShift [pi $precision 1]]
-    # now a little trick : asin(x)=Pi/2-asin(sqrt(1-x^2))
-    # so we can limit the entry of the Taylor development
-    # to 1/sqrt(2)~0.7071
-    # the comparison is : if x>0.7071 then ...
-    if {[compare $x [fromstr 0.7071]]>0} {
-        set fone [list F [expr {1<<$precision}] -$precision 1]
-        # asin(1)=Pi/2 (with the same precision as the entry has)
-        if {[equal $fone $x]} {
-            return $piOverTwo
-        }
-        if {[compare $x $fone]>0} {
-            error "asin on a number greater than 1"
-        }
-        # asin(x)=Pi/2-asin(sqrt(1-x^2))
-        set x [sqrt [sub $fone [mul $x $x]]]
-        return [sub $piOverTwo [_asin $x]]
-    }
-    return [normalize [_asin $x]]
-}
-
-################################################################################
-# _asin : arcsinus of numbers between 0 and +1
-################################################################################
-proc ::math::bigfloat::_asin {x} {
-    # Taylor development
-    # asin(x)=x + 1/2 x^3/3 + 3/2.4 x^5/5 + 3.5/2.4.6 x^7/7 + ...
-    # into this iterative form :
-    # asin(x)=x * (1 + 1/2 * x^2 * (1/3 + 3/4 *x^2 * (...
-    # ...* (1/(2n-1) + (2n-1)/2n * x^2 / (2n+1))...)))
-    # we show how is really computed the development : 
-    # we don't need to set a var with x^n or a product of integers
-    # all we need is : x^2, 2n-1, 2n, 2n+1 and a few variables
-    foreach {dummy mantissa exp delta} $x {break}
-    set precision [expr {-$exp}]
-    if {$precision+1<[bits $mantissa]} {
-        error "sinus greater than 1"
-    }
-    # precision is the number of after-dot digits
-    set result $mantissa
-    set delta_final $delta
-    # resultat is the final result, and delta_final
-    # will contain the uncertainty of the result
-    # square is the square of the mantissa
-    set square [expr {$mantissa*$mantissa>>$precision}]
-    # dt is the uncertainty of Mantissa
-    set dt [expr {$mantissa*$delta>>($precision-1)}]
-    incr dt
-    set num 1
-    # two will be used into the loop
-    set i 3
-    set denom 2
-    # the nth factor equals : $num/$denom* $mantissa/$i
-    set delta [expr {$delta*$square + $dt*($delta+$mantissa)}]
-    set delta [expr {($delta*$num)/ $denom >>$precision}]
-    incr delta
-    # we do not multiply the Mantissa by $num right now because it is 1 !
-    # but we have Mantissa=$x
-    # and we want Mantissa*$x^2 * $num / $denom / $i
-    set mantissa [expr {($mantissa*$square>>$precision)/$denom}]
-    # do not forget the modified Taylor development :
-    # asin(x)=x * (1 + 1/2*x^2*(1/3 + 3/4*x^2*(...*(1/(2n-1) + (2n-1)/2n*x^2/(2n+1))...)))
-    # all we need is : x^2, 2n-1, 2n, 2n+1 and a few variables
-    # $num=2n-1 $denom=2n $square=x^2 and $i=2n+1
-    set mantissa_temp [expr {$mantissa/$i}]
-    set delta_temp [expr {1+$delta/$i}]
-    # when the Mantissa increment is smaller than the Delta increment,
-    # we would not get much precision by continuing the development
-    while {$mantissa_temp!=0} {
-        # Mantissa = Mantissa * $num/$denom * $square
-        # Add Mantissa/$i, which is stored in $mantissa_temp, to the result
-        incr result $mantissa_temp
-        incr delta_final $delta_temp
-        # here we have $two instead of [fromstr 2] (optimization)
-        # num=num+2,i=i+2,denom=denom+2
-        # because num=2n-1 denom=2n and i=2n+1
-        incr num 2
-        incr i 2
-        incr denom 2
-        # computes precisly the future Delta parameter
-        set delta [expr {$delta*$square+$dt*($delta+$mantissa)}]
-        set delta [expr {($delta*$num)/$denom>>$precision}]
-        incr delta
-        set mantissa [expr {$mantissa*$square>>$precision}]
-        set mantissa [expr {($mantissa*$num)/$denom}]
-        set mantissa_temp [expr {$mantissa/$i}]
-        set delta_temp [expr {1+$delta/$i}]
-    }
-    return [normalize [list F $result $exp $delta_final]]
-}
-
-################################################################################
-# arctangent : returns atan(x)
-################################################################################
-proc ::math::bigfloat::atan {x} {
-    checkFloat $x
-    foreach {dummy mantissa exp delta} $x {break}
-    if {$exp>=0} {
-        error "not enough precision to compute atan"
-    }
-    set precision [expr {-$exp}]
-    # atan(0)=0
-    if {[iszero $x]} {
-        return [list F 0 -$precision $delta]
-    }
-    # atan(-x)=-atan(x)
-    if {$mantissa<0} {
-        return [opp [atan [abs $x]]]
-    }
-    # now x is strictly positive
-    # at this moment, we are trying to limit |x| to a fair acceptable number
-    # to ensure that Taylor development will converge quickly
-    set float1 [list F [expr {1<<$precision}] -$precision 1]
-    if {[compare $float1 $x]<0} {
-        # compare x to 2.4142
-        if {[compare $x [fromstr 2.4142]]<0} {
-            # atan(x)=Pi/4 + atan((x-1)/(x+1))
-            # as 1<x<2.4142 : (x-1)/(x+1)=1-2/(x+1) belongs to
-            # the range :  ]0,1-2/3.414[
-            # that equals  ]0,0.414[
-            set pi_sur_quatre [floatRShift [pi $precision 1] 2]
-            return [add $pi_sur_quatre [atan \
-                    [div [sub $x $float1] [add $x $float1]]]]
-        }
-        # atan(x)=Pi/2-atan(1/x)
-        # 1/x < 1/2.414 so the argument is lower than 0.414
-        set pi_over_two [floatRShift [pi $precision 1]]
-        return [sub $pi_over_two [atan [div $float1 $x]]]
-    }
-    if {[compare $x [fromstr 0.4142]]>0} {
-        # atan(x)=Pi/4 + atan((x-1)/(x+1))
-        # x>0.420 so (x-1)/(x+1)=1 - 2/(x+1) > 1-2/1.414
-        #                                    > -0.414
-        # x<1 so (x-1)/(x+1)<0
-        set pi_sur_quatre [floatRShift [pi $precision 1] 2]
-        return [add $pi_sur_quatre [atan \
-                [div [sub $x $float1] [add $x $float1]]]]
-    }
-    # precision increment : to have less uncertainty
-    # we add a little more precision so that the result would be more accurate
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # when we have n steps in Taylor development : the nth term is :
-    # x^(2n-1)/(2n-1)
-    # and the loss of precision is of 2n (n sums and n divisions)
-    # this command is called with x<sqrt(2)-1
-    # if we add an increment to the precision, say n:
-    # (sqrt(2)-1)^(2n-1)/(2n-1) has to be lower than 2^(-precision-n-1)
-    # (2n-1)*log(sqrt(2)-1)-log(2n-1)<-(precision+n+1)*log(2)
-    # 2n(log(sqrt(2)-1)-log(sqrt(2)))<-(precision-1)*log(2)+log(2n-1)+log(sqrt(2)-1)
-    # 2n*log(1-1/sqrt(2))<-(precision-1)*log(2)+log(2n-1)+log(2)/2
-    # 2n/sqrt(2)>(precision-3/2)*log(2)-log(2n-1)
-    # hence log(2n-1)<2n-1
-    # n*sqrt(2)>(precision-1.5)*log(2)+1-2n
-    # n*(sqrt(2)+2)>(precision-1.5)*log(2)+1
-    set n [expr {int((log(2)*($precision-1.5)+1)/(sqrt(2)+2)+1)}]
-    incr precision $n
-    set mantissa [expr {$mantissa<<$n}]
-    set delta [expr {$delta<<$n}]
-    # end of adding precision increment
-    # now computing Taylor development :
-    # atan(x)=x - x^3/3 + x^5/5 - x^7/7 ... + (-1)^n*x^(2n+1)/(2n+1)
-    # atan(x)=x * (1 - x^2 * (1/3 - x^2 * (1/5 - x^2 * (...*(1/(2n-1) - x^2 / (2n+1))...))))
-    # what do we need to compute this ?
-    # x^2 ($square), 2n+1 ($divider), $result, the nth term of the development ($t)
-    # and the nth term multiplied by 2n+1 ($temp)
-    # then we do this (with care keeping as much precision as possible):
-    # while ($t <>0) :
-    #     $result=$result+$t
-    #     $temp=$temp * $square
-    #     $divider = $divider+2
-    #     $t=$temp/$divider
-    # end-while
-    set result $mantissa
-    set delta_end $delta
-    # we store the square of the integer (mantissa)
-    # Delta of Mantissa^2 = Delta * 2 = Delta << 1
-    set delta_square [expr {$delta<<1}]
-    set square [expr {$mantissa*$mantissa>>$precision}]
-    # the (2n+1) divider
-    set divider 3
-    # computing precisely the uncertainty
-    set delta [expr {1+($delta_square*$mantissa+$delta*$square>>$precision)}]
-    # temp contains (-1)^n*x^(2n+1)
-    set temp [expr {-$mantissa*$square>>$precision}]
-    set t [expr {$temp/$divider}]
-    set dt [expr {1+$delta/$divider}]
-    while {$t!=0} {
-        incr result $t
-        incr delta_end $dt
-        incr divider 2
-        set delta [expr {1+($delta_square*abs($temp)+$delta*($delta_square+$square)>>$precision)}]
-        set temp [expr {-$temp*$square>>$precision}]
-        set t [expr {$temp/$divider}]
-        set dt [expr {1+$delta/$divider}]
-    }
-    # we have to normalize because the uncertainty might be greater than 2**16
-    # moreover it is the most often case
-    return [normalize [list F $result [expr {$exp-$n}] $delta_end]]
-}
-
-
-################################################################################
-# compute atan(1/integer) at a given precision
-# this proc is only used to compute Pi
-# it is using the same Taylor development as [atan]
-################################################################################
-proc ::math::bigfloat::_atanfract {integer precision} {
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # when we have n steps in Taylor development : the nth term is :
-    # 1/denom^(2n+1)/(2n+1)
-    # and the loss of precision is of 2n (n sums and n divisions)
-    # this command is called with integer>=5
-    #
-    # We do not want to compute the Delta parameter, so we just
-    # can increment precision (with lshift) in order for the result to be precise.
-    # Remember : we compute atan2(1,$integer) with $precision bits
-    # $integer has no Delta parameter as it is a BigInt, of course, so
-    # theorically we could compute *any* number of digits.
-    #
-    # if we add an increment to the precision, say n:
-    # (1/5)^(2n-1)/(2n-1)     has to be lower than (1/2)^(precision+n-1)
-    # Calculus :
-    # log(left term) < log(right term)
-    # log(1/left term) > log(1/right term)
-    # (2n-1)*log(5)+log(2n-1)>(precision+n-1)*log(2)
-    # n(2log(5)-log(2))>(precision-1)*log(2)-log(2n-1)+log(5)
-    # -log(2n-1)>-(2n-1)
-    # n(2log(5)-log(2)+2)>(precision-1)*log(2)+1+log(5)
-    set n [expr {int((($precision-1)*log(2)+1+log(5))/(2*log(5)-log(2)+2)+1)}]
-    incr precision $n
-    # first term of the development : 1/integer
-    set a [expr {(1<<$precision)/$integer}]
-    # 's' will contain the result
-    set s $a
-    # Taylor development : x - x^3/3 + x^5/5 - ... + (-1)^(n+1)*x^(2n-1)/(2n-1)
-    # equals x (1 - x^2 * (1/3 + x^2 * (... * (1/(2n-3) + (-1)^(n+1) * x^2 / (2n-1))...)))
-    # all we need to store is : 2n-1 ($denom), x^(2n+1) and x^2 ($square) and two results :
-    # - the nth term => $u
-    # - the nth term * (2n-1) => $t
-    # + of course, the result $s
-    set square [expr {$integer*$integer}]
-    set denom 3
-    # $t is (-1)^n*x^(2n+1)
-    set t [expr {-$a/$square}]
-    set u [expr {$t/$denom}]
-    # we break the loop when the current term of the development is null
-    while {$u!=0} {
-        incr s $u
-        # denominator= (2n+1)
-        incr denom 2
-        # div $t by x^2
-        set t [expr {-$t/$square}]
-        set u [expr {$t/$denom}]
-    }
-    # go back to the initial precision
-    return [expr {$s>>$n}]
-}
-
-#
-# bits : computes the number of bits of an integer, approx.
-#
-proc ::math::bigfloat::bits {int} {
-    set l [string length [set int [expr {abs($int)}]]]
-    # int<10**l -> log_2(int)=l*log_2(10)
-    set l [expr {int($l*log(10)/log(2))+1}]
-    if {$int>>$l!=0} {
-        error "bad result: $l bits"
-    }
-    while {($int>>($l-1))==0} {
-        incr l -1
-    }
-    return $l
-}
-    
-################################################################################
-# returns the integer part of a BigFloat, as a BigInt
-# the result is the same one you would have
-# if you had called [expr {ceil($x)}]
-################################################################################
-proc ::math::bigfloat::ceil {number} {
-    checkFloat $number
-    set number [normalize $number]
-    if {[iszero $number]} {
-        return 0
-    }
-    foreach {dummy integer exp delta} $number {break}
-    if {$exp>=0} {
-        error "not enough precision to perform rounding (ceil)"
-    }
-    # saving the sign ...
-    set sign [expr {$integer<0}]
-    set integer [expr {abs($integer)}]
-    # integer part
-    set try [expr {$integer>>(-$exp)}]
-    if {$sign} {
-        return [opp $try]
-    }
-    # fractional part
-    if {($try<<(-$exp))!=$integer} {
-        return [incr try]
-    }
-    return $try
-}
-
-
-################################################################################
-# checks each variable to be a BigFloat
-# arguments : each argument is the name of a variable to be checked
-################################################################################
-proc ::math::bigfloat::checkFloat {number} {
-    if {![isFloat $number]} {
-        error "BigFloat expected"
-    }
-}
-
-################################################################################
-# checks if each number is either a BigFloat or a BigInt
-# arguments : each argument is the name of a variable to be checked
-################################################################################
-proc ::math::bigfloat::checkNumber {x} {
-    if {![isFloat $x] && ![isInt $x]} {
-        error "input is not an integer, nor a BigFloat"
-    }
-}
-
-
-################################################################################
-# returns 0 if A and B are equal, else returns 1 or -1
-# accordingly to the sign of (A - B)
-################################################################################
-proc ::math::bigfloat::compare {a b} {
-    if {[isInt $a] && [isInt $b]} {
-        set diff [expr {$a-$b}]
-        if {$diff>0} {return 1} elseif {$diff<0} {return -1}
-        return 0
-    }
-    checkFloat $a
-    checkFloat $b
-    if {[equal $a $b]} {return 0}
-    if {[lindex [sub $a $b] 1]<0} {return -1}
-    return 1
-}
-
-
-
-
-################################################################################
-# gets cos(x)
-# throws an error if there is not enough precision on the input
-################################################################################
-proc ::math::bigfloat::cos {x} {
-    checkFloat $x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>-2} {
-        error "not enough precision on floating-point number"
-    }
-    set precision [expr {-$exp}]
-    # cos(2kPi+x)=cos(x)
-    foreach {n integer} [divPiQuarter $integer $precision] {break}
-    # now integer>=0 and <Pi/2
-    set d [expr {$n%4}]
-    # add trigonometric circle turns number to delta
-    incr delta [expr {abs($n)}]
-    set signe 0
-    # cos(Pi-x)=-cos(x)
-    # cos(-x)=cos(x)
-    # cos(Pi/2-x)=sin(x)
-    switch -- $d {
-        1 {set signe 1;set l [_sin2 $integer $precision $delta]}
-        2 {set signe 1;set l [_cos2 $integer $precision $delta]}
-        0 {set l [_cos2 $integer $precision $delta]}
-        3 {set l [_sin2 $integer $precision $delta]}
-        default {error "internal error"}
-    }
-    # precision -> exp (multiplied by -1)
-    #idebug break
-    lset l 1 [expr {-([lindex $l 1])}]
-    # set the sign
-    if {$signe} {
-        lset l 0 [expr {-[lindex $l 0]}]
-    }
-    #idebug break
-    return [normalize [linsert $l 0 F]]
-}
-
-################################################################################
-# compute cos(x) where 0<=x<Pi/2
-# returns : a list formed with :
-# 1. the mantissa
-# 2. the precision (opposite of the exponent)
-# 3. the uncertainty (doubt range)
-################################################################################
-proc ::math::bigfloat::_cos2 {x precision delta} {
-    # precision bits after the dot
-    set pi [_pi $precision]
-    set pis2 [expr {$pi>>1}]
-    set pis4 [expr {$pis2>>1}]
-    if {$x>=$pis4} {
-        # cos(Pi/2-x)=sin(x)
-        set x [expr {$pis2-$x}]
-        incr delta
-        return [_sin $x $precision $delta]
-    }
-    #idebug break
-    return [_cos $x $precision $delta]
-}
-
-################################################################################
-# compute cos(x) where 0<=x<Pi/4
-# returns : a list formed with :
-# 1. the mantissa
-# 2. the precision (opposite of the exponent)
-# 3. the uncertainty (doubt range)
-################################################################################
-proc ::math::bigfloat::_cos {x precision delta} {
-    set float1 [expr {1<<$precision}]
-    # Taylor development follows :
-    # cos(x)=1-x^2/2 + x^4/4! ... + (-1)^(2n)*x^(2n)/2n!
-    # cos(x)= 1 - x^2/1.2 * (1 - x^2/3.4 * (... * (1 - x^2/(2n.(2n-1))...))
-    # variables : $s (the Mantissa of the result)
-    # $denom1 & $denom2 (2n-1 & 2n)
-    # $x as the square of what is named x in 'cos(x)'
-    set s $float1
-    # 'd' is the uncertainty on x^2
-    set d [expr {$x*($delta<<1)}]
-    set d [expr {1+($d>>$precision)}]
-    # x=x^2 (because in this Taylor development, there are only even powers of x)
-    set x [expr {$x*$x>>$precision}]
-    set denom1 1
-    set denom2 2
-    set t [expr {-($x>>1)}]
-    set dt $d
-    while {$t!=0} {
-        incr s $t
-        incr delta $dt
-        incr denom1 2
-        incr denom2 2
-        set dt [expr {$x*$dt+($t+$dt)*$d>>$precision}]
-        incr dt
-        set t [expr {$x*$t>>$precision}]
-        set t [expr {-$t/($denom1*$denom2)}]
-    }
-    return [list $s $precision $delta]
-}
-
-################################################################################
-# cotangent : the trivial algorithm is used
-################################################################################
-proc ::math::bigfloat::cotan {x} {
-    return [::math::bigfloat::div [::math::bigfloat::cos $x] [::math::bigfloat::sin $x]]
-}
-
-################################################################################
-# converts angles from degrees to radians
-# deg/180=rad/Pi
-################################################################################
-proc ::math::bigfloat::deg2rad {x} {
-    checkFloat $x
-    set xLen [expr {-[lindex $x 2]}]
-    if {$xLen<3} {
-        error "number too loose to convert to radians"
-    }
-    set pi [pi $xLen 1]
-    return [div [mul $x $pi] 180]
-}
-
-
-
-################################################################################
-# private proc to get : x modulo Pi/2
-# and the quotient (x divided by Pi/2)
-# used by cos , sin & others
-################################################################################
-proc ::math::bigfloat::divPiQuarter {integer precision} {
-    incr precision 2
-    set integer [expr {$integer<<1}]
-    #idebug break
-    set P [_pi $precision]
-    # modulo 2Pi
-    set integer [expr {$integer%$P}]
-    # end modulo 2Pi
-    # 2Pi>>1 = Pi of course!
-    set P [expr {$P>>1}]
-    set n [expr {$integer/$P}]
-    set integer [expr {$integer%$P}]
-    # now divide by Pi/2
-    # multiply n by 2
-    set n [expr {$n<<1}]
-    # pi/2=Pi>>1
-    set P [expr {$P>>1}]
-    return [list [incr n [expr {$integer/$P}]] [expr {($integer%$P)>>1}]]
-}
-
-
-################################################################################
-# divide A by B and returns the result
-# throw error : divide by zero
-################################################################################
-proc ::math::bigfloat::div {a b} {
-    checkNumber $a
-    checkNumber $b
-    # dispatch to an appropriate procedure 
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            return [expr {$a/$b}]
-        }
-        error "trying to divide an integer by a BigFloat"
-    }
-    if {[isInt $b]} {return [divFloatByInt $a $b]}
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    # computes the limits of the doubt (or uncertainty) interval
-    set BMin [expr {$integerB-$deltaB}]
-    set BMax [expr {$integerB+$deltaB}]
-    if {$BMin>$BMax} {
-        # swap BMin and BMax
-        set temp $BMin
-        set BMin $BMax
-        set BMax $temp
-    }
-    # multiply by zero gives zero
-    if {$integerA==0} {
-        # why not return any number or the integer 0 ?
-        # because there is an exponent that might be different between two BigFloats
-        # 0.00 --> exp = -2, 0.000000 -> exp = -6
-        return $a 
-    }
-    # test of the division by zero
-    if {$BMin*$BMax<0 || $BMin==0 || $BMax==0} {
-        error "divide by zero"
-    }
-    # shift A because we need accuracy
-    set l [bits $integerB]
-    set integerA [expr {$integerA<<$l}]
-    set deltaA [expr {$deltaA<<$l}]
-    set exp [expr {$expA-$l-$expB}]
-    # relative uncertainties (dX/X) are added
-    # to give the relative uncertainty of the result
-    # i.e. 3% on A + 2% on B --> 5% on the quotient
-    # d(A/B)/(A/B)=dA/A + dB/B
-    # Q=A/B
-    # dQ=dA/B + dB*A/B*B
-    # dQ is "delta"
-    set delta [expr {($deltaB*abs($integerA))/abs($integerB)}]
-    set delta [expr {([incr delta]+$deltaA)/abs($integerB)}]
-    set quotient [expr {$integerA/$integerB}]
-    if {$integerB*$integerA<0} {
-        incr quotient -1
-    }
-    return [normalize [list F $quotient $exp [incr delta]]]
-}
-
-
-
-
-################################################################################
-# divide a BigFloat A by a BigInt B
-# throw error : divide by zero
-################################################################################
-proc ::math::bigfloat::divFloatByInt {a b} {
-    # type check
-    checkFloat $a
-    if {![isInt $b]} {
-        error "second argument is not an integer"
-    }
-    foreach {dummy integer exp delta} $a {break}
-    # zero divider test
-    if {$b==0} {
-        error "divide by zero"
-    }
-    # shift left for accuracy ; see other comments in [div] procedure
-    set l [bits $b]
-    set integer [expr {$integer<<$l}]
-    set delta [expr {$delta<<$l}]
-    incr exp -$l
-    set integer [expr {$integer/$b}]
-    # the uncertainty is always evaluated to the ceil value
-    # and as an absolute value
-    set delta [expr {$delta/abs($b)+1}]
-    return [normalize [list F $integer $exp $delta]]
-}
-
-
-
-
-
-################################################################################
-# returns 1 if A and B are equal, 0 otherwise
-# IN : a, b (BigFloats)
-################################################################################
-proc ::math::bigfloat::equal {a b} {
-    if {[isInt $a] && [isInt $b]} {
-        return [expr {$a==$b}]
-    }
-    # now a & b should only be BigFloats
-    checkFloat $a
-    checkFloat $b
-    foreach {dummy aint aexp adelta} $a {break}
-    foreach {dummy bint bexp bdelta} $b {break}
-    # set all Mantissas and Deltas to the same level (exponent)
-    # with lshift
-    set diff [expr {$aexp-$bexp}]
-    if {$diff<0} {
-        set diff [expr {-$diff}]
-        set bint [expr {$bint<<$diff}]
-        set bdelta [expr {$bdelta<<$diff}]
-    } elseif {$diff>0} {
-        set aint [expr {$aint<<$diff}]
-        set adelta [expr {$adelta<<$diff}]
-    }
-    # compute limits of the number's doubt range
-    set asupInt [expr {$aint+$adelta}]
-    set ainfInt [expr {$aint-$adelta}]
-    set bsupInt [expr {$bint+$bdelta}]
-    set binfInt [expr {$bint-$bdelta}]
-    # A & B are equal
-    # if their doubt ranges overlap themselves
-    if {$bint==$aint} {
-        return 1
-    }
-    if {$bint>$aint} {
-        set r [expr {$asupInt>=$binfInt}]
-    } else {
-        set r [expr {$bsupInt>=$ainfInt}]
-    }
-    return $r
-}
-
-################################################################################
-# returns exp(X) where X is a BigFloat
-################################################################################
-proc ::math::bigfloat::exp {x} {
-    checkFloat $x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>=0} {
-        # shift till exp<0 with respect to the internal representation
-        # of the number
-        incr exp
-        set integer [expr {$integer<<$exp}]
-        set delta [expr {$delta<<$exp}]
-        set exp -1
-    }
-    # add 8 bits of precision for safety
-    set precision [expr {8-$exp}]
-    set integer [expr {$integer<<8}]
-    set delta [expr {$delta<<8}]
-    set Log2 [_log2 $precision]
-    set new_exp [expr {$integer/$Log2}]
-    set integer [expr {$integer%$Log2}]
-    # $new_exp = integer part of x/log(2)
-    # $integer = remainder
-    # exp(K.log(2)+r)=2^K.exp(r)
-    # so we just have to compute exp(r), r is small so
-    # the Taylor development will converge quickly
-    incr delta $new_exp
-    foreach {integer delta} [_exp $integer $precision $delta] {break}
-    set delta [expr {$delta>>8}]
-    incr precision -8
-    # multiply by 2^K , and take care of the sign
-    # example : X=-6.log(2)+0.01
-    # exp(X)=exp(0.01)*2^-6
-    # if {abs($new_exp)>>30!=0} {
-        # error "floating-point overflow due to exp"
-    # }
-    set exp [expr {$new_exp-$precision}]
-    incr delta
-    return [normalize [list F [expr {$integer>>8}] $exp $delta]]
-}
-
-
-################################################################################
-# private procedure to compute exponentials
-# using Taylor development of exp(x) :
-# exp(x)=1+ x + x^2/2 + x^3/3! +...+x^n/n!
-# input : integer (the mantissa)
-#         precision (the number of decimals)
-#         delta (the doubt limit, or uncertainty)
-# returns a list : 1. the mantissa of the result
-#                  2. the doubt limit, or uncertainty
-################################################################################
-proc ::math::bigfloat::_exp {integer precision delta} {
-    if {$integer==0} {
-        # exp(0)=1
-        return [list [expr {1<<$precision}] $delta]
-    }
-    set s [expr {(1<<$precision)+$integer}]
-    set d [expr {1+$delta/2}]
-    incr delta $delta
-    # dt = uncertainty on x^2
-    set dt [expr {1+($d*$integer>>$precision)}]
-    # t= x^2/2 = x^2>>1
-    set t [expr {$integer*$integer>>$precision+1}]
-    set denom 2
-    while {$t!=0} {
-        # the sum is called 's'
-        incr s $t
-        incr delta $dt
-        # we do not have to keep trace of the factorial, we just iterate divisions
-        incr denom
-        # add delta
-        set d [expr {1+$d/$denom}]
-        incr dt $d
-        # get x^n from x^(n-1)
-        set t [expr {($integer*$t>>$precision)/$denom}]
-    }
-    return [list $s $delta]
-}
-################################################################################
-# divide a BigFloat by 2 power 'n'
-################################################################################
-proc ::math::bigfloat::floatRShift {float {n 1}} {
-    return [lset float 2 [expr {[lindex $float 2]-$n}]]
-}
-
-
-
-################################################################################
-# procedure floor : identical to [expr floor($x)] in functionality
-# arguments : number IN (a BigFloat)
-# returns : the floor value as a BigInt
-################################################################################
-proc ::math::bigfloat::floor {number} {
-    checkFloat $number
-    if {[iszero $number]} {
-        # returns the BigInt 0
-        return 0
-    }
-    foreach {dummy integer exp delta} $number {break}
-    if {$exp>=0} {
-        error "not enough precision to perform rounding (floor)"
-    }
-    # floor(n.xxxx)=n when n is positive
-    if {$integer>0} {return [expr {$integer>>(-$exp)}]}
-    set integer [expr {abs($integer)}]
-    # integer part
-    set try [expr {$integer>>(-$exp)}]
-    # floor(-n.xxxx)=-(n+1) when xxxx!=0
-    if {$try<<(-$exp)!=$integer} {
-        incr try
-    }
-    return [expr {-$try}]
-}
-
-
-################################################################################
-# returns a list formed by an integer and an exponent
-# x = (A +/- C) * 10 power B
-# return [list "F" A B C] (where F is the BigFloat tag)
-# A and C are BigInts, B is a raw integer
-# return also a BigInt when there is neither a dot, nor a 'e' exponent
-#
-# arguments : -base base integer
-#          or integer
-#          or float
-#          or float trailingZeros
-################################################################################
-proc ::math::bigfloat::fromstr {number {addzeros 0}} {
-    if {$addzeros<0} {
-        error "second argument has to be a positive integer"
-    }
-    # eliminate the sign problem
-    # added on 05/08/2005
-    # setting '$signe' to the sign of the number
-    set number [string trimleft $number +]
-    if {[string index $number 0]=="-"} {
-        set signe 1
-        set string [string range $number 1 end]
-    } else  {
-        set signe 0
-        set string $number
-    }
-    # integer case (not a floating-point number)
-    if {[string is digit $string]} {
-        if {$addzeros!=0} {
-            error "second argument not allowed with an integer"
-        }
-        # we have completed converting an integer to a BigInt
-        # please note that most math::bigfloat procs accept BigInts as arguments
-        return $number
-    }
-    # floating-point number : check for an exponent
-    # scientific notation
-    set tab [split $string e]
-    if {[llength $tab]>2} {
-        # there are more than one 'e' letter in the number
-        error "syntax error in number : $string"
-    }
-    if {[llength $tab]==2} {
-        set exp [lindex $tab 1]
-        # now exp can look like +099 so you need to handle octal numbers
-        # too bad...
-        # find the sign (if any?)
-        regexp {^[\+\-]?} $exp expsign
-        # trim the number with left-side 0's
-        set found [string length $expsign]
-        set exp $expsign[string trimleft [string range $exp $found end] 0]
-        set mantissa [lindex $tab 0]
-    } else {
-        set exp 0
-        set mantissa [lindex $tab 0]
-    }
-    # a floating-point number may have a dot
-    set tab [split [string trimleft $mantissa 0] .]
-    if {[llength $tab]>2} {error "syntax error in number : $string"}
-    if {[llength $tab]==2} {
-        set mantissa [join $tab ""]
-        # increment by the number of decimals (after the dot)
-        incr exp -[string length [lindex $tab 1]]
-    }
-    # this is necessary to ensure we can call fromstr (recursively) with
-    # the mantissa ($number)
-    if {![string is digit $mantissa]} {
-        error "$number is not a number"
-    }
-    # take account of trailing zeros 
-    incr exp -$addzeros
-    # multiply $number by 10^$trailingZeros
-    append mantissa [string repeat 0 $addzeros]
-    # add the sign
-    # here we avoid octal numbers by trimming the leading zeros!
-    # 2005-10-28 S.ARNOLD
-    if {$signe} {set mantissa [expr {-[string trimleft $mantissa 0]}]}
-    # the F tags a BigFloat
-    # a BigInt is like any other integer since Tcl 8.5,
-    # because expr now supports arbitrary length integers
-    return [_fromstr $mantissa $exp]
-}
-
-################################################################################
-# private procedure to transform decimal floats into binary ones
-# IN :
-#     - number : a BigInt representing the Mantissa
-#     - exp : the decimal exponent (a simple integer)
-# OUT :
-#     $number * 10^$exp, as the internal binary representation of a BigFloat
-################################################################################
-proc ::math::bigfloat::_fromstr {number exp} {
-    set number [string trimleft $number 0]
-    if {$number==""} {
-        return [list F 0 [expr {int($exp*log(10)/log(2))-15}] [expr {1<<15}]]
-    }
-    if {$exp==0} {
-        return [list F $number 0 1]
-    }
-    if {$exp>0} {
-        # mul by 10^exp, then normalize
-        set power [expr {10**$exp}]
-        set number [expr {$number*$power}]
-        return [normalize [list F $number 0 $power]]
-    }
-    # now exp is negative or null
-    # the closest power of 2 to the 'exp'th power of ten, but greater than it
-    # 10**$exp<2**$binaryExp
-    # $binaryExp>$exp*log(10)/log(2)
-    set binaryExp [expr {int(-$exp*log(10)/log(2))+1+16}]
-    # then compute n * 2^binaryExp / 10^(-exp)
-    # (exp is negative)
-    # equals n * 2^(binaryExp+exp) / 5^(-exp)
-    set diff [expr {$binaryExp+$exp}]
-    if {$diff<0} {
-        error "internal error"
-    }
-    set power [expr {5**(-$exp)}]
-    set number [expr {($number<<$diff)/$power}]
-    set delta [expr {(1<<$diff)/$power}]
-    return [normalize [list F $number [expr {-$binaryExp}] [incr delta]]]
-}
-
-
-################################################################################
-# fromdouble :
-# like fromstr, but for a double scalar value
-# arguments :
-# double - the number to convert to a BigFloat
-# exp (optional) - the total number of digits
-################################################################################
-proc ::math::bigfloat::fromdouble {double {exp {}}} {
-    set mantissa [lindex [split $double e] 0]
-    # line added by SArnold on 05/08/2005
-    set mantissa [string trimleft [string map {+ "" - ""} $mantissa] 0]
-    set precision [string length [string map {. ""} $mantissa]]
-    if { $exp != {} && [incr exp]>$precision } {
-        return [fromstr $double [expr {$exp-$precision}]]
-    } else {
-        # tests have failed : not enough precision or no exp argument
-        return [fromstr $double]
-    }
-}
-
-
-################################################################################
-# converts a BigInt into a BigFloat with a given decimal precision
-################################################################################
-proc ::math::bigfloat::int2float {int {decimals 1}} {
-    # it seems like we need some kind of type handling
-    # very odd in this Tcl world :-(
-    if {![isInt $int]} {
-        error "first argument is not an integer"
-    }
-    if {$decimals<1} {
-        error "non-positive decimals number"
-    }
-    # the lowest number of decimals is 1, because
-    # [tostr [fromstr 10.0]] returns 10.
-    # (we lose 1 digit when converting back to string)
-    set int [expr {$int*10**$decimals}]
-    return [_fromstr $int [expr {-$decimals}]]
-}
-
-
-
-################################################################################
-# multiplies 'leftop' by 'rightop' and rshift the result by 'shift'
-################################################################################
-proc ::math::bigfloat::intMulShift {leftop rightop shift} {
-    return [::math::bignum::rshift [::math::bignum::mul $leftop $rightop] $shift]
-}
-
-################################################################################
-# returns 1 if x is a BigFloat, 0 elsewhere
-################################################################################
-proc ::math::bigfloat::isFloat {x} {
-    # a BigFloat is a list of : "F" mantissa exponent delta
-    if {[llength $x]!=4} {
-        return 0
-    }
-    # the marker is the letter "F"
-    if {[string equal [lindex $x 0] F]} {
-        return 1
-    }
-    return 0
-}
-
-################################################################################
-# checks that n is a BigInt (a number create by math::bignum::fromstr)
-################################################################################
-proc ::math::bigfloat::isInt {n} {
-    if {[llength $n]>1} {
-        return 0
-    }
-    # if {[string is digit $n]} {
-        # return 1
-    # }
-    return 1
-}
-
-
-
-################################################################################
-# returns 1 if x is null, 0 otherwise
-################################################################################
-proc ::math::bigfloat::iszero {x} {
-    if {[isInt $x]} {
-        return [expr {$x==0}]
-    }
-    checkFloat $x
-    # now we do some interval rounding : if a number's interval englobs 0,
-    # it is considered to be equal to zero
-    foreach {dummy integer exp delta} $x {break}
-    if {$delta>=abs($integer)} {return 1}
-    return 0
-}
-
-
-################################################################################
-# compute log(X)
-################################################################################
-proc ::math::bigfloat::log {x} {
-    checkFloat $x
-    foreach {dummy integer exp delta} $x {break}
-    if {$integer<=0} {
-        error "zero logarithm error"
-    }
-    if {[iszero $x]} {
-        error "number equals zero"
-    }
-    set precision [bits $integer]
-    # uncertainty of the logarithm
-    set delta [_logOnePlusEpsilon $delta $integer $precision]
-    incr delta
-    # we got : x = 1xxxxxx (binary number with 'precision' bits) * 2^exp
-    # we need : x = 0.1xxxxxx(binary) *2^(exp+precision)
-    incr exp $precision
-    foreach {integer deltaIncr} [_log $integer] {break}
-    incr delta $deltaIncr
-    # log(a * 2^exp)= log(a) + exp*log(2)
-    # result = log(x) + exp*log(2)
-    # as x<1 log(x)<0 but 'integer' (result of '_log') is the absolute value
-    # that is why we substract $integer to log(2)*$exp
-    set integer [expr {[_log2 $precision]*$exp-$integer}]
-    incr delta [expr {abs($exp)}]
-    return [normalize [list F $integer -$precision $delta]]
-}
-
-
-################################################################################
-# compute log(1-epsNum/epsDenom)=log(1-'epsilon')
-# Taylor development gives -x -x^2/2 -x^3/3 -x^4/4 ...
-# used by 'log' command because log(x+/-epsilon)=log(x)+log(1+/-(epsilon/x))
-# so the uncertainty equals abs(log(1-epsilon/x))
-# ================================================
-# arguments :
-# epsNum IN (the numerator of epsilon)
-# epsDenom IN (the denominator of epsilon)
-# precision IN (the number of bits after the dot)
-#
-# 'epsilon' = epsNum*2^-precision/epsDenom
-################################################################################
-proc ::math::bigfloat::_logOnePlusEpsilon {epsNum epsDenom precision} {
-    if {$epsNum>=$epsDenom} {
-        error "number is null"
-    }
-    set s [expr {($epsNum<<$precision)/$epsDenom}]
-    set divider 2
-    set t [expr {$s*$epsNum/$epsDenom}]
-    set u [expr {$t/$divider}]
-    # when u (the current term of the development) is zero, we have reached our goal
-    # it has converged
-    while {$u!=0} {
-        incr s $u
-        # divider = order of the term = 'n'
-        incr divider
-        # t = (epsilon)^n
-        set t [expr {$t*$epsNum/$epsDenom}]
-        # u = t/n = (epsilon)^n/n and is the nth term of the Taylor development
-        set u [expr {$t/$divider}]
-    }
-    return $s
-}
-
-
-################################################################################
-# compute log(0.xxxxxxxx) : log(1-epsilon)=-eps-eps^2/2-eps^3/3...-eps^n/n
-################################################################################
-proc ::math::bigfloat::_log {integer} {
-    # the uncertainty is nbSteps with nbSteps<=nbBits
-    # take nbSteps=nbBits (the worse case) and log(nbBits+increment)=increment
-    set precision [bits $integer]
-    set n [expr {int(log($precision+2*log($precision)))}]
-    set integer [expr {$integer<<$n}]
-    incr precision $n
-    set delta 3
-    # 1-epsilon=integer
-    set integer [expr {(1<<$precision)-$integer}]
-    set s $integer
-    # t=x^2
-    set t [expr {$integer*$integer>>$precision}]
-    set denom 2
-    # u=x^2/2 (second term)
-    set u [expr {$t/$denom}]
-    while {$u!=0} {
-        # while the current term is not zero, it has not converged
-        incr s $u
-        incr delta
-        # t=x^n
-        set t [expr {$t*$integer>>$precision}]
-        # denom = n (the order of the current development term)
-        # u = x^n/n (the nth term of Taylor development)
-        set u [expr {$t/[incr denom]}]
-    }
-    # shift right to restore the precision
-    set delta
-    return [list [expr {$s>>$n}] [expr {($delta>>$n)+1}]]
-}
-
-################################################################################
-# computes log(num/denom) with 'precision' bits
-# used to compute some analysis constants with a given accuracy
-# you might not call this procedure directly : it assumes 'num/denom'>4/5
-# and 'num/denom'<1
-################################################################################
-proc ::math::bigfloat::__log {num denom precision} {
-    # Please Note : we here need a precision increment, in order to
-    # keep accuracy at $precision digits. If we just hold $precision digits,
-    # each number being precise at the last digit +/- 1,
-    # we would lose accuracy because small uncertainties add to themselves.
-    # Example : 0.0001 + 0.0010 = 0.0011 +/- 0.0002
-    # This is quite the same reason that made tcl_precision defaults to 12 :
-    # internally, doubles are computed with 17 digits, but to keep precision
-    # we need to limit our results to 12.
-    # The solution : given a precision target, increment precision with a
-    # computed value so that all digits of he result are exacts.
-    # 
-    # p is the precision
-    # pk is the precision increment
-    # 2 power pk is also the maximum number of iterations
-    # for a number close to 1 but lower than 1,
-    # (denom-num)/denum is (in our case) lower than 1/5
-    # so the maximum nb of iterations is for:
-    # 1/5*(1+1/5*(1/2+1/5*(1/3+1/5*(...))))
-    # the last term is 1/n*(1/5)^n
-    # for the last term to be lower than 2^(-p-pk)
-    # the number of iterations has to be
-    # 2^(-pk).(1/5)^(2^pk) < 2^(-p-pk)
-    # log(1/5).2^pk < -p
-    # 2^pk > p/log(5)
-    # pk > log(2)*log(p/log(5))
-    # now set the variable n to the precision increment i.e. pk
-    set n [expr {int(log(2)*log($precision/log(5)))+1}]
-    incr precision $n
-    # log(num/denom)=log(1-(denom-num)/denom)
-    # log(1+x) = x + x^2/2 + x^3/3 + ... + x^n/n
-    #          = x(1 + x(1/2 + x(1/3 + x(...+ x(1/(n-1) + x/n)...))))
-    set num [expr {$denom-$num}]
-    # $s holds the result
-    set s [expr {($num<<$precision)/$denom}]
-    # $t holds x^n
-    set t [expr {$s*$num/$denom}]
-    set d 2
-    # $u holds x^n/n
-    set u [expr {$t/$d}]
-    while {$u!=0} {
-        incr s $u
-        # get x^n * x
-        set t [expr {$t*$num/$denom}]
-        # get n+1
-        incr d
-        # then : $u = x^(n+1)/(n+1)
-        set u [expr {$t/$d}]
-    }
-    # see head of the proc : we return the value with its target precision
-    return [expr {$s>>$n}]
-}
-
-################################################################################
-# computes log(2) with 'precision' bits and caches it into a namespace variable
-################################################################################
-proc ::math::bigfloat::__logbis {precision} {
-    set increment [expr {int(log($precision)/log(2)+1)}]
-    incr precision $increment
-    # ln(2)=3*ln(1-4/5)+ln(1-125/128)
-    set a [__log 125 128 $precision]
-    set b [__log 4 5 $precision]
-    set r [expr {$b*3+$a}]
-    set ::math::bigfloat::Log2 [expr {$r>>$increment}]
-    # formerly (when BigFloats were stored in ten radix) we had to compute log(10)
-    # ln(10)=10.ln(1-4/5)+3*ln(1-125/128)
-}
-
-
-################################################################################
-# retrieves log(2) with 'precision' bits ; the result is cached
-################################################################################
-proc ::math::bigfloat::_log2 {precision} {
-    variable Log2
-    if {![info exists Log2]} {
-        __logbis $precision
-    } else {
-        # the constant is cached and computed again when more precision is needed
-        set l [bits $Log2]
-        if {$precision>$l} {
-            __logbis $precision
-        }
-    }
-    # return log(2) with 'precision' bits even when the cached value has more bits
-    return [_round $Log2 $precision]
-}
-
-
-################################################################################
-# returns A modulo B (like with fmod() math function)
-################################################################################
-proc ::math::bigfloat::mod {a b} {
-    checkNumber $a
-    checkNumber $b
-    if {[isInt $a] && [isInt $b]} {return [expr {$a%$b}]}
-    if {[isInt $a]} {error "trying to divide an integer by a BigFloat"}
-    set quotient [div $a $b]
-    # examples : fmod(3,2)=1 quotient=1.5
-    # fmod(1,2)=1 quotient=0.5
-    # quotient>0 and b>0 : get floor(quotient)
-    # fmod(-3,-2)=-1 quotient=1.5
-    # fmod(-1,-2)=-1 quotient=0.5
-    # quotient>0 and b<0 : get floor(quotient)
-    # fmod(-3,2)=-1 quotient=-1.5
-    # fmod(-1,2)=-1 quotient=-0.5
-    # quotient<0 and b>0 : get ceil(quotient)
-    # fmod(3,-2)=1 quotient=-1.5
-    # fmod(1,-2)=1 quotient=-0.5
-    # quotient<0 and b<0 : get ceil(quotient)
-    if {[sign $quotient]} {
-        set quotient [ceil $quotient]
-    } else  {
-        set quotient [floor $quotient]
-    }
-    return [sub $a [mul $quotient $b]]
-}
-
-################################################################################
-# returns A times B
-################################################################################
-proc ::math::bigfloat::mul {a b} {
-    checkNumber $a
-    checkNumber $b
-    # dispatch the command to appropriate commands regarding types (BigInt & BigFloat)
-    if {[isInt $a]} {
-        if {[isInt $b]} {
-            return [expr {$a*$b}]
-        }
-        return [mulFloatByInt $b $a]
-    }
-    if {[isInt $b]} {return [mulFloatByInt $a $b]}
-    # now we are sure that 'a' and 'b' are BigFloats
-    foreach {dummy integerA expA deltaA} $a {break}
-    foreach {dummy integerB expB deltaB} $b {break}
-    # 2^expA * 2^expB = 2^(expA+expB)
-    set exp [expr {$expA+$expB}]
-    # mantissas are multiplied
-    set integer [expr {$integerA*$integerB}]
-    # compute precisely the uncertainty
-    set delta [expr {$deltaA*(abs($integerB)+$deltaB)+abs($integerA)*$deltaB+1}]
-    # we have to normalize because 'delta' may be too big
-    return [normalize [list F $integer $exp $delta]]
-}
-
-################################################################################
-# returns A times B, where B is a positive integer
-################################################################################
-proc ::math::bigfloat::mulFloatByInt {a b} {
-    checkFloat $a
-    foreach {dummy integer exp delta} $a {break}
-    if {$b==0} {
-        return [list F 0 $exp $delta]
-    }
-    # Mantissa and Delta are simply multplied by $b
-    set integer [expr {$integer*$b}]
-    set delta [expr {$delta*$b}]
-    # We normalize because Delta could have seriously increased
-    return [normalize [list F $integer $exp $delta]]
-}
-
-################################################################################
-# normalizes a number : Delta (accuracy of the BigFloat)
-# has to be limited, because the memory use increase
-# quickly when we do some computations, as the Mantissa and Delta
-# increase together
-# The solution : limit the size of Delta to 16 bits
-################################################################################
-proc ::math::bigfloat::normalize {number} {
-    checkFloat $number
-    foreach {dummy integer exp delta} $number {break}
-    set l [bits $delta]
-    if {$l>16} {
-        incr l -16
-        # $l holds the supplementary size (in bits)
-        # now we can shift right by $l bits
-        # always round upper the Delta
-        set delta [expr {$delta>>$l}]
-        incr delta
-        set integer [expr {$integer>>$l}]
-        incr exp $l
-    }
-    return [list F $integer $exp $delta]
-}
-
-
-
-################################################################################
-# returns -A (the opposite)
-################################################################################
-proc ::math::bigfloat::opp {a} {
-    checkNumber $a
-    if {[iszero $a]} {
-        return $a
-    }
-    if {[isInt $a]} {
-        return [expr {-$a}]
-    }
-    # recursive call
-    lset a 1 [expr {-[lindex $a 1]}]
-    return $a
-}
-
-################################################################################
-# gets Pi with precision bits
-# after the dot (after you call [tostr] on the result)
-################################################################################
-proc ::math::bigfloat::pi {precision {binary 0}} {
-    if {![isInt $precision]} {
-        error "'$precision' expected to be an integer"
-    }
-    if {!$binary} {
-        # convert decimal digit length into bit length
-        set precision [expr {int(ceil($precision*log(10)/log(2)))}]
-    }
-    return [list F [_pi $precision] -$precision 1]
-}
-
-#
-# Procedure that resets the stored cached Pi constant
-#
-proc ::math::bigfloat::reset {} {
-    variable _pi0
-    if {[info exists _pi0]} {unset _pi0}
-}
-
-proc ::math::bigfloat::_pi {precision} {
-    # the constant Pi begins with 3.xxx
-    # so we need 2 digits to store the digit '3'
-    # and then we will have precision+2 bits in the mantissa
-    variable _pi0
-    if {![info exists _pi0]} {
-        set _pi0 [__pi $precision]
-    }
-    set lenPiGlobal [bits $_pi0]
-    if {$lenPiGlobal<$precision} {
-        set _pi0 [__pi $precision]
-    }
-    return [expr {$_pi0 >> [bits $_pi0]-2-$precision}]
-}
-
-################################################################################
-# computes an integer representing Pi in binary radix, with precision bits
-################################################################################
-proc ::math::bigfloat::__pi {precision} {
-    set safetyLimit 8
-    # for safety and for the better precision, we do so ...
-    incr precision $safetyLimit
-    # formula found in the Math litterature (on Wikipedia
-    # Pi/4 = 44.atan(1/57) + 7.atan(1/239) - 12.atan(1/682) + 24.atan(1/12943)
-    set a [expr {[_atanfract 57 $precision]*44}]
-    incr a [expr {[_atanfract 239 $precision]*7}]
-    set a [expr {$a - [_atanfract 682 $precision]*12}]
-    incr a [expr {[_atanfract 12943 $precision]*24}]
-    return [expr {$a>>$safetyLimit-2}]
-}
-
-################################################################################
-# shift right an integer until it haves $precision bits
-# round at the same time
-################################################################################
-proc ::math::bigfloat::_round {integer precision} {
-    set shift [expr {[bits $integer]-$precision}]
-    if {$shift==0} {
-        return $integer
-    }
-    # $result holds the shifted integer
-    set result [expr {$integer>>$shift}]
-    # $shift-1 is the bit just rights the last bit of the result
-    # Example : integer=1000010 shift=2
-    # => result=10000 and the tested bit is '1'
-    if {$integer & (1<<($shift-1))} {
-        # we round to the upper limit
-        return [incr result]
-    }
-    return $result
-}
-
-################################################################################
-# returns A power B, where B is a positive integer
-################################################################################
-proc ::math::bigfloat::pow {a b} {
-    checkNumber $a
-    if {$b<0} {
-        error "pow : exponent is not a positive integer"
-    }
-    # case where it is obvious that we should use the appropriate command
-    # from math::bignum (added 5th March 2005)
-    if {[isInt $a]} {
-        return [expr {$a**$b}]
-    }
-    # algorithm : exponent=$b = Sum(i=0..n) b(i)2^i
-    # $a^$b = $a^( b(0) + 2b(1) + 4b(2) + ... + 2^n*b(n) )
-    # we have $a^(x+y)=$a^x * $a^y
-    # then $a^$b = Product(i=0...n) $a^(2^i*b(i))
-    # b(i) is boolean so $a^(2^i*b(i))= 1 when b(i)=0 and = $a^(2^i) when b(i)=1
-    # then $a^$b = Product(i=0...n and b(i)=1) $a^(2^i) and 1 when $b=0
-    if {$b==0} {return 1}
-    # $res holds the result
-    set res 1
-    while {1} {
-        # at the beginning i=0
-        # $remainder is b(i)
-        set remainder [expr {$b&1}]
-        # $b 'rshift'ed by 1 bit : i=i+1
-        # so next time we will test bit b(i+1)
-        set b [expr {$b>>1}]
-        # if b(i)=1
-        if {$remainder} {
-            # mul the result by $a^(2^i)
-            # if i=0 we multiply by $a^(2^0)=$a^1=$a
-            set res [mul $res $a]
-        }
-        # no more bits at '1' in $b : $res is the result
-        if {$b==0} {
-            return [normalize $res]
-        }
-        # i=i+1 : $a^(2^(i+1)) = square of $a^(2^i)
-        set a [mul $a $a]
-    }
-}
-
-################################################################################
-# converts angles for radians to degrees
-################################################################################
-proc ::math::bigfloat::rad2deg {x} {
-    checkFloat $x
-    set xLen [expr {-[lindex $x 2]}]
-    if {$xLen<3} {
-        error "number too loose to convert to degrees"
-    }
-    # $rad/Pi=$deg/180
-    # so result in deg = $radians*180/Pi
-    return [div [mul $x 180] [pi $xLen 1]]
-}
-
-################################################################################
-# retourne la partie entière (ou 0) du nombre "number"
-################################################################################
-proc ::math::bigfloat::round {number} {
-    checkFloat $number
-    #set number [normalize $number]
-    # fetching integers (or BigInts) from the internal representation
-    foreach {dummy integer exp delta} $number {break}
-    if {$integer==0} {
-        return 0
-    }
-    if {$exp>=0} {
-        error "not enough precision to round (in round)"
-    }
-    set exp [expr {-$exp}]
-    # saving the sign, ...
-    set sign [expr {$integer<0}]
-    set integer [expr {abs($integer)}]
-    # integer part of the number
-    set try [expr {$integer>>$exp}]
-    # first bit after the dot
-    set way [expr {$integer>>($exp-1)&1}]
-    # delta is shifted so it gives the integer part of 2*delta
-    set delta [expr {$delta>>($exp-1)}]
-    # when delta is too big to compute rounded value (
-    if {$delta!=0} {
-        error "not enough precision to round (in round)"
-    }
-    if {$way} {
-        incr try
-    }
-    # ... restore the sign now
-    if {$sign} {return [expr {-$try}]}
-    return $try
-}
-
-################################################################################
-# round and divide by 10^n
-################################################################################
-proc ::math::bigfloat::roundshift {integer n} {
-    # $exp= 10^$n
-    incr n -1
-    set exp [expr {10**$n}]
-    set toround [expr {$integer/$exp}]
-    if {$toround%10>=5} {
-        return [expr {$toround/10+1}]
-    }
-    return [expr {$toround/10}]
-}
-
-################################################################################
-# gets the sign of either a bignum, or a BitFloat
-# we keep the bignum convention : 0 for positive, 1 for negative
-################################################################################
-proc ::math::bigfloat::sign {n} {
-    if {[isInt $n]} {
-        return [expr {$n<0}]
-    }
-    checkFloat $n
-    # sign of 0=0
-    if {[iszero $n]} {return 0}
-    # the sign of the Mantissa, which is a BigInt
-    return [sign [lindex $n 1]]
-}
-
-
-################################################################################
-# gets sin(x)
-################################################################################
-proc ::math::bigfloat::sin {x} {
-    checkFloat $x
-    foreach {dummy integer exp delta} $x {break}
-    if {$exp>-2} {
-        error "sin : not enough precision"
-    }
-    set precision [expr {-$exp}]
-    # sin(2kPi+x)=sin(x)
-    # $integer is now the modulo of the division of the mantissa by Pi/4
-    # and $n is the quotient
-    foreach {n integer} [divPiQuarter $integer $precision] {break}
-    incr delta $n
-    set d [expr {$n%4}]
-    # now integer>=0
-    # x = $n*Pi/4 + $integer and $n belongs to [0,3]
-    # sin(2Pi-x)=-sin(x)
-    # sin(Pi-x)=sin(x)
-    # sin(Pi/2+x)=cos(x)
-    set sign 0
-    switch  -- $d {
-        0 {set l [_sin2 $integer $precision $delta]}
-        1 {set l [_cos2 $integer $precision $delta]}
-        2 {set sign 1;set l [_sin2 $integer $precision $delta]}
-        3 {set sign 1;set l [_cos2 $integer $precision $delta]}
-        default {error "internal error"}
-    }
-    # $l is a list : {Mantissa Precision Delta}
-    # precision --> the opposite of the exponent
-    # 1.000 = 1000*10^-3 so exponent=-3 and precision=3 digits
-    lset l 1 [expr {-([lindex $l 1])}]
-    # the sign depends on the switch statement below
-    #::math::bignum::setsign integer $sign
-    if {$sign} {
-        lset l 0 [expr {-[lindex $l 0]}]
-    }
-    # we insert the Bigfloat tag (F) and normalize the final result
-    return [normalize [linsert $l 0 F]]
-}
-
-proc ::math::bigfloat::_sin2 {x precision delta} {
-    set pi [_pi $precision]
-    # shift right by 1 = divide by 2
-    # shift right by 2 = divide by 4
-    set pis2 [expr {$pi>>1}]
-    set pis4 [expr {$pis2>>1}]
-    if {$x>=$pis4} {
-        # sin(Pi/2-x)=cos(x)
-        incr delta
-        set x [expr {$pis2-$x}]
-        return [_cos $x $precision $delta]
-    }
-    return [_sin $x $precision $delta]
-}
-
-################################################################################
-# sin(x) with 'x' lower than Pi/4 and positive
-# 'x' is the Mantissa - 'delta' is Delta
-# 'precision' is the opposite of the exponent
-################################################################################
-proc ::math::bigfloat::_sin {x precision delta} {
-    # $s holds the result
-    set s $x
-    # sin(x) = x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)!
-    #        = x * (1 - x^2/(2*3) * (1 - x^2/(4*5) * (...* (1 - x^2/(2n*(2n+1)) )...)))
-    # The second expression allows us to compute the less we can
-    
-    # $double holds the uncertainty (Delta) of x^2 : 2*(Mantissa*Delta) + Delta^2
-    # (Mantissa+Delta)^2=Mantissa^2 + 2*Mantissa*Delta + Delta^2
-    set double [expr {$x*$delta>>$precision-1}]
-    incr double [expr {1+$delta*$delta>>$precision}]
-    # $x holds the Mantissa of x^2
-    set x [expr {$x*$x>>$precision}]
-    set dt [expr {$x*$delta+$double*($s+$delta)>>$precision}]
-    incr dt
-    # $t holds $s * -(x^2) / (2n*(2n+1))
-    # mul by x^2
-    set t [expr {$s*$x>>$precision}]
-    set denom2 2
-    set denom3 3
-    # mul by -1 (opp) and divide by 2*3
-    set t [expr {-$t/($denom2*$denom3)}]
-    while {$t!=0} {
-        incr s $t
-        incr delta $dt
-        # incr n => 2n --> 2n+2 and 2n+1 --> 2n+3
-        incr denom2 2
-        incr denom3 2
-        # $dt is the Delta corresponding to $t
-        # $double ""     ""    ""     ""    $x (x^2)
-        # ($t+$dt) * ($x+$double) = $t*$x + ($dt*$x + $t*$double) + $dt*$double
-        #                   Mantissa^        ^--------Delta-------------------^
-        set dt [expr {$x*$dt+($t+$dt)*$double>>$precision}]
-        set t [expr {$t*$x>>$precision}]
-        # removed 2005/08/31 by sarnold75
-        #set dt [::math::bignum::add $dt $double]
-        set denom [expr {$denom2*$denom3}]
-        # now computing : div by -2n(2n+1)
-        set dt [expr {1+$dt/$denom}]
-        set t [expr {-$t/$denom}]
-    }
-    return [list $s $precision $delta]
-}
-
-
-################################################################################
-# procedure for extracting the square root of a BigFloat
-################################################################################
-proc ::math::bigfloat::sqrt {x} {
-    checkFloat $x
-    foreach {dummy integer exp delta} $x {break}
-    # if x=0, return 0
-    if {[iszero $x]} {
-        # return zero, taking care of its precision ($exp)
-        return [list F 0 $exp $delta]
-    }
-    # we cannot get sqrt(x) if x<0
-    if {[lindex $integer 0]<0} {
-        error "negative sqrt input"
-    }
-    # (1+epsilon)^p = 1 + epsilon*(p-1) + epsilon^2*(p-1)*(p-2)/2! + ...
-    #                   + epsilon^n*(p-1)*...*(p-n)/n!
-    # sqrt(1 + epsilon) = (1 + epsilon)^(1/2)
-    #                   = 1 - epsilon/2 - epsilon^2*3/(4*2!) - ...
-    #                       - epsilon^n*(3*5*..*(2n-1))/(2^n*n!)
-    # sqrt(1 - epsilon) = 1 + Sum(i=1..infinity) epsilon^i*(3*5*...*(2i-1))/(i!*2^i)
-    # sqrt(n +/- delta)=sqrt(n) * sqrt(1 +/- delta/n)
-    # so the uncertainty on sqrt(n +/- delta) equals sqrt(n) * (sqrt(1 - delta/n) - 1)
-    #         sqrt(1+eps) < sqrt(1-eps) because their logarithm compare as :
-    #       -ln(2)(1+eps) < -ln(2)(1-eps)
-    # finally :
-    # Delta = sqrt(n) * Sum(i=1..infinity) (delta/n)^i*(3*5*...*(2i-1))/(i!*2^i)
-    # here we compute the second term of the product by _sqrtOnePlusEpsilon
-    set delta [_sqrtOnePlusEpsilon $delta $integer]
-    set intLen [bits $integer]
-    # removed 2005/08/31 by sarnold75, readded 2005/08/31
-    set precision $intLen
-    # intLen + exp = number of bits before the dot
-    #set precision [expr {-$exp}]
-    # square root extraction
-    set integer [expr {$integer<<$intLen}]
-    incr exp -$intLen
-    incr intLen $intLen
-    # there is an exponent 2^$exp : when $exp is odd, we would need to compute sqrt(2)
-    # so we decrement $exp, in order to get it even, and we do not need sqrt(2) anymore !
-    if {$exp&1} {
-        incr exp -1
-        set integer [expr {$integer<<1}]
-        incr intLen
-        incr precision
-    }
-    # using a low-level (taken from math::bignum) root extraction procedure
-    # using binary operators
-    set integer [_sqrt $integer]
-    # delta has to be multiplied by the square root
-    set delta [expr {$delta*$integer>>$precision}]
-    # round to the ceiling the uncertainty (worst precision, the fastest to compute)
-    incr delta
-    # we are sure that $exp is even, see above
-    return [normalize [list F $integer [expr {$exp/2}] $delta]]
-}
-
-
-
-################################################################################
-# compute abs(sqrt(1-delta/integer)-1)
-# the returned value is a relative uncertainty
-################################################################################
-proc ::math::bigfloat::_sqrtOnePlusEpsilon {delta integer} {
-    # sqrt(1-x) - 1 = x/2 + x^2*3/(2^2*2!) + x^3*3*5/(2^3*3!) + ...
-    #               = x/2 * (1 + x*3/(2*2) * ( 1 + x*5/(2*3) *
-    #                     (...* (1 + x*(2n-1)/(2n) ) )...)))
-    set l [bits $integer]
-    # to compute delta/integer we have to shift left to keep the same precision level
-    # we have a better accuracy computing (delta << lg(integer))/integer
-    # than computing (delta/integer) << lg(integer)
-    set x [expr {($delta<<$l)/$integer}]
-    # denom holds 2n
-    set denom 4
-    # x/2
-    set result [expr {$x>>1}]
-    # x^2*3/(2!*2^2)
-    # numerator holds 2n-1
-    set numerator 3
-    set temp [expr {($result*$delta*$numerator)/($integer*$denom)}]
-    incr temp
-    while {$temp!=0} {
-        incr result $temp
-        incr numerator 2
-        incr denom 2
-        # n = n+1 ==> num=num+2 denom=denom+2
-        # num=2n+1 denom=2n+2
-        set temp [expr {($temp*$delta*$numerator)/($integer*$denom)}]
-    }
-    return $result
-}
-
-#
-# Computes the square root of an integer
-# Returns an integer
-#
-proc ::math::bigfloat::_sqrt {n} {
-    set i [expr {(([bits $n]-1)/2)+1}]
-    set b [expr {$i*2}] ; # Bit to set to get 2^i*2^i
-    
-    set r 0 ; # guess
-    set x 0 ; # guess^2
-    set s 0 ; # guess^2 backup
-    set t 0 ; # intermediate result
-    for {} {$i >= 0} {incr i -1; incr b -2} {
-        set x [expr {$s+($t|(1<<$b))}]
-        if {abs($x)<= abs($n)} {
-            set s $x
-            set r [expr {$r|(1<<$i)}]
-            set t [expr {$t|(1<<$b+1)}]
-        }
-        set t [expr {$t>>1}]
-    }
-    return $r
-}
-
-################################################################################
-# substracts B to A
-################################################################################
-proc ::math::bigfloat::sub {a b} {
-    checkNumber $a
-    checkNumber $b
-    if {[isInt $a] && [isInt $b]} {
-        # the math::bignum::sub proc is designed to work with BigInts
-        return [expr {$a-$b}]
-    }
-    return [add $a [opp $b]]
-}
-
-################################################################################
-# tangent (trivial algorithm)
-################################################################################
-proc ::math::bigfloat::tan {x} {
-    return [::math::bigfloat::div [::math::bigfloat::sin $x] [::math::bigfloat::cos $x]]
-}
-
-################################################################################
-# returns a power of ten
-################################################################################
-proc ::math::bigfloat::tenPow {n} {
-    return [expr {10**$n}]
-}
-
-
-################################################################################
-# converts a BigInt to a double (basic floating-point type)
-# with respect to the global variable 'tcl_precision'
-################################################################################
-proc ::math::bigfloat::todouble {x} {
-    global tcl_precision
-    set precision $tcl_precision
-    if {$precision==0} {
-        # this is a cheat, I must admit, for Tcl 8.5
-        set precision 16
-    }
-    checkFloat $x
-    # get the string repr of x without the '+' sign
-    # please note: here we call math::bigfloat::tostr
-    set result [string trimleft [tostr $x] +]
-    set minus ""
-    if {[string index $result 0]=="-"} {
-        set minus -
-        set result [string range $result 1 end]
-    }
-    
-    set l [split $result e]
-    set exp 0
-    if {[llength $l]==2} {
-        # exp : x=Mantissa*2^Exp
-        set exp [lindex $l 1]
-    }
-    # caution with octal numbers : we have to remove heading zeros
-    # but count them as digits
-    regexp {^0*} $result zeros
-    incr exp -[string length $zeros]
-    # Mantissa = integerPart.fractionalPart
-    set l [split [lindex $l 0] .]
-    set integerPart [lindex $l 0]
-    set integerLen [string length $integerPart]
-    set fractionalPart [lindex $l 1]
-    # The number of digits in Mantissa, excluding the dot and the leading zeros, of course
-    set integer [string trimleft $integerPart$fractionalPart 0]
-    if {$integer==""} {
-        set integer 0
-    }
-    set len [string length $integer]
-    # Now Mantissa is stored in $integer
-    if {$len>$tcl_precision} {
-        set lenDiff [expr {$len-$tcl_precision}]
-        # true when the number begins with a zero
-        set zeroHead 0
-        if {[string index $integer 0]==0} {
-            incr lenDiff -1
-            set zeroHead 1
-        }
-        set integer [roundshift $integer $lenDiff]
-        if {$zeroHead} {
-            set integer 0$integer
-        }
-        set len [string length $integer]
-        if {$len<$integerLen} {
-            set exp [expr {$integerLen-$len}]
-            # restore the true length
-            set integerLen $len
-        }
-    }
-    # number = 'sign'*'integer'*10^'exp'
-    if {$exp==0} {
-        # no scientific notation
-        set exp ""
-    } else {
-        # scientific notation
-        set exp e$exp
-    }
-    # place the dot just before the index $integerLen in the Mantissa
-    set result [string range $integer 0 [expr {$integerLen-1}]]
-    append result .[string range $integer $integerLen end]
-    # join the Mantissa with the sign before and the exponent after
-    return $minus$result$exp
-}
-
-################################################################################
-# converts a number stored as a list to a string in which all digits are true
-################################################################################
-proc ::math::bigfloat::tostr {number} {
-    if {[isInt $number]} {
-        return $number
-    }
-    checkFloat $number
-    foreach {dummy integer exp delta} $number {break}
-    if {[iszero $number]} {
-        # we do matter how much precision $number has :
-        # it can be 0.0000000 or 0.0, the result is not the same zero
-        #return 0
-    }
-    if {$exp>0} {
-        # the power of ten the closest but greater than 2^$exp
-        # if it was lower than the power of 2, we would have more precision
-        # than existing in the number
-        set newExp [expr {int(ceil($exp*log(2)/log(10)))}]
-        # 'integer' <- 'integer' * 2^exp / 10^newExp
-        # equals 'integer' * 2^(exp-newExp) / 5^newExp
-        set binExp [expr {$exp-$newExp}]
-        if {$binExp<0} {
-            # it cannot happen
-            error "internal error"
-        }
-        # 5^newExp
-        set fivePower [expr {5**$newExp}]
-        # 'lshift'ing $integer by $binExp bits is like multiplying it by 2^$binExp
-        # but much, much faster
-        set integer [expr {($integer<<$binExp)/$fivePower}]
-        # $integer is the Mantissa - Delta should follow the same operations
-        set delta [expr {($delta<<$binExp)/$fivePower}]
-        set exp $newExp
-    } elseif {$exp<0} {
-        # the power of ten the closest but lower than 2^$exp
-        # same remark about the precision
-        set newExp [expr {int(floor(-$exp*log(2)/log(10)))}]
-        # 'integer' <- 'integer' * 10^newExp / 2^(-exp)
-        # equals 'integer' * 5^(newExp) / 2^(-exp-newExp)
-        set binShift [expr {-$exp-$newExp}]
-        set fivePower [expr {5**$newExp}]
-        # rshifting is like dividing by 2^$binShift, but faster as we said above about lshift
-        set integer [expr {$integer*$fivePower>>$binShift}]
-        set delta [expr {$delta*$fivePower>>$binShift}]
-        set exp -$newExp
-    }
-    # saving the sign, to restore it into the result
-    set result [expr {abs($integer)}]
-    set sign [expr {$integer<0}]
-    # rounded 'integer' +/- 'delta'
-    set up [expr {$result+$delta}]
-    set down [expr {$result-$delta}]
-    if {($up<0 && $down>0)||($up>0 && $down<0)} {
-        # $up>0 and $down<0 or vice-versa : then the number is considered equal to zero
-        set isZero yes
-	# delta <= 2**n (n = bits(delta))
-	# 2**n  <= 10**exp , then 
-	# exp >= n.log(2)/log(10)
-	# delta <= 10**(n.log(2)/log(10))
-        incr exp [expr {int(ceil([bits $delta]*log(2)/log(10)))}]
-        set result 0
-    } else {
-	# iterate until the convergence of the rounding
-	# we incr $shift until $up and $down are rounded to the same number
-	# at each pass we lose one digit of precision, so necessarly it will success
-	for {set shift 1} {
-	    [roundshift $up $shift]!=[roundshift $down $shift]
-	} {
-	    incr shift
-	} {}
-	incr exp $shift
-	set result [roundshift $up $shift]
-	set isZero no
-    }
-    set l [string length $result]
-    # now formatting the number the most nicely for having a clear reading
-    # would'nt we allow a number being constantly displayed
-    # as : 0.2947497845e+012 , would we ?
-    if {$exp>0} {
-        # we display 423*10^6 as : 4.23e+8
-        # Length of mantissa : $l
-        # Increment exp by $l-1 because the first digit is placed before the dot,
-        # the other ($l-1) digits following the dot.
-        incr exp [incr l -1]
-        set result [string index $result 0].[string range $result 1 end]
-        append result "e+$exp"
-    } elseif {$exp==0} {
-        # it must have a dot to be a floating-point number (syntaxically speaking)
-        append result .
-    } else {
-        set exp [expr {-$exp}]
-        if {$exp < $l} {
-            # we can display the number nicely as xxxx.yyyy*
-            # the problem of the sign is solved finally at the bottom of the proc
-            set n [string range $result 0 end-$exp]
-            incr exp -1
-            append n .[string range $result end-$exp end]
-            set result $n
-        } elseif {$l==$exp} {
-            # we avoid to use the scientific notation
-            # because it is harder to read
-            set result "0.$result"
-        } else  {
-            # ... but here there is no choice, we should not represent a number
-            # with more than one leading zero
-            set result [string index $result 0].[string range $result 1 end]e-[expr {$exp-$l+1}]
-        }
-    }
-    # restore the sign : we only put a minus on numbers that are different from zero
-    if {$sign==1 && !$isZero} {set result "-$result"}
-    return $result
-}
-
-################################################################################
-# PART IV
-# HYPERBOLIC FUNCTIONS
-################################################################################
-
-################################################################################
-# hyperbolic cosinus
-################################################################################
-proc ::math::bigfloat::cosh {x} {
-    # cosh(x) = (exp(x)+exp(-x))/2
-    # dividing by 2 is done faster by 'rshift'ing
-    return [floatRShift [add [exp $x] [exp [opp $x]]] 1]
-}
-
-################################################################################
-# hyperbolic sinus
-################################################################################
-proc ::math::bigfloat::sinh {x} {
-    # sinh(x) = (exp(x)-exp(-x))/2
-    # dividing by 2 is done faster by 'rshift'ing
-    return [floatRShift [sub [exp $x] [exp [opp $x]]] 1]
-}
-
-################################################################################
-# hyperbolic tangent
-################################################################################
-proc ::math::bigfloat::tanh {x} {
-    set up [exp $x]
-    set down [exp [opp $x]]
-    # tanh(x)=sinh(x)/cosh(x)= (exp(x)-exp(-x))/2/ [(exp(x)+exp(-x))/2]
-    #        =(exp(x)-exp(-x))/(exp(x)+exp(-x))
-    #        =($up-$down)/($up+$down)
-    return [div [sub $up $down] [add $up $down]]
-}
-
-# exporting public interface
-namespace eval ::math::bigfloat {
-    foreach function {
-        add mul sub div mod pow
-        iszero compare equal
-        fromstr tostr fromdouble todouble
-        int2float isInt isFloat
-        exp log sqrt round ceil floor
-        sin cos tan cotan asin acos atan
-        cosh sinh tanh abs opp
-        pi deg2rad rad2deg
-    } {
-        namespace export $function
-    }
-}
-
-# (AM) No "namespace import" - this should be left to the user!
-#namespace import ::math::bigfloat::*
-
-package provide math::bigfloat 2.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/bignum.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/bignum.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,900 +1,0 @@
-# bignum library in pure Tcl [VERSION 7Sep2004]
-# Copyright (C) 2004 Salvatore Sanfilippo <antirez at invece dot org>
-# Copyright (C) 2004 Arjen Markus <arjen dot markus at wldelft dot nl>
-#
-# LICENSE
-#
-# This software is:
-# Copyright (C) 2004 Salvatore Sanfilippo <antirez at invece dot org>
-# Copyright (C) 2004 Arjen Markus <arjen dot markus at wldelft dot nl>
-# The following terms apply to all files associated with the software
-# unless explicitly disclaimed in individual files.
-#
-# The authors hereby grant permission to use, copy, modify, distribute,
-# and license this software and its documentation for any purpose, provided
-# that existing copyright notices are retained in all copies and that this
-# notice is included verbatim in any distributions. No written agreement,
-# license, or royalty fee is required for any of the authorized uses.
-# Modifications to this software may be copyrighted by their authors
-# and need not follow the licensing terms described here, provided that
-# the new terms are clearly indicated on the first page of each file where
-# they apply.
-#
-# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
-# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-# MODIFICATIONS.
-#
-# GOVERNMENT USE: If you are acquiring this software on behalf of the
-# U.S. government, the Government shall have only "Restricted Rights"
-# in the software and related documentation as defined in the Federal
-# Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
-# are acquiring the software on behalf of the Department of Defense, the
-# software shall be classified as "Commercial Computer Software" and the
-# Government shall have only "Restricted Rights" as defined in Clause
-# 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
-# authors grant the U.S. Government and others acting in its behalf
-# permission to use and distribute the software in accordance with the
-# terms specified in this license.
-
-# TODO
-# - pow and powm should check if the exponent is zero in order to return one
-
-package require Tcl 8.4
-
-namespace eval ::math::bignum {}
-
-#################################### Misc ######################################
-
-# Don't change atombits define if you don't know what you are doing.
-# Note that it must be a power of two, and that 16 is too big
-# because expr may overflow in the product of two 16 bit numbers.
-set ::math::bignum::atombits 16
-set ::math::bignum::atombase [expr {1 << $::math::bignum::atombits}]
-set ::math::bignum::atommask [expr {$::math::bignum::atombase-1}]
-
-# Note: to change 'atombits' is all you need to change the
-# library internal representation base.
-
-# Return the max between a and b (not bignums)
-proc ::math::bignum::max {a b} {
-    expr {($a > $b) ? $a : $b}
-}
-
-# Return the min between a and b (not bignums)
-proc ::math::bignum::min {a b} {
-    expr {($a < $b) ? $a : $b}
-}
-
-############################ Basic bignum operations ###########################
-
-# Returns a new bignum initialized to the value of 0.
-#
-# The big numbers are represented as a Tcl lists
-# The all-is-a-string representation does not pay here
-# bignums in Tcl are already slow, we can't slow-down it more.
-#
-# The bignum representation is [list bignum <sign> <atom0> ... <atomN>]
-# Where the atom0 is the least significant. Atoms are the digits
-# of a number in base 2^$::math::bignum::atombits
-#
-# The sign is 0 if the number is positive, 1 for negative numbers.
-
-# Note that the function accepts an argument used in order to
-# create a bignum of <atoms> atoms. For default zero is
-# represented as a single zero atom.
-#
-# The function is designed so that "set b [zero [atoms $a]]" will
-# produce 'b' with the same number of atoms as 'a'.
-proc ::math::bignum::zero {{value 0}} {
-    set v [list bignum 0 0]
-    while { $value > 1 } {
-       lappend v 0
-       incr value -1
-    }
-    return $v
-}
-
-# Get the bignum sign
-proc ::math::bignum::sign bignum {
-    lindex $bignum 1
-}
-
-# Get the number of atoms in the bignum
-proc ::math::bignum::atoms bignum {
-    expr {[llength $bignum]-2}
-}
-
-# Get the i-th atom out of a bignum.
-# If the bignum is shorter than i atoms, the function
-# returns 0.
-proc ::math::bignum::atom {bignum i} {
-    if {[::math::bignum::atoms $bignum] < [expr {$i+1}]} {
-	return 0
-    } else {
-	lindex $bignum [expr {$i+2}]
-    }
-}
-
-# Set the i-th atom out of a bignum. If the bignum
-# has less than 'i+1' atoms, add zero atoms to reach i.
-proc ::math::bignum::setatom {bignumvar i atomval} {
-    upvar 1 $bignumvar bignum
-    while {[::math::bignum::atoms $bignum] < [expr {$i+1}]} {
-	lappend bignum 0
-    }
-    lset bignum [expr {$i+2}] $atomval
-}
-
-# Set the bignum sign
-proc ::math::bignum::setsign {bignumvar sign} {
-    upvar 1 $bignumvar bignum
-    lset bignum 1 $sign
-}
-
-# Remove trailing atoms with a value of zero
-# The normalized bignum is returned
-proc ::math::bignum::normalize bignumvar {
-    upvar 1 $bignumvar bignum
-    set atoms [expr {[llength $bignum]-2}]
-    set i [expr {$atoms+1}]
-    while {$atoms && [lindex $bignum $i] == 0} {
-	set bignum [lrange $bignum 0 end-1]
-	incr atoms -1
-	incr i -1
-    }
-    if {!$atoms} {
-	set bignum [list bignum 0 0]
-    }
-    return $bignum
-}
-
-# Return the absolute value of N
-proc ::math::bignum::abs n {
-    ::math::bignum::setsign n 0
-    return $n
-}
-
-################################# Comparison ###################################
-
-# Compare by absolute value. Called by ::math::bignum::cmp after the sign check.
-#
-# Returns 1 if |a| > |b|
-#         0 if a == b
-#        -1 if |a| < |b|
-#
-proc ::math::bignum::abscmp {a b} {
-    if {[llength $a] > [llength $b]} {
-	return 1
-    } elseif {[llength $a] < [llength $b]} {
-	return -1
-    }
-    set j [expr {[llength $a]-1}]
-    while {$j >= 2} {
-	if {[lindex $a $j] > [lindex $b $j]} {
-	    return 1
-	} elseif {[lindex $a $j] < [lindex $b $j]} {
-	    return -1
-	}
-	incr j -1
-    }
-    return 0
-}
-
-# High level comparison. Return values:
-#
-#  1 if a > b
-# -1 if a < b
-#  0 if a == b
-#
-proc ::math::bignum::cmp {a b} { ; # same sign case
-    set a [_treat $a]
-    set b [_treat $b]
-    if {[::math::bignum::sign $a] == [::math::bignum::sign $b]} {
-	if {[::math::bignum::sign $a] == 0} {
-	    ::math::bignum::abscmp $a $b
-	} else {
-	    expr {-([::math::bignum::abscmp $a $b])}
-	}
-    } else { ; # different sign case
-	if {[::math::bignum::sign $a]} {return -1}
-	return 1
-    }
-}
-
-# Return true if 'z' is zero.
-proc ::math::bignum::iszero z {
-    set z [_treat $z]
-    expr {[llength $z] == 3 && [lindex $z 2] == 0}
-}
-
-# Comparison facilities
-proc ::math::bignum::lt {a b} {expr {[::math::bignum::cmp $a $b] < 0}}
-proc ::math::bignum::le {a b} {expr {[::math::bignum::cmp $a $b] <= 0}}
-proc ::math::bignum::gt {a b} {expr {[::math::bignum::cmp $a $b] > 0}}
-proc ::math::bignum::ge {a b} {expr {[::math::bignum::cmp $a $b] >= 0}}
-proc ::math::bignum::eq {a b} {expr {[::math::bignum::cmp $a $b] == 0}}
-proc ::math::bignum::ne {a b} {expr {[::math::bignum::cmp $a $b] != 0}}
-
-########################### Addition / Subtraction #############################
-
-# Add two bignums, don't care about the sign.
-proc ::math::bignum::rawAdd {a b} {
-    while {[llength $a] < [llength $b]} {lappend a 0}
-    while {[llength $b] < [llength $a]} {lappend b 0}
-    set r [::math::bignum::zero [expr {[llength $a]-1}]]
-    set car 0
-    for {set i 2} {$i < [llength $a]} {incr i} {
-	set sum [expr {[lindex $a $i]+[lindex $b $i]+$car}]
-	set car [expr {$sum >> $::math::bignum::atombits}]
-	set sum [expr {$sum & $::math::bignum::atommask}]
-	lset r $i $sum
-    }
-    if {$car} {
-	lset r $i $car
-    }
-    ::math::bignum::normalize r
-}
-
-# Subtract two bignums, don't care about the sign. a > b condition needed.
-proc ::math::bignum::rawSub {a b} {
-    set atoms [::math::bignum::atoms $a]
-    set r [::math::bignum::zero $atoms]
-    while {[llength $b] < [llength $a]} {lappend b 0} ; # b padding
-    set car 0
-    incr atoms 2
-    for {set i 2} {$i < $atoms} {incr i} {
-	set sub [expr {[lindex $a $i]-[lindex $b $i]-$car}]
-	set car 0
-	if {$sub < 0} {
-	    incr sub $::math::bignum::atombase
-	    set car 1
-	}
-	lset r $i $sub
-    }
-    # Note that if a > b there is no car in the last for iteration
-    ::math::bignum::normalize r
-}
-
-# Higher level addition, care about sign and call rawAdd or rawSub
-# as needed.
-proc ::math::bignum::add {a b} {
-    set a [_treat $a]
-    set b [_treat $b]
-    # Same sign case
-    if {[::math::bignum::sign $a] == [::math::bignum::sign $b]} {
-	set r [::math::bignum::rawAdd $a $b]
-	::math::bignum::setsign r [::math::bignum::sign $a]
-    } else {
-	# Different sign case
-	set cmp [::math::bignum::abscmp $a $b]
-	# 's' is the sign, set accordingly to A or B negative
-	set s [expr {[::math::bignum::sign $a] == 1}]
-	switch -- $cmp {
-	    0 {return [::math::bignum::zero]}
-	    1 {
-		set r [::math::bignum::rawSub $a $b]
-		::math::bignum::setsign r $s
-		return $r
-	    }
-	    -1 {
-		set r [::math::bignum::rawSub $b $a]
-		::math::bignum::setsign r [expr {!$s}]
-		return $r
-	    }
-	}
-    }
-    return $r
-}
-
-# Higher level subtraction, care about sign and call rawAdd or rawSub
-# as needed.
-proc ::math::bignum::sub {a b} {
-    set a [_treat $a]
-    set b [_treat $b]
-    # Different sign case
-    if {[::math::bignum::sign $a] != [::math::bignum::sign $b]} {
-	set r [::math::bignum::rawAdd $a $b]
-	::math::bignum::setsign r [::math::bignum::sign $a]
-    } else {
-	# Same sign case
-	set cmp [::math::bignum::abscmp $a $b]
-	# 's' is the sign, set accordingly to A and B both negative or positive
-	set s [expr {[::math::bignum::sign $a] == 1}]
-	switch -- $cmp {
-	    0 {return [::math::bignum::zero]}
-	    1 {
-		set r [::math::bignum::rawSub $a $b]
-		::math::bignum::setsign r $s
-		return $r
-	    }
-	    -1 {
-		set r [::math::bignum::rawSub $b $a]
-		::math::bignum::setsign r [expr {!$s}]
-		return $r
-	    }
-	}
-    }
-    return $r
-}
-
-############################### Multiplication #################################
-
-set ::math::bignum::karatsubaThreshold 32
-
-# Multiplication. Calls Karatsuba that calls Base multiplication under
-# a given threshold.
-proc ::math::bignum::mul {a b} {
-    set a [_treat $a]
-    set b [_treat $b]
-    set r [::math::bignum::kmul $a $b]
-    # The sign is the xor between the two signs
-    ::math::bignum::setsign r [expr {[::math::bignum::sign $a]^[::math::bignum::sign $b]}]
-}
-
-# Karatsuba Multiplication
-proc ::math::bignum::kmul {a b} {
-    set n [expr {[::math::bignum::max [llength $a] [llength $b]]-2}]
-    set nmin [expr {[::math::bignum::min [llength $a] [llength $b]]-2}]
-    if {$nmin < $::math::bignum::karatsubaThreshold} {return [::math::bignum::bmul $a $b]}
-    set m [expr {($n+($n&1))/2}]
-
-    set x0 [concat [list bignum 0] [lrange $a 2 [expr {$m+1}]]]
-    set y0 [concat [list bignum 0] [lrange $b 2 [expr {$m+1}]]]
-    set x1 [concat [list bignum 0] [lrange $a [expr {$m+2}] end]]
-    set y1 [concat [list bignum 0] [lrange $b [expr {$m+2}] end]]
-
-    if {0} {
-    puts "m: $m"
-    puts "x0: $x0"
-    puts "x1: $x1"
-    puts "y0: $y0"
-    puts "y1: $y1"
-    }
-
-    set p1 [::math::bignum::kmul $x1 $y1]
-    set p2 [::math::bignum::kmul $x0 $y0]
-    set p3 [::math::bignum::kmul [::math::bignum::add $x1 $x0] [::math::bignum::add $y1 $y0]]
-
-    set p3 [::math::bignum::sub $p3 $p1]
-    set p3 [::math::bignum::sub $p3 $p2]
-    set p1 [::math::bignum::lshiftAtoms $p1 [expr {$m*2}]]
-    set p3 [::math::bignum::lshiftAtoms $p3 $m]
-    set p3 [::math::bignum::add $p3 $p1]
-    set p3 [::math::bignum::add $p3 $p2]
-    return $p3
-}
-
-# Base Multiplication.
-proc ::math::bignum::bmul {a b} {
-    set r [::math::bignum::zero [expr {[llength $a]+[llength $b]-3}]]
-    for {set j 2} {$j < [llength $b]} {incr j} {
-	set car 0
-	set t [list bignum 0 0]
-	for {set i 2} {$i < [llength $a]} {incr i} {
-	    # note that A = B * C + D + E
-	    # with A of N*2 bits and C,D,E of N bits
-	    # can't overflow since:
-	    # (2^N-1)*(2^N-1)+(2^N-1)+(2^N-1) == 2^(2*N)-1
-	    set t0 [lindex $a $i]
-	    set t1 [lindex $b $j]
-	    set t2 [lindex $r [expr {$i+$j-2}]]
-	    set mul [expr {wide($t0)*$t1+$t2+$car}]
-	    set car [expr {$mul >> $::math::bignum::atombits}]
-	    set mul [expr {$mul & $::math::bignum::atommask}]
-	    lset r [expr {$i+$j-2}] $mul
-	}
-	if {$car} {
-	    lset r [expr {$i+$j-2}] $car
-	}
-    }
-    ::math::bignum::normalize r
-}
-
-################################## Shifting ####################################
-
-# Left shift 'z' of 'n' atoms. Low-level function used by ::math::bignum::lshift
-# Exploit the internal representation to go faster.
-proc ::math::bignum::lshiftAtoms {z n} {
-    while {$n} {
-	set z [linsert $z 2 0]
-	incr n -1
-    }
-    return $z
-}
-
-# Right shift 'z' of 'n' atoms. Low-level function used by ::math::bignum::lshift
-# Exploit the internal representation to go faster.
-proc ::math::bignum::rshiftAtoms {z n} {
-    set z [lreplace $z 2 [expr {$n+1}]]
-}
-
-# Left shift 'z' of 'n' bits. Low-level function used by ::math::bignum::lshift.
-# 'n' must be <= $::math::bignum::atombits
-proc ::math::bignum::lshiftBits {z n} {
-    set atoms [llength $z]
-    set car 0
-    for {set j 2} {$j < $atoms} {incr j} {
-	set t [lindex $z $j]
-	lset z $j \
-	    [expr {wide($car)|((wide($t)<<$n)&$::math::bignum::atommask)}]
-	set car [expr {wide($t)>>($::math::bignum::atombits-$n)}]
-    }
-    if {$car} {
-	lappend z 0
-	lset z $j $car
-    }
-    return $z ; # No normalization needed
-}
-
-# Right shift 'z' of 'n' bits. Low-level function used by ::math::bignum::rshift.
-# 'n' must be <= $::math::bignum::atombits
-proc ::math::bignum::rshiftBits {z n} {
-    set atoms [llength $z]
-    set car 0
-    for {set j [expr {$atoms-1}]} {$j >= 2} {incr j -1} {
-	set t [lindex $z $j]
-	lset z $j [expr {wide($car)|(wide($t)>>$n)}]
-	set car \
-	    [expr {(wide($t)<<($::math::bignum::atombits-$n))&$::math::bignum::atommask}]
-    }
-    ::math::bignum::normalize z
-}
-
-# Left shift 'z' of 'n' bits.
-proc ::math::bignum::lshift {z n} {
-    set z [_treat $z]
-    set atoms [expr {$n / $::math::bignum::atombits}]
-    set bits [expr {$n & ($::math::bignum::atombits-1)}]
-    ::math::bignum::lshiftBits [math::bignum::lshiftAtoms $z $atoms] $bits
-}
-
-# Right shift 'z' of 'n' bits.
-proc ::math::bignum::rshift {z n} {
-    set z [_treat $z]
-    set atoms [expr {$n / $::math::bignum::atombits}]
-    set bits [expr {$n & ($::math::bignum::atombits-1)}]
-
-    #
-    # Correct for "arithmetic shift" - signed integers
-    #
-    set corr 0
-    if { [::math::bignum::sign $z] == 1 } {
-        for {set j [expr {$atoms+1}]} {$j >= 2} {incr j -1} {
-            set t [lindex $z $j]
-            if { $t != 0 } {
-                set corr 1
-            }
-        }
-        if { $corr == 0 } {
-            set t [lindex $z [expr {$atoms+2}]]
-            if { ( $t & ~($::math::bignum::atommask<<($bits)) ) != 0 } {
-                set corr 1
-            }
-        }
-    }
-
-    set newz [::math::bignum::rshiftBits [math::bignum::rshiftAtoms $z $atoms] $bits]
-    if { $corr } {
-        set newz [::math::bignum::sub $newz 1]
-    }
-    return $newz
-}
-
-############################## Bit oriented ops ################################
-
-# Set the bit 'n' of 'bignumvar'
-proc ::math::bignum::setbit {bignumvar n} {
-    upvar 1 $bignumvar z
-    set atom [expr {$n / $::math::bignum::atombits}]
-    set bit [expr {1 << ($n & ($::math::bignum::atombits-1))}]
-    incr atom 2
-    while {$atom >= [llength $z]} {lappend z 0}
-    lset z $atom [expr {[lindex $z $atom]|$bit}]
-}
-
-# Clear the bit 'n' of 'bignumvar'
-proc ::math::bignum::clearbit {bignumvar n} {
-    upvar 1 $bignumvar z
-    set atom [expr {$n / $::math::bignum::atombits}]
-    incr atom 2
-    if {$atom >= [llength $z]} {return $z}
-    set mask [expr {$::math::bignum::atommask^(1 << ($n & ($::math::bignum::atombits-1)))}]
-    lset z $atom [expr {[lindex $z $atom]&$mask}]
-    ::math::bignum::normalize z
-}
-
-# Test the bit 'n' of 'z'. Returns true if the bit is set.
-proc ::math::bignum::testbit {z n} {
-    set  atom [expr {$n / $::math::bignum::atombits}]
-    incr atom 2
-    if {$atom >= [llength $z]} {return 0}
-    set mask [expr {1 << ($n & ($::math::bignum::atombits-1))}]
-    expr {([lindex $z $atom] & $mask) != 0}
-}
-
-# does bitwise and between a and b
-proc ::math::bignum::bitand {a b} {
-    # The internal number rep is little endian. Appending zeros is
-    # equivalent to adding leading zeros to a regular big-endian
-    # representation. The two numbers are extended to the same length,
-    # then the operation is applied to the absolute value.
-    set a [_treat $a]
-    set b [_treat $b]
-    while {[llength $a] < [llength $b]} {lappend a 0}
-    while {[llength $b] < [llength $a]} {lappend b 0}
-    set r [::math::bignum::zero [expr {[llength $a]-1}]]
-    for {set i 2} {$i < [llength $a]} {incr i} {
-	set or [expr {[lindex $a $i] & [lindex $b $i]}]
-	lset r $i $or
-    }
-    ::math::bignum::normalize r
-}
-
-# does bitwise XOR between a and b
-proc ::math::bignum::bitxor {a b} {
-    # The internal number rep is little endian. Appending zeros is
-    # equivalent to adding leading zeros to a regular big-endian
-    # representation. The two numbers are extended to the same length,
-    # then the operation is applied to the absolute value.
-    set a [_treat $a]
-    set b [_treat $b]
-    while {[llength $a] < [llength $b]} {lappend a 0}
-    while {[llength $b] < [llength $a]} {lappend b 0}
-    set r [::math::bignum::zero [expr {[llength $a]-1}]]
-    for {set i 2} {$i < [llength $a]} {incr i} {
-	set or [expr {[lindex $a $i] ^ [lindex $b $i]}]
-	lset r $i $or
-    }
-    ::math::bignum::normalize r
-}
-
-# does bitwise or between a and b
-proc ::math::bignum::bitor {a b} {
-    # The internal number rep is little endian. Appending zeros is
-    # equivalent to adding leading zeros to a regular big-endian
-    # representation. The two numbers are extended to the same length,
-    # then the operation is applied to the absolute value.
-    set a [_treat $a]
-    set b [_treat $b]
-    while {[llength $a] < [llength $b]} {lappend a 0}
-    while {[llength $b] < [llength $a]} {lappend b 0}
-    set r [::math::bignum::zero [expr {[llength $a]-1}]]
-    for {set i 2} {$i < [llength $a]} {incr i} {
-	set or [expr {[lindex $a $i] | [lindex $b $i]}]
-	lset r $i $or
-    }
-    ::math::bignum::normalize r
-}
-
-# Return the number of bits needed to represent 'z'.
-proc ::math::bignum::bits z {
-    set atoms [::math::bignum::atoms $z]
-    set bits [expr {($atoms-1)*$::math::bignum::atombits}]
-    set atom [lindex $z [expr {$atoms+1}]]
-    while {$atom} {
-	incr bits
-	set atom [expr {$atom >> 1}]
-    }
-    return $bits
-}
-
-################################## Division ####################################
-
-# Division. Returns [list n/d n%d]
-#
-# I got this algorithm from PGP 2.6.3i (see the mp_udiv function).
-# Here is how it works:
-#
-# Input:  N=(Nn,...,N2,N1,N0)radix2
-#         D=(Dn,...,D2,D1,D0)radix2
-# Output: Q=(Qn,...,Q2,Q1,Q0)radix2 = N/D
-#         R=(Rn,...,R2,R1,R0)radix2 = N%D
-#
-# Assume: N >= 0, D > 0
-#
-# For j from 0 to n
-#      Qj <- 0
-#      Rj <- 0
-# For j from n down to 0
-#      R <- R*2
-#      if Nj = 1 then R0 <- 1
-#      if R => D then R <- (R - D), Qn <- 1
-#
-# Note that the doubling of R is usually done leftshifting one position.
-# The only operations needed are bit testing, bit setting and subtraction.
-#
-# This is the "raw" version, don't care about the sign, returns both
-# quotient and rest as a two element list.
-# This procedure is used by divqr, div, mod, rem.
-proc ::math::bignum::rawDiv {n d} {
-    set bit [expr {[::math::bignum::bits $n]-1}]
-    set r [list bignum 0 0]
-    set q [::math::bignum::zero [expr {[llength $n]-2}]]
-    while {$bit >= 0} {
-	set b_atom [expr {($bit / $::math::bignum::atombits) + 2}]
-	set b_bit [expr {1 << ($bit & ($::math::bignum::atombits-1))}]
-	set r [::math::bignum::lshiftBits $r 1]
-	if {[lindex $n $b_atom]&$b_bit} {
-	    lset r 2 [expr {[lindex $r 2] | 1}]
-	}
-	if {[::math::bignum::abscmp $r $d] >= 0} {
-	    set r [::math::bignum::rawSub $r $d]
-	    lset q $b_atom [expr {[lindex $q $b_atom]|$b_bit}]
-	}
-	incr bit -1
-    }
-    ::math::bignum::normalize q
-    list $q $r
-}
-
-# Divide by single-atom immediate. Used to speedup bignum -> string conversion.
-# The procedure returns a two-elements list with the bignum quotient and
-# the remainder (that's just a number being <= of the max atom value).
-proc ::math::bignum::rawDivByAtom {n d} {
-    set atoms [::math::bignum::atoms $n]
-    set t 0
-    set j $atoms
-    incr j -1
-    for {} {$j >= 0} {incr j -1} {
-	set t [expr {($t << $::math::bignum::atombits)+[lindex $n [expr {$j+2}]]}]
-	lset n [expr {$j+2}] [expr {$t/$d}]
-	set t [expr {$t % $d}]
-    }
-    ::math::bignum::normalize n
-    list $n $t
-}
-
-# Higher level division. Returns a list with two bignums, the first
-# is the quotient of n/d, the second the remainder n%d.
-# Note that if you want the *modulo* operator you should use ::math::bignum::mod
-#
-# The remainder sign is always the same as the divident.
-proc ::math::bignum::divqr {n d} {
-    set n [_treat $n]
-    set d [_treat $d]
-    if {[::math::bignum::iszero $d]} {
-	error "Division by zero"
-    }
-    foreach {q r} [::math::bignum::rawDiv $n $d] break
-    ::math::bignum::setsign q [expr {[::math::bignum::sign $n]^[::math::bignum::sign $d]}]
-    ::math::bignum::setsign r [::math::bignum::sign $n]
-    list $q $r
-}
-
-# Like divqr, but only the quotient is returned.
-proc ::math::bignum::div {n d} {
-    lindex [::math::bignum::divqr $n $d] 0
-}
-
-# Like divqr, but only the remainder is returned.
-proc ::math::bignum::rem {n d} {
-    lindex [::math::bignum::divqr $n $d] 1
-}
-
-# Modular reduction. Returns N modulo M
-proc ::math::bignum::mod {n m} {
-    set n [_treat $n]
-    set m [_treat $m]
-    set r [lindex [::math::bignum::divqr $n $m] 1]
-    if {[::math::bignum::sign $m] != [::math::bignum::sign $r]} {
-	set r [::math::bignum::add $r $m]
-    }
-    return $r
-}
-
-# Returns true if n is odd
-proc ::math::bignum::isodd n {
-    expr {[lindex $n 2]&1}
-}
-
-# Returns true if n is even
-proc ::math::bignum::iseven n {
-    expr {!([lindex $n 2]&1)}
-}
-
-############################# Power and Power mod N ############################
-
-# Returns b^e
-proc ::math::bignum::pow {b e} {
-    set b [_treat $b]
-    set e [_treat $e]
-    if {[::math::bignum::iszero $e]} {return [list bignum 0 1]}
-    # The power is negative is the base is negative and the exponent is odd
-    set sign [expr {[::math::bignum::sign $b] && [::math::bignum::isodd $e]}]
-    # Set the base to it's abs value, i.e. make it positive
-    ::math::bignum::setsign b 0
-    # Main loop
-    set r [list bignum 0 1]; # Start with result = 1
-    while {[::math::bignum::abscmp $e [list bignum 0 1]] > 0} { ;# While the exp > 1
-	if {[::math::bignum::isodd $e]} {
-	    set r [::math::bignum::mul $r $b]
-	}
-	set e [::math::bignum::rshiftBits $e 1] ;# exp = exp / 2
-	set b [::math::bignum::mul $b $b]
-    }
-    set r [::math::bignum::mul $r $b]
-    ::math::bignum::setsign r $sign
-    return $r
-}
-
-# Returns b^e mod m
-proc ::math::bignum::powm {b e m} {
-    set b [_treat $b]
-    set e [_treat $e]
-    set m [_treat $m]
-    if {[::math::bignum::iszero $e]} {return [list bignum 0 1]}
-    # The power is negative is the base is negative and the exponent is odd
-    set sign [expr {[::math::bignum::sign $b] && [::math::bignum::isodd $e]}]
-    # Set the base to it's abs value, i.e. make it positive
-    ::math::bignum::setsign b 0
-    # Main loop
-    set r [list bignum 0 1]; # Start with result = 1
-    while {[::math::bignum::abscmp $e [list bignum 0 1]] > 0} { ;# While the exp > 1
-	if {[::math::bignum::isodd $e]} {
-	    set r [::math::bignum::mod [::math::bignum::mul $r $b] $m]
-	}
-	set e [::math::bignum::rshiftBits $e 1] ;# exp = exp / 2
-	set b [::math::bignum::mod [::math::bignum::mul $b $b] $m]
-    }
-    set r [::math::bignum::mul $r $b]
-    ::math::bignum::setsign r $sign
-    set r [::math::bignum::mod $r $m]
-    return $r
-}
-
-################################## Square Root #################################
-
-# SQRT using the 'binary sqrt algorithm'.
-#
-# The basic algoritm consists in starting from the higer-bit
-# the real square root may have set, down to the bit zero,
-# trying to set every bit and checking if guess*guess is not
-# greater than 'n'. If it is greater we don't set the bit, otherwise
-# we set it. In order to avoid to compute guess*guess a trick
-# is used, so only addition and shifting are really required.
-proc ::math::bignum::sqrt n {
-    if {[lindex $n 1]} {
-	error "Square root of a negative number"
-    }
-    set i [expr {(([::math::bignum::bits $n]-1)/2)+1}]
-    set b [expr {$i*2}] ; # Bit to set to get 2^i*2^i
-
-    set r [::math::bignum::zero] ; # guess
-    set x [::math::bignum::zero] ; # guess^2
-    set s [::math::bignum::zero] ; # guess^2 backup
-    set t [::math::bignum::zero] ; # intermediate result
-    for {} {$i >= 0} {incr i -1; incr b -2} {
-	::math::bignum::setbit t $b
-	set x [::math::bignum::rawAdd $s $t]
-	::math::bignum::clearbit t $b
-	if {[::math::bignum::abscmp $x $n] <= 0} {
-	    set s $x
-	    ::math::bignum::setbit r $i
-	    ::math::bignum::setbit t [expr {$b+1}]
-	}
-	set t [::math::bignum::rshiftBits $t 1]
-    }
-    return $r
-}
-
-################################## Random Number ###############################
-
-# Returns a random number in the range [0,2^n-1]
-proc ::math::bignum::rand bits {
-    set atoms [expr {($bits+$::math::bignum::atombits-1)/$::math::bignum::atombits}]
-    set shift [expr {($atoms*$::math::bignum::atombits)-$bits}]
-    set r [list bignum 0]
-    while {$atoms} {
-	lappend r [expr {int(rand()*(1<<$::math::bignum::atombits))}]
-	incr atoms -1
-    }
-    set r [::math::bignum::rshiftBits $r $shift]
-    return $r
-}
-
-############################ Convertion to/from string #########################
-
-# The string representation charset. Max base is 36
-set ::math::bignum::cset "0123456789abcdefghijklmnopqrstuvwxyz"
-
-# Convert 'z' to a string representation in base 'base'.
-# Note that this is missing a simple but very effective optimization
-# that's to divide by the biggest power of the base that fits
-# in a Tcl plain integer, and then to perform divisions with [expr].
-proc ::math::bignum::tostr {z {base 10}} {
-    if {[string length $::math::bignum::cset] < $base} {
-	error "base too big for string convertion"
-    }
-    if {[::math::bignum::iszero $z]} {return 0}
-    set sign [::math::bignum::sign $z]
-    set str {}
-    while {![::math::bignum::iszero $z]} {
-	foreach {q r} [::math::bignum::rawDivByAtom $z $base] break
-	append str [string index $::math::bignum::cset $r]
-	set z $q
-    }
-    if {$sign} {append str -}
-    # flip the resulting string
-    set flipstr {}
-    set i [string length $str]
-    incr i -1
-    while {$i >= 0} {
-	append flipstr [string index $str $i]
-	incr i -1
-    }
-    return $flipstr
-}
-
-# Create a bignum from a string representation in base 'base'.
-proc ::math::bignum::fromstr {str {base 0}} {
-    set z [::math::bignum::zero]
-    set str [string trim $str]
-    set sign 0
-    if {[string index $str 0] eq {-}} {
-	set str [string range $str 1 end]
-	set sign 1
-    }
-    if {$base == 0} {
-	switch -- [string tolower [string range $str 0 1]] {
-	    0x {set base 16; set str [string range $str 2 end]}
-	    ox {set base 8 ; set str [string range $str 2 end]}
-	    bx {set base 2 ; set str [string range $str 2 end]}
-	    default {set base 10}
-	}
-    }
-    if {[string length $::math::bignum::cset] < $base} {
-	error "base too big for string convertion"
-    }
-    set bigbase [list bignum 0 $base] ; # Build a bignum with the base value
-    set basepow [list bignum 0 1] ; # multiply every digit for a succ. power
-    set i [string length $str]
-    incr i -1
-    while {$i >= 0} {
-	set digitval [string first [string index $str $i] $::math::bignum::cset]
-	if {$digitval == -1} {
-	    error "Illegal char '[string index $str $i]' for base $base"
-	}
-	set bigdigitval [list bignum 0 $digitval]
-	set z [::math::bignum::rawAdd $z [::math::bignum::mul $basepow $bigdigitval]]
-	set basepow [::math::bignum::mul $basepow $bigbase]
-	incr i -1
-    }
-    if {![::math::bignum::iszero $z]} {
-	::math::bignum::setsign z $sign
-    }
-    return $z
-}
-
-#
-# Pre-treatment of some constants : 0 and 1
-# Updated 19/11/2005 : abandon the 'upvar' command and its cost
-#
-proc ::math::bignum::_treat {num} {
-    if {[llength $num]<2} {
-        if {[string equal $num 0]} {
-            # set to the bignum 0
-            return {bignum 0 0}
-        } elseif {[string equal $num 1]} {
-            # set to the bignum 1
-            return {bignum 0 1}
-        }
-    }
-    return $num
-}
-
-namespace eval ::math::bignum {
-    namespace export *
-}
-
-# Announce the package
-
-package provide math::bignum 3.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/calculus.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/calculus.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1447 +1,0 @@
-# calculus.tcl --
-#    Package that implements several basic numerical methods, such
-#    as the integration of a one-dimensional function and the
-#    solution of a system of first-order differential equations.
-#
-# Copyright (c) 2002, 2003, 2004, 2006 by Arjen Markus.
-# Copyright (c) 2004 by Kevin B. Kenny.  All rights reserved.
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: calculus.tcl,v 1.13 2006/03/28 20:36:00 arjenmarkus Exp $
-
-package require Tcl 8.4
-package require math::interpolate
-package provide math::calculus 0.7
-
-# math::calculus --
-#    Namespace for the commands
-
-namespace eval ::math::calculus {
-
-    namespace import ::math::interpolate::neville
-
-    namespace import ::math::expectDouble ::math::expectInteger
-
-    namespace export \
-	integral integralExpr integral2D integral3D \
-	eulerStep heunStep rungeKuttaStep           \
-	boundaryValueSecondOrder solveTriDiagonal   \
-	newtonRaphson newtonRaphsonParameters
-    namespace export \
-        integral2D_2accurate integral3D_accurate
-
-    namespace export romberg romberg_infinity
-    namespace export romberg_sqrtSingLower romberg_sqrtSingUpper
-    namespace export romberg_powerLawLower romberg_powerLawUpper
-    namespace export romberg_expLower romberg_expUpper
-
-    namespace export regula_falsi
-
-    variable nr_maxiter    20
-    variable nr_tolerance   0.001
-
-}
-
-# integral --
-#    Integrate a function over a given interval using the Simpson rule
-#
-# Arguments:
-#    begin       Start of the interval
-#    end         End of the interval
-#    nosteps     Number of steps in which to divide the interval
-#    func        Name of the function to be integrated (takes one
-#                argument)
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integral { begin end nosteps func } {
-
-   set delta    [expr {($end-$begin)/double($nosteps)}]
-   set hdelta   [expr {$delta/2.0}]
-   set result   0.0
-   set xval     $begin
-   set func_end [uplevel 1 $func $xval]
-   for { set i 1 } { $i <= $nosteps } { incr i } {
-      set func_begin  $func_end
-      set func_middle [uplevel 1 $func [expr {$xval+$hdelta}]]
-      set func_end    [uplevel 1 $func [expr {$xval+$delta}]]
-      set result      [expr  {$result+$func_begin+4.0*$func_middle+$func_end}]
-
-      set xval        [expr {$begin+double($i)*$delta}]
-   }
-
-   return [expr {$result*$delta/6.0}]
-}
-
-# integralExpr --
-#    Integrate an expression with "x" as the integrate according to the
-#    Simpson rule
-#
-# Arguments:
-#    begin       Start of the interval
-#    end         End of the interval
-#    nosteps     Number of steps in which to divide the interval
-#    expression  Expression with "x" as the integrate
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integralExpr { begin end nosteps expression } {
-
-   set delta    [expr {($end-$begin)/double($nosteps)}]
-   set hdelta   [expr {$delta/2.0}]
-   set result   0.0
-   set x        $begin
-   # FRINK: nocheck
-   set func_end [expr $expression]
-   for { set i 1 } { $i <= $nosteps } { incr i } {
-      set func_begin  $func_end
-      set x           [expr {$x+$hdelta}]
-       # FRINK: nocheck
-      set func_middle [expr $expression]
-      set x           [expr {$x+$hdelta}]
-       # FRINK: nocheck
-      set func_end    [expr $expression]
-      set result      [expr {$result+$func_begin+4.0*$func_middle+$func_end}]
-
-      set x           [expr {$begin+double($i)*$delta}]
-   }
-
-   return [expr {$result*$delta/6.0}]
-}
-
-# integral2D --
-#    Integrate a given fucntion of two variables over a block,
-#    using bilinear interpolation (for this moment: block function)
-#
-# Arguments:
-#    xinterval   Start, stop and number of steps of the "x" interval
-#    yinterval   Start, stop and number of steps of the "y" interval
-#    func        Function of the two variables to be integrated
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integral2D { xinterval yinterval func } {
-
-   foreach { xbegin xend xnumber } $xinterval { break }
-   foreach { ybegin yend ynumber } $yinterval { break }
-
-   set xdelta    [expr {($xend-$xbegin)/double($xnumber)}]
-   set ydelta    [expr {($yend-$ybegin)/double($ynumber)}]
-   set hxdelta   [expr {$xdelta/2.0}]
-   set hydelta   [expr {$ydelta/2.0}]
-   set result   0.0
-   set dxdy      [expr {$xdelta*$ydelta}]
-   for { set j 0 } { $j < $ynumber } { incr j } {
-      set y [expr {$ybegin+$hydelta+double($j)*$ydelta}]
-      for { set i 0 } { $i < $xnumber } { incr i } {
-         set x           [expr {$xbegin+$hxdelta+double($i)*$xdelta}]
-         set func_value  [uplevel 1 $func $x $y]
-         set result      [expr {$result+$func_value}]
-      }
-   }
-
-   return [expr {$result*$dxdy}]
-}
-
-# integral3D --
-#    Integrate a given fucntion of two variables over a block,
-#    using trilinear interpolation (for this moment: block function)
-#
-# Arguments:
-#    xinterval   Start, stop and number of steps of the "x" interval
-#    yinterval   Start, stop and number of steps of the "y" interval
-#    zinterval   Start, stop and number of steps of the "z" interval
-#    func        Function of the three variables to be integrated
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integral3D { xinterval yinterval zinterval func } {
-
-   foreach { xbegin xend xnumber } $xinterval { break }
-   foreach { ybegin yend ynumber } $yinterval { break }
-   foreach { zbegin zend znumber } $zinterval { break }
-
-   set xdelta    [expr {($xend-$xbegin)/double($xnumber)}]
-   set ydelta    [expr {($yend-$ybegin)/double($ynumber)}]
-   set zdelta    [expr {($zend-$zbegin)/double($znumber)}]
-   set hxdelta   [expr {$xdelta/2.0}]
-   set hydelta   [expr {$ydelta/2.0}]
-   set hzdelta   [expr {$zdelta/2.0}]
-   set result   0.0
-   set dxdydz    [expr {$xdelta*$ydelta*$zdelta}]
-   for { set k 0 } { $k < $znumber } { incr k } {
-      set z [expr {$zbegin+$hzdelta+double($k)*$zdelta}]
-      for { set j 0 } { $j < $ynumber } { incr j } {
-         set y [expr {$ybegin+$hydelta+double($j)*$ydelta}]
-         for { set i 0 } { $i < $xnumber } { incr i } {
-            set x           [expr {$xbegin+$hxdelta+double($i)*$xdelta}]
-            set func_value  [uplevel 1 $func $x $y $z]
-            set result      [expr {$result+$func_value}]
-         }
-      }
-   }
-
-   return [expr {$result*$dxdydz}]
-}
-
-# integral2D_accurate --
-#    Integrate a given function of two variables over a block,
-#    using a four-point quadrature formula
-#
-# Arguments:
-#    xinterval   Start, stop and number of steps of the "x" interval
-#    yinterval   Start, stop and number of steps of the "y" interval
-#    func        Function of the two variables to be integrated
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integral2D_accurate { xinterval yinterval func } {
-
-    foreach { xbegin xend xnumber } $xinterval { break }
-    foreach { ybegin yend ynumber } $yinterval { break }
-
-    set alpha     [expr {sqrt(2.0/3.0)}]
-    set minalpha  [expr {-$alpha}]
-    set dpoints   [list $alpha 0.0 $minalpha 0.0 0.0 $alpha 0.0 $minalpha]
-
-    set xdelta    [expr {($xend-$xbegin)/double($xnumber)}]
-    set ydelta    [expr {($yend-$ybegin)/double($ynumber)}]
-    set hxdelta   [expr {$xdelta/2.0}]
-    set hydelta   [expr {$ydelta/2.0}]
-    set result   0.0
-    set dxdy      [expr {0.25*$xdelta*$ydelta}]
-
-    for { set j 0 } { $j < $ynumber } { incr j } {
-        set y [expr {$ybegin+$hydelta+double($j)*$ydelta}]
-        for { set i 0 } { $i < $xnumber } { incr i } {
-            set x [expr {$xbegin+$hxdelta+double($i)*$xdelta}]
-
-            foreach {dx dy} $dpoints {
-                set x1          [expr {$x+$dx}]
-                set y1          [expr {$y+$dy}]
-                set func_value  [uplevel 1 $func $x1 $y1]
-                set result      [expr {$result+$func_value}]
-            }
-        }
-    }
-
-    return [expr {$result*$dxdy}]
-}
-
-# integral3D_accurate --
-#    Integrate a given function of three variables over a block,
-#    using an 8-point quadrature formula
-#
-# Arguments:
-#    xinterval   Start, stop and number of steps of the "x" interval
-#    yinterval   Start, stop and number of steps of the "y" interval
-#    zinterval   Start, stop and number of steps of the "z" interval
-#    func        Function of the three variables to be integrated
-# Return value:
-#    Computed integral
-#
-proc ::math::calculus::integral3D_accurate { xinterval yinterval zinterval func } {
-
-    foreach { xbegin xend xnumber } $xinterval { break }
-    foreach { ybegin yend ynumber } $yinterval { break }
-    foreach { zbegin zend znumber } $zinterval { break }
-
-    set alpha     [expr {sqrt(1.0/3.0)}]
-    set minalpha  [expr {-$alpha}]
-
-    set dpoints   [list $alpha    $alpha    $alpha    \
-                        $alpha    $alpha    $minalpha \
-                        $alpha    $minalpha $alpha    \
-                        $alpha    $minalpha $minalpha \
-                        $minalpha $alpha    $alpha    \
-                        $minalpha $alpha    $minalpha \
-                        $minalpha $minalpha $alpha    \
-                        $minalpha $minalpha $minalpha ]
-
-    set xdelta    [expr {($xend-$xbegin)/double($xnumber)}]
-    set ydelta    [expr {($yend-$ybegin)/double($ynumber)}]
-    set zdelta    [expr {($zend-$zbegin)/double($znumber)}]
-    set hxdelta   [expr {$xdelta/2.0}]
-    set hydelta   [expr {$ydelta/2.0}]
-    set hzdelta   [expr {$zdelta/2.0}]
-    set result    0.0
-    set dxdydz    [expr {0.125*$xdelta*$ydelta*$zdelta}]
-
-    for { set k 0 } { $k < $znumber } { incr k } {
-        set z [expr {$zbegin+$hzdelta+double($k)*$zdelta}]
-        for { set j 0 } { $j < $ynumber } { incr j } {
-            set y [expr {$ybegin+$hydelta+double($j)*$ydelta}]
-            for { set i 0 } { $i < $xnumber } { incr i } {
-                set x [expr {$xbegin+$hxdelta+double($i)*$xdelta}]
-
-                foreach {dx dy dz} $dpoints {
-                    set x1 [expr {$x+$dx}]
-                    set y1 [expr {$y+$dy}]
-                    set z1 [expr {$z+$dz}]
-                    set func_value  [uplevel 1 $func $x1 $y1 $z1]
-                    set result      [expr {$result+$func_value}]
-                }
-            }
-        }
-    }
-
-    return [expr {$result*$dxdydz}]
-}
-
-# eulerStep --
-#    Integrate a system of ordinary differential equations of the type
-#    x' = f(x,t), where x is a vector of quantities. Integration is
-#    done over a single step according to Euler's method.
-#
-# Arguments:
-#    t           Start value of independent variable (time for instance)
-#    tstep       Step size of interval
-#    xvec        Vector of dependent values at the start
-#    func        Function taking the arguments t and xvec to return
-#                the derivative of each dependent variable.
-# Return value:
-#    List of values at the end of the step
-#
-proc ::math::calculus::eulerStep { t tstep xvec func } {
-
-   set xderiv   [uplevel 1 $func $t [list $xvec]]
-   set result   {}
-   foreach xv $xvec dx $xderiv {
-      set xnew [expr {$xv+$tstep*$dx}]
-      lappend result $xnew
-   }
-
-   return $result
-}
-
-# heunStep --
-#    Integrate a system of ordinary differential equations of the type
-#    x' = f(x,t), where x is a vector of quantities. Integration is
-#    done over a single step according to Heun's method.
-#
-# Arguments:
-#    t           Start value of independent variable (time for instance)
-#    tstep       Step size of interval
-#    xvec        Vector of dependent values at the start
-#    func        Function taking the arguments t and xvec to return
-#                the derivative of each dependent variable.
-# Return value:
-#    List of values at the end of the step
-#
-proc ::math::calculus::heunStep { t tstep xvec func } {
-
-   #
-   # Predictor step
-   #
-   set funcq    [uplevel 1 namespace which -command $func]
-   set xpred    [eulerStep $t $tstep $xvec $funcq]
-
-   #
-   # Corrector step
-   #
-   set tcorr    [expr {$t+$tstep}]
-   set xcorr    [eulerStep $t     $tstep $xpred $funcq]
-
-   set result   {}
-   foreach xv $xvec xc $xcorr {
-      set xnew [expr {0.5*($xv+$xc)}]
-      lappend result $xnew
-   }
-
-   return $result
-}
-
-# rungeKuttaStep --
-#    Integrate a system of ordinary differential equations of the type
-#    x' = f(x,t), where x is a vector of quantities. Integration is
-#    done over a single step according to Runge-Kutta 4th order.
-#
-# Arguments:
-#    t           Start value of independent variable (time for instance)
-#    tstep       Step size of interval
-#    xvec        Vector of dependent values at the start
-#    func        Function taking the arguments t and xvec to return
-#                the derivative of each dependent variable.
-# Return value:
-#    List of values at the end of the step
-#
-proc ::math::calculus::rungeKuttaStep { t tstep xvec func } {
-
-   set funcq    [uplevel 1 namespace which -command $func]
-
-   #
-   # Four steps:
-   # - k1 = tstep*func(t,x0)
-   # - k2 = tstep*func(t+0.5*tstep,x0+0.5*k1)
-   # - k3 = tstep*func(t+0.5*tstep,x0+0.5*k2)
-   # - k4 = tstep*func(t+    tstep,x0+    k3)
-   # - x1 = x0 + (k1+2*k2+2*k3+k4)/6
-   #
-   set tstep2   [expr {$tstep/2.0}]
-   set tstep6   [expr {$tstep/6.0}]
-
-   set xk1      [$funcq $t $xvec]
-   set xvec2    {}
-   foreach x1 $xvec xv $xk1 {
-      lappend xvec2 [expr {$x1+$tstep2*$xv}]
-   }
-   set xk2      [$funcq [expr {$t+$tstep2}] $xvec2]
-
-   set xvec3    {}
-   foreach x1 $xvec xv $xk2 {
-      lappend xvec3 [expr {$x1+$tstep2*$xv}]
-   }
-   set xk3      [$funcq [expr {$t+$tstep2}] $xvec3]
-
-   set xvec4    {}
-   foreach x1 $xvec xv $xk3 {
-      lappend xvec4 [expr {$x1+$tstep*$xv}]
-   }
-   set xk4      [$funcq [expr {$t+$tstep}] $xvec4]
-
-   set result   {}
-   foreach x0 $xvec k1 $xk1 k2 $xk2 k3 $xk3 k4 $xk4 {
-      set dx [expr {$k1+2.0*$k2+2.0*$k3+$k4}]
-      lappend result [expr {$x0+$dx*$tstep6}]
-   }
-
-   return $result
-}
-
-# boundaryValueSecondOrder --
-#    Integrate a second-order differential equation and solve for
-#    given boundary values.
-#
-#    The equation is (see the documentation):
-#       d       dy   d
-#       -- A(x) -- + -- B(x) y + C(x) y = D(x)
-#       dx      dx   dx
-#
-#    The procedure uses finite differences and tridiagonal matrices to
-#    solve the equation. The boundary values are put in the matrix
-#    directly.
-#
-# Arguments:
-#    coeff_func  Name of triple-valued function for coefficients A, B, C
-#    force_func  Name of the function providing the force term D(x)
-#    leftbnd     Left boundary condition (list of: xvalue, boundary
-#                value or keyword zero-flux, zero-derivative)
-#    rightbnd    Right boundary condition (ditto)
-#    nostep      Number of steps
-# Return value:
-#    List of x-values and calculated values (x1, y1, x2, y2, ...)
-#
-proc ::math::calculus::boundaryValueSecondOrder {
-   coeff_func force_func leftbnd rightbnd nostep } {
-
-   set coeffq    [uplevel 1 namespace which -command $coeff_func]
-   set forceq    [uplevel 1 namespace which -command $force_func]
-
-   if { [llength $leftbnd] != 2 || [llength $rightbnd] != 2 } {
-      error "Boundary condition(s) incorrect"
-   }
-   if { $nostep < 1 } {
-      error "Number of steps must be larger/equal 1"
-   }
-
-   #
-   # Set up the matrix, as three different lists and the
-   # righthand side as the fourth
-   #
-   set xleft  [lindex $leftbnd 0]
-   set xright [lindex $rightbnd 0]
-   set xstep  [expr {($xright-$xleft)/double($nostep)}]
-
-   set acoeff {}
-   set bcoeff {}
-   set ccoeff {}
-   set dvalue {}
-
-   set x $xleft
-   foreach {A B C} [$coeffq $x] { break }
-
-   set A1 [expr {$A/$xstep-0.5*$B}]
-   set B1 [expr {$A/$xstep+0.5*$B+0.5*$C*$xstep}]
-   set C1 0.0
-
-   for { set i 1 } { $i <= $nostep } { incr i } {
-      set x [expr {$xleft+double($i)*$xstep}]
-      if { [expr {abs($x)-0.5*abs($xstep)}] < 0.0 } {
-         set x 0.0
-      }
-      foreach {A B C} [$coeffq $x] { break }
-
-      set A2 0.0
-      set B2 [expr {$A/$xstep-0.5*$B+0.5*$C*$xstep}]
-      set C2 [expr {$A/$xstep+0.5*$B}]
-      lappend acoeff [expr {$A1+$A2}]
-      lappend bcoeff [expr {-$B1-$B2}]
-      lappend ccoeff [expr {$C1+$C2}]
-      set A1 [expr {$A/$xstep-0.5*$B}]
-      set B1 [expr {$A/$xstep+0.5*$B+0.5*$C*$xstep}]
-      set C1 0.0
-   }
-   set xvec {}
-   for { set i 0 } { $i < $nostep } { incr i } {
-      set x [expr {$xleft+(0.5+double($i))*$xstep}]
-      if { [expr {abs($x)-0.25*abs($xstep)}] < 0.0 } {
-         set x 0.0
-      }
-      lappend xvec   $x
-      lappend dvalue [expr {$xstep*[$forceq $x]}]
-   }
-
-   #
-   # Substitute the boundary values
-   #
-   set A  [lindex $acoeff 0]
-   set D  [lindex $dvalue 0]
-   set D1 [expr {$D-$A*[lindex $leftbnd 1]}]
-   set C  [lindex $ccoeff end]
-   set D  [lindex $dvalue end]
-   set D2 [expr {$D-$C*[lindex $rightbnd 1]}]
-   set dvalue [concat $D1 [lrange $dvalue 1 end-1] $D2]
-
-   set yvec [solveTriDiagonal $acoeff $bcoeff $ccoeff $dvalue]
-
-   foreach x $xvec y $yvec {
-      lappend result $x $y
-   }
-   return $result
-}
-
-# solveTriDiagonal --
-#    Solve a system of equations Ax = b where A is a tridiagonal matrix
-#
-# Arguments:
-#    acoeff      Values on lower diagonal
-#    bcoeff      Values on main diagonal
-#    ccoeff      Values on upper diagonal
-#    dvalue      Values on righthand side
-# Return value:
-#    List of values forming the solution
-#
-proc ::math::calculus::solveTriDiagonal { acoeff bcoeff ccoeff dvalue } {
-
-   set nostep [llength $acoeff]
-   #
-   # First step: Gauss-elimination
-   #
-   set B [lindex $bcoeff 0]
-   set C [lindex $ccoeff 0]
-   set D [lindex $dvalue 0]
-   set bcoeff2 [list $B]
-   set dvalue2 [list $D]
-   for { set i 1 } { $i < $nostep } { incr i } {
-      set A2    [lindex $acoeff $i]
-      set B2    [lindex $bcoeff $i]
-      set C2    [lindex $ccoeff $i]
-      set D2    [lindex $dvalue $i]
-      set ratab [expr {$A2/$B}]
-      set B2    [expr {$B2-$ratab*$C}]
-      set D2    [expr {$D2-$ratab*$D}]
-      lappend bcoeff2 $B2
-      lappend dvalue2 $D2
-      set B     $B2
-      set D     $D2
-   }
-
-   #
-   # Second step: substitution
-   #
-   set yvec {}
-   set B [lindex $bcoeff2 end]
-   set D [lindex $dvalue2 end]
-   set y [expr {$D/$B}]
-   for { set i [expr {$nostep-2}] } { $i >= 0 } { incr i -1 } {
-      set yvec  [concat $y $yvec]
-      set B     [lindex $bcoeff2 $i]
-      set C     [lindex $ccoeff  $i]
-      set D     [lindex $dvalue2 $i]
-      set y     [expr {($D-$C*$y)/$B}]
-   }
-   set yvec [concat $y $yvec]
-
-   return $yvec
-}
-
-# newtonRaphson --
-#    Determine the root of an equation via the Newton-Raphson method
-#
-# Arguments:
-#    func        Function (proc) in x
-#    deriv       Derivative (proc) of func w.r.t. x
-#    initval     Initial value for x
-# Return value:
-#    Estimate of root
-#
-proc ::math::calculus::newtonRaphson { func deriv initval } {
-   variable nr_maxiter
-   variable nr_tolerance
-
-   set funcq  [uplevel 1 namespace which -command $func]
-   set derivq [uplevel 1 namespace which -command $deriv]
-
-   set value $initval
-   set diff  [expr {10.0*$nr_tolerance}]
-
-   for { set i 0 } { $i < $nr_maxiter } { incr i } {
-      if { $diff < $nr_tolerance } {
-         break
-      }
-
-      set newval [expr {$value-[$funcq $value]/[$derivq $value]}]
-      if { $value != 0.0 } {
-         set diff   [expr {abs($newval-$value)/abs($value)}]
-      } else {
-         set diff   [expr {abs($newval-$value)}]
-      }
-      set value $newval
-   }
-
-   return $newval
-}
-
-# newtonRaphsonParameters --
-#    Set the parameters for the Newton-Raphson method
-#
-# Arguments:
-#    maxiter     Maximum number of iterations
-#    tolerance   Relative precisiion of the result
-# Return value:
-#    None
-#
-proc ::math::calculus::newtonRaphsonParameters { maxiter tolerance } {
-   variable nr_maxiter
-   variable nr_tolerance
-
-   if { $maxiter > 0 } {
-      set nr_maxiter $maxiter
-   }
-   if { $tolerance > 0 } {
-      set nr_tolerance $tolerance
-   }
-}
-
-#----------------------------------------------------------------------
-#
-# midpoint --
-#
-#	Perform one set of steps in evaluating an integral using the
-#	midpoint method.
-#
-# Usage:
-#	midpoint f a b s ?n?
-#
-# Parameters:
-#	f - function to integrate
-#	a - One limit of integration
-#	b - Other limit of integration.  a and b need not be in ascending
-#	    order.
-#	s - Value returned from a previous call to midpoint (see below)
-#	n - Step number (see below)
-#
-# Results:
-#	Returns an estimate of the integral obtained by dividing the
-#	interval into 3**n equal intervals and using the midpoint rule.
-#
-# Side effects:
-#	f is evaluated 2*3**(n-1) times and may have side effects.
-#
-# The 'midpoint' procedure is designed for successive approximations.
-# It should be called initially with n==0.  On this initial call, s
-# is ignored.  The function is evaluated at the midpoint of the interval, and
-# the value is multiplied by the width of the interval to give the
-# coarsest possible estimate of the integral.
-#
-# On each iteration except the first, n should be incremented by one,
-# and the previous value returned from [midpoint] should be supplied
-# as 's'.  The function will be evaluated at additional points
-# to give a total of 3**n equally spaced points, and the estimate
-# of the integral will be updated and returned
-#
-# Under normal circumstances, user code will not call this function
-# directly. Instead, it will use ::math::calculus::romberg to
-# do error control and extrapolation to a zero step size.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::midpoint { f a b { n 0 } { s 0. } } {
-
-    if { $n == 0 } {
-
-	# First iteration.  Simply evaluate the function at the midpoint
-	# of the interval.
-
-	set cmd $f; lappend cmd [expr { 0.5 * ( $a + $b ) }]; set v [eval $cmd]
-	return [expr { ( $b - $a ) * $v }]
-
-    } else {
-
-	# Subsequent iterations. We've divided the interval into
-	# $it subintervals.  Evaluate the function at the 1/3 and
-	# 2/3 points of each subinterval.  Then update the estimate
-	# of the integral that we produced on the last step with
-	# the new sum.
-
-	set it [expr { pow( 3, $n-1 ) }]
-	set h [expr { ( $b - $a ) / ( 3. * $it ) }]
-	set h2 [expr { $h + $h }]
-	set x [expr { $a + 0.5 * $h }]
-	set sum 0
-	for { set j 0 } { $j < $it } { incr j } {
-	    set cmd $f; lappend cmd $x; set y [eval $cmd]
-	    set sum [expr { $sum + $y }]
-	    set x [expr { $x + $h2 }]
-	    set cmd $f; lappend cmd $x; set y [eval $cmd]
-	    set sum [expr { $sum + $y }]
-	    set x [expr { $x + $h}]
-	}
-	return [expr { ( $s + ( $b - $a ) * $sum / $it ) / 3. }]
-
-    }
-}
-
-#----------------------------------------------------------------------
-#
-# romberg --
-#	
-#	Compute the integral of a function over an interval using
-#	Romberg's method.
-#
-# Usage:
-#	romberg f a b ?-option value?...
-#
-# Parameters:
-#	f - Function to integrate.  Must be a single Tcl command,
-#	    to which will be appended the abscissa at which the function
-#	    should be evaluated.  f should be analytic over the
-#	    region of integration, but may have a removable singularity
-#	    at either endpoint.
-#	a - One bound of the interval
-#	b - The other bound of the interval.  a and b need not be in
-#	    ascending order.
-#
-# Options:
-#	-abserror ABSERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-10.
-#	-relerror RELERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-6.
-#	-degree N
-#		Specifies the degree of the polynomial that will be
-#		used to extrapolate to a zero step size.  -degree 0
-#		requests integration with the midpoint rule; -degree 1
-#		is equivalent to Simpson's 3/8 rule; higher degrees
-#		are difficult to describe but (within reason) give
-#		faster convergence for smooth functions.  Default is
-#		-degree 4.
-#	-maxiter N
-#		Specifies the maximum number of triplings of the
-#		number of steps to take in integration.  At most
-#		3**N function evaluations will be performed in
-#		integrating with -maxiter N.  The integration
-#		will terminate at that time, even if the result
-#		satisfies neither the -relerror nor -abserror tests.
-#
-# Results:
-#	Returns a two-element list.  The first element is the estimated
-#	value of the integral; the second is the estimated absolute
-#	error of the value.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg { f a b args } {
-
-    # Replace f with a context-independent version
-
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-
-    # Assign default parameters
-
-    array set params {
-	-abserror 1.0e-10
-	-degree 4
-	-relerror 1.0e-6
-	-maxiter 14
-    }
-
-    # Extract parameters
-
-    if { ( [llength $args] % 2 ) != 0 } {
-        return -code error -errorcode [list romberg wrongNumArgs] \
-            "wrong \# args, should be\
-                 \"[lreplace [info level 0] 1 end \
-                         f x1 x2 ?-option value?...]\""
-    }
-    foreach { key value } $args {
-        if { ![info exists params($key)] } {
-            return -code error -errorcode [list romberg badoption $key] \
-                "unknown option \"$key\",\
-                     should be -abserror, -degree, -relerror, or -maxiter"
-        }
-        set params($key) $value
-    }
-
-    # Check params
-
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { ![string is double -strict $params(-abserror)] } {
-	return -code error [expectDouble $params(-abserror)]
-    }
-    if { ![string is integer -strict $params(-degree)] } {
-	return -code error [expectInteger $params(-degree)]
-    }
-    if { ![string is integer -strict $params(-maxiter)] } {
-	return -code error [expectInteger $params(-maxiter)]
-    }
-    if { ![string is double -strict $params(-relerror)] } {
-	return -code error [expectDouble $params(-relerror)]
-    }
-    foreach key {-abserror -degree -maxiter -relerror} {
-	if { $params($key) <= 0 } {
-	    return -code error -errorcode [list romberg notPositive $key] \
-		"$key must be positive"
-	}
-    }
-    if { $params(-maxiter) <= $params(-degree) } {
-	return -code error -errorcode [list romberg tooFewIter] \
-	    "-maxiter must be greater than -degree"
-    }
-
-    # Create lists of step size and sum with the given number of steps.
-
-    set x [list]
-    set y [list]
-    set s 0;				# Current best estimate of integral
-    set indx end-$params(-degree)
-    set pow3 1.;			# Current step size (times b-a)
-
-    # Perform successive integrations, tripling the number of steps each time
-
-    for { set i 0 } { $i < $params(-maxiter) } { incr i } {
-	set s [midpoint $f $a $b $i $s]
-	lappend x $pow3
-	lappend y $s
-	set pow3 [expr { $pow3 / 9. }]
-
-	# Once $degree steps have been done, start Richardson extrapolation
-	# to a zero step size.
-
-	if { $i >= $params(-degree) } {
-	    set x [lrange $x $indx end]
-	    set y [lrange $y $indx end]
-	    foreach {estimate err} [neville $x $y 0.] break
-	    if { $err < $params(-abserror)
-		 || $err < $params(-relerror) * abs($estimate) } {
-		return [list $estimate $err]
-	    }
-	}
-    }
-
-    # If -maxiter iterations have been done, give up, and return
-    # with the current error estimate.
-
-    return [list $estimate $err]
-}
-
-#----------------------------------------------------------------------
-#
-# u_infinity --
-#	Change of variable for integrating over a half-infinite
-#	interval
-#
-# Parameters:
-#	f - Function being integrated
-#	u - 1/x, where x is the abscissa where f is to be evaluated
-#
-# Results:
-#	Returns f(1/u)/(u**2)
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_infinity { f u } {
-    set cmd $f
-    lappend cmd [expr { 1.0 / $u }]
-    set y [eval $cmd]
-    return [expr { $y / ( $u * $u ) }]
-}
-
-#----------------------------------------------------------------------
-#
-# romberg_infinity --
-#	Evaluate a function on a half-open interval
-#
-# Usage:
-#	Same as 'romberg'
-#
-# The 'romberg_infinity' procedure performs Romberg integration on
-# an interval [a,b] where an infinite a or b may be represented by
-# a large number (e.g. 1.e30).  It operates by a change of variable;
-# instead of integrating f(x) from a to b, it makes a change
-# of variable u = 1/x, and integrates from 1/b to 1/a f(1/u)/u**2 du.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_infinity { f a b args } {
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a * $b <= 0. } {
-        return -code error -errorcode {romberg_infinity cross-axis} \
-            "limits of integration have opposite sign"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set f [list u_infinity $f]
-    return [eval [linsert $args 0 \
-                      romberg $f [expr { 1.0 / $b }] [expr { 1.0 / $a }]]]
-}
-
-#----------------------------------------------------------------------
-#
-# u_sqrtSingLower --
-#	Change of variable for integrating over an interval with
-#	an inverse square root singularity at the lower bound.
-#
-# Parameters:
-#	f - Function being integrated
-#	a - Lower bound
-#	u - sqrt(x-a), where x is the abscissa where f is to be evaluated
-#
-# Results:
-#	Returns 2 * u * f( a + u**2 )
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_sqrtSingLower { f a u } {
-    set cmd $f
-    lappend cmd [expr { $a + $u * $u }]
-    set y [eval $cmd]
-    return [expr { 2. * $u * $y }]
-}
-
-#----------------------------------------------------------------------
-#
-# u_sqrtSingUpper --
-#	Change of variable for integrating over an interval with
-#	an inverse square root singularity at the upper bound.
-#
-# Parameters:
-#	f - Function being integrated
-#	b - Upper bound
-#	u - sqrt(b-x), where x is the abscissa where f is to be evaluated
-#
-# Results:
-#	Returns 2 * u * f( b - u**2 )
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_sqrtSingUpper { f b u } {
-    set cmd $f
-    lappend cmd [expr { $b - $u * $u }]
-    set y [eval $cmd]
-    return [expr { 2. * $u * $y }]
-}
-
-#----------------------------------------------------------------------
-#
-# math::calculus::romberg_sqrtSingLower --
-#	Integrate a function with an inverse square root singularity
-#	at the lower bound
-#
-# Usage:
-#	Same as 'romberg'
-#
-# The 'romberg_sqrtSingLower' procedure is a wrapper for 'romberg'
-# for integrating a function with an inverse square root singularity
-# at the lower bound of the interval.  It works by making the change
-# of variable u = sqrt( x-a ).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_sqrtSingLower { f a b args } {
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set f [list u_sqrtSingLower $f $a]
-    return [eval [linsert $args 0 \
-			     romberg $f 0 [expr { sqrt( $b - $a ) }]]]
-}
-
-#----------------------------------------------------------------------
-#
-# math::calculus::romberg_sqrtSingUpper --
-#	Integrate a function with an inverse square root singularity
-#	at the upper bound
-#
-# Usage:
-#	Same as 'romberg'
-#
-# The 'romberg_sqrtSingUpper' procedure is a wrapper for 'romberg'
-# for integrating a function with an inverse square root singularity
-# at the upper bound of the interval.  It works by making the change
-# of variable u = sqrt( b-x ).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_sqrtSingUpper { f a b args } {
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set f [list u_sqrtSingUpper $f $b]
-    return [eval [linsert $args 0 \
-		      romberg $f 0. [expr { sqrt( $b - $a ) }]]]
-}
-
-#----------------------------------------------------------------------
-#
-# u_powerLawLower --
-#	Change of variable for integrating over an interval with
-#	an integrable power law singularity at the lower bound.
-#
-# Parameters:
-#	f - Function being integrated
-#	gammaover1mgamma - gamma / (1 - gamma), where gamma is the power
-#	oneover1mgamma - 1 / (1 - gamma), where gamma is the power
-#	a - Lower limit of integration
-#	u - Changed variable u == (x-a)**(1-gamma)
-#
-# Results:
-#	Returns u**(1/1-gamma) * f(a + u**(1/1-gamma) ).
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_powerLawLower { f gammaover1mgamma oneover1mgamma
-					 a u } {
-    set cmd $f
-    lappend cmd [expr { $a + pow( $u, $oneover1mgamma ) }]
-    set y [eval $cmd]
-    return [expr { $y * pow( $u, $gammaover1mgamma ) }]
-}
-
-#----------------------------------------------------------------------
-#
-# math::calculus::romberg_powerLawLower --
-#	Integrate a function with an integrable power law singularity
-#	at the lower bound
-#
-# Usage:
-#	romberg_powerLawLower gamma f a b ?-option value...?
-#
-# Parameters:
-#	gamma - Power (0<gamma<1) of the singularity
-#	f - Function to integrate.  Must be a single Tcl command,
-#	    to which will be appended the abscissa at which the function
-#	    should be evaluated.  f is expected to have an integrable
-#	    power law singularity at the lower endpoint; that is, the
-#	    integrand is expected to diverge as (x-a)**gamma.
-#	a - One bound of the interval
-#	b - The other bound of the interval.  a and b need not be in
-#	    ascending order.
-#
-# Options:
-#	-abserror ABSERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-10.
-#	-relerror RELERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-6.
-#	-degree N
-#		Specifies the degree of the polynomial that will be
-#		used to extrapolate to a zero step size.  -degree 0
-#		requests integration with the midpoint rule; -degree 1
-#		is equivalent to Simpson's 3/8 rule; higher degrees
-#		are difficult to describe but (within reason) give
-#		faster convergence for smooth functions.  Default is
-#		-degree 4.
-#	-maxiter N
-#		Specifies the maximum number of triplings of the
-#		number of steps to take in integration.  At most
-#		3**N function evaluations will be performed in
-#		integrating with -maxiter N.  The integration
-#		will terminate at that time, even if the result
-#		satisfies neither the -relerror nor -abserror tests.
-#
-# Results:
-#	Returns a two-element list.  The first element is the estimated
-#	value of the integral; the second is the estimated absolute
-#	error of the value.
-#
-# The 'romberg_sqrtSingLower' procedure is a wrapper for 'romberg'
-# for integrating a function with an integrable power law singularity
-# at the lower bound of the interval.  It works by making the change
-# of variable u = (x-a)**(1-gamma).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_powerLawLower { gamma f a b args } {
-    if { ![string is double -strict $gamma] } {
-	return -code error [expectDouble $gamma]
-    }
-    if { $gamma <= 0.0 || $gamma >= 1.0 } {
-	return -code error -errorcode [list romberg gammaTooBig] \
-	    "gamma must lie in the interval (0,1)"
-    }
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set onemgamma [expr { 1. - $gamma }]
-    set f [list u_powerLawLower $f \
-	       [expr { $gamma / $onemgamma }] \
-	       [expr { 1 / $onemgamma }] \
-	       $a]
-	
-    set limit [expr { pow( $b - $a, $onemgamma ) }]
-    set result {}
-    foreach v [eval [linsert $args 0 romberg $f 0 $limit]] {
-	lappend result [expr { $v / $onemgamma }]
-    }
-    return $result
-
-}
-
-#----------------------------------------------------------------------
-#
-# u_powerLawLower --
-#	Change of variable for integrating over an interval with
-#	an integrable power law singularity at the upper bound.
-#
-# Parameters:
-#	f - Function being integrated
-#	gammaover1mgamma - gamma / (1 - gamma), where gamma is the power
-#	oneover1mgamma - 1 / (1 - gamma), where gamma is the power
-#	b - Upper limit of integration
-#	u - Changed variable u == (b-x)**(1-gamma)
-#
-# Results:
-#	Returns u**(1/1-gamma) * f(b-u**(1/1-gamma) ).
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_powerLawUpper { f gammaover1mgamma oneover1mgamma
-					 b u } {
-    set cmd $f
-    lappend cmd [expr { $b - pow( $u, $oneover1mgamma ) }]
-    set y [eval $cmd]
-    return [expr { $y * pow( $u, $gammaover1mgamma ) }]
-}
-
-#----------------------------------------------------------------------
-#
-# math::calculus::romberg_powerLawUpper --
-#	Integrate a function with an integrable power law singularity
-#	at the upper bound
-#
-# Usage:
-#	romberg_powerLawLower gamma f a b ?-option value...?
-#
-# Parameters:
-#	gamma - Power (0<gamma<1) of the singularity
-#	f - Function to integrate.  Must be a single Tcl command,
-#	    to which will be appended the abscissa at which the function
-#	    should be evaluated.  f is expected to have an integrable
-#	    power law singularity at the upper endpoint; that is, the
-#	    integrand is expected to diverge as (b-x)**gamma.
-#	a - One bound of the interval
-#	b - The other bound of the interval.  a and b need not be in
-#	    ascending order.
-#
-# Options:
-#	-abserror ABSERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-10.
-#	-relerror RELERROR
-#		Requests that the integration be performed to make
-#		the estimated absolute error of the integral less than
-#		the given value.  Default is 1.e-6.
-#	-degree N
-#		Specifies the degree of the polynomial that will be
-#		used to extrapolate to a zero step size.  -degree 0
-#		requests integration with the midpoint rule; -degree 1
-#		is equivalent to Simpson's 3/8 rule; higher degrees
-#		are difficult to describe but (within reason) give
-#		faster convergence for smooth functions.  Default is
-#		-degree 4.
-#	-maxiter N
-#		Specifies the maximum number of triplings of the
-#		number of steps to take in integration.  At most
-#		3**N function evaluations will be performed in
-#		integrating with -maxiter N.  The integration
-#		will terminate at that time, even if the result
-#		satisfies neither the -relerror nor -abserror tests.
-#
-# Results:
-#	Returns a two-element list.  The first element is the estimated
-#	value of the integral; the second is the estimated absolute
-#	error of the value.
-#
-# The 'romberg_PowerLawUpper' procedure is a wrapper for 'romberg'
-# for integrating a function with an integrable power law singularity
-# at the upper bound of the interval.  It works by making the change
-# of variable u = (b-x)**(1-gamma).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_powerLawUpper { gamma f a b args } {
-    if { ![string is double -strict $gamma] } {
-	return -code error [expectDouble $gamma]
-    }
-    if { $gamma <= 0.0 || $gamma >= 1.0 } {
-	return -code error -errorcode [list romberg gammaTooBig] \
-	    "gamma must lie in the interval (0,1)"
-    }
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set onemgamma [expr { 1. - $gamma }]
-    set f [list u_powerLawUpper $f \
-	       [expr { $gamma / $onemgamma }] \
-	       [expr { 1. / $onemgamma }] \
-	       $b]
-	
-    set limit [expr { pow( $b - $a, $onemgamma ) }]
-    set result {}
-    foreach v [eval [linsert $args 0 romberg $f 0 $limit]] {
-	lappend result [expr { $v / $onemgamma }]
-    }
-    return $result
-
-}
-
-#----------------------------------------------------------------------
-#
-# u_expUpper --
-#
-#	Change of variable to integrate a function that decays
-#	exponentially.
-#
-# Parameters:
-#	f - Function to integrate
-#	u - Changed variable u = exp(-x)
-#
-# Results:
-#	Returns (1/u)*f(-log(u))
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_expUpper { f u } {
-    set cmd $f
-    lappend cmd [expr { -log($u) }]
-    set y [eval $cmd]
-    return [expr { $y / $u }]
-}
-
-#----------------------------------------------------------------------
-#
-# romberg_expUpper --
-#
-#	Integrate a function that decays exponentially over a
-#	half-infinite interval.
-#
-# Parameters:
-#	Same as romberg.  The upper limit of integration, 'b',
-#	is expected to be very large.
-#
-# Results:
-#	Same as romberg.
-#
-# The romberg_expUpper function operates by making the change of
-# variable, u = exp(-x).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_expUpper { f a b args } {
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set f [list u_expUpper $f]
-    return [eval [linsert $args 0 \
-		      romberg $f [expr {exp(-$b)}] [expr {exp(-$a)}]]]
-}
-
-#----------------------------------------------------------------------
-#
-# u_expLower --
-#
-#	Change of variable to integrate a function that grows
-#	exponentially.
-#
-# Parameters:
-#	f - Function to integrate
-#	u - Changed variable u = exp(x)
-#
-# Results:
-#	Returns (1/u)*f(log(u))
-#
-# Side effects:
-#	Whatever f does.
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::u_expLower { f u } {
-    set cmd $f
-    lappend cmd [expr { log($u) }]
-    set y [eval $cmd]
-    return [expr { $y / $u }]
-}
-
-#----------------------------------------------------------------------
-#
-# romberg_expLower --
-#
-#	Integrate a function that grows exponentially over a
-#	half-infinite interval.
-#
-# Parameters:
-#	Same as romberg.  The lower limit of integration, 'a',
-#	is expected to be very large and negative.
-#
-# Results:
-#	Same as romberg.
-#
-# The romberg_expUpper function operates by making the change of
-# variable, u = exp(x).
-#
-#----------------------------------------------------------------------
-
-proc ::math::calculus::romberg_expLower { f a b args } {
-    if { ![string is double -strict $a] } {
-	return -code error [expectDouble $a]
-    }
-    if { ![string is double -strict $b] } {
-	return -code error [expectDouble $b]
-    }
-    if { $a >= $b } {
-	return -code error "limits of integration out of order"
-    }
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-    set f [list u_expLower $f]
-    return [eval [linsert $args 0 \
-		      romberg $f [expr {exp($a)}] [expr {exp($b)}]]]
-}
-
-
-# regula_falsi --
-#    Compute the zero of a function via regula falsi
-# Arguments:
-#    f       Name of the procedure/command that evaluates the function
-#    xb      Start of the interval that brackets the zero
-#    xe      End of the interval that brackets the zero
-#    eps     Relative error that is allowed (default: 1.0e-4)
-# Result:
-#    Estimate of the zero, such that the estimated (!)
-#    error < eps * abs(xe-xb)
-# Note:
-#    f(xb)*f(xe) must be negative and eps must be positive
-#
-proc ::math::calculus::regula_falsi { f xb xe {eps 1.0e-4} } {
-    if { $eps <= 0.0 } {
-       return -code error "Relative error must be positive"
-    }
-
-    set fb [$f $xb]
-    set fe [$f $xe]
-
-    if { $fb * $fe > 0.0 } {
-       return -code error "Interval must be chosen such that the \
-function has a different sign at the beginning than at the end"
-    }
-
-    set max_error [expr {$eps * abs($xe-$xb)}]
-    set interval  [expr {abs($xe-$xb)}]
-
-    while { $interval > $max_error } {
-       set coeff [expr {($fe-$fb)/($xe-$xb)}]
-       set xi    [expr {$xb-$fb/$coeff}]
-       set fi    [$f $xi]
-
-       if { $fi == 0.0 } {
-          break
-       }
-       set diff1 [expr {abs($xe-$xi)}]
-       set diff2 [expr {abs($xb-$xi)}]
-       if { $diff1 > $diff2 } {
-          set interval $diff2
-       } else {
-          set interval $diff1
-       }
-
-       if { $fb*$fi < 0.0 } {
-          set xe $xi
-          set fe $fi
-       } else {
-          set xb $xi
-          set fb $fi
-       }
-    }
-
-    return $xi
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/classic_polyns.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/classic_polyns.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,193 +1,0 @@
-# classic_polyns.tcl --
-#    Implement procedures for the classic orthogonal polynomials
-#
-package require math::polynomials
-
-namespace eval ::math::special {
-    if {[info commands addPolyn] == {} } {
-        namespace import ::math::polynomials::*
-    }
-}
-
-
-# legendre --
-#    Return the nth degree Legendre polynomial
-#
-# Arguments:
-#    n            The degree of the polynomial
-# Result:
-#    Polynomial definition
-#
-proc ::math::special::legendre {n} {
-    if { ! [string is integer -strict $n] || $n < 0 } {
-        return -code error "Degree must be a non-negative integer"
-    }
-
-    set pnm1   [polynomial 1.0]
-    set pn     [polynomial {0.0 1.0}]
-
-    if { $n == 0 } {return $pnm1}
-    if { $n == 1 } {return $pn}
-
-    set degree 1
-    while { $degree < $n } {
-        set an       [expr {(2.0*$degree+1.0)/($degree+1.0)}]
-        set bn       0.0
-        set cn       [expr {$degree/($degree+1.0)}]
-        set factor_n [polynomial [list $bn $an]]
-        set term_nm1 [multPolyn $pnm1 [expr {-1.0*$cn}]]
-        set term_n   [multPolyn $factor_n $pn]
-        set pnp1     [addPolyn $term_n $term_nm1]
-
-        set pnm1     $pn
-        set pn       $pnp1
-        incr degree
-    }
-
-    return $pnp1
-}
-
-# chebyshev --
-#    Return the nth degree Chebeyshev polynomial of the first kind
-#
-# Arguments:
-#    n            The degree of the polynomial
-# Result:
-#    Polynomial definition
-#
-proc ::math::special::chebyshev {n} {
-    if { ! [string is integer -strict $n] || $n < 0 } {
-        return -code error "Degree must be a non-negative integer"
-    }
-
-    set pnm1   [polynomial 1.0]
-    set pn     [polynomial {0.0 1.0}]
-
-    if { $n == 0 } {return $pnm1}
-    if { $n == 1 } {return $pn}
-
-    set degree 1
-    while { $degree < $n } {
-        set an       2.0
-        set bn       0.0
-        set cn       1.0
-        set factor_n [polynomial [list $bn $an]]
-        set term_nm1 [multPolyn $pnm1 [expr {-1.0*$cn}]]
-        set term_n   [multPolyn $factor_n $pn]
-        set pnp1     [addPolyn $term_n $term_nm1]
-
-        set pnm1     $pn
-        set pn       $pnp1
-        incr degree
-    }
-
-    return $pnp1
-}
-
-# laguerre --
-#    Return the nth degree Laguerre polynomial with parameter alpha
-#
-# Arguments:
-#    alpha        The parameter for the polynomial
-#    n            The degree of the polynomial
-# Result:
-#    Polynomial definition
-#
-proc ::math::special::laguerre {alpha n} {
-    if { ! [string is double -strict $alpha] } {
-        return -code error "Parameter must be a double"
-    }
-    if { ! [string is integer -strict $n] || $n < 0 } {
-        return -code error "Degree must be a non-negative integer"
-    }
-
-    set pnm1   [polynomial 1.0]
-    set pn     [polynomial [list [expr {1.0-$alpha}] -1.0]]
-
-    if { $n == 0 } {return $pnm1}
-    if { $n == 1 } {return $pn}
-
-    set degree 1
-    while { $degree < $n } {
-        set an       [expr {-1.0/($degree+1.0)}]
-        set bn       [expr {(2.0*$degree+$alpha+1)/($degree+1.0)}]
-        set cn       [expr {($degree+$alpha)/($degree+1.0)}]
-        set factor_n [polynomial [list $bn $an]]
-        set term_nm1 [multPolyn $pnm1 [expr {-1.0*$cn}]]
-        set term_n   [multPolyn $factor_n $pn]
-        set pnp1     [addPolyn $term_n $term_nm1]
-
-        set pnm1     $pn
-        set pn       $pnp1
-        incr degree
-    }
-
-    return $pnp1
-}
-
-# hermite --
-#    Return the nth degree Hermite polynomial
-#
-# Arguments:
-#    n            The degree of the polynomial
-# Result:
-#    Polynomial definition
-#
-proc ::math::special::hermite {n} {
-    if { ! [string is integer -strict $n] || $n < 0 } {
-        return -code error "Degree must be a non-negative integer"
-    }
-
-    set pnm1   [polynomial 1.0]
-    set pn     [polynomial {0.0 2.0}]
-
-    if { $n == 0 } {return $pnm1}
-    if { $n == 1 } {return $pn}
-
-    set degree 1
-    while { $degree < $n } {
-        set an       2.0
-        set bn       0.0
-        set cn       [expr {2.0*$degree}]
-        set factor_n [polynomial [list $bn $an]]
-        set term_n   [multPolyn $factor_n $pn]
-        set term_nm1 [multPolyn $pnm1 [expr {-1.0*$cn}]]
-        set pnp1     [addPolyn $term_n $term_nm1]
-
-        set pnm1     $pn
-        set pn       $pnp1
-        incr degree
-    }
-
-    return $pnp1
-}
-
-# some tests --
-#
-if { 0 } {
-set tcl_precision 17
-
-puts "Legendre:"
-foreach n {0 1 2 3 4} {
-    puts [::math::special::legendre $n]
-}
-
-puts "Chebyshev:"
-foreach n {0 1 2 3 4} {
-    puts [::math::special::chebyshev $n]
-}
-
-puts "Laguerre (alpha=0):"
-foreach n {0 1 2 3 4} {
-    puts [::math::special::laguerre 0.0 $n]
-}
-puts "Laguerre (alpha=1):"
-foreach n {0 1 2 3 4} {
-    puts [::math::special::laguerre 1.0 $n]
-}
-
-puts "Hermite:"
-foreach n {0 1 2 3 4} {
-    puts [::math::special::hermite $n]
-}
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/combinatorics.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/combinatorics.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,448 +1,0 @@
-#----------------------------------------------------------------------
-#
-# math/combinatorics.tcl --
-#
-#	This file contains definitions of mathematical functions
-#	useful in combinatorial problems.  
-#
-# Copyright (c) 2001, by Kevin B. Kenny.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: combinatorics.tcl,v 1.5 2004/02/09 19:31:54 hobbs Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.0
-
-namespace eval ::math {
-
-    # Commonly used combinatorial functions
-
-    # ln_Gamma is spelt thus because it's a capital gamma (\u0393)
-
-    namespace export ln_Gamma;		# Logarithm of the Gamma function
-    namespace export factorial;		# Factorial
-    namespace export choose;		# Binomial coefficient
-
-    # Note that Beta is spelt thus because it's conventionally a
-    # capital beta (\u0392).  It is exported from the package even
-    # though its name is capitalized.
-
-    namespace export Beta;		# Beta function
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# ::math::InitializeFactorial --
-#
-#	Initialize a table of factorials for small integer arguments.
-#
-# Parameters:
-#	None.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#	The variable, ::math::factorialList, is initialized to hold
-#	a table of factorial n for 0 <= n <= 170.
-#
-# This procedure is called once when the 'factorial' procedure is
-# being loaded.
-#
-#----------------------------------------------------------------------
-
-proc ::math::InitializeFactorial {} {
-
-    variable factorialList
-
-    set factorialList [list 1]
-    set f 1
-    for { set i 1 } { $i < 171 } { incr i } {
-	if { $i > 12. } {
-	    set f [expr { $f * double($i)}]
-	} else {
-	    set f [expr { $f * $i }]
-	}
-	lappend factorialList $f
-    }
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# ::math::InitializePascal --
-#
-#	Precompute the first few rows of Pascal's triangle and store
-#	them in the variable ::math::pascal
-#
-# Parameters:
-#	None.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#	::math::pascal is initialized to a flat list containing 
-#	the first 34 rows of Pascal's triangle.	 C(n,k) is to be found
-#	at [lindex $pascal $i] where i = n * ( n + 1 ) + k.  No attempt
-#	is made to exploit symmetry.
-#
-#----------------------------------------------------------------------
-
-proc ::math::InitializePascal {} {
-
-    variable pascal
-
-    set pascal [list 1]
-    for { set n 1 } { $n < 34 } { incr n } {
-	lappend pascal 1
-	set l2 [list 1]
-	for { set k 1 } { $k < $n } { incr k } {
-	    set km1 [expr { $k - 1 }]
-	    set c [expr { [lindex $l $km1] + [lindex $l $k] }]
-	    lappend pascal $c
-	    lappend l2 $c
-	}
-	lappend pascal 1
-	lappend l2 1
-	set l $l2
-    }
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# ::math::ln_Gamma --
-#
-#	Returns ln(Gamma(x)), where x >= 0
-#
-# Parameters:
-#	x - Argument to the Gamma function.
-#
-# Results:
-#	Returns the natural logarithm of Gamma(x).
-#
-# Side effects:
-#	None.
-#
-# Gamma(x) is defined as:
-#
-#		  +inf
-#		    _
-#		   |	x-1  -t
-#	Gamma(x)= _|   t    e	dt
-#
-#		   0
-#
-# The approximation used here is from Lanczos, SIAM J. Numerical Analysis,
-# series B, volume 1, p. 86.  For x > 1, the absolute error of the
-# result is claimed to be smaller than 5.5 * 10**-10 -- that is, the
-# resulting value of Gamma when exp( ln_Gamma( x ) ) is computed is
-# expected to be precise to better than nine significant figures.
-#
-#----------------------------------------------------------------------
-
-proc ::math::ln_Gamma { x } {
-
-    # Handle the common case of a real argument that's within the
-    # permissible range.
-
-    if { [string is double -strict $x]
-	 && ( $x > 0 )
-	 && ( $x <= 2.5563481638716906e+305 )
-     } {
-	set x [expr { $x - 1.0 }]
-	set tmp [expr { $x + 5.5 }]
-	set tmp [ expr { ( $x + 0.5 ) * log( $tmp ) - $tmp }]
-	set ser 1.0
-	foreach cof {
-	    76.18009173 -86.50532033 24.01409822
-	    -1.231739516 .00120858003 -5.36382e-6
-	} {
-	    set x [expr { $x + 1.0 }]
-	    set ser [expr { $ser + $cof / $x }]
-	}
-	return [expr { $tmp + log( 2.50662827465 * $ser ) }]
-    } 
-
-    # Handle the error cases.
-
-    if { ![string is double -strict $x] } {
-	return -code error [expectDouble $x]
-    }
-
-    if { $x <= 0.0 } {
-	set proc [lindex [info level 0] 0]
-	return -code error \
-	    -errorcode [list ARITH DOMAIN \
-			"argument to $proc must be positive"] \
-	    "argument to $proc must be positive"
-    }
-
-    return -code error \
-	-errorcode [list ARITH OVERFLOW \
-		    "floating-point value too large to represent"] \
-	"floating-point value too large to represent"
-	
-}
-
-
-#----------------------------------------------------------------------
-#
-# math::factorial --
-#
-#	Returns the factorial of the argument x.
-#
-# Parameters:
-#	x -- Number whose factorial is to be computed.
-#
-# Results:
-#	Returns x!, the factorial of x.
-#
-# Side effects:
-#	None.
-#
-# For integer x, 0 <= x <= 12, an exact integer result is returned.
-#
-# For integer x, 13 <= x <= 21, an exact floating-point result is returned
-# on machines with IEEE floating point.
-#
-# For integer x, 22 <= x <= 170, the result is exact to 1 ULP.
-#
-# For real x, x >= 0, the result is approximated by computing
-# Gamma(x+1) using the ::math::ln_Gamma function, and the result is
-# expected to be precise to better than nine significant figures.
-#
-# It is an error to present x <= -1 or x > 170, or a value of x that
-# is not numeric.
-#
-#----------------------------------------------------------------------
-
-proc ::math::factorial { x } {
-
-    variable factorialList
-
-    # Common case: factorial of a small integer
-
-    if { [string is integer -strict $x]
-	 && $x >= 0
-	 && $x < [llength $factorialList] } {
-	return [lindex $factorialList $x]
-    }
-
-    # Error case: not a number
-
-    if { ![string is double -strict $x] } {
-	return -code error [expectDouble $x]
-    }
-
-    # Error case: gamma in the left half plane
-
-    if { $x <= -1.0 } {
-	set proc [lindex [info level 0] 0]
-	set message "argument to $proc must be greater than -1.0"
-	return -code error -errorcode [list ARITH DOMAIN $message] $message
-    }
-
-    # Error case - gamma fails
-
-    if { [catch { expr {exp( [ln_Gamma [expr { $x + 1 }]] )} } result] } {
-	return -code error -errorcode $::errorCode $result
-    }
-
-    # Success - computed factorial n as Gamma(n+1)
-
-    return $result
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# ::math::choose --
-#
-#	Returns the binomial coefficient C(n,k) = n!/k!(n-k)!
-#
-# Parameters:
-#	n -- Number of objects in the sampling pool
-#	k -- Number of objects to be chosen.
-#
-# Results:
-#	Returns C(n,k).	 
-#
-# Side effects:
-#	None.
-#
-# Results are expected to be accurate to ten significant figures.
-# If both parameters are integers and the result fits in 32 bits, 
-# the result is rounded to an integer.
-#
-# Integer results are exact up to at least n = 34.
-# Floating point results are precise to better than nine significant 
-# figures.
-#
-#----------------------------------------------------------------------
-
-proc ::math::choose { n k } {
-
-    variable pascal
-
-    # Use a precomputed table for small integer args
-
-    if { [string is integer -strict $n]
-	 && $n >= 0 && $n < 34
-	 && [string is integer -strict $k]
-	 && $k >= 0 && $k <= $n } {
-
-	set i [expr { ( ( $n * ($n + 1) ) / 2 ) + $k }]
-
-	return [lindex $pascal $i]
-
-    }
-
-    # Test bogus arguments
-
-    if { ![string is double -strict $n] } {
-	return -code error [expectDouble $n]
-    }
-    if { ![string is double -strict $k] } {
-	return -code error [expectDouble $k]
-    }
-
-    # Forbid negative n
-
-    if { $n < 0. } {
-	set proc [lindex [info level 0] 0]
-	set msg "first argument to $proc must be non-negative"
-	return -code error -errorcode [list ARITH DOMAIN $msg] $msg
-    }
-
-    # Handle k out of range
-
-    if { [string is integer -strict $k] && [string is integer -strict $n]
-	 && ( $k < 0 || $k > $n ) } {
-	return 0
-    }
-
-    if { $k < 0. } {
-	set proc [lindex [info level 0] 0]
-	set msg "second argument to $proc must be non-negative,\
-                 or both must be integers"
-	return -code error -errorcode [list ARITH DOMAIN $msg] $msg
-    }
-
-    # Compute the logarithm of the desired binomial coefficient.
-
-    if { [catch { expr { [ln_Gamma [expr { $n + 1 }]]
-			 - [ln_Gamma [expr { $k + 1 }]]
-			 - [ln_Gamma [expr { $n - $k + 1 }]] } } r] } {
-	return -code error -errorcode $::errorCode $r
-    }
-
-    # Compute the binomial coefficient itself
-
-    if { [catch { expr { exp( $r ) } } r] } {
-	return -code error -errorcode $::errorCode $r
-    }
-
-    # Round to integer if both args are integers and the result fits
-
-    if { $r <= 2147483647.5 
-	       && [string is integer -strict $n]
-	       && [string is integer -strict $k] } {
-	return [expr { round( $r ) }]
-    }
-
-    return $r
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# ::math::Beta --
-#
-#	Return the value of the Beta function of parameters z and w.
-#
-# Parameters:
-#	z, w : Two real parameters to the Beta function
-#
-# Results:
-#	Returns the value of the Beta function.
-#
-# Side effects:
-#	None.
-#
-# Beta( w, z ) is defined as:
-#
-#				  1_
-#				  |  (z-1)     (w-1)
-# Beta( w, z ) = Beta( z, w ) =	  | t	  (1-t)	     dt
-#				 _|
-#				  0
-#
-#	       = Gamma( z ) Gamma( w ) / Gamma( z + w )
-#
-# Results are returned as a floating point number precise to better
-# than nine significant figures for w, z > 1.
-#
-#----------------------------------------------------------------------
-
-proc ::math::Beta { z w } {
-
-    # Check form of both args so that domain check can be made
-
-    if { ![string is double -strict $z] } {
-	return -code error [expectDouble $z]
-    }
-    if { ![string is double -strict $w] } {
-	return -code error [expectDouble $w]
-    }
-
-    # Check sign of both args
-
-    if { $z <= 0.0 } {
-	set proc [lindex [info level 0] 0]
-	set msg "first argument to $proc must be positive"
-	return -code error -errorcode [list ARITH DOMAIN $msg] $msg
-    }
-    if { $w <= 0.0 } {
-	set proc [lindex [info level 0] 0]
-	set msg "second argument to $proc must be positive"
-	return -code error -errorcode [list ARITH DOMAIN $msg] $msg
-    }
-
-    # Compute beta using gamma function, keeping stack trace clean.
-
-    if { [catch { expr { exp( [ln_Gamma $z] + [ln_Gamma $w]
-			      - [ln_Gamma [ expr { $z + $w }]] ) } } beta] } {
-
-	return -code error -errorcode $::errorCode $beta
-
-    } 
-
-    return $beta
-
-}
-
-
-#----------------------------------------------------------------------
-#
-# Initialization of this file:
-#
-#	Initialize the precomputed tables of factorials and binomial
-#	coefficients.
-#
-#----------------------------------------------------------------------
-
-namespace eval ::math {
-    InitializeFactorial
-    InitializePascal
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/constants.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/constants.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,199 +1,0 @@
-# constants.tcl --
-#    Module defining common mathematical and numerical constants
-#
-# Copyright (c) 2004 by Arjen Markus.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: constants.tcl,v 1.8 2005/10/06 05:16:37 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.2
-
-package provide math::constants 1.0.1
-
-# namespace constants
-#    Create a convenient namespace for the constants
-#
-namespace eval ::math::constants {
-    #
-    # List of constants and their description
-    #
-    variable constants {
-        pi        3.14159265358979323846   "ratio of circle circumference and diameter"
-        e         2.71828182845904523536   "base for natural logarithm"
-        ln10      2.30258509299404568402   "natural logarithm of 10"
-        phi       1.61803398874989484820   "golden ratio"
-        gamma     0.57721566490153286061   "Euler's constant"
-        sqrt2     1.41421356237309504880   "Square root of 2"
-        thirdrt2  1.25992104989487316477   "One-third power of 2"
-        sqrt3     1.73205080756887729533   "Square root of 3"
-        radtodeg  57.2957795131            "Conversion from radians to degrees"
-        degtorad  0.017453292519943        "Conversion from degrees to radians"
-        onethird  1.0/3.0                  "One third (0.3333....)"
-        twothirds 2.0/3.0                  "Two thirds (0.3333....)"
-        onesixth  1.0/6.0                  "One sixth (0.1666....)"
-        huge      [find_huge]              "(Approximately) largest number"
-        tiny      [find_tiny]              "(Approximately) smallest number not equal zero"
-        eps       [find_eps]               "Smallest number such that 1+eps != 1"
-    }
-    namespace export constants print-constants
-}
-
-# constants --
-#    Expose the constants in the caller's routine or namespace
-#
-# Arguments:
-#    args         List of constants to be exposed
-# Result:
-#    None
-#
-proc ::math::constants::constants {args} {
-
-    foreach const $args {
-        uplevel 1 [list variable $const [set ::math::constants::$const]]
-    }
-}
-
-# print-constants --
-#    Print the selected or all constants to the screen
-#
-# Arguments:
-#    args         List of constants to be exposed
-# Result:
-#    None
-#
-proc ::math::constants::print-constants {args} {
-    variable constants
-
-    if { [llength $args] != 0 } {
-        foreach const $args {
-            set idx [lsearch $constants $const]
-            if { $idx >= 0 } {
-                set descr [lindex $constants [expr {$idx+2}]]
-                puts "$const = [set ::math::constants::$const] = $descr"
-            } else {
-                puts "*** $const unknown ***"
-            }
-        }
-    } else {
-        foreach {const value descr} $constants {
-            puts "$const = [set ::math::constants::$const] = $descr"
-        }
-    }
-}
-
-# find_huge --
-#    Find the largest possible number
-#
-# Arguments:
-#    None
-# Result:
-#    Estimate of the largest possible number
-#
-proc ::math::constants::find_huge {} {
-
-    set result 1.0
-    set Inf Inf
-    while {1} {
-	if {[catch {expr {2.0 * $result}} result]} {
-	    break
-	}
-	if { $result == $Inf } {
-	    break
-	}
-	set prev_result $result
-    }
-    set result $prev_result
-    set adder [expr { $result / 2. }]
-    while { $adder != 0.0 } {
-	if {![catch {expr {$adder + $prev_result}} result]} {
-	    if { $result == $prev_result } break
-	    if { $result != $Inf } {
-		set prev_result $result
-	    }
-	}
-	set adder [expr { $adder / 2. }]
-    }
-    return $prev_result
-
-}
-
-# find_tiny --
-#    Find the smallest possible number
-#
-# Arguments:
-#    None
-# Result:
-#    Estimate of the smallest possible number
-#
-proc ::math::constants::find_tiny {} {
-
-    set result 1.0
-
-    while { ! [catch {set result [expr {$result/2.0}]}] && $result > 0.0 } {
-        set prev_result $result
-    }
-    return $prev_result
-}
-
-# find_eps --
-#    Find the smallest number eps such that 1+eps != 1
-#
-# Arguments:
-#    None
-# Result:
-#    Estimate of the machine epsilon
-#
-proc ::math::constants::find_eps { } {
-    set eps 1.0
-    while { [expr {1.0+$eps}] != 1.0 } {
-        set prev_eps $eps
-        set eps  [expr {0.5*$eps}]
-    }
-    return $prev_eps
-}
-
-# Create the variables from the list:
-# - By using expr we ensure that the best double precision
-#   approximation is assigned to the variable, rather than
-#   just the string
-# - It also allows us to rely on IEEE arithmetic if available,
-#   so that for instance 3.0*(1.0/3.0) is exactly 1.0
-#
-namespace eval ::math::constants {
-    foreach {const value descr} $constants {
-        # FRINK: nocheck
-        set [namespace current]::$const [expr 0.0+$value]
-    }
-    unset value
-    unset const
-    unset descr 
-
-    rename find_eps  {}
-    rename find_tiny {}
-    rename find_huge {}
-}
-
-# some tests --
-#
-if { [info exists ::argv0]
-     && [string equal $::argv0 [info script]] } {
-    ::math::constants::constants pi e ln10 onethird eps
-    set tcl_precision 17
-    puts "$pi - [expr {1.0/$pi}]"
-    puts $e
-    puts $ln10
-    puts "onethird: [expr {3.0*$onethird}]"
-    ::math::constants::print-constants onethird pi e
-    puts "All defined constants:"
-    ::math::constants::print-constants
-    
-    if { 1.0+$eps == 1.0 } {
-        puts "Something went wrong with eps!"
-    } else {
-        puts "Difference: [set ee [expr {1.0+$eps}]] - 1.0 = [expr {$ee-1.0}]"
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/elliptic.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/elliptic.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,236 +1,0 @@
-# elliptic.tcl --
-#    Compute elliptic functions and integrals
-#
-#    Computation of elliptic functions cn, dn and sn
-#    adapted from:
-#        Michael W. Pashea
-#        Numerical computation of elliptic functions
-#        Doctor Dobbs' Journal, May 2005
-#
-
-# namespace ::math::special
-#
-namespace eval ::math::special {
-    namespace export cn sn dn
-
-    ::math::constants::constants pi
-
-    variable halfpi [expr {$pi/2.0}]
-    variable tol
-
-    set tol 1.0e-10
-}
-
-# elliptic_K --
-#    Compute the complete elliptic integral of the first kind
-#
-# Arguments:
-#    k            Parameter of the integral
-# Result:
-#    Value of K(k)
-# Note:
-#    This relies on the arithmetic-geometric mean
-#
-proc ::math::special::elliptic_K {k} {
-    variable halfpi
-    if { $k < 0.0 || $k >= 1.0 } {
-        error "Domain error: must be between 0 (inclusive) and 1 (not inclusive)"
-    }
-
-    if { $k == 0.0 } {
-        return $halfpi
-    }
-
-    set a 1.0
-    set b [expr {sqrt(1.0-$k*$k)}]
-
-    for {set i 0} {$i < 10} {incr i} {
-        set anew [expr {($a+$b)/2.0}]
-        set bnew [expr {sqrt($a*$b)}]
-
-        set a $anew
-        set b $bnew
-        #puts "$a $b"
-    }
-
-    return [expr {$halfpi/$a}]
-}
-
-# elliptic_E --
-#    Compute the complete elliptic integral of the second kind
-#
-# Arguments:
-#    k            Parameter of the integral
-# Result:
-#    Value of E(k)
-# Note:
-#    This relies on the arithmetic-geometric mean
-#
-proc ::math::special::elliptic_E {k} {
-   variable halfpi
-   if { $k < 0.0 || $k >= 1.0 } {
-       error "Domain error: must be between 0 (inclusive) and 1 (not inclusive)"
-   }
-
-   if { $k == 0.0 } {
-       return $halfpi
-   }
-   if { $k == 1.0 } {
-       return 1.0
-   }
-
-   set a      1.0
-   set b      [expr {sqrt(1.0-$k*$k)}]
-   set sumc   [expr {$k*$k/2.0}]
-   set factor 0.25
-
-   for {set i 0} {$i < 10} {incr i} {
-       set anew   [expr {($a+$b)/2.0}]
-       set bnew   [expr {sqrt($a*$b)}]
-       set sumc   [expr {$sumc+$factor*($a-$b)*($a-$b)}]
-       set factor [expr {$factor*2.0}]
-
-       set a $anew
-       set b $bnew
-       #puts "$a $b"
-   }
-
-   set Kk [expr {$halfpi/$a}]
-   return [expr {(1.0-$sumc)*$Kk}]
-}
-
-namespace eval ::math::special {
-}
-
-# Nextk --
-#     Auxiliary function for computing next value of k
-#
-# Arguments:
-#     k           Parameter
-# Return value:
-#     Next value to be used
-#
-proc ::math::special::Nextk { k } {
-    set ksq [expr {sqrt(1.0-$k*$k)}]
-    return [expr {(1.0-$ksq)/(1+$ksq)}]
-}
-
-# IterateUK --
-#     Auxiliary function to compute the raw value (phi)
-#
-# Arguments:
-#     u           Independent variable
-#     k           Parameter
-# Return value:
-#     phi
-#
-proc ::math::special::IterateUK { u k } {
-    variable tol
-    set kvalues {}
-    set nmax    1
-    while { $k > $tol } {
-        set k [Nextk $k]
-        set kvalues [concat $k $kvalues]
-        set u [expr {$u*2.0/(1.0+$k)}]
-        incr nmax
-        #puts "$nmax -$u - $k"
-    }
-    foreach k $kvalues {
-        set u [expr {( $u + asin($k*sin($u)) )/2.0}]
-    }
-    return $u
-}
-
-# cn --
-#     Compute the elliptic function cn
-#
-# Arguments:
-#     u           Independent variable
-#     k           Parameter
-# Return value:
-#     cn(u,k)
-# Note:
-#     If k == 1, then the iteration does not stop
-#
-proc ::math::special::cn { u k } {
-    if { $k > 1.0 } {
-        return -code error "Parameter out of range - must be <= 1.0"
-    }
-    if { $k == 1.0 } {
-        return [expr {1.0/cosh($u)}]
-    } else {
-        set u [IterateUK $u $k]
-        return [expr {cos($u)}]
-    }
-}
-
-# sn --
-#     Compute the elliptic function sn
-#
-# Arguments:
-#     u           Independent variable
-#     k           Parameter
-# Return value:
-#     sn(u,k)
-# Note:
-#     If k == 1, then the iteration does not stop
-#
-proc ::math::special::sn { u k } {
-    if { $k > 1.0 } {
-        return -code error "Parameter out of range - must be <= 1.0"
-    }
-    if { $k == 1.0 } {
-        return [expr {tanh($u)}]
-    } else {
-        set u [IterateUK $u $k]
-        return [expr {sin($u)}]
-    }
-}
-
-# dn --
-#     Compute the elliptic function sn
-#
-# Arguments:
-#     u           Independent variable
-#     k           Parameter
-# Return value:
-#     dn(u,k)
-# Note:
-#     If k == 1, then the iteration does not stop
-#
-proc ::math::special::sn { u k } {
-    if { $k > 1.0 } {
-        return -code error "Parameter out of range - must be <= 1.0"
-    }
-    if { $k == 1.0 } {
-        return [expr {1.0/cosh($u)}]
-    } else {
-        set u [IterateUK $u $k]
-        return [expr {sqrt(1.0-$k*$k*sin($u)}]
-    }
-}
-
-
-# main --
-#    Simple tests
-#
-if { 0 } {
-puts "Special cases:"
-puts "cos(1):    [::math::special::cn 1.0 0.0] -- [expr {cos(1.0)}]"
-puts "1/cosh(1): [::math::special::cn 1.0 0.999] -- [expr {1.0/cosh(1.0)}]"
-}
-
-# some tests --
-#
-if { 0 } {
-set tcl_precision 17
-#foreach k {0.0 0.1 0.2 0.4 0.6 0.8 0.9} {
-#    puts "$k: [::math::special::elliptic_K $k]"
-#}
-foreach k2 {0.0 0.1 0.2 0.4 0.6 0.8 0.9} {
-    set k [expr {sqrt($k2)}]
-    puts "$k2: [::math::special::elliptic_K $k] \
-[::math::special::elliptic_E $k]"
-}
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/exponential.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/exponential.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,434 +1,0 @@
-# exponential.tcl --
-#    Compute exponential integrals (E1, En, Ei, li, Shi, Chi, Si, Ci)
-#
-
-namespace eval ::math::special {
-    variable pi 3.1415926
-    variable gamma 0.57721566490153286
-    variable halfpi [expr {$pi/2.0}]
-
-# Euler's digamma function for small integer arguments
-
-    variable psi {
-        NaN
-        -0.57721566490153286 0.42278433509846713 0.92278433509846713
-        1.2561176684318005 1.5061176684318005 1.7061176684318005
-        1.8727843350984672 2.0156414779556102 2.1406414779556102
-        2.2517525890667214 2.3517525890667215 2.4426616799758123
-        2.5259950133091458 2.6029180902322229 2.6743466616607945
-        2.7410133283274614 2.8035133283274614 2.8623368577392259
-        2.9178924132947812 2.9705239922421498 3.0205239922421496
-        3.0681430398611971 3.1135975853157425 3.1570758461853079
-        3.1987425128519744 3.2387425128519745 3.2772040513135128
-        3.31424108835055 3.3499553740648356 3.3844381326855251
-        3.4177714660188583 3.4500295305349873 3.4812795305349873
-        3.5115825608380176 3.5409943255438998 3.5695657541153283
-        3.597343531893106 3.6243705589201332 3.6506863483938172
-        3.6763273740348428
-    }
-}
-
-# ComputeExponFG --
-#    Compute the auxiliary functions f and g
-#
-# Arguments:
-#    x            Parameter of the integral (x>=0)
-# Result:
-#    Approximate values for f and g
-# Note:
-#    See Abramowitz and Stegun
-#
-proc ::math::special::ComputeExponFG {x} {
-    set x2 [expr {$x*$x}]
-    set fx [expr {($x2*$x2+7.241163*$x2+2.463936)/
-                  ($x2*$x2+9.068580*$x2+7.157433)/$x}]
-    set gx [expr {($x2*$x2+7.547478*$x2+1.564072)/
-                  ($x2*$x2+12.723684*$x2+15.723606)/$x2}]
-    list $fx $gx
-}
-
-
-# exponential_Ei --
-#    Compute the exponential integral of the second kind, to relative
-#    error eps
-# Arguments:
-#    x       Value of the argument
-#    eps     Relative error
-# Result:
-#    Principal value of the integral exp(x)/x
-#    from -infinity to x
-#
-proc ::math::special::exponential_Ei { x { eps 1.0e-10 } } {
-    variable gamma
-
-    if { ![string is double -strict $x] } {
-        return -code error "expected a floating point number but found \"$x\""
-    }
-    if { $x < 0.0 } {
-        return [expr { -[exponential_En 1 [expr { - $x }] $eps] }]
-    }
-    if { $x == 0.0 } {
-       set message "Argument to exponential_Ei must not be zero"
-       return -code error -errorcode [list ARITH DOMAIN $message] $message
-    }
-    if { $x >= -log($eps) } {
-        # evaluate Ei(x) as an asymptotic series; the series is formally
-        # divergent, but the leading terms give the desired value to
-        # enough precision.
-        set sum 0.
-        set term 1.
-        set k 1
-        while { 1 } {
-            set p $term
-            set term [expr { $term * ( $k / $x ) }]
-            if { $term < $eps } {
-                break
-            }
-            if { $term < $p } {
-                set sum [expr { $sum + $term }]
-            } else {
-                set sum [expr { $sum - $p }]
-                break
-            }
-            incr k
-        }
-        return [expr { exp($x) * ( 1.0 + $sum ) / $x }]
-    } elseif { $x >= 1e-18 } {
-        # evaluate Ei(x) as a power series
-        set sum 0.
-        set fact 1.
-        set pow $x
-        set n 1
-        while { 1 } {
-            set fact [expr { $fact * $n }]
-            set term [expr { $pow / $n / $fact }]
-            set sum [expr { $sum + $term }]
-            if { $term < $eps * $sum } break
-            set pow [expr { $x * $pow }]
-            incr n
-        }
-        return [expr { $sum + $gamma + log($x) }]
-    } else {
-        # Ei(x) for small x
-        return [expr { log($x) + $gamma }]
-    }
-}
-
-
-# exponential_En --
-#    Compute the exponential integral of n-th order, to relative error
-#    epsilon
-#
-# Arguments:
-#    n            Order of the integral (n>=1, integer)
-#    x            Parameter of the integral (x>0)
-#    epsilon      Relative error
-# Result:
-#    Value of En(x) = integral from 0 to x of exp(-x)/x**n
-#
-proc ::math::special::exponential_En { n x { epsilon 1.0e-10 } } {
-    variable psi
-    variable gamma
-    if { ![string is integer -strict $n] || $n < 0 } {
-        return -code error "expected a non-negative integer but found \"$n\""
-    }
-    if { ![string is double -strict $x] } {
-        return -code error "expected a floating point number but found \"$x\""
-    }
-    if { $n == 0 } {
-        if { $x == 0.0 } {
-            return -code error "E0(0) is indeterminate"
-        }
-        return [expr { exp( -$x ) / $x }]
-    }
-    if { $n == 1 && $x < 0.0 } {
-        return [expr {- [exponential_Ei [expr { -$x }] $eps] }]
-    }
-    if { $x < 0.0 } {
-        return -code error "can't evaluate En(x) for negative x"
-    }
-    if { $x == 0.0 } {
-        return [expr { 1.0 / ( $n - 1 ) }]
-    }
-
-    if { $x > 1.0 } {
-        # evaluate En(x) as a continued fraction
-        set b [expr { $x + $n }]
-        set c 1.e308
-        set d [expr { 1.0 / $b }]
-        set h $d
-        set i 1
-        while { 1 } {
-            set a [expr { -$i * ( $n - 1 + $i ) }]
-            set b [expr { $b + 2.0 }]
-            set d [expr { 1.0 / ( $a * $d + $b ) }]
-            set c [expr { $b + $a / $c }]
-            set delta [expr { $c * $d }]
-            set h [expr { $h * $delta }]
-            if { abs( $delta - 1. ) < $epsilon } {
-                return [expr { $h * exp(-$x) }]
-            }
-            incr i
-        }
-    } else {
-        # evaluate En(x) as a series
-        if { $n == 1 } {
-            set a [expr { -log($x) - $gamma }]
-        } else {
-            set a [expr { 1.0 / ( $n - 1 ) }]
-        }
-        set f 1.0
-        set i 1
-        while { 1 } {
-            set f [expr { - $f *  $x / $i }]
-            if { $i == $n - 1 } {
-                set term [expr { $f * ([lindex $psi $n] - log($x)) }]
-            } else {
-                set term [expr { $f / ( $n - 1 - $i ) }]
-            }
-            set a [expr { $a + $term }]
-            if { abs($term) < $epsilon * abs($a) } {
-                return $a
-            }
-            incr i
-        }
-    }
-}
-
-# exponential_E1 --
-#    Compute the exponential integral
-#
-# Arguments:
-#    x            Parameter of the integral (x>0)
-# Result:
-#    Value of E1(x) = integral from x to infinity of exp(-x)/x
-# Note:
-#    This relies on a rational approximation (error ~ 2e-7 (x<1) or 5e-5 (x>1)
-#
-proc ::math::special::exponential_E1 {x} {
-    if { $x <= 0.0 } {
-        error "Domain error: x must be positive"
-    }
-
-   if { $x < 1.0 } {
-      return [expr {-log($x)+((((0.00107857*$x-0.00976004)*$x+0.05519968)*$x-0.24991055)*$x+0.99999193)*$x-0.57721566}]
-   } else {
-      set xexpe [expr {($x*$x+2.334733*$x+0.250621)/($x*$x+3.330657*$x+1.681534)}]
-      return [expr {$xexpe/($x*exp($x))}]
-   }
-}
-
-# exponential_li --
-#    Compute the logarithmic integral
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    Value of the integral 1/ln(x) from 0 to x
-#
-proc ::math::special::exponential_li {x} {
-    if { $x < 0 } {
-        return -code error "Argument must be positive or zero"
-    } else {
-        if { $x == 0.0 } {
-            return 0.0
-        } else {
-            return [exponential_Ei [expr {log($x)}]]
-        }
-    }
-}
-
-# exponential_Shi --
-#    Compute the hyperbolic sine integral
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    Value of the integral sinh(x)/x from 0 to x
-#
-proc ::math::special::exponential_Shi {x} {
-    if { $x < 0 } {
-        return -code error "Argument must be positive or zero"
-    } else {
-        if { $x == 0.0 } {
-            return 0.0
-        } else {
-            proc g {x} {
-               return [expr {sinh($x)/$x}]
-            }
-            return [lindex [::math::calculus::romberg g 0.0 $x] 0]
-        }
-    }
-}
-
-# exponential_Chi --
-#    Compute the hyperbolic cosine integral
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    Value of the integral (cosh(x)-1)/x from 0 to x
-#
-proc ::math::special::exponential_Chi {x} {
-    variable gamma
-    if { $x < 0 } {
-        return -code error "Argument must be positive or zero"
-    } else {
-        if { $x == 0.0 } {
-            return 0.0
-        } else {
-            proc g {x} {
-               return [expr {(cosh($x)-1.0)/$x}]
-            }
-            set integral [lindex [::math::calculus::romberg g 0.0 $x] 0]
-            return [expr {$gamma+log($x)+$integral}]
-        }
-    }
-}
-
-# exponential_Si --
-#    Compute the sine integral
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    Value of the integral sin(x)/x from 0 to x
-#
-proc ::math::special::exponential_Si {x} {
-    variable halfpi
-    if { $x < 0 } {
-        return -code error "Argument must be positive or zero"
-    } else {
-        if { $x == 0.0 } {
-            return 0.0
-        } else {
-            if { $x < 1.0 } {
-                proc g {x} {
-                    return [expr {sin($x)/$x}]
-                }
-                return [lindex [::math::calculus::romberg g 0.0 $x] 0]
-            } else {
-                foreach {f g} [ComputeExponFG $x] {break}
-                return [expr {$halfpi-$f*cos($x)-$g*sin($x)}]
-            }
-        }
-    }
-}
-
-# exponential_Ci --
-#    Compute the cosine integral
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    Value of the integral (cosh(x)-1)/x from 0 to x
-#
-proc ::math::special::exponential_Ci {x} {
-    variable gamma
-
-    if { $x < 0 } {
-        return -code error "Argument must be positive or zero"
-    } else {
-        if { $x == 0.0 } {
-            return 0.0
-        } else {
-            if { $x < 1.0 } {
-                proc g {x} {
-                    return [expr {(cos($x)-1.0)/$x}]
-                }
-                set integral [lindex [::math::calculus::romberg g 0.0 $x] 0]
-                return [expr {$gamma+log($x)+$integral}]
-            } else {
-                foreach {f g} [ComputeExponFG $x] {break}
-                return [expr {$f*sin($x)-$g*cos($x)}]
-            }
-        }
-    }
-}
-
-# some tests --
-#    Reproduce tables 5.1, 5.2 from Abramowitz & Stegun,
-
-if { [info exists ::argv0] && ![string compare $::argv0 [info script]] } {
-namespace eval ::math::special {
-for { set i 0.01 } { $i < 0.505 } { set i [expr { $i + 0.01 }] } {
-    set ei [exponential_Ei $i]
-    set e1 [expr { - [exponential_Ei [expr { - $i }]] }]
-    puts [format "%9.6f\t%.10g\t%.10g" $i \
-              [expr {($ei - log($i) - 0.57721566490153286)/$i} ] \
-              [expr {($e1 + log($i) + 0.57721566490153286) / $i }]]
-}
-puts {}
-for { set i 0.5 } { $i < 2.005 } { set i [expr { $i + 0.01 }] } {
-    set ei [exponential_Ei $i]
-    set e1 [expr { - [exponential_Ei [expr { - $i }]] }]
-    puts [format "%9.6f\t%.10g\t%.10g" $i $ei $e1]
-}
-puts {}
-for {} { $i < 10.05 } { set i [expr { $i + 0.1 }] } {
-    set ei [exponential_Ei $i]
-    set e1 [expr { - [exponential_Ei [expr { - $i }]] }]
-    puts [format "%9.6f\t%.10g\t%.10g" $i \
-              [expr { $i * exp(-$i) * $ei }] \
-              [expr { $i * exp($i) * $e1 }]]
-
-}
-puts {}
-for {set ooi 0.1} { $ooi > 0.0046 } { set ooi [expr { $ooi - 0.005 }] } {
-    set i [expr { 1.0 / $ooi }]
-    set ri [expr { round($i) }]
-    set ei [exponential_Ei $i]
-    set e1 [expr { - [exponential_Ei [expr { - $i }]] }]
-    puts [format "%9.6f\t%.10g\t%.10g\t%d" $i \
-              [expr { $i * exp(-$i) * $ei }] \
-              [expr { $i * exp($i) * $e1 }] \
-              $ri]
-}
-puts {}
-
-# Reproduce table 5.4 from Abramowitz and Stegun
-
-for { set x 0.00 } { $x < 0.505 } { set x [expr { $x + 0.01 }] } {
-    set line [format %4.2f $x]
-    if { $x == 0.00 } {
-        append line { } 1.0000000
-    } else {
-        append line { } [format %9.7f \
-                             [expr { [exponential_En 2 $x] - $x * log($x) }]]
-    }
-    foreach n { 3 4 10 20 } {
-        append line { } [format %9.7f [exponential_En $n $x]]
-    }
-    puts $line
-}
-puts {}
-for { set x 0.50 } { $x < 2.005 } { set x [expr { $x + 0.01 }] } {
-    set line [format %4.2f $x]
-    foreach n { 2 3 4 10 20 } {
-        append line { } [format %9.7f [exponential_En $n $x]]
-    }
-    puts $line
-}
-puts {}
-
-for { set oox 0.5 } { $oox > 0.1025 } { set oox [expr { $oox - 0.05 }] } {
-    set line [format %4.2f $oox]
-    set x [expr { 1.0 / $oox }]
-    set rx [expr { round( $x ) }]
-    foreach n { 2 3 4 10 20 } {
-        set en [exponential_En $n [expr { 1.0 / $oox }]]
-        append line { } [format %9.7f [expr { ( $x + $n ) * exp($x) * $en }]]
-    }
-    append line { } [format %3d $rx]
-    puts $line
-}
-for { set oox 0.10 } { $oox > 0.005 } { set oox [expr { $oox - 0.01 }] } {
-    set line [format %4.2f $oox]
-    set x [expr { 1.0 / $oox }]
-    set rx [expr { round( $x ) }]
-    foreach n { 2 3 4 10 20 } {
-        set en [exponential_En $n $x]
-        append line { } [format %9.7f [expr { ( $x + $n ) * exp($x) * $en }]]
-    }
-    append line { } [format %3d $rx]
-    puts $line
-}
-puts {}
-catch {exponential_Ei 0.0} result; puts $result
-}
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/fourier.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/fourier.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,376 +1,0 @@
-# fourier.tcl --
-#    Package for discrete (ordinary) and fast fourier transforms
-#
-# Author: Lars Hellstrom (...)
-#
-# The two top-level procedures defined are
-#
-#          dft data-list
-#          inverse_dft data-list
-#
-# which take a list of complex numbers and apply a Discrete Fourier
-# Transform (DFT) or its inverse respectively to these lists of numbers.
-# A "complex number" in this case is either (i) a pair (two element
-# list) of numbers, interpreted as the real and imaginary parts of the
-# complex number, or (ii) a single number, interpreted as the real
-# part of a complex number whose imaginary part is zero. The return
-# value is always in the first format. (The DFT generally produces
-# complex results even if the input is purely real.) Applying first
-# one and then the other of these procedures to a list of complex
-# numbers will (modulo rounding errors due to floating point
-# arithmetic) return the original list of numbers.
-#
-# If the input length N is a power of two then these procedures will
-# utilize the O(N log N) Fast Fourier Transform algorithm. If input
-# length is not a power of two then the DFT will instead be computed
-# using a the naive quadratic algorithm.
-#
-# Some examples:
-#
-#   % dft {1 2 3 4}
-#   {10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}
-#   % inverse_dft {{10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}}
-#   {1.0 0.0} {2.0 0.0} {3.0 0.0} {4.0 0.0}
-#   % dft {1 2 3 4 5}
-#   {15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}
-#   % inverse_dft {{15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}}
-#   {1.0 0.0} {2.0 8.881784197e-17} {3.0 4.4408920985e-17} {4.0 4.4408920985e-17} {5.0 -8.881784197e-17}
-                                   #
-# In the last case, the imaginary parts <1e-16 would have been zero in
-# exact arithmetic, but aren't here due to rounding errors.
-#
-# Internally, the procedures use a flat list format where every even
-# index element of a list is a real part and every odd index element is
-# an imaginary part. This is reflected in the variable names by Re_ and
-# Im_ prefixes.
-#
-
-namespace eval ::math::fourier {
-   #::math::constants pi
-
-   namespace export dft inverse_dft lowpass highpass
-}
-
-# dft --
-#     Return the discrete fourier transform as a list of complex numbers
-#
-# Arguments:
-#     in_data     List of data (either real or complex)
-# Returns:
-#     List of complex amplitudes for the Fourier components
-# Note:
-#     The procedure uses an ordinary DFT if the number of data is
-#     not a power of 2, otherwise it uses FFT.
-#
-proc ::math::fourier::dft {in_data} {
-    # First convert to internal format
-    set dataL [list]
-    set n 0
-    foreach datum $in_data {
-        if {[llength $datum] == 1} then {
-            lappend dataL $datum 0.0
-        } else {
-            lappend dataL [lindex $datum 0] [lindex $datum 1]
-        }
-        incr n
-    }
-
-    # Then compute a list of n'th roots of unity (explanation below)
-    set rootL [DFT_make_roots $n -1]
-
-    # Check if the input length is a power of two.
-    set p 1
-    while {$p < $n} {set p [expr {$p << 1}]}
-    # By construction, $p is a power of two. If $n==$p then $n is too.
-
-    # Finally compute the transform using Fast_DFT or Slow_DFT,
-    # and convert back to the input format.
-    set res [list]
-    foreach {Re Im} [
-        if {$p == $n} then {
-            Fast_DFT $dataL $rootL
-        } else {
-            Slow_DFT $dataL $rootL
-        }
-    ] {
-        lappend res [list $Re $Im]
-    }
-    return $res
-}
-
-# inverse_dft --
-#     Invert the discrete fourier transform and return the restored data
-#     as complex numbers
-#
-# Arguments:
-#     in_data     List of fourier coefficients (either real or complex)
-# Returns:
-#     List of complex amplitudes for the Fourier components
-# Note:
-#     The procedure uses an ordinary DFT if the number of data is
-#     not a power of 2, otherwise it uses FFT.
-#
-proc ::math::fourier::inverse_dft {in_data} {
-    # First convert to internal format
-    set dataL [list]
-    set n 0
-    foreach datum $in_data {
-        if {[llength $datum] == 1} then {
-            lappend dataL $datum 0.0
-        } else {
-            lappend dataL [lindex $datum 0] [lindex $datum 1]
-        }
-        incr n
-    }
-
-    # Then compute a list of n'th roots of unity (explanation below)
-    set rootL [DFT_make_roots $n 1]
-
-    # Check if the input length is a power of two.
-    set p 1
-    while {$p < $n} {set p [expr {$p << 1}]}
-    # By construction, $p is a power of two. If $n==$p then $n is too.
-
-    # Finally compute the transform using Fast_DFT or Slow_DFT,
-    # divide by input data length to correct the amplitudes,
-    # and convert back to the input format.
-    set res [list]
-    foreach {Re Im} [
-        # $p is power of two. If $n==$p then $n is too.
-        if {$p == $n} then {
-            Fast_DFT $dataL $rootL
-        } else {
-            Slow_DFT $dataL $rootL
-        }
-    ] {
-        lappend res [list [expr {$Re/$n}] [expr {$Im/$n}]]
-    }
-    return $res
-}
-
-# DFT_make_roots --
-#     Return a list of the complex roots of unity or of -1
-#
-# Arguments:
-#     n           Order of the roots
-#     sign        Whether to use 1 or -1 (for inverse transform)
-# Returns:
-#     List of complex roots of unity or -1
-#
-proc ::math::fourier::DFT_make_roots {n sign} {
-    set res [list]
-    for {set k 0} {2*$k < $n} {incr k} {
-        set alpha [expr {2*3.1415926535897931*$sign*$k/$n}]
-        lappend res [expr {cos($alpha)}] [expr {sin($alpha)}]
-    }
-    return $res
-}
-
-# Fast_DFT --
-#     Perform the fast Fourier transform
-#
-# Arguments:
-#     dataL       List of data
-#     rootL       Roots of unity or -1 to use in the transform
-# Returns:
-#     List of complex numbers
-#
-proc ::math::fourier::Fast_DFT {dataL rootL} {
-    if {[llength $dataL] == 8} then {
-        foreach {Re_z0 Im_z0 Re_z1 Im_z1 Re_z2 Im_z2 Re_z3 Im_z3} $dataL {break}
-        if {[lindex $rootL 3] > 0} then {
-            return [list\
-              [expr {$Re_z0 + $Re_z1 + $Re_z2 + $Re_z3}] [expr {$Im_z0 + $Im_z1 + $Im_z2 + $Im_z3}]\
-              [expr {$Re_z0 - $Im_z1 - $Re_z2 + $Im_z3}] [expr {$Im_z0 + $Re_z1 - $Im_z2 - $Re_z3}]\
-              [expr {$Re_z0 - $Re_z1 + $Re_z2 - $Re_z3}] [expr {$Im_z0 - $Im_z1 + $Im_z2 - $Im_z3}]\
-              [expr {$Re_z0 + $Im_z1 - $Re_z2 - $Im_z3}] [expr {$Im_z0 - $Re_z1 - $Im_z2 + $Re_z3}]]
-        } else {
-            return [list\
-              [expr {$Re_z0 + $Re_z1 + $Re_z2 + $Re_z3}] [expr {$Im_z0 + $Im_z1 + $Im_z2 + $Im_z3}]\
-              [expr {$Re_z0 + $Im_z1 - $Re_z2 - $Im_z3}] [expr {$Im_z0 - $Re_z1 - $Im_z2 + $Re_z3}]\
-              [expr {$Re_z0 - $Re_z1 + $Re_z2 - $Re_z3}] [expr {$Im_z0 - $Im_z1 + $Im_z2 - $Im_z3}]\
-              [expr {$Re_z0 - $Im_z1 - $Re_z2 + $Im_z3}] [expr {$Im_z0 + $Re_z1 - $Im_z2 - $Re_z3}]]
-        }
-    } elseif {[llength $dataL] > 8} then {
-        set evenL [list]
-        set oddL [list]
-        foreach {Re_z0 Im_z0 Re_z1 Im_z1} $dataL {
-            lappend evenL $Re_z0 $Im_z0
-            lappend oddL $Re_z1 $Im_z1
-        }
-        set squarerootL [list]
-        foreach {Re_omega0 Im_omega0 Re_omega1 Im_omega1} $rootL {
-            lappend squarerootL $Re_omega0 $Im_omega0
-        }
-        set lowL [list]
-        set highL [list]
-        foreach\
-          {Re_y0 Im_y0}       [Fast_DFT $evenL $squarerootL]\
-          {Re_y1 Im_y1}       [Fast_DFT $oddL $squarerootL]\
-          {Re_omega Im_omega} $rootL {
-            set Re_y1t [expr {$Re_y1 * $Re_omega - $Im_y1 * $Im_omega}]
-            set Im_y1t [expr {$Im_y1 * $Re_omega + $Re_y1 * $Im_omega}]
-            lappend lowL  [expr {$Re_y0 + $Re_y1t}] [expr {$Im_y0 + $Im_y1t}]
-            lappend highL [expr {$Re_y0 - $Re_y1t}] [expr {$Im_y0 - $Im_y1t}]
-        }
-        return [concat $lowL $highL]
-    } elseif {[llength $dataL] == 4} then {
-        foreach {Re_z0 Im_z0 Re_z1 Im_z1} $dataL {break}
-        return [list\
-          [expr {$Re_z0 + $Re_z1}] [expr {$Im_z0 + $Im_z1}]\
-          [expr {$Re_z0 - $Re_z1}] [expr {$Im_z0 - $Im_z1}]]
-    } else {
-        return $dataL
-    }
-}
-
-# Slow_DFT --
-#     Perform the ordinary discrete (slow) Fourier transform
-#
-# Arguments:
-#     dataL       List of data
-#     rootL       Roots of unity or -1 to use in the transform
-# Returns:
-#     List of complex numbers
-#
-proc ::math::fourier::Slow_DFT {dataL rootL} {
-    set n [expr {[llength $dataL] / 2}]
-
-    # The missing roots are computed by complex conjugating the given
-    # roots. If $n is even then -1 is also needed; it is inserted explicitly.
-    set k [llength $rootL]
-    if {$n % 2 == 0} then {
-        lappend rootL -1.0 0.0
-    }
-    for {incr k -2} {$k > 0} {incr k -2} {
-        lappend rootL [lindex $rootL $k]\
-          [expr {-[lindex $rootL [expr {$k+1}]]}]
-    }
-
-    # This is strictly following the naive formula.
-    # The product jk is kept as a separate counter variable.
-    set res [list]
-    for {set k 0} {$k < $n} {incr k} {
-        set Re_sum 0.0
-        set Im_sum 0.0
-        set jk 0
-        foreach {Re_z Im_z} $dataL {
-            set Re_omega [lindex $rootL [expr {2*$jk}]]
-            set Im_omega [lindex $rootL [expr {2*$jk+1}]]
-            set Re_sum [expr {$Re_sum +
-              $Re_z * $Re_omega - $Im_z * $Im_omega}]
-            set Im_sum [expr {$Im_sum +
-              $Im_z * $Re_omega + $Re_z * $Im_omega}]
-            incr jk $k
-            if {$jk >= $n} then {set jk [expr {$jk - $n}]}
-        }
-        lappend res $Re_sum $Im_sum
-    }
-    return $res
-}
-
-# lowpass --
-#     Apply a low-pass filter to the Fourier transform
-#
-# Arguments:
-#     cutoff      Cut-off frequency
-#     in_data     Input transform (complex data)
-# Returns:
-#     Filtered transform
-#
-proc ::math::fourier::lowpass {cutoff in_data} {
-    package require math::complexnumbers
-
-    set res    [list]
-    set cutoff [list $cutoff 0.0]
-    set f      0.0
-    foreach a $in_data {
-       set an [::math::complexnumbers::/ $a \
-                  [::math::complexnumbers::+ {1.0 0.0} \
-                      [::math::complexnumbers::/ [list 0.0 $f] $cutoff]]]
-       lappend res $an
-       set f [expr {$f+1.0}]
-    }
-
-    return $res
-}
-
-# highpass --
-#     Apply a high-pass filter to the Fourier transform
-#
-# Arguments:
-#     cutoff      Cut-off frequency
-#     in_data     Input transform (complex data)
-# Returns:
-#     Filtered transform (high-pass)
-#
-proc ::math::fourier::highpass {cutoff in_data} {
-    package require math::complexnumbers
-
-    set res    [list]
-    set cutoff [list $cutoff 0.0]
-    set f      0.0
-    foreach a $in_data {
-       set ff [::math::complexnumbers::/ [list 0.0 $f] $cutoff]
-       set an [::math::complexnumbers::/ $ff \
-                  [::math::complexnumbers::+ {1.0 0.0} $ff]]
-       lappend res $an
-       set f [expr {$f+1.0}]
-    }
-
-    return $res
-}
-
-#
-# Announce the package
-#
-package provide math::fourier 1.0.2
-
-# test --
-#
-proc test_dft {points {real 0} {iterations 20}} {
-    set in_dataL [list]
-    for {set k 0} {$k < $points} {incr k} {
-        if {$real} then {
-            lappend in_dataL [expr {2*rand()-1}]
-        } else {
-            lappend in_dataL [list [expr {2*rand()-1}] [expr {2*rand()-1}]]
-        }
-    }
-    set time1 [time {
-        set conv_dataL [::math::fourier::dft $in_dataL]
-    } $iterations]
-    set time2 [time {
-        set out_dataL [::math::fourier::inverse_dft $conv_dataL]
-    } $iterations]
-    set err 0.0
-    foreach iz $in_dataL oz $out_dataL {
-        if {$real} then {
-            foreach {o1 o2} $oz {break}
-            set err [expr {$err + ($i-$o1)*($i-$o1) + $o2*$o2}]
-        } else {
-            foreach i $iz o $oz {
-                set err [expr {$err + ($i-$o)*($i-$o)}]
-            }
-        }
-    }
-    return [format "Forward: %s\nInverse: %s\nAverage error: %g"\
-      $time1 $time2 [expr {sqrt($err/$points)}]]
-}
-
-# Note:
-# Add simple filters
-
-if { 0 } {
-puts [::math::fourier::dft {1 2 3 4}]
-puts [::math::fourier::inverse_dft {{10 0.0} {-2.0 2.0} {-2 0.0} {-2.0 -2.0}}]
-puts [::math::fourier::dft {1 2 3 4 5}]
-puts [::math::fourier::inverse_dft {{15.0 0.0} {-2.5 3.44095480118} {-2.5 0.812299240582} {-2.5 -0.812299240582} {-2.5 -3.44095480118}}]
-puts [test_dft 10]
-puts [test_dft 16]
-puts [test_dft 100]
-puts [test_dft 128]
-
-puts [::math::fourier::dft {1 2 3 4}]
-puts [::math::fourier::lowpass 1.5 [::math::fourier::dft {1 2 3 4}]]
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/fuzzy.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/fuzzy.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,176 +1,0 @@
-# fuzzy.tcl --
-#
-#    Script to define tolerant floating-point comparisons
-#    (Tcl-only version)
-#
-#    version 0.2: improved and extended, march 2002
-
-package provide math::fuzzy 0.2
-
-namespace eval ::math::fuzzy {
-   variable eps3 2.2e-16
-
-   namespace export teq tne tge tgt tle tlt tfloor tceil tround troundn
-
-# DetermineTolerance
-#    Determine the epsilon value
-#
-# Arguments:
-#    None
-#
-# Result:
-#    None
-#
-# Side effects:
-#    Sets variable eps3
-#
-proc DetermineTolerance { } {
-   variable eps3
-   set eps 1.0
-   while { [expr {1.0+$eps}] != 1.0 } {
-      set eps3 [expr 3.0*$eps]
-      set eps  [expr 0.5*$eps]
-   }
-   #set check [expr {1.0+2.0*$eps}]
-   #puts "Eps3: $eps3 ($eps) ([expr {1.0-$check}] [expr 1.0-$check]"
-}
-
-# Absmax --
-#    Return the absolute maximum of two numbers
-#
-# Arguments:
-#    first      First number
-#    second     Second number
-#
-# Result:
-#    Maximum of the absolute values
-#
-proc Absmax { first second } {
-   return [expr {abs($first) > abs($second)? abs($first) : abs($second)}]
-}
-
-# teq, tne, tge, tgt, tle, tlt --
-#    Compare two floating-point numbers and return the logical result
-#
-# Arguments:
-#    first      First number
-#    second     Second number
-#
-# Result:
-#    1 if the condition holds, 0 if not.
-#
-proc teq { first second } {
-   variable eps3
-   set scale [Absmax $first $second]
-   return [expr {abs($first-$second) <= $eps3 * $scale}]
-}
-
-proc tne { first second } {
-   variable eps3
-
-   return [expr {![teq $first $second]}]
-}
-
-proc tgt { first second } {
-   variable eps3
-   set scale [Absmax $first $second]
-   return [expr {($first-$second) > $eps3 * $scale}]
-}
-
-proc tle { first second } {
-   return [expr {![tgt $first $second]}]
-}
-
-proc tlt { first second } {
-   if { [tgt $first $second] } {
-      return 1
-   } else {
-      return [tne $first $second]
-   }
-}
-
-proc tge { first second } {
-   if { [tgt $first $second] } {
-      return 1
-   } else {
-      return [teq $first $second]
-   }
-}
-
-# tfloor --
-#    Determine the "floor" of a number and return the result
-#
-# Arguments:
-#    number     Number in question
-#
-# Result:
-#    Largest integer number that is tolerantly smaller than the given
-#    value
-#
-proc tfloor { number } {
-   variable eps3
-
-   set q      [expr {($number < 0.0)? (1.0-$eps3) : 1.0 }]
-   set rmax   [expr {$q / (2.0 - $eps3)}]
-   set eps5   [expr {$eps3/$q}]
-   set vmin1  [expr {$eps5*abs(1.0+floor($number))}]
-   set vmin2  [expr {($rmax < $vmin1)? $rmax : $vmin1}]
-   set vmax   [expr {($eps3 > $vmin2)? $eps3 : $vmin2}]
-   set result [expr {floor($number+$vmax)}]
-   if { $number <= 0.0 || ($result-$number) < $rmax } {
-      return $result
-   } else {
-      return [expr {$result-1.0}]
-   }
-}
-
-# tceil --
-#    Determine the "ceil" of a number and return the result
-#
-# Arguments:
-#    number     Number in question
-#
-# Result:
-#    Smallest integer number that is tolerantly greater than the given
-#    value
-#
-proc tceil { number } {
-   expr {-[tfloor [expr {-$number}]]}
-}
-
-# tround --
-#    Round off a number and return the result
-#
-# Arguments:
-#    number     Number in question
-#
-# Result:
-#    Nearest integer number
-#
-proc tround { number } {
-   tfloor [expr {$number+0.5}]
-}
-
-# troundn --
-#    Round off a number to a given precision and return the result
-#
-# Arguments:
-#    number     Number in question
-#    ndec       Number of decimals to keep
-#
-# Result:
-#    Nearest number with given precision
-#
-proc troundn { number ndec } {
-   set scale   [expr {pow(10.0,$ndec)}]
-   set rounded [tfloor [expr {$number*$scale+0.5}]]
-   expr {$rounded/$scale}
-}
-
-#
-# Determine the tolerance once and for all
-#
-DetermineTolerance
-rename DetermineTolerance {}
-
-} ;# End of namespace
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/geometry.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/geometry.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1093 +1,0 @@
-# geometry.tcl --
-#
-#	Collection of geometry functions.
-#
-# Copyright (c) 2001 by Ideogramic ApS and other parties.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: geometry.tcl,v 1.8 2005/10/04 17:31:23 andreas_kupries Exp $
-
-namespace eval ::math::geometry {
-}
-
-package require math
-
-###
-#
-# POINTS
-#
-#    A point P consists of an x-coordinate, Px, and a y-coordinate, Py,
-#    and both coordinates are floating point values.
-#
-#    Points are usually denoted by A, B, C, P, or Q.
-#
-###
-#
-# LINES
-#
-#    There are basically three types of lines:
-#         line           A line is defined by two points A and B as the
-#                        _infinite_ line going through these two points.
-#                        Often a line is given as a list of 4 coordinates
-#                        instead of 2 points.
-#         line segment   A line segment is defined by two points A and B
-#                        as the _finite_ that starts in A and ends in B.
-#                        Often a line segment is given as a list of 4
-#                        coordinates instead of 2 points.
-#         polyline       A polyline is a sequence of connected line segments.
-#
-#    Please note that given a point P, the closest point on a line is given
-#    by the projection of P onto the line. The closest point on a line segment
-#    may be the projection, but it may also be one of the end points of the
-#    line segment.
-#
-###
-#
-# DISTANCES
-#
-#    The distances in this package are all floating point values.
-#
-###
-
-
-
-# ::math::geometry::calculateDistanceToLine
-#
-#       Calculate the distance between a point and a line.
-#
-# Arguments:
-#       P             a point
-#       line          a line
-#
-# Results:
-#       dist          the smallest distance between P and the line
-#
-# Examples:
-#     - calculateDistanceToLine {5 10} {0 0 10 10}
-#       Result: 3.53553390593
-#     - calculateDistanceToLine {-10 0} {0 0 10 10}
-#       Result: 7.07106781187
-#
-proc ::math::geometry::calculateDistanceToLine {P line} {
-    # solution based on FAQ 1.02 on comp.graphics.algorithms
-    # L = sqrt( (Bx-Ax)^2 + (By-Ay)^2 )
-    #     (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
-    # s = -----------------------------
-    #                 L^2
-    # dist = |s|*L
-    #
-    # =>
-    #
-    #        | (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay) |
-    # dist = ---------------------------------
-    #                       L
-    set Ax [lindex $line 0]
-    set Ay [lindex $line 1]
-    set Bx [lindex $line 2]
-    set By [lindex $line 3]
-    set Cx [lindex $P 0]
-    set Cy [lindex $P 1]
-    if {$Ax==$Bx && $Ay==$By} {
-	return [lengthOfPolyline [concat $P [lrange $line 0 1]]]
-    } else {
-	set L [expr {sqrt(pow($Bx-$Ax,2) + pow($By-$Ay,2))}]
-	return [expr {abs(($Ay-$Cy)*($Bx-$Ax)-($Ax-$Cx)*($By-$Ay)) / $L}]
-    }
-}
-
-# ::math::geometry::findClosestPointOnLine
-#
-#       Return the point on a line which is closest to a given point.
-#
-# Arguments:
-#       P             a point
-#       line          a line
-#
-# Results:
-#       Q             the point on the line that has the smallest
-#                     distance to P
-#
-# Examples:
-#     - findClosestPointOnLine {5 10} {0 0 10 10}
-#       Result: 7.5 7.5
-#     - findClosestPointOnLine {-10 0} {0 0 10 10}
-#       Result: -5.0 -5.0
-#
-proc ::math::geometry::findClosestPointOnLine {P line} {
-    return [lindex [findClosestPointOnLineImpl $P $line] 0]
-}
-
-# ::math::geometry::findClosestPointOnLineImpl
-#
-#       PRIVATE FUNCTION USED BY OTHER FUNCTIONS.
-#       Find the point on a line that is closest to a given point.
-#
-# Arguments:
-#       P             a point
-#       line          a line defined by points A and B
-#
-# Results:
-#       Q             the point on the line that has the smallest
-#                     distance to P
-#       r             r has the following meaning:
-#                        r=0      P = A
-#                        r=1      P = B
-#                        r<0      P is on the backward extension of AB
-#                        r>1      P is on the forward extension of AB
-#                        0<r<1    P is interior to AB
-#
-proc ::math::geometry::findClosestPointOnLineImpl {P line} {
-    # solution based on FAQ 1.02 on comp.graphics.algorithms
-    #   L = sqrt( (Bx-Ax)^2 + (By-Ay)^2 )
-    #        (Cx-Ax)(Bx-Ax) + (Cy-Ay)(By-Ay)
-    #   r = -------------------------------
-    #                     L^2
-    #   Px = Ax + r(Bx-Ax)
-    #   Py = Ay + r(By-Ay)
-    set Ax [lindex $line 0]
-    set Ay [lindex $line 1]
-    set Bx [lindex $line 2]
-    set By [lindex $line 3]
-    set Cx [lindex $P 0]
-    set Cy [lindex $P 1]
-    if {$Ax==$Bx && $Ay==$By} {
-	return [list [list $Ax $Ay] 0]
-    } else {
-	set L [expr {sqrt(pow($Bx-$Ax,2) + pow($By-$Ay,2))}]
-	set r [expr {(($Cx-$Ax)*($Bx-$Ax) + ($Cy-$Ay)*($By-$Ay))/pow($L,2)}]
-	set Px [expr {$Ax + $r*($Bx-$Ax)}]
-	set Py [expr {$Ay + $r*($By-$Ay)}]
-	return [list [list $Px $Py] $r]
-    }
-}
-
-# ::math::geometry::calculateDistanceToLineSegment
-#
-#       Calculate the distance between a point and a line segment.
-#
-# Arguments:
-#       P             a point
-#       linesegment   a line segment
-#
-# Results:
-#       dist          the smallest distance between P and any point
-#                     on the line segment
-#
-# Examples:
-#     - calculateDistanceToLineSegment {5 10} {0 0 10 10}
-#       Result: 3.53553390593
-#     - calculateDistanceToLineSegment {-10 0} {0 0 10 10}
-#       Result: 10.0
-#
-proc ::math::geometry::calculateDistanceToLineSegment {P linesegment} {
-    set result [calculateDistanceToLineSegmentImpl $P $linesegment]
-    set distToLine [lindex $result 0]
-    set r [lindex $result 1]
-    if {$r<0} {
-	return [lengthOfPolyline [concat $P [lrange $linesegment 0 1]]]
-    } elseif {$r>1} {
-	return [lengthOfPolyline [concat $P [lrange $linesegment 2 3]]]
-    } else {
-	return $distToLine
-    }
-}
-
-# ::math::geometry::calculateDistanceToLineSegmentImpl
-#
-#       PRIVATE FUNCTION USED BY OTHER FUNCTIONS.
-#       Find the distance between a point and a line.
-#
-# Arguments:
-#       P             a point
-#       linesegment   a line segment A->B
-#
-# Results:
-#       dist          the smallest distance between P and the line
-#       r             r has the following meaning:
-#                        r=0      P = A
-#                        r=1      P = B
-#                        r<0      P is on the backward extension of AB
-#                        r>1      P is on the forward extension of AB
-#                        0<r<1    P is interior to AB
-#
-proc ::math::geometry::calculateDistanceToLineSegmentImpl {P linesegment} {
-    # solution based on FAQ 1.02 on comp.graphics.algorithms
-    # L = sqrt( (Bx-Ax)^2 + (By-Ay)^2 )
-    #     (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
-    # s = -----------------------------
-    #                 L^2
-    #      (Cx-Ax)(Bx-Ax) + (Cy-Ay)(By-Ay)
-    # r = -------------------------------
-    #                   L^2
-    # dist = |s|*L
-    #
-    # =>
-    #
-    #        | (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay) |
-    # dist = ---------------------------------
-    #                       L
-    set Ax [lindex $linesegment 0]
-    set Ay [lindex $linesegment 1]
-    set Bx [lindex $linesegment 2]
-    set By [lindex $linesegment 3]
-    set Cx [lindex $P 0]
-    set Cy [lindex $P 1]
-    if {$Ax==$Bx && $Ay==$By} {
-	return [list [lengthOfPolyline [concat $P [lrange $linesegment 0 1]]] 0]
-    } else {
-	set L [expr {sqrt(pow($Bx-$Ax,2) + pow($By-$Ay,2))}]
-	set r [expr {(($Cx-$Ax)*($Bx-$Ax) + ($Cy-$Ay)*($By-$Ay))/pow($L,2)}]
-	return [list [expr {abs(($Ay-$Cy)*($Bx-$Ax)-($Ax-$Cx)*($By-$Ay)) / $L}] $r]
-    }
-}
-
-# ::math::geometry::findClosestPointOnLineSegment
-#
-#       Return the point on a line segment which is closest to a given point.
-#
-# Arguments:
-#       P             a point
-#       linesegment   a line segment
-#
-# Results:
-#       Q             the point on the line segment that has the
-#                     smallest distance to P
-#
-# Examples:
-#     - findClosestPointOnLineSegment {5 10} {0 0 10 10}
-#       Result: 7.5 7.5
-#     - findClosestPointOnLineSegment {-10 0} {0 0 10 10}
-#       Result: 0 0
-#
-proc ::math::geometry::findClosestPointOnLineSegment {P linesegment} {
-    set result [findClosestPointOnLineImpl $P $linesegment]
-    set Q [lindex $result 0]
-    set r [lindex $result 1]
-    if {$r<0} {
-	return [lrange $linesegment 0 1]
-    } elseif {$r>1} {
-	return [lrange $linesegment 2 3]
-    } else {
-	return $Q
-    }
-
-}
-
-# ::math::geometry::calculateDistanceToPolyline
-#
-#       Calculate the distance between a point and a polyline.
-#
-# Arguments:
-#       P           a point
-#       polyline    a polyline
-#
-# Results:
-#       dist        the smallest distance between P and any point
-#                   on the polyline
-#
-# Examples:
-#     - calculateDistanceToPolyline {10 10} {0 0 10 5 20 0}
-#       Result: 5.0
-#     - calculateDistanceToPolyline {5 10} {0 0 10 5 20 0}
-#       Result: 6.7082039325
-#
-proc ::math::geometry::calculateDistanceToPolyline {P polyline} {
-    set minDist "none"
-    foreach {Ax Ay} [lrange $polyline 0 end-2] {Bx By} [lrange $polyline 2 end] {
-	set dist [calculateDistanceToLineSegment $P [list $Ax $Ay $Bx $By]]
-	if {$minDist=="none" || $dist < $minDist} {
-	    set minDist $dist
-	}
-    }
-    return $minDist
-}
-
-# ::math::geometry::findClosestPointOnPolyline
-#
-#       Return the point on a polyline which is closest to a given point.
-#
-# Arguments:
-#       P           a point
-#       polyline    a polyline
-#
-# Results:
-#       Q           the point on the polyline that has the smallest
-#                   distance to P
-#
-# Examples:
-#     - findClosestPointOnPolyline {10 10} {0 0 10 5 20 0}
-#       Result: 10 5
-#     - findClosestPointOnPolyline {5 10} {0 0 10 5 20 0}
-#       Result: 8.0 4.0
-#
-proc ::math::geometry::findClosestPointOnPolyline {P polyline} {
-    set closestPoint "none"
-    foreach {Ax Ay} [lrange $polyline 0 end-2] {Bx By} [lrange $polyline 2 end] {
-	set Q [findClosestPointOnLineSegment $P [list $Ax $Ay $Bx $By]]
-	set dist [lengthOfPolyline [concat $P $Q]]
-	if {$closestPoint=="none" || $dist<$closestDistance} {
-	    set closestPoint $Q
-	    set closestDistance $dist
-	}
-    }
-    return $closestPoint
-}
-
-
-
-
-
-
-# ::math::geometry::lengthOfPolyline
-#
-#       Find the length of a polyline, i.e., the sum of the
-#       lengths of the individual line segments.
-#
-# Arguments:
-#       polyline      a polyline
-#
-# Results:
-#       length        the length of the polyline
-#
-# Examples:
-#     - lengthOfPolyline {0 0 5 0 5 10}
-#       Result: 15.0
-#
-proc ::math::geometry::lengthOfPolyline {polyline} {
-    set length 0
-    foreach {x1 y1} [lrange $polyline 0 end-2] {x2 y2} [lrange $polyline 2 end] {
-	set length [expr {$length + sqrt(pow($x1-$x2,2) + pow($y1-$y2,2))}]
-	#set length [expr {$length + sqrt(($x1-$x2)*($x1-$x2) + ($y1-$y2)*($y1-$y2))}]
-    }
-    return $length
-}
-
-
-
-
-# ::math::geometry::movePointInDirection
-#
-#       Move a point in a given direction.
-#
-# Arguments:
-#       P             the starting point
-#       direction     the direction from P
-#                     The direction is in 360-degrees going counter-clockwise,
-#                     with "straight right" being 0 degrees
-#       dist          the distance from P
-#
-# Results:
-#       Q             the point which is found by starting in P and going
-#                     in the given direction, until the distance between
-#                     P and Q is dist
-#
-# Examples:
-#     - movePointInDirection {0 0} 45.0 10
-#       Result: 7.07106781187 7.07106781187
-#
-proc ::math::geometry::movePointInDirection {P direction dist} {
-    set x [lindex $P 0]
-    set y [lindex $P 1]
-    set pi [expr {4*atan(1)}]
-    set xt [expr {$x + $dist*cos(($direction*$pi)/180)}]
-    set yt [expr {$y + $dist*sin(($direction*$pi)/180)}]
-    return [list $xt $yt]
-}
-
-
-# ::math::geometry::angle
-#
-#       Calculates angle from the horizon (0,0)->(1,0) to a line.
-#
-# Arguments:
-#       line          a line defined by two points A and B
-#
-# Results:
-#       angle         the angle between the line (0,0)->(1,0) and (Ax,Ay)->(Bx,By).
-#                     Angle is in 360-degrees going counter-clockwise
-#
-# Examples:
-#     - angle {10 10 15 13}
-#       Result: 30.9637565321
-#
-proc ::math::geometry::angle {line} {
-    set x1 [lindex $line 0]
-    set y1 [lindex $line 1]
-    set x2 [lindex $line 2]
-    set y2 [lindex $line 3]
-    # - handle vertical lines
-    if {$x1==$x2} {if {$y1<$y2} {return 90} else {return 270}}
-    # - handle other lines
-    set a [expr {atan(abs((1.0*$y1-$y2)/(1.0*$x1-$x2)))}] ; # a is between 0 and pi/2
-    set pi [expr {4*atan(1)}]
-    if {$y1<=$y2} {
-	# line is going upwards
-	if {$x1<$x2} {set b $a} else {set b [expr {$pi-$a}]}
-    } else {
-	# line is going downwards
-	if {$x1<$x2} {set b [expr {2*$pi-$a}]} else {set b [expr {$pi+$a}]}
-    }
-    return [expr {$b/$pi*180}] ; # convert b to degrees
-}
-
-
-
-
-###
-#
-# Intersection procedures
-#
-###
-
-# ::math::geometry::lineSegmentsIntersect
-#
-#       Checks whether two line segments intersect.
-#
-# Arguments:
-#       linesegment1  the first line segment
-#       linesegment2  the second line segment
-#
-# Results:
-#       dointersect   a boolean saying whether the line segments intersect
-#                     (i.e., have any points in common)
-#
-# Examples:
-#     - lineSegmentsIntersect {0 0 10 10} {0 10 10 0}
-#       Result: 1
-#     - lineSegmentsIntersect {0 0 10 10} {20 20 20 30}
-#       Result: 0
-#     - lineSegmentsIntersect {0 0 10 10} {10 10 15 15}
-#       Result: 1
-#
-proc ::math::geometry::lineSegmentsIntersect {linesegment1 linesegment2} {
-    # Algorithm based on Sedgewick.
-    set l1x1 [lindex $linesegment1 0]
-    set l1y1 [lindex $linesegment1 1]
-    set l1x2 [lindex $linesegment1 2]
-    set l1y2 [lindex $linesegment1 3]
-    set l2x1 [lindex $linesegment2 0]
-    set l2y1 [lindex $linesegment2 1]
-    set l2x2 [lindex $linesegment2 2]
-    set l2y2 [lindex $linesegment2 3]
-    return [expr {([ccw [list $l1x1 $l1y1] [list $l1x2 $l1y2] [list $l2x1 $l2y1]]\
-	    *[ccw [list $l1x1 $l1y1] [list $l1x2 $l1y2] [list $l2x2 $l2y2]] <= 0) \
-	    && ([ccw [list $l2x1 $l2y1] [list $l2x2 $l2y2] [list $l1x1 $l1y1]]\
-	    *[ccw [list $l2x1 $l2y1] [list $l2x2 $l2y2] [list $l1x2 $l1y2]] <= 0)}]
-}
-
-# ::math::geometry::findLineSegmentIntersection
-#
-#       Returns the intersection point of two line segments.
-#       Note: may also return "coincident" and "none".
-#
-# Arguments:
-#       linesegment1  the first line segment
-#       linesegment2  the second line segment
-#
-# Results:
-#       P             the intersection point of linesegment1 and linesegment2.
-#                     If linesegment1 and linesegment2 have an infinite number
-#                     of points in common, the procedure returns "coincident".
-#                     If there are no intersection points, the procedure
-#                     returns "none".
-#
-# Examples:
-#     - findLineSegmentIntersection {0 0 10 10} {0 10 10 0}
-#       Result: 5.0 5.0
-#     - findLineSegmentIntersection {0 0 10 10} {20 20 20 30}
-#       Result: none
-#     - findLineSegmentIntersection {0 0 10 10} {10 10 15 15}
-#       Result: 10.0 10.0
-#     - findLineSegmentIntersection {0 0 10 10} {5 5 15 15}
-#       Result: coincident
-#
-proc ::math::geometry::findLineSegmentIntersection {linesegment1 linesegment2} {
-    if {[lineSegmentsIntersect $linesegment1 $linesegment2]} {
-	set lineintersect [findLineIntersection $linesegment1 $linesegment2]
-	switch -- $lineintersect {
-
-	    "coincident" {
-		# lines are coincident
-		set l1x1 [lindex $linesegment1 0]
-		set l1y1 [lindex $linesegment1 1]
-		set l1x2 [lindex $linesegment1 2]
-		set l1y2 [lindex $linesegment1 3]
-		set l2x1 [lindex $linesegment2 0]
-		set l2y1 [lindex $linesegment2 1]
-		set l2x2 [lindex $linesegment2 2]
-		set l2y2 [lindex $linesegment2 3]
-		# check if the line SEGMENTS overlap
-		# (NOT enough to check if the x-intervals overlap (vertical lines!))
-		set overlapx [intervalsOverlap $l1x1 $l1x2 $l2x1 $l2x2 0]
-		set overlapy [intervalsOverlap $l1y1 $l1y2 $l2y1 $l2y2 0]
-		if {$overlapx && $overlapy} {
-		    return "coincident"
-		} else {
-		    return "none"
-		}
-	    }
-
-	    "none" {
-		# should never happen, because we call "lineSegmentsIntersect" first
-		puts stderr "::math::geometry::findLineSegmentIntersection: suddenly no intersection?"
-		return "none"
-	    }
-
-	    default {
-		# lineintersect = the intersection point
-		return $lineintersect
-	    }
-	}
-    } else {
-	return "none"
-    }
-}
-
-# ::math::geometry::findLineIntersection {line1 line2}
-#
-#       Returns the intersection point of two lines.
-#       Note: may also return "coincident" and "none".
-#
-# Arguments:
-#       line1         the first line
-#       line2         the second line
-#
-# Results:
-#       P             the intersection point of line1 and line2.
-#                     If line1 and line2 have an infinite number of points
-#                     in common, the procedure returns "coincident".
-#                     If there are no intersection points, the procedure
-#                     returns "none".
-#
-# Examples:
-#     - findLineIntersection {0 0 10 10} {0 10 10 0}
-#       Result: 5.0 5.0
-#     - findLineIntersection {0 0 10 10} {20 20 20 30}
-#       Result: 20.0 20.0
-#     - findLineIntersection {0 0 10 10} {10 10 15 15}
-#       Result: coincident
-#     - findLineIntersection {0 0 10 10} {5 5 15 15}
-#       Result: coincident
-#     - findLineIntersection {0 0 10 10} {0 1 10 11}
-#       Result: none
-#
-proc ::math::geometry::findLineIntersection {line1 line2} {
-    set l1x1 [lindex $line1 0]
-    set l1y1 [lindex $line1 1]
-    set l1x2 [lindex $line1 2]
-    set l1y2 [lindex $line1 3]
-    set l2x1 [lindex $line2 0]
-    set l2y1 [lindex $line2 1]
-    set l2x2 [lindex $line2 2]
-    set l2y2 [lindex $line2 3]
-
-    # Is one of the lines vertical?
-    if {$l1x1==$l1x2 || $l2x1==$l2x2} {
-	# One of the lines is vertical
-	if {$l1x1==$l1x2 && $l2x1==$l2x2} {
-	    # both lines are vertical
-	    if {$l1x1==$l2x1} {
-		return "coincident"
-	    } else {
-		return "none"
-	    }
-	}
-
-	# make sure line1 is a vertical line
-	if {$l1x1!=$l1x2} {
-	    # interchange line 1 and 2
-	    set l1x1 [lindex $line2 0]
-	    set l1y1 [lindex $line2 1]
-	    set l1x2 [lindex $line2 2]
-	    set l1y2 [lindex $line2 3]
-	    set l2x1 [lindex $line1 0]
-	    set l2y1 [lindex $line1 1]
-	    set l2x2 [lindex $line1 2]
-	    set l2y2 [lindex $line1 3]
-	}
-
-	# get equation of line 2 (y=a*x+b)
-	set a [expr {1.0*($l2y2-$l2y1)/($l2x2-$l2x1)}]
-	set b [expr {$l2y1-$a*$l2x1}]
-
-	# Calculate intersection
-	set y [expr {$a*$l1x1+$b}]
-	return [list $l1x1 $y]
-    } else {
-	# None of the lines are vertical
-	# - get equation of line 1 (y=a1*x+b1)
-	set a1 [expr {(1.0*$l1y2-$l1y1)/($l1x2-$l1x1)}]
-	set b1 [expr {$l1y1-$a1*$l1x1}]
-	# - get equation of line 2 (y=a2*x+b2)
-	set a2 [expr {(1.0*$l2y2-$l2y1)/($l2x2-$l2x1)}]
-	set b2 [expr {$l2y1-$a2*$l2x1}]
-	
-	if {abs($a2-$a1) > 0.0001} {
-	    # the lines are not parallel
-	    set x [expr {($b2-$b1)/($a1-$a2)}]
-	    set y [expr {$a1*$x+$b1}]
-	    return [list $x $y]
-	} else {
-	    # the lines are parallel
-	    if {abs($b1-$b2) < 0.00001} {
-		return "coincident"
-	    } else {
-		return "none"
-	    }
-	}
-    }
-}
-
-
-# ::math::geometry::polylinesIntersect
-#
-#       Checks whether two polylines intersect.
-#
-# Arguments;
-#       polyline1     the first polyline
-#       polyline2     the second polyline
-#
-# Results:
-#       dointersect   a boolean saying whether the polylines intersect
-#
-# Examples:
-#     - polylinesIntersect {0 0 10 10 10 20} {0 10 10 0}
-#       Result: 1
-#     - polylinesIntersect {0 0 10 10 10 20} {5 4 10 4}
-#       Result: 0
-#
-proc ::math::geometry::polylinesIntersect {polyline1 polyline2} {
-    return [polylinesBoundingIntersect $polyline1 $polyline2 0]
-}
-
-# ::math::geometry::polylinesBoundingIntersect
-#
-#       Check whether two polylines intersect, but reduce
-#       the correctness of the result to the given granularity.
-#       Use this for faster, but weaker, intersection checking.
-#
-#       How it works:
-#          Each polyline is split into a number of smaller polylines,
-#          consisting of granularity points each. If a pair of those smaller
-#          lines' bounding boxes intersect, then this procedure returns 1,
-#          otherwise it returns 0.
-#
-# Arguments:
-#       polyline1     the first polyline
-#       polyline2     the second polyline
-#       granularity   the number of points in each part-polyline
-#                     granularity<=1 means full correctness
-#
-# Results:
-#       dointersect   a boolean saying whether the polylines intersect
-#
-# Examples:
-#     - polylinesBoundingIntersect {0 0 10 10 10 20} {0 10 10 0} 2
-#       Result: 1
-#     - polylinesBoundingIntersect {0 0 10 10 10 20} {5 4 10 4} 2
-#       Result: 1
-#
-proc ::math::geometry::polylinesBoundingIntersect {polyline1 polyline2 granularity} {
-    if {$granularity<=1} {
-	# Use perfect intersect
-	# => first pin down where an intersection point may be, and then
-	#    call MultilinesIntersectPerfect on those parts
-	set granularity 10 ; # optimal search granularity?
-	set perfectmatch 1
-    } else {
-	set perfectmatch 0
-    }
-
-    # split the lines into parts consisting of $granularity points
-    set polyline1parts {}
-    for {set i 0} {$i<[llength $polyline1]} {incr i [expr {2*$granularity-2}]} {
-	lappend polyline1parts [lrange $polyline1 $i [expr {$i+2*$granularity-1}]]
-    }
-    set polyline2parts {}
-    for {set i 0} {$i<[llength $polyline2]} {incr i [expr {2*$granularity-2}]} {
-	lappend polyline2parts [lrange $polyline2 $i [expr {$i+2*$granularity-1}]]
-    }
-
-    # do any of the parts overlap?
-    foreach part1 $polyline1parts {
-	foreach part2 $polyline2parts {
-	    set part1bbox [bbox $part1]
-	    set part2bbox [bbox $part2]
-	    if {[rectanglesOverlap [lrange $part1bbox 0 1] [lrange $part1bbox 2 3] \
-		    [lrange $part2bbox 0 1] [lrange $part2bbox 2 3] 0]} {
-		# the lines' bounding boxes intersect
-		if {$perfectmatch} {
-		    foreach {l1x1 l1y1} [lrange $part1 0 end-2] {l1x2 l1y2} [lrange $part1 2 end] {
-			foreach {l2x1 l2y1} [lrange $part2 0 end-2] {l2x2 l2y2} [lrange $part2 2 end] {
-			    if {[lineSegmentsIntersect [list $l1x1 $l1y1 $l1x2 $l1y2] \
-				    [list $l2x1 $l2y1 $l2x2 $l2y2]]} {
-				# two line segments overlap
-				return 1
-			    }
-			}
-		    }
-		    return 0
-		} else {
-		    return 1
-		}
-	    }
-	}
-    }
-    return 0
-}
-
-# ::math::geometry::ccw
-#
-#       PRIVATE FUNCTION USED BY OTHER FUNCTIONS.
-#       Returns whether traversing from A to B to C is CounterClockWise
-#       Algorithm by Sedgewick.
-#
-# Arguments:
-#       A             first point
-#       B             second point
-#       C             third point
-#
-# Reeults:
-#       ccw           a boolean saying whether traversing from A to B to C
-#                     is CounterClockWise
-#
-proc ::math::geometry::ccw {A B C} {
-    set Ax [lindex $A 0]
-    set Ay [lindex $A 1]
-    set Bx [lindex $B 0]
-    set By [lindex $B 1]
-    set Cx [lindex $C 0]
-    set Cy [lindex $C 1]
-    set dx1 [expr {$Bx - $Ax}]
-    set dy1 [expr {$By - $Ay}]
-    set dx2 [expr {$Cx - $Ax}]
-    set dy2 [expr {$Cy - $Ay}]
-    if {$dx1*$dy2 > $dy1*$dx2} {return 1}
-    if {$dx1*$dy2 < $dy1*$dx2} {return -1}
-    if {($dx1*$dx2 < 0) || ($dy1*$dy2 < 0)} {return -1}
-    if {($dx1*$dx1 + $dy1*$dy1) < ($dx2*$dx2+$dy2*$dy2)} {return 1}
-    return 0
-}
-
-
-
-
-
-
-
-###
-#
-# Overlap procedures
-#
-###
-
-# ::math::geometry::intervalsOverlap
-#
-#       Check whether two intervals overlap.
-#       Examples:
-#         - (2,4) and (5,3) overlap with strict=0 and strict=1
-#         - (2,4) and (1,2) overlap with strict=0 but not with strict=1
-#
-# Arguments:
-#       y1,y2         the first interval
-#       y3,y4         the second interval
-#       strict        choosing strict or non-strict interpretation
-#
-# Results:
-#       dooverlap     a boolean saying whether the intervals overlap
-#
-# Examples:
-#     - intervalsOverlap 2 4 4 6 1
-#       Result: 0
-#     - intervalsOverlap 2 4 4 6 0
-#       Result: 1
-#     - intervalsOverlap 4 2 3 5 0
-#       Result: 1
-#
-proc ::math::geometry::intervalsOverlap {y1 y2 y3 y4 strict} {
-    if {$y1>$y2} {
-	set temp $y1
-	set y1 $y2
-	set y2 $temp
-    }
-    if {$y3>$y4} {
-	set temp $y3
-	set y3 $y4
-	set y4 $temp
-    }
-    if {$strict} {
-	return [expr {$y2>$y3 && $y4>$y1}]
-    } else {
-	return [expr {$y2>=$y3 && $y4>=$y1}]
-    }
-}
-
-# ::math::geometry::rectanglesOverlap
-#
-#       Check whether two rectangles overlap (see also intervalsOverlap).
-#
-# Arguments:
-#       P1            upper-left corner of the first rectangle
-#       P2            lower-right corner of the first rectangle
-#       Q1            upper-left corner of the second rectangle
-#       Q2            lower-right corner of the second rectangle
-#       strict        choosing strict or non-strict interpretation
-#
-# Results:
-#       dooverlap     a boolean saying whether the rectangles overlap
-#
-# Examples:
-#     - rectanglesOverlap {0 10} {10 0} {10 10} {20 0} 1
-#       Result: 0
-#     - rectanglesOverlap {0 10} {10 0} {10 10} {20 0} 0
-#       Result: 1
-#
-proc ::math::geometry::rectanglesOverlap {P1 P2 Q1 Q2 strict} {
-    set b1x1 [lindex $P1 0]
-    set b1y1 [lindex $P1 1]
-    set b1x2 [lindex $P2 0]
-    set b1y2 [lindex $P2 1]
-    set b2x1 [lindex $Q1 0]
-    set b2y1 [lindex $Q1 1]
-    set b2x2 [lindex $Q2 0]
-    set b2y2 [lindex $Q2 1]
-    # ensure b1x1<=b1x2 etc.
-    if {$b1x1 > $b1x2} {
-	set temp $b1x1
-	set b1x1 $b1x2
-	set b1x2 $temp
-    }
-    if {$b1y1 > $b1y2} {
-	set temp $b1y1
-	set b1y1 $b1y2
-	set b1y2 $temp
-    }
-    if {$b2x1 > $b2x2} {
-	set temp $b2x1
-	set b2x1 $b2x2
-	set b2x2 $temp
-    }
-    if {$b2y1 > $b2y2} {
-	set temp $b2y1
-	set b2y1 $b2y2
-	set b2y2 $temp
-    }
-    # Check if the boxes intersect
-    # (From: Cormen, Leiserson, and Rivests' "Algorithms", page 889)
-    if {$strict} {
-	return [expr {($b1x2>$b2x1) && ($b2x2>$b1x1) \
-		&& ($b1y2>$b2y1) && ($b2y2>$b1y1)}]
-    } else {
-	return [expr {($b1x2>=$b2x1) && ($b2x2>=$b1x1) \
-		&& ($b1y2>=$b2y1) && ($b2y2>=$b1y1)}]
-    }
-}
-
-
-
-# ::math::geometry::bbox
-#
-#       Calculate the bounding box of a polyline.
-#
-# Arguments:
-#       polyline      a polyline
-#
-# Results:
-#       x1,y1,x2,y2   four coordinates where (x1,y1) is the upper-left corner
-#                     of the bounding box, and (x2,y2) is the lower-right corner
-#
-# Examples:
-#     - bbox {0 10 4 1 6 23 -12 5}
-#       Result: -12 1 6 23
-#
-proc ::math::geometry::bbox {polyline} {
-    set minX [lindex $polyline 0]
-    set maxX $minX
-    set minY [lindex $polyline 1]
-    set maxY $minY
-    foreach {x y} $polyline {
-	if {$x < $minX} {set minX $x}
-	if {$x > $maxX} {set maxX $x}
-	if {$y < $minY} {set minY $y}
-	if {$y > $maxY} {set maxY $y}
-    }
-    return [list $minX $minY $maxX $maxY]
-}
-
-
-
-
-
-
-# ::math::geometry::pointInsidePolygon
-#
-#       Determine if a point is completely inside a polygon. If the point
-#       touches the polygon, then the point is not complete inside the
-#       polygon.
-#
-# Arguments:
-#       P             a point
-#       polygon       a polygon
-#
-# Results:
-#       isinside      a boolean saying whether the point is
-#                     completely inside the polygon or not
-#
-# Examples:
-#     - pointInsidePolygon {5 5} {4 4 4 6 6 6 6 4}
-#       Result: 1
-#     - pointInsidePolygon {5 5} {6 6 6 7 7 7}
-#       Result: 0
-#
-proc ::math::geometry::pointInsidePolygon {P polygon} {
-    # check if P is on one of the polygon's sides (if so, P is not
-    # inside the polygon)
-    set closedPolygon [concat $polygon [lrange $polygon 0 1]]
-    foreach {x1 y1} [lrange $closedPolygon 0 end-2] {x2 y2} [lrange $closedPolygon 2 end] {
-	if {[calculateDistanceToLineSegment $P [list $x1 $y1 $x2 $y2]]<0.0000001} {
-	    return 0
-	}
-    }
-
-    # Algorithm
-    #
-    # Consider a straight line going from P to a point far away from both
-    # P and the polygon (in particular outside the polygon).
-    #   - If the line intersects with 0 of the polygon's sides, then
-    #     P must be outside the polygon.
-    #   - If the line intersects with 1 of the polygon's sides, then
-    #     P must be inside the polygon (since the other end of the line
-    #     is outside the polygon).
-    #   - If the line intersects with 2 of the polygon's sides, then
-    #     the line must pass into one polygon area and out of it again,
-    #     and hence P is outside the polygon.
-    #   - In general: if the line intersects with the polygon's sides an odd
-    #     number of times, then P is inside the polygon. Note: we also have
-    #     to check whether the line crosses one of the polygon's
-    #     bend points for the same reason.
-
-    # get point far away and define the line
-    set polygonBbox [bbox $polygon]
-    set pointFarAway [list [expr {[lindex $polygonBbox 0]-1}] [expr {[lindex $polygonBbox 1]-1}]]
-    set infinityLine [concat $pointFarAway $P]
-    # calculate number of intersections
-    set noOfIntersections 0
-    #   1. count intersections between the line and the polygon's sides
-    set closedPolygon [concat $polygon [lrange $polygon 0 1]]
-    foreach {x1 y1} [lrange $closedPolygon 0 end-2] {x2 y2} [lrange $closedPolygon 2 end] {
-	if {[lineSegmentsIntersect $infinityLine [list $x1 $y1 $x2 $y2]]} {
-	    incr noOfIntersections
-	}
-    }
-    #   2. count intersections between the line and the polygon's points
-    foreach {x1 y1} $polygon {
-	if {[calculateDistanceToLineSegment [list $x1 $y1] $infinityLine]<0.0000001} {
-	    incr noOfIntersections
-	}
-    }
-    return [expr {$noOfIntersections % 2}]
-}
-
-
-# ::math::geometry::rectangleInsidePolygon
-#
-#       Determine if a rectangle is completely inside a polygon. If polygon
-#       touches the rectangle, then the rectangle is not complete inside the
-#       polygon.
-#
-# Arguments:
-#       P1            upper-left corner of the rectangle
-#       P2            lower-right corner of the rectangle
-#       polygon       a polygon
-#
-# Results:
-#       isinside      a boolean saying whether the rectangle is
-#                     completely inside the polygon or not
-#
-# Examples:
-#     - rectangleInsidePolygon {0 10} {10 0} {-10 -10 0 11 11 11 11 0}
-#       Result: 1
-#     - rectangleInsidePolygon {0 0} {0 0} {-16 14 5 -16 -16 -25 -21 16 -19 24}
-#       Result: 1
-#     - rectangleInsidePolygon {0 0} {0 0} {2 2 2 4 4 4 4 2}
-#       Result: 0
-#
-proc ::math::geometry::rectangleInsidePolygon {P1 P2 polygon} {
-    # get coordinates of rectangle
-    set bx1 [lindex $P1 0]
-    set by1 [lindex $P1 1]
-    set bx2 [lindex $P2 0]
-    set by2 [lindex $P2 1]
-
-    # if rectangle does not overlap with the bbox of polygon, then the
-    # rectangle cannot be inside the polygon (this is a quick way to
-    # get an answer in many cases)
-    set polygonBbox [bbox $polygon]
-    set polygonP1x [lindex $polygonBbox 0]
-    set polygonP1y [lindex $polygonBbox 1]
-    set polygonP2x [lindex $polygonBbox 2]
-    set polygonP2y [lindex $polygonBbox 3]
-    if {![rectanglesOverlap [list $bx1 $by1] [list $bx2 $by2] \
-	    [list $polygonP1x $polygonP1y] [list $polygonP2x $polygonP2y] 0]} {
-	return 0
-    }
-
-    # 1. if one of the points of the polygon is inside the rectangle,
-    # then the rectangle cannot be inside the polygon
-    foreach {x y} $polygon {
-	if {$bx1<$x && $x<$bx2 && $by1<$y && $y<$by2} {
-	    return 0
-	}
-    }
-
-    # 2. if one of the line segments of the polygon intersect with the
-    # rectangle, then the rectangle cannot be inside the polygon
-    set rectanglePolyline [list $bx1 $by1 $bx2 $by1 $bx2 $by2 $bx1 $by2 $bx1 $by1]
-    set closedPolygon [concat $polygon [lrange $polygon 0 1]]
-    if {[polylinesIntersect $closedPolygon $rectanglePolyline]} {
-	return 0
-    }
-
-    # at this point we know that:
-    #  1. the polygon has no points inside the rectangle
-    #  2. the polygon's sides don't intersect with the rectangle
-    # therefore:
-    #  either the rectangle is (completely) inside the polygon, or
-    #  the rectangle is (completely) outside the polygon
-
-    # final test: if one of the points on the rectangle is inside the
-    # polygon, then the whole rectangle must be inside the rectangle
-    return [pointInsidePolygon [list $bx1 $by1] $polygon]
-}
-
-
-# ::math::geometry::areaPolygon
-#
-#       Determine the area enclosed by a (non-complex) polygon
-#
-# Arguments:
-#       polygon       a polygon
-#
-# Results:
-#       area          the area enclosed by the polygon
-#
-# Examples:
-#     - areaPolygon {-10 -10 10 -10 10 10 -10 10}
-#       Result: 400
-#
-proc ::math::geometry::areaPolygon {polygon} {
-
-    foreach {a1 a2 b1 b2} $polygon {break}
-
-    set area 0.0
-    foreach {c1 c2} [lrange $polygon 4 end] {
-        set area [expr {$area + $b1*$c2 - $b2*$c1}]
-        set b1   $c1
-        set b2   $c2
-    }
-    expr {0.5*abs($area)}
-}
-
-package provide math::geometry 1.0.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/interpolate.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/interpolate.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,653 +1,0 @@
-# interpolate.tcl --
-#
-#    Package for interpolation methods (one- and two-dimensional)
-#
-# Remarks:
-#    None of the methods deal gracefully with missing values
-#
-# To do:
-#    Add cubic splines and B-splines as methods
-#    For spatial interpolation in two dimensions also quadrant method?
-#    Method for destroying a table
-#    Proper documentation
-#    Proper test cases
-#
-# version 0.1: initial implementation, january 2003
-# version 0.2: added linear and Lagrange interpolation, straightforward
-#              spatial interpolation, april 2004
-# version 0.3: added Neville algorithm.
-# version 1.0: added cubic splines, september 2004
-#
-# Copyright (c) 2004 by Arjen Markus. All rights reserved.
-# Copyright (c) 2004 by Kevin B. Kenny.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: interpolate.tcl,v 1.9 2006/09/20 22:16:01 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.4
-package require struct::matrix
-
-# ::math::interpolate --
-#   Namespace holding the procedures and variables
-#
-
-namespace eval ::math::interpolate {
-   variable search_radius {}
-   variable inv_dist_pow  2
-
-   namespace export interp-1d-table interp-table interp-linear \
-                    interp-lagrange
-   namespace export neville
-}
-
-# defineTable --
-#    Define a two-dimensional table of data
-#
-# Arguments:
-#    name     Name of the table to be created
-#    cols     Names of the columns (for convenience and for counting)
-#    values   List of values to fill the table with (must be sorted
-#             w.r.t. first column or first column and first row)
-#
-# Results:
-#    Name of the new command
-#
-# Side effects:
-#    Creates a new command, which is used in subsequent calls
-#
-proc ::math::interpolate::defineTable { name cols values } {
-
-   set table ::math::interpolate::__$name
-   ::struct::matrix $table
-
-   $table add columns [llength $cols]
-   $table add row
-   $table set row 0 $cols
-
-   set row    1
-   set first  0
-   set nocols [llength $cols]
-   set novals [llength $values]
-   while { $first < $novals } {
-      set last [expr {$first+$nocols-1}]
-      $table add row
-      $table set row $row [lrange $values $first $last]
-
-      incr first $nocols
-      incr row
-   }
-
-   return $table
-}
-
-# inter-1d-table --
-#    Interpolate in a one-dimensional table
-#    (first column is independent variable, all others dependent)
-#
-# Arguments:
-#    table    Name of the table
-#    xval     Value of the independent variable
-#
-# Results:
-#    List of interpolated values, including the x-variable
-#
-proc ::math::interpolate::interp-1d-table { table xval } {
-
-   #
-   # Search for the records that enclose the x-value
-   #
-   set xvalues [lrange [$table get column 0] 1 end]
-
-   foreach {row row2} [FindEnclosingEntries $xval $xvalues] break
-
-   set prev_values [$table get row $row]
-   set next_values [$table get row $row2]
-
-   set xprev       [lindex $prev_values 0]
-   set xnext       [lindex $next_values 0]
-
-   if { $row == $row2 } {
-      return [concat $xval [lrange $prev_values 1 end]]
-   } else {
-      set wprev [expr {($xnext-$xval)/($xnext-$xprev)}]
-      set wnext [expr {1.0-$wprev}]
-      set results {}
-      foreach vprev $prev_values vnext $next_values {
-         set vint  [expr {$vprev*$wprev+$vnext*$wnext}]
-         lappend results $vint
-      }
-      return $results
-   }
-}
-
-# interp-table --
-#    Interpolate in a two-dimensional table
-#    (first column and first row are independent variables)
-#
-# Arguments:
-#    table    Name of the table
-#    xval     Value of the independent row-variable
-#    yval     Value of the independent column-variable
-#
-# Results:
-#    Interpolated value
-#
-# Note:
-#    Use bilinear interpolation
-#
-proc ::math::interpolate::interp-table { table xval yval } {
-
-   #
-   # Search for the records that enclose the x-value
-   #
-   set xvalues [lrange [$table get column 0] 2 end]
-
-   foreach {row row2} [FindEnclosingEntries $xval $xvalues] break
-   incr row
-   incr row2
-
-   #
-   # Search for the columns that enclose the y-value
-   #
-   set yvalues [lrange [$table get row 1] 1 end]
-
-   foreach {col col2} [FindEnclosingEntries $yval $yvalues] break
-
-   set yvalues [concat "." $yvalues] ;# Prepend a dummy column!
-
-   set prev_values [$table get row $row]
-   set next_values [$table get row $row2]
-
-   set x1          [lindex $prev_values 0]
-   set x2          [lindex $next_values 0]
-   set y1          [lindex $yvalues     $col]
-   set y2          [lindex $yvalues     $col2]
-
-   set v11         [lindex $prev_values $col]
-   set v12         [lindex $prev_values $col2]
-   set v21         [lindex $next_values $col]
-   set v22         [lindex $next_values $col2]
-
-   #
-   # value = v0 + a*(x-x1) + b*(y-y1) + c*(x-x1)*(y-y1)
-   # if x == x1 and y == y1: value = v11
-   # if x == x1 and y == y2: value = v12
-   # if x == x2 and y == y1: value = v21
-   # if x == x2 and y == y2: value = v22
-   #
-   set a 0.0
-   if { $x1 != $x2 } {
-      set a [expr {($v21-$v11)/($x2-$x1)}]
-   }
-   set b 0.0
-   if { $y1 != $y2 } {
-      set b [expr {($v12-$v11)/($y2-$y1)}]
-   }
-   set c 0.0
-   if { $x1 != $x2 && $y1 != $y2 } {
-      set c [expr {($v11+$v22-$v12-$v21)/($x2-$x1)/($y2-$y1)}]
-   }
-
-   set result \
-   [expr {$v11+$a*($xval-$x1)+$b*($yval-$y1)+$c*($xval-$x1)*($yval-$y1)}]
-
-   return $result
-}
-
-# FindEnclosingEntries --
-#    Search within a sorted list
-#
-# Arguments:
-#    val      Value to be searched
-#    values   List of values to be examined
-#
-# Results:
-#    Returns a list of the previous and next indices
-#
-proc FindEnclosingEntries { val values } {
-   set found 0
-   set row2  1
-   foreach v $values {
-      if { $val <= $v } {
-         set row   [expr {$row2-1}]
-         set found 1
-         break
-      }
-      incr row2
-   }
-
-   #
-   # Border cases: extrapolation needed
-   #
-   if { ! $found } {
-      incr row2 -1
-      set  row $row2
-   }
-   if { $row == 0 } {
-      set row $row2
-   }
-
-   return [list $row $row2]
-}
-
-# interp-linear --
-#    Use linear interpolation
-#
-# Arguments:
-#    xyvalues   List of x/y values to be interpolated
-#    xval       x-value for which a value is sought
-#
-# Results:
-#    Estimated value at $xval
-#
-# Note:
-#    The list xyvalues must be sorted w.r.t. the x-value
-#
-proc ::math::interpolate::interp-linear { xyvalues xval } {
-   #
-   # Border cases first
-   #
-   if { [lindex $xyvalues 0] > $xval } {
-      return [lindex $xyvalues 1]
-   }
-   if { [lindex $xyvalues end-1] < $xval } {
-      return [lindex $xyvalues end]
-   }
-
-   #
-   # The ordinary case
-   #
-   set idxx -2
-   set idxy -1
-   foreach { x y } $xyvalues {
-      if { $xval < $x } {
-         break
-      }
-      incr idxx 2
-      incr idxy 2
-   }
-
-   set x2 [lindex $xyvalues $idxx]
-   set y2 [lindex $xyvalues $idxy]
-
-   if { $x2 != $x } {
-      set yval [expr {$y+($y2-$y)*($xval-$x)/($x2-$x)}]
-   } else {
-      set yval $y
-   }
-   return $yval
-}
-
-# interp-lagrange --
-#    Use the Lagrange interpolation method
-#
-# Arguments:
-#    xyvalues   List of x/y values to be interpolated
-#    xval       x-value for which a value is sought
-#
-# Results:
-#    Estimated value at $xval
-#
-# Note:
-#    The list xyvalues must be sorted w.r.t. the x-value
-#    Furthermore the Lagrange method is not a very practical
-#    method, as potentially the errors are unbounded
-#
-proc ::math::interpolate::interp-lagrange { xyvalues xval } {
-   #
-   # Border case: xval equals one of the "nodes"
-   #
-   foreach { x y } $xyvalues {
-      if { $x == $xval } {
-         return $y
-      }
-   }
-
-   #
-   # Ordinary case
-   #
-   set nonodes2 [llength $xyvalues]
-
-   set yval 0.0
-
-   for { set i 0 } { $i < $nonodes2 } { incr i 2 } {
-      set idxn 0
-      set xn   [lindex $xyvalues $i]
-      set yn   [lindex $xyvalues [expr {$i+1}]]
-
-      foreach { x y } $xyvalues {
-         if { $idxn != $i } {
-            set yn [expr {$yn*($x-$xval)/($x-$xn)}]
-         }
-         incr idxn 2
-      }
-
-      set yval [expr {$yval+$yn}]
-   }
-
-   return $yval
-}
-
-# interp-spatial --
-#    Use a straightforward interpolation method with weights as
-#    function of the inverse distance to interpolate in 2D and N-D
-#    space
-#
-# Arguments:
-#    xyvalues   List of coordinates and values at these coordinates
-#    coord      List of coordinates for which a value is sought
-#
-# Results:
-#    Estimated value(s) at $coord
-#
-# Note:
-#    The list xyvalues is a list of lists:
-#    { {x1 y1 z1 {v11 v12 v13 v14}
-#      {x2 y2 z2 {v21 v22 v23 v24}
-#      ...
-#    }
-#    The last element of each inner list is either a single number
-#    or a list in itself. In the latter case the return value is
-#    a list with the same number of elements.
-#
-#    The method is influenced by the search radius and the
-#    power of the inverse distance
-#
-proc ::math::interpolate::interp-spatial { xyvalues coord } {
-   variable search_radius
-   variable inv_dist_pow
-
-   set result {}
-   foreach v [lindex [lindex $xyvalues 0] end] {
-      lappend result 0.0
-   }
-
-   set total_weight 0.0
-
-   if { $search_radius != {} } {
-      set max_radius2  [expr {$search_radius*$search_radius}]
-   } else {
-      set max_radius2  {}
-   }
-
-   foreach point $xyvalues {
-      set dist 0.0
-      foreach c [lrange $point 0 end-1] cc $coord {
-         set dist [expr {$dist+($c-$cc)*($c-$cc)}]
-      }
-      if { $max_radius2 == {} || $dist <= $max_radius2 } {
-         if { $inv_dist_pow == 1 } {
-            set dist [expr {sqrt($dist)}]
-         }
-         set total_weight [expr {$total_weight+1.0/$dist}]
-
-         set idx 0
-         foreach v [lindex $point end] r $result {
-            lset result $idx [expr {$r+$v/$dist}]
-            incr idx
-         }
-      }
-   }
-
-   if { $total_weight == 0.0 } {
-      set idx 0
-      foreach r $result {
-         lset result $idx {}
-         incr idx
-      }
-   } else {
-      set idx 0
-      foreach r $result {
-         lset result $idx [expr {$r/$total_weight}]
-         incr idx
-      }
-   }
-
-   return $result
-}
-
-# interp-spatial-params --
-#    Set the parameters for spatial interpolation
-#
-# Arguments:
-#    max_search   Search radius (if none: use {} or "")
-#    power        Power for the inverse distance (1 or 2, defaults to 2)
-#
-# Results:
-#    None
-#
-proc ::math::interpolate::interp-spatial-params { max_search {power 2} } {
-   variable search_radius
-   variable inv_dist_pow
-
-   set search_radius $max_search
-   if { $power == 1 } {
-      set inv_dist_pow 1
-   } else {
-      set inv_dist_pow 2
-   }
-}
-
-#----------------------------------------------------------------------
-#
-# neville --
-#
-#	Interpolate a function between tabulated points using Neville's
-#	algorithm.
-#
-# Parameters:
-#	xtable - Table of abscissae.
-#	ytable - Table of ordinates.  Must be a list of the same
-#		 length as 'xtable.'
-#	x - Abscissa for which the function value is desired.
-#
-# Results:
-#	Returns a two-element list.  The first element is the
-#	requested ordinate.  The second element is a rough estimate
-#	of the absolute error, that is, the magnitude of the first
-#	neglected term of a power series.
-#
-# Side effects:
-#	None.
-#
-#----------------------------------------------------------------------
-
-proc ::math::interpolate::neville { xtable ytable x } {
-
-    set n [llength $xtable]
-
-    # Initialization.  Set c and d to the ordinates, and set ns to the
-    # index of the nearest abscissa. Set y to the zero-order approximation
-    # of the nearest ordinate, and dif to the difference between x
-    # and the nearest tabulated abscissa.
-
-    set c [list]
-    set d [list]
-    set i 0
-    set ns 0
-    set dif [expr { abs( $x - [lindex $xtable 0] ) }]
-    set y [lindex $ytable 0]
-    foreach xi $xtable yi $ytable {
-	set dift [expr { abs ( $x - $xi ) }]
-	if { $dift < $dif } {
-	    set ns $i
-	    set y $yi
-	    set dif $dift
-	}
-	lappend c $yi
-	lappend d $yi
-	incr i
-    }
-
-    # Compute successively higher-degree approximations to the fit
-    # function by using the recurrence:
-    #   d_m[i] = ( c_{m-1}[i+1] - d{m-1}[i] ) * (x[i+m]-x) /
-    #			(x[i] - x[i+m])
-    #   c_m[i] = ( c_{m-1}[i+1] - d{m-1}[i] ) * (x[i]-x) /
-    #			(x[i] - x[i+m])
-
-    for { set m 1 } { $m < $n } { incr m } {
-	for { set i 0 } { $i < $n - $m } { set i $ip1 } {
-	    set ip1 [expr { $i + 1 }]
-	    set ipm [expr { $i + $m }]
-	    set ho [expr { [lindex $xtable $i] - $x }]
-	    set hp [expr { [lindex $xtable $ipm] - $x }]
-	    set w [expr { [lindex $c $ip1] - [lindex $d $i] }]
-	    set q [expr { $w / ( $ho - $hp ) }]
-	    lset d $i [expr { $hp * $q }]
-	    lset c $i [expr { $ho * $q }]
-	}
-
-	# Take the straighest path possible through the tableau of c
-	# and d approximations back to the tabulated value
-	if { 2 * $ns < $n - $m } {
-	    set dy [lindex $c $ns]
-	} else {
-	    incr ns -1
-	    set dy [lindex $d $ns]
-	}
-	set y [expr { $y + $dy }]
-    }
-
-    # Return the approximation and the highest-order correction term.
-
-    return [list $y [expr { abs($dy) }]]
-}
-
-# prepare-cubic-splines --
-#    Prepare interpolation based on cubic splines
-#
-# Arguments:
-#    xcoord    The x-coordinates
-#    ycoord    Y-values for these x-coordinates
-# Result:
-#    Intermediate parameters describing the spline function,
-#    to be used in the second step, interp-cubic-splines.
-# Note:
-#    Implicitly it is assumed that the function decribed by xcoord
-#    and ycoord has a second derivative 0 at the end points.
-#    To minimise the work if more than one value is needed, the
-#    algorithm is divided in two steps
-#    (Derived from the routine SPLINT in Davis and Rabinowitz:
-#    Methods for Numerical Integration, AP, 1984)
-#
-proc ::math::interpolate::prepare-cubic-splines {xcoord ycoord} {
-
-    if { [llength $xcoord] < 3 } {
-        return -code error "At least three points are required"
-    }
-    if { [llength $xcoord] != [llength $ycoord] } {
-        return -code error "Equal number of x and y values required"
-    }
-
-    set m2 [expr {[llength $xcoord]-1}]
-
-    set s  0.0
-    set h  {}
-    set c  {}
-    for { set i 0 } { $i < $m2 } { incr i } {
-        set ip1 [expr {$i+1}]
-        set h1  [expr {[lindex $xcoord $ip1]-[lindex $xcoord $i]}]
-        lappend h $h1
-        if { $h1 <= 0.0 } {
-            return -code error "X values must be strictly ascending"
-        }
-        set r [expr {([lindex $ycoord $ip1]-[lindex $ycoord $i])/$h1}]
-        lappend c [expr {$r-$s}]
-        set s $r
-    }
-    set s 0.0
-    set r 0.0
-    set t {--}
-    lset c 0 0.0
-
-    for { set i 1 } { $i < $m2 } { incr i } {
-        set ip1 [expr {$i+1}]
-        set im1 [expr {$i-1}]
-        set y2  [expr {[lindex $c $i]+$r*[lindex $c $im1]}]
-        set t1  [expr {2.0*([lindex $xcoord $im1]-[lindex $xcoord $ip1])-$r*$s}]
-        set s   [lindex $h $i]
-        set r   [expr {$s/$t1}]
-        lset c  $i $y2
-        lappend t  $t1
-    }
-    lappend c 0.0
-
-    for { set j 1 } { $j < $m2 } { incr j } {
-        set i   [expr {$m2-$j}]
-        set ip1 [expr {$i+1}]
-        set h1  [lindex $h $i]
-        set yp1 [lindex $c $ip1]
-        set y1  [lindex $c $i]
-        set t1  [lindex $t $i]
-        lset c  $i [expr {($h1*$yp1-$y1)/$t1}]
-    }
-
-    set b {}
-    set d {}
-    for { set i 0 } { $i < $m2 } { incr i } {
-        set ip1 [expr {$i+1}]
-        set s   [lindex $h $i]
-        set yp1 [lindex $c $ip1]
-        set y1  [lindex $c $i]
-        set r   [expr {$yp1-$y1}]
-        lappend d [expr {$r/$s}]
-        lset c $i [expr {3.0*$y1}]
-        lappend b [expr {([lindex $ycoord $ip1]-[lindex $ycoord $i])/$s
-                         -($y1+$r)*$s}]
-    }
-
-    lappend d 0.0
-    lappend b 0.0
-
-    return [list $d $c $b $ycoord $xcoord]
-}
-
-# interp-cubic-splines --
-#    Interpolate based on cubic splines
-#
-# Arguments:
-#    coeffs    Coefficients resulting from the preparation step
-#    x         The x-coordinate for which to estimate the value
-# Result:
-#    Interpolated value at x
-#
-proc ::math::interpolate::interp-cubic-splines {coeffs x} {
-    foreach {dcoef ccoef bcoef acoef xcoord} $coeffs {break}
-
-    #
-    # Check the bounds - no extrapolation
-    #
-    if { $x < [lindex $xcoord 0] } {error "X value too small"}
-    if { $x > [lindex $xcoord end] } {error "X value too large"}
-
-    #
-    # Which interval?
-    #
-    set idx -1
-    foreach xv $xcoord {
-        if { $xv > $x } {
-            break
-        }
-        incr idx
-    }
-
-    set a      [lindex $acoef $idx]
-    set b      [lindex $bcoef $idx]
-    set c      [lindex $ccoef $idx]
-    set d      [lindex $dcoef $idx]
-    set dx     [expr {$x-[lindex $xcoord $idx]}]
-
-    return [expr {(($d*$dx+$c)*$dx+$b)*$dx+$a}]
-}
-
-
-
-#
-# Announce our presence
-#
-package provide math::interpolate 1.0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/linalg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/linalg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1791 +1,0 @@
-# linalg.tcl --
-#    Linear algebra package, based partly on Hume's LA package,
-#    partly on experiments with various representations of
-#    matrices. Also the functionality of the BLAS library has
-#    been taken into account.
-#
-#    General information:
-#    - The package provides both a high-level general interface and
-#      a lower-level specific interface for various LA functions
-#      and tasks.
-#    - The general procedures perform some checks and then call
-#      the various specific procedures. The general procedures are
-#      aimed at robustness and ease of use.
-#    - The specific procedures do not check anything, they are
-#      designed for speed. Failure to comply to the interface
-#      requirements will presumably lead to [expr] errors.
-#    - Vectors are represented as lists, matrices as lists of
-#      lists, where the rows are the innermost lists:
-#
-#      / a11 a12 a13 \
-#      | a21 a22 a23 | == { {a11 a12 a13} {a21 a22 a23} {a31 a32 a33} }
-#      \ a31 a32 a33 /
-#
-
-package require Tcl 8.4
-
-namespace eval ::math::linearalgebra {
-    # Define the namespace
-    namespace export dim shape conforming symmetric
-    namespace export norm norm_one norm_two norm_max normMatrix
-    namespace export dotproduct unitLengthVector normalizeStat
-    namespace export axpy axpy_vect axpy_mat crossproduct
-    namespace export add add_vect add_mat
-    namespace export sub sub_vect sub_mat
-    namespace export scale scale_vect scale_mat matmul transpose
-    namespace export rotate angle choleski
-    namespace export getrow getcol getelem setrow setcol setelem
-    namespace export mkVector mkMatrix mkIdentity mkDiagonal
-    namespace export mkHilbert mkDingdong mkBorder mkFrank
-    namespace export mkMoler mkWilkinsonW+ mkWilkinsonW-
-    namespace export solveGauss solveTriangular
-    namespace export solveGaussBand solveTriangularBand
-    namespace export determineSVD eigenvectorsSVD
-    namespace export leastSquaresSVD
-    namespace export orthonormalizeColumns orthonormalizeRows
-    namespace export show to_LA from_LA
-}
-
-# dim --
-#     Return the dimension of an object (scalar, vector or matrix)
-# Arguments:
-#     obj        Object like a scalar, vector or matrix
-# Result:
-#     Dimension: 0 for a scalar, 1 for a vector, 2 for a matrix
-#
-proc ::math::linearalgebra::dim { obj } {
-    return [llength [shape $obj]]
-}
-
-# shape --
-#     Return the shape of an object (scalar, vector or matrix)
-# Arguments:
-#     obj        Object like a scalar, vector or matrix
-# Result:
-#     List of the sizes: empty list for a scalar, number of components
-#     for a vector, number of rows and columns for a matrix
-#
-proc ::math::linearalgebra::shape { obj } {
-    if { [llength $obj] <= 1 } {
-       return {}
-    }
-    set result [llength $obj]
-    if { [llength [lindex $obj 0]] <= 1 } {
-       return $result
-    } else {
-       lappend result [llength [lindex $obj 0]]
-    }
-    return $result
-}
-
-# show --
-#     Return a string representing the vector or matrix,
-#     for easy printing
-# Arguments:
-#     obj        Object like a scalar, vector or matrix
-#     format     Format to be used (defaults to %6.4f)
-#     rowsep     Separator for rows (defaults to \n)
-#     colsep     Separator for columns (defaults to " ")
-# Result:
-#     String representing the vector or matrix
-#
-proc ::math::linearalgebra::show { obj {format %6.4f} {rowsep \n} {colsep " "} } {
-    set result ""
-    if { [llength [lindex $obj 0]] == 1 } {
-        foreach v $obj {
-            append result "[format $format $v]$rowsep"
-        }
-    } else {
-        foreach row $obj {
-            foreach v $row {
-                append result "[format $format $v]$colsep"
-            }
-            append result $rowsep
-        }
-    }
-    return $result
-}
-
-# conforming --
-#     Determine if two objects (vector or matrix) are conforming
-#     in shape, rows or for a matrix multiplication
-# Arguments:
-#     type       Type of conforming: shape, rows or matmul
-#     obj1       First object (vector or matrix)
-#     obj2       Second object (vector or matrix)
-# Result:
-#     1 if they conform, 0 if not
-#
-proc ::math::linearalgebra::conforming { type obj1 obj2 } {
-    set shape1 [shape $obj1]
-    set shape2 [shape $obj2]
-    set result 0
-    if { $type == "shape" } {
-        set result [expr {[lindex $shape1 0] == [lindex $shape2 0] &&
-                          [lindex $shape1 1] == [lindex $shape2 1]}]
-    }
-    if { $type == "rows" } {
-        set result [expr {[lindex $shape1 0] == [lindex $shape2 0]}]
-    }
-    if { $type == "matmul" } {
-        set result [expr {[lindex $shape1 1] == [lindex $shape2 0]}]
-    }
-    return $result
-}
-
-# crossproduct --
-#     Return the "cross product" of two 3D vectors
-# Arguments:
-#     vect1      First vector
-#     vect2      Second vector
-# Result:
-#     Cross product
-#
-proc ::math::linearalgebra::crossproduct { vect1 vect2 } {
-
-    if { [llength $vect1] == 3 && [llength $vect2] == 3 } {
-        foreach {v11 v12 v13} $vect1 {v21 v22 v23} $vect2 {break}
-        return [list \
-            [expr {$v12*$v23 - $v13*$v22}] \
-            [expr {$v13*$v21 - $v11*$v23}] \
-            [expr {$v11*$v22 - $v12*$v21}] ]
-    } else {
-        return -code error "Cross-product only defined for 3D vectors"
-    }
-}
-
-# angle --
-#     Return the "angle" between two vectors (in radians)
-# Arguments:
-#     vect1      First vector
-#     vect2      Second vector
-# Result:
-#     Angle between the two vectors
-#
-proc ::math::linearalgebra::angle { vect1 vect2 } {
-
-    set dp [dotproduct $vect1 $vect2]
-    set n1 [norm_two $vect1]
-    set n2 [norm_two $vect2]
-
-    if { $n1 == 0.0 || $n2 == 0.0 } {
-        return -code error "Angle not defined for null vector"
-    }
-
-    return [expr {acos($dp/$n1/$n2)}]
-}
-
-
-# norm --
-#     Compute the (1-, 2- or Inf-) norm of a vector
-# Arguments:
-#     vector     Vector (list of numbers)
-#     type       Either 1, 2 or max/inf to indicate the type of
-#                norm (default: 2, the euclidean norm)
-# Result:
-#     The (1-, 2- or Inf-) norm of a vector
-#
-proc ::math::linearalgebra::norm { vector {type 2} } {
-    if { $type == 2 } {
-       return [norm_two $vector]
-    }
-    if { $type == 1 } {
-       return [norm_one $vector]
-    }
-    if { $type == "max" || $type == "inf" } {
-       return [norm_max $vector]
-    }
-    return -code error "Unknown norm: $type"
-}
-
-# norm_one --
-#     Compute the 1-norm of a vector
-# Arguments:
-#     vector     Vector
-# Result:
-#     The 1-norm of a vector
-#
-proc ::math::linearalgebra::norm_one { vector } {
-    set sum 0.0
-    foreach c $vector {
-        set sum [expr {$sum+abs($c)}]
-    }
-    return $sum
-}
-
-# norm_two --
-#     Compute the 2-norm of a vector (euclidean norm)
-# Arguments:
-#     vector     Vector
-# Result:
-#     The 2-norm of a vector
-# Note:
-#     Rely on the function hypot() to make this robust
-#     against overflow and underflow
-#
-proc ::math::linearalgebra::norm_two { vector } {
-    set sum 0.0
-    foreach c $vector {
-        set sum [expr {hypot($c,$sum)}]
-    }
-    return $sum
-}
-
-# norm_max --
-#     Compute the inf-norm of a vector (maximum of its components)
-# Arguments:
-#     vector     Vector
-# Result:
-#     The inf-norm of a vector
-#
-proc ::math::linearalgebra::norm_max { vector } {
-    set max [lindex $vector 0]
-    foreach c $vector {
-        set max [expr {abs($c)>$max? abs($c) : $max}]
-    }
-    return $max
-}
-
-# normMatrix --
-#     Compute the (1-, 2- or Inf-) norm of a matrix
-# Arguments:
-#     matrix     Matrix (list of row vectors)
-#     type       Either 1, 2 or max/inf to indicate the type of
-#                norm (default: 2, the euclidean norm)
-# Result:
-#     The (1-, 2- or Inf-) norm of the matrix
-#
-proc ::math::linearalgebra::normMatrix { matrix {type 2} } {
-    set v {}
-
-    foreach row $matrix {
-        lappend v [norm $row $type]
-    }
-
-    return [norm $v $type]
-}
-
-# symmetric --
-#     Determine if the matrix is symmetric or not
-# Arguments:
-#     matrix     Matrix (list of row vectors)
-#     eps        Tolerance (defaults to 1.0e-8)
-# Result:
-#     1 if symmetric (within the tolerance), 0 if not
-#
-proc ::math::linearalgebra::symmetric { matrix {eps 1.0e-8} } {
-    set shape [shape $matrix]
-    if { [lindex $shape 0] != [lindex $shape 1] } {
-       return 0
-    }
-
-    set norm_org   [normMatrix $matrix]
-    set norm_asymm [normMatrix [sub $matrix [transpose $matrix]]]
-
-    if { $norm_asymm <= $eps*$norm_org } {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-# dotproduct --
-#     Compute the dot product of two vectors
-# Arguments:
-#     vect1      First vector
-#     vect2      Second vector
-# Result:
-#     The dot product of the two vectors
-#
-proc ::math::linearalgebra::dotproduct { vect1 vect2 } {
-    if { [llength $vect1] != [llength $vect2] } {
-       return -code error "Vectors must be of equal length"
-    }
-    set sum 0.0
-    foreach c1 $vect1 c2 $vect2 {
-        set sum [expr {$sum + $c1*$c2}]
-    }
-    return $sum
-}
-
-# unitLengthVector --
-#     Normalize a vector so that a length 1 results and return the new vector
-# Arguments:
-#     vector     Vector to be normalized
-# Result:
-#     A vector of length 1
-#
-proc ::math::linearalgebra::unitLengthVector { vector } {
-    set scale [norm_two $vector]
-    if { $scale == 0.0 } {
-        return -code error "Can not normalize a null-vector"
-    }
-    return [scale [expr {1.0/$scale}] $vector]
-}
-
-# normalizeStat --
-#     Normalize a matrix or vector in a statistical sense and return the result
-# Arguments:
-#     mv        Matrix or vector to be normalized
-# Result:
-#     A matrix or vector whose columns are normalised to have a mean of
-#     0 and a standard deviation of 1.
-#
-proc ::math::linearalgebra::normalizeStat { mv } {
-
-    if { [llength [lindex $mv 0]] > 1 } {
-        set result {}
-        foreach vector [transpose $mv] {
-            lappend result [NormalizeStat_vect $vector]
-        }
-        return [transpose $result]
-    } else {
-        return [NormalizeStat_vect $mv]
-    }
-}
-
-# NormalizeStat_vect --
-#     Normalize a vector in a statistical sense and return the result
-# Arguments:
-#     v        Vector to be normalized
-# Result:
-#     A vector whose elements are normalised to have a mean of
-#     0 and a standard deviation of 1. If all coefficients are equal,
-#     a null-vector is returned.
-#
-proc ::math::linearalgebra::NormalizeStat_vect { v } {
-    if { [llength $v] <= 1 } {
-        return -code error "Vector can not be normalised - too few coefficients"
-    }
-
-    set sum   0.0
-    set sum2  0.0
-    set count 0.0
-    foreach c $v {
-        set sum   [expr {$sum   + $c}]
-        set sum2  [expr {$sum2  + $c*$c}]
-        set count [expr {$count + 1.0}]
-    }
-    set corr   [expr {$sum/$count}]
-    set factor [expr {($sum2-$sum*$sum/$count)/($count-1)}]
-    if { $factor > 0.0 } {
-        set factor [expr {1.0/sqrt($factor)}]
-    } else {
-        set factor 0.0
-    }
-    set result {}
-    foreach c $v {
-        lappend result [expr {$factor*($c-$corr)}]
-    }
-    return $result
-}
-
-# axpy --
-#     Compute the sum of a scaled vector/matrix and another
-#     vector/matrix: a*x + y
-# Arguments:
-#     scale      Scale factor (a) for the first vector/matrix
-#     mv1        First vector/matrix (x)
-#     mv2        Second vector/matrix (y)
-# Result:
-#     The result of a*x+y
-#
-proc ::math::linearalgebra::axpy { scale mv1 mv2 } {
-    if { [llength [lindex $mv1 0]] > 1 } {
-        return [axpy_mat $scale $mv1 $mv2]
-    } else {
-        return [axpy_vect $scale $mv1 $mv2]
-    }
-}
-
-# axpy_vect --
-#     Compute the sum of a scaled vector and another vector: a*x + y
-# Arguments:
-#     scale      Scale factor (a) for the first vector
-#     vect1      First vector (x)
-#     vect2      Second vector (y)
-# Result:
-#     The result of a*x+y
-#
-proc ::math::linearalgebra::axpy_vect { scale vect1 vect2 } {
-    set result {}
-
-    foreach c1 $vect1 c2 $vect2 {
-        lappend result [expr {$scale*$c1+$c2}]
-    }
-    return $result
-}
-
-# axpy_mat --
-#     Compute the sum of a scaled matrix and another matrix: a*x + y
-# Arguments:
-#     scale      Scale factor (a) for the first matrix
-#     mat1       First matrix (x)
-#     mat2       Second matrix (y)
-# Result:
-#     The result of a*x+y
-#
-proc ::math::linearalgebra::axpy_mat { scale mat1 mat2 } {
-    set result {}
-    foreach row1 $mat1 row2 $mat2 {
-        lappend result [axpy_vect $scale $row1 $row2]
-    }
-    return $result
-}
-
-# add --
-#     Compute the sum of two vectors/matrices
-# Arguments:
-#     mv1        First vector/matrix (x)
-#     mv2        Second vector/matrix (y)
-# Result:
-#     The result of x+y
-#
-proc ::math::linearalgebra::add { mv1 mv2 } {
-    if { [llength [lindex $mv1 0]] > 1 } {
-        return [add_mat $mv1 $mv2]
-    } else {
-        return [add_vect $mv1 $mv2]
-    }
-}
-
-# add_vect --
-#     Compute the sum of two vectors
-# Arguments:
-#     vect1      First vector (x)
-#     vect2      Second vector (y)
-# Result:
-#     The result of x+y
-#
-proc ::math::linearalgebra::add_vect { vect1 vect2 } {
-    set result {}
-    foreach c1 $vect1 c2 $vect2 {
-        lappend result [expr {$c1+$c2}]
-    }
-    return $result
-}
-
-# add_mat --
-#     Compute the sum of two matrices
-# Arguments:
-#     mat1       First matrix (x)
-#     mat2       Second matrix (y)
-# Result:
-#     The result of x+y
-#
-proc ::math::linearalgebra::add_mat { mat1 mat2 } {
-    set result {}
-    foreach row1 $mat1 row2 $mat2 {
-        lappend result [add_vect $row1 $row2]
-    }
-    return $result
-}
-
-# sub --
-#     Compute the difference of two vectors/matrices
-# Arguments:
-#     mv1        First vector/matrix (x)
-#     mv2        Second vector/matrix (y)
-# Result:
-#     The result of x-y
-#
-proc ::math::linearalgebra::sub { mv1 mv2 } {
-    if { [llength [lindex $mv1 0]] > 0 } {
-        return [sub_mat $mv1 $mv2]
-    } else {
-        return [sub_vect $mv1 $mv2]
-    }
-}
-
-# sub_vect --
-#     Compute the difference of two vectors
-# Arguments:
-#     vect1      First vector (x)
-#     vect2      Second vector (y)
-# Result:
-#     The result of x-y
-#
-proc ::math::linearalgebra::sub_vect { vect1 vect2 } {
-    set result {}
-    foreach c1 $vect1 c2 $vect2 {
-        lappend result [expr {$c1-$c2}]
-    }
-    return $result
-}
-
-# sub_mat --
-#     Compute the difference of two matrices
-# Arguments:
-#     mat1       First matrix (x)
-#     mat2       Second matrix (y)
-# Result:
-#     The result of x-y
-#
-proc ::math::linearalgebra::sub_mat { mat1 mat2 } {
-    set result {}
-    foreach row1 $mat1 row2 $mat2 {
-        lappend result [sub_vect $row1 $row2]
-    }
-    return $result
-}
-
-# scale --
-#     Scale a vector or a matrix
-# Arguments:
-#     scale      Scale factor (scalar; a)
-#     mv         Vector/matrix (x)
-# Result:
-#     The result of a*x
-#
-proc ::math::linearalgebra::scale { scale mv } {
-    if { [llength [lindex $mv 0]] > 1 } {
-        return [scale_mat $scale $mv]
-    } else {
-        return [scale_vect $scale $mv]
-    }
-}
-
-# scale_vect --
-#     Scale a vector
-# Arguments:
-#     scale      Scale factor to apply (a)
-#     vect       Vector to be scaled (x)
-# Result:
-#     The result of a*x
-#
-proc ::math::linearalgebra::scale_vect { scale vect } {
-    set result {}
-    foreach c $vect {
-        lappend result [expr {$scale*$c}]
-    }
-    return $result
-}
-
-# scale_mat --
-#     Scale a matrix
-# Arguments:
-#     scale      Scale factor to apply
-#     mat        Matrix to be scaled
-# Result:
-#     The result of x+y
-#
-proc ::math::linearalgebra::scale_mat { scale mat } {
-    set result {}
-    foreach row $mat {
-        lappend result [scale_vect $scale $row]
-    }
-    return $result
-}
-
-# rotate --
-#     Apply a planar rotation to two vectors
-# Arguments:
-#     c          Cosine of the angle
-#     s          Sine of the angle
-#     vect1      First vector (x)
-#     vect2      Second vector (y)
-# Result:
-#     A list of two elements: c*x-s*y and s*x+c*y
-#
-proc ::math::linearalgebra::rotate { c s vect1 vect2 } {
-    set result1 {}
-    set result2 {}
-    foreach v1 $vect1 v2 $vect2 {
-        lappend result1 [expr {$c*$v1-$s*$v2}]
-        lappend result2 [expr {$s*$v1+$c*$v2}]
-    }
-    return [list $result1 $result2]
-}
-
-# transpose --
-#     Transpose a matrix
-# Arguments:
-#     matrix     Matrix to be transposed
-# Result:
-#     The transposed matrix
-# Note:
-#     The second transpose implementation is faster on large
-#     matrices (100x100 say), there is no significant difference
-#     on small ones (10x10 say).
-#
-#
-proc ::math::linearalgebra::transpose_old { matrix } {
-   set row {}
-   set transpose {}
-   foreach c [lindex $matrix 0] {
-      lappend row 0.0
-   }
-   foreach r $matrix {
-      lappend transpose $row
-   }
-
-   set nr 0
-   foreach r $matrix {
-      set nc 0
-      foreach c $r {
-         lset transpose $nc $nr $c
-         incr nc
-      }
-      incr nr
-   }
-   return $transpose
-}
-
-proc ::math::linearalgebra::transpose { matrix } {
-   set transpose {}
-   set c 0
-   foreach col [lindex $matrix 0] {
-       set newrow {}
-       foreach row $matrix {
-           lappend newrow [lindex $row $c]
-       }
-       lappend transpose $newrow
-       incr c
-   }
-   return $transpose
-}
-
-# MorV --
-#     Identify if the object is a row/column vector or a matrix
-# Arguments:
-#     obj        Object to be examined
-# Result:
-#     The letter R, C or M depending on the shape
-#     (just to make it all work fine: S for scalar)
-# Note:
-#     Private procedure to fix a bug in matmul
-#
-proc ::math::linearalgebra::MorV { obj } {
-    if { [llength $obj] > 1 } {
-        if { [llength [lindex $obj 0]] > 1 } {
-            return "M"
-        } else {
-            return "C"
-        }
-    } else {
-        if { [llength [lindex $obj 0]] > 1 } {
-            return "R"
-        } else {
-            return "S"
-        }
-    }
-}
-
-# matmul --
-#     Multiply a vector/matrix with another vector/matrix
-# Arguments:
-#     mv1        First vector/matrix (x)
-#     mv2        Second vector/matrix (y)
-# Result:
-#     The result of x*y
-#
-proc ::math::linearalgebra::matmul_org { mv1 mv2 } {
-    if { [llength [lindex $mv1 0]] > 1 } {
-        if { [llength [lindex $mv2 0]] > 1 } {
-            return [matmul_mm $mv1 $mv2]
-        } else {
-            return [matmul_mv $mv1 $mv2]
-        }
-    } else {
-        if { [llength [lindex $mv2 0]] > 1 } {
-            return [matmul_vm $mv1 $mv2]
-        } else {
-            return [matmul_vv $mv1 $mv2]
-        }
-    }
-}
-
-proc ::math::linearalgebra::matmul { mv1 mv2 } {
-    switch -exact -- "[MorV $mv1][MorV $mv2]" {
-    "MM" {
-         return [matmul_mm $mv1 $mv2]
-    }
-    "MC" {
-         return [matmul_mv $mv1 $mv2]
-    }
-    "MR" {
-         return -code error "Can not multiply a matrix with a row vector - wrong order"
-    }
-    "RM" {
-         return [matmul_vm [transpose $mv1] $mv2]
-    }
-    "RC" {
-         return [dotproduct [transpose $mv1] $mv2]
-    }
-    "RR" {
-         return -code error "Can not multiply a matrix with a row vector - wrong order"
-    }
-    "CM" {
-         return [transpose [matmul_vm $mv1 $mv2]]
-    }
-    "CR" {
-         return [matmul_vv $mv1 [transpose $mv2]]
-    }
-    "CC" {
-         return [matmul_vv $mv1 $mv2]
-    }
-    default {
-         return -code error "Can not use a scalar object"
-    }
-    }
-}
-
-# matmul_mv --
-#     Multiply a matrix and a column vector
-# Arguments:
-#     matrix     Matrix (applied left: A)
-#     vector     Vector (interpreted as column vector: x)
-# Result:
-#     The vector A*x
-#
-proc ::math::linearalgebra::matmul_mv { matrix vector } {
-   set newvect {}
-   foreach row $matrix {
-      set sum 0.0
-      foreach v $vector c $row {
-         set sum [expr {$sum+$v*$c}]
-      }
-      lappend newvect $sum
-   }
-   return $newvect
-}
-
-# matmul_vm --
-#     Multiply a row vector with a matrix
-# Arguments:
-#     vector     Vector (interpreted as row vector: x)
-#     matrix     Matrix (applied right: A)
-# Result:
-#     The vector xtrans*A = Atrans*x
-#
-proc ::math::linearalgebra::matmul_vm { vector matrix } {
-   return [transpose [matmul_mv [transpose $matrix] $vector]]
-}
-
-# matmul_vv --
-#     Multiply two vectors to obtain a matrix
-# Arguments:
-#     vect1      First vector (column vector, x)
-#     vect2      Second vector (row vector, y)
-# Result:
-#     The "outer product" x*ytrans
-#
-proc ::math::linearalgebra::matmul_vv { vect1 vect2 } {
-   set newmat {}
-   foreach v1 $vect1 {
-      set newrow {}
-      foreach v2 $vect2 {
-         lappend newrow [expr {$v1*$v2}]
-      }
-      lappend newmat $newrow
-   }
-   return $newmat
-}
-
-# matmul_mm --
-#     Multiply two matrices
-# Arguments:
-#     mat1      First matrix (A)
-#     mat2      Second matrix (B)
-# Result:
-#     The matrix product A*B
-# Note:
-#     By transposing matrix B we can access the columns
-#     as rows - much easier and quicker, as they are
-#     the elements of the outermost list.
-#
-proc ::math::linearalgebra::matmul_mm { mat1 mat2 } {
-   set newmat {}
-   set tmat [transpose $mat2]
-   foreach row1 $mat1 {
-      set newrow {}
-      foreach row2 $tmat {
-         lappend newrow [dotproduct $row1 $row2]
-      }
-      lappend newmat $newrow
-   }
-   return $newmat
-}
-
-# mkVector --
-#     Make a vector of a given size
-# Arguments:
-#     ndim       Dimension of the vector
-#     value      Default value for all elements (default: 0.0)
-# Result:
-#     A list with ndim elements, representing a vector
-#
-proc ::math::linearalgebra::mkVector { ndim {value 0.0} } {
-    set result {}
-
-    while { $ndim > 0 } {
-        lappend result $value
-        incr ndim -1
-    }
-    return $result
-}
-
-# mkUnitVector --
-#     Make a unit vector in a given direction
-# Arguments:
-#     ndim       Dimension of the vector
-#     dir        The direction (0, ... ndim-1)
-# Result:
-#     A list with ndim elements, representing a unit vector
-#
-proc ::math::linearalgebra::mkUnitVector { ndim dir } {
-
-    if { $dir < 0 || $dir >= $ndim } {
-        return -code error "Invalid direction for unit vector - $dir"
-    } else {
-        set result [mkVector $ndim]
-        lset result $dir 1.0
-    }
-    return $result
-}
-
-# mkMatrix --
-#     Make a matrix of a given size
-# Arguments:
-#     nrows      Number of rows
-#     ncols      Number of columns
-#     value      Default value for all elements (default: 0.0)
-# Result:
-#     A nested list, representing an nrows x ncols matrix
-#
-proc ::math::linearalgebra::mkMatrix { nrows ncols {value 0.0} } {
-    set result {}
-
-    while { $nrows > 0 } {
-        lappend result [mkVector $ncols $value]
-        incr nrows -1
-    }
-    return $result
-}
-
-# mkIdent --
-#     Make an identity matrix of a given size
-# Arguments:
-#     size       Number of rows/columns
-# Result:
-#     A nested list, representing an size x size identity matrix
-#
-proc ::math::linearalgebra::mkIdentity { size } {
-    set result [mkMatrix $size $size 0.0]
-
-    while { $size > 0 } {
-        incr size -1
-        lset result $size $size 1.0
-    }
-    return $result
-}
-
-# mkDiagonal --
-#     Make a diagonal matrix of a given size
-# Arguments:
-#     diag       List of values to appear on the diagonal
-#
-# Result:
-#     A nested list, representing a diagonal matrix
-#
-proc ::math::linearalgebra::mkDiagonal { diag } {
-    set size   [llength $diag]
-    set result [mkMatrix $size $size 0.0]
-
-    while { $size > 0 } {
-        incr size -1
-        lset result $size $size [lindex $diag $size]
-    }
-    return $result
-}
-
-# mkHilbert --
-#     Make a Hilbert matrix of a given size
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Hilbert matrix
-# Notes:
-#     Hilbert matrices are very ill-conditioned wrt
-#     eigenvalue/eigenvector problems. Therefore they
-#     are good candidates for testing the accuracy
-#     of algorithms and implementations.
-#
-proc ::math::linearalgebra::mkHilbert { size } {
-    set size   [llength $diag]
-
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            lappend row [expr {1.0/($i+$j+1.0)}]
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkDingdong --
-#     Make a Dingdong matrix of a given size
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Dingdong matrix
-# Notes:
-#     Dingdong matrices are imprecisely represented,
-#     but have the property of being very stable in
-#     such algorithms as Gauss elimination.
-#
-proc ::math::linearalgebra::mkDingdong { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            lappend row [expr {0.5/($size-$i-$j-0.5)}]
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkOnes --
-#     Make a square matrix consisting of ones
-# Arguments:
-#     size       Number of rows/columns
-# Result:
-#     A nested list, representing a size x size matrix,
-#     filled with 1.0
-#
-proc ::math::linearalgebra::mkOnes { size } {
-    return [mkMatrix $size $size 1.0]
-}
-
-# mkMoler --
-#     Make a Moler matrix
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Moler matrix
-# Notes:
-#     Moler matrices have a very simple Choleski
-#     decomposition. It has one small eigenvalue
-#     and it can easily upset elimination methods
-#     for systems of linear equations
-#
-proc ::math::linearalgebra::mkMoler { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            if { $i == $j } {
-                lappend row [expr {$i+1}]
-            } else {
-                lappend row [expr {($i>$j?$j:$i)-1.0}]
-            }
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkFrank --
-#     Make a Frank matrix
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Frank matrix
-#
-proc ::math::linearalgebra::mkFrank { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            lappend row [expr {($i>$j?$j:$i)-2.0}]
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkBorder --
-#     Make a bordered matrix
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a bordered matrix
-# Note:
-#     This matrix has size-2 eigenvalues at 1.
-#
-proc ::math::linearalgebra::mkBorder { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            set entry 0.0
-            if { $i == $j } {
-                set entry 1.0
-            }
-            if { $i == $size-1 } {
-                set entry [expr {pow(2.0,-$j)}]
-                if { $j == $size-1 } {
-                   set entry 0.0
-                }
-            }
-            if { $j == $size-1 } {
-                set entry [expr {pow(2.0,-$i)}]
-                if { $i == $size-1 } {
-                   set entry 0.0
-                }
-            }
-            lappend row $entry
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkWilkinsonW+ --
-#     Make a Wilkinson W+ matrix
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Wilkinson W+ matrix
-# Note:
-#     This kind of matrix has pairs of eigenvalues that
-#     are very close together. Usually the order is odd.
-#
-proc ::math::linearalgebra::mkWilkinsonW+ { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            set entry 0.0
-            if { $i == $j } {
-                set entry [expr {$size/2 + 1 -
-                                   ($i>$size-$i+1? $size-$i : $i+1)}]
-            }
-            if { $i == $j+1 || $i+1 == $j } {
-                set entry 1
-            }
-            lappend row $entry
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# mkWilkinsonW+ --
-#     Make a Wilkinson W+ matrix
-# Arguments:
-#     size       Size of the matrix
-# Result:
-#     A nested list, representing a Wilkinson W+ matrix
-# Note:
-#     This kind of matrix has pairs of eigenvalues with
-#     opposite signs (if the order is odd).
-#
-proc ::math::linearalgebra::mkWilkinsonW- { size } {
-    set result {}
-    for { set j 0 } { $j < $size } { incr j } {
-        set row {}
-        for { set i 0 } { $i < $size } { incr i } {
-            set entry 0.0
-            if { $i == $j } {
-                set entry [expr {$size/2 + $i}]
-            }
-            if { $i == $j+1 || $i+1 == $j } {
-                set entry 1
-            }
-            lappend row $entry
-        }
-        lappend result $row
-    }
-    return $result
-}
-
-# getrow --
-#     Get the specified row from a matrix
-# Arguments:
-#     matrix     Matrix in question
-#     row        Index of the row
-#
-# Result:
-#     A list with the values on the requested row
-#
-proc ::math::linearalgebra::getrow { matrix row } {
-    lindex $matrix $row
-}
-
-# setrow --
-#     Set the specified row in a matrix
-# Arguments:
-#     matrix     _Name_ of matrix in question
-#     row        Index of the row
-#     newvalues  New values for the row
-#
-# Result:
-#     Updated matrix
-# Side effect:
-#     The matrix is updated
-#
-proc ::math::linearalgebra::setrow { matrix row newvalues } {
-    upvar $matrix mat
-    lset mat $row $newvalues
-    return $mat
-}
-
-# getcol --
-#     Get the specified column from a matrix
-# Arguments:
-#     matrix     Matrix in question
-#     col        Index of the column
-#
-# Result:
-#     A list with the values on the requested column
-#
-proc ::math::linearalgebra::getcol { matrix col } {
-    set result {}
-    foreach r $matrix {
-        lappend result [lindex $r $col]
-    }
-    return $result
-}
-
-# setcol --
-#     Set the specified column in a matrix
-# Arguments:
-#     matrix     _Name_ of matrix in question
-#     col        Index of the column
-#     newvalues  New values for the column
-#
-# Result:
-#     Updated matrix
-# Side effect:
-#     The matrix is updated
-#
-proc ::math::linearalgebra::setcol { matrix col newvalues } {
-    upvar $matrix mat
-    for { set i 0 } { $i < [llength $mat] } { incr i } {
-        lset mat $i $col [lindex $newvalues $i]
-    }
-    return $mat
-}
-
-# getelem --
-#     Get the specified element (row,column) from a matrix/vector
-# Arguments:
-#     matrix     Matrix in question
-#     row        Index of the row
-#     col        Index of the column (not present for vectors)
-#
-# Result:
-#     The matrix element (row,column)
-#
-proc ::math::linearalgebra::getelem { matrix row {col {}} } {
-    if { $col != {} } {
-        lindex $matrix $row $col
-    } else {
-        lindex $matrix $row
-    }
-}
-
-# setelem --
-#     Set the specified element (row,column) in a matrix or vector
-# Arguments:
-#     matrix     _Name_ of matrix/vector in question
-#     row        Index of the row
-#     col        Index of the column/new value
-#     newvalue   New value  for the element (not present for vectors)
-#
-# Result:
-#     Updated matrix
-# Side effect:
-#     The matrix is updated
-#
-proc ::math::linearalgebra::setelem { matrix row col {newvalue {}} } {
-    upvar $matrix mat
-    if { $newvalue != {} } {
-        lset mat $row $col $newvalue
-    } else {
-        lset mat $row $col
-    }
-    return $mat
-}
-
-# solveGauss --
-#     Solve a system of linear equations using Gauss elimination
-# Arguments:
-#     matrix     Matrix defining the coefficients
-#     bvect      Right-hand side (may be several columns)
-#
-# Result:
-#     Solution of the system or an error in case of singularity
-#
-proc ::math::linearalgebra::solveGauss { matrix bvect } {
-    set norows [llength $matrix]
-    set nocols $norows
-
-    for { set i 0 } { $i < $nocols } { incr i } {
-        set sweep_row   [getrow $matrix $i]
-        set bvect_sweep [getrow $bvect  $i]
-        # No pivoting yet
-        set sweep_fact  [expr {double([lindex $sweep_row $i])}]
-        for { set j [expr {$i+1}] } { $j < $norows } { incr j } {
-            set current_row   [getrow $matrix $j]
-            set bvect_current [getrow $bvect  $j]
-            set factor      [expr {-[lindex $current_row $i]/$sweep_fact}]
-
-            lset matrix $j [axpy_vect $factor $sweep_row   $current_row]
-            lset bvect  $j [axpy_vect $factor $bvect_sweep $bvect_current]
-        }
-    }
-
-    return [solveTriangular $matrix $bvect]
-}
-
-# solveTriangular --
-#     Solve a system of linear equations where the matrix is
-#     upper-triangular
-# Arguments:
-#     matrix     Matrix defining the coefficients
-#     bvect      Right-hand side (may be several columns)
-#
-# Result:
-#     Solution of the system or an error in case of singularity
-#
-proc ::math::linearalgebra::solveTriangular { matrix bvect } {
-    set norows [llength $matrix]
-    set nocols $norows
-
-    for { set i [expr {$norows-1}] } { $i >= 0 } { incr i -1 } {
-        set sweep_row   [getrow $matrix $i]
-        set bvect_sweep [getrow $bvect  $i]
-        set sweep_fact  [expr {double([lindex $sweep_row $i])}]
-        set norm_fact   [expr {1.0/$sweep_fact}]
-
-        lset bvect $i [scale $norm_fact $bvect_sweep]
-
-        for { set j [expr {$i-1}] } { $j >= 0 } { incr j -1 } {
-            set current_row   [getrow $matrix $j]
-            set bvect_current [getrow $bvect  $j]
-            set factor     [expr {-[lindex $current_row $i]/$sweep_fact}]
-
-            lset bvect  $j [axpy_vect $factor $bvect_sweep $bvect_current]
-        }
-    }
-
-    return $bvect
-}
-
-# solveGaussBand --
-#     Solve a system of linear equations using Gauss elimination,
-#     where the matrix is stored as a band matrix.
-# Arguments:
-#     matrix     Matrix defining the coefficients (in band form)
-#     bvect      Right-hand side (may be several columns)
-#
-# Result:
-#     Solution of the system or an error in case of singularity
-#
-proc ::math::linearalgebra::solveGaussBand { matrix bvect } {
-    set norows   [llength $matrix]
-    set nocols   $norows
-    set nodiags  [llength [lindex $matrix 0]]
-    set lowdiags [expr {($nodiags-1)/2}]
-
-    for { set i 0 } { $i < $nocols } { incr i } {
-        set sweep_row   [getrow $matrix $i]
-        set bvect_sweep [getrow $bvect  $i]
-
-        set sweep_fact [lindex $sweep_row [expr {$lowdiags-$i}]]
-
-        for { set j [expr {$i+1}] } { $j <= $lowdiags } { incr j } {
-            set sweep_row     [concat [lrange $sweep_row 1 end] 0.0]
-            set current_row   [getrow $matrix $j]
-            set bvect_current [getrow $bvect  $j]
-            set factor      [expr {-[lindex $current_row $i]/$sweep_fact}]
-
-            lset matrix $j [axpy_vect $factor $sweep_row   $current_row]
-            lset bvect  $j [axpy_vect $factor $bvect_sweep $bvect_current]
-        }
-    }
-
-    return [solveTriangularBand $matrix $bvect]
-}
-
-# solveTriangularBand --
-#     Solve a system of linear equations where the matrix is
-#     upper-triangular (stored as a band matrix)
-# Arguments:
-#     matrix     Matrix defining the coefficients (in band form)
-#     bvect      Right-hand side (may be several columns)
-#
-# Result:
-#     Solution of the system or an error in case of singularity
-#
-proc ::math::linearalgebra::solveTriangularBand { matrix bvect } {
-    set norows   [llength $matrix]
-    set nocols   $norows
-    set nodiags  [llength [lindex $matrix 0]]
-    set uppdiags [expr {($nodiags-1)/2}]
-    set middle   [expr {($nodiags-1)/2}]
-
-    for { set i [expr {$norows-1}] } { $i >= 0 } { incr i -1 } {
-        set sweep_row   [getrow $matrix $i]
-        set bvect_sweep [getrow $bvect  $i]
-        set sweep_fact  [lindex $sweep_row $middle]
-        set norm_fact   [expr {1.0/$sweep_fact}]
-
-        lset bvect $i [scale $norm_fact $bvect_sweep]
-
-        for { set j [expr {$i-1}] } { $j >= $i-$middle && $j >= 0 } \
-                { incr j -1 } {
-            set current_row   [getrow $matrix $j]
-            set bvect_current [getrow $bvect  $j]
-            set k             [expr {$i-$middle}]
-            set factor     [expr {-[lindex $current_row $k]/$sweep_fact}]
-
-            lset bvect  $j [axpy_vect $factor $bvect_sweep $bvect_current]
-        }
-    }
-
-    return $bvect
-}
-
-# determineSVD --
-#     Determine the singular value decomposition of a matrix
-# Arguments:
-#     A          Matrix to be examined
-#     epsilon    Tolerance for the procedure (defaults to 2.3e-16)
-#
-# Result:
-#     List of the three elements U, S and V, where:
-#     U, V orthogonal matrices, S a diagonal matrix (here a vector)
-#     such that A = USVt
-# Note:
-#     This is taken directly from Hume's LA package, and adjusted
-#     to fit the different matrix format. Also changes are applied
-#     that can be found in the second edition of Nash's book
-#     "Compact numerical methods for computers"
-#
-#     To be done: transpose the algorithm so that we can work
-#     on rows, rather than columns
-#
-proc ::math::linearalgebra::determineSVD { A {epsilon 2.3e-16} } {
-    foreach {m n} [shape $A] {break}
-    set tolerance [expr {$epsilon * $epsilon* $m * $n}]
-    set V [mkIdentity $n]
-
-    #
-    # Top of the iteration
-    #
-    set count 1
-    for {set isweep 0} {$isweep < 30 && $count > 0} {incr isweep} {
-        set count [expr {$n*($n-1)/2}] ;# count of rotations in a sweep
-        for {set j 0} {$j < [expr {$n-1}]} {incr j} {
-            for {set k [expr {$j+1}]} {$k < $n} {incr k} {
-                set p [set q [set r 0.0]]
-                for {set i 0} {$i < $m} {incr i} {
-                    set Aij [lindex $A $i $j]
-                    set Aik [lindex $A $i $k]
-                    set p [expr {$p + $Aij*$Aik}]
-                    set q [expr {$q + $Aij*$Aij}]
-                    set r [expr {$r + $Aik*$Aik}]
-                }
-                if { $q < $r } {
-                    set c 0.0
-                    set s 1.0
-                } elseif { $q * $r == 0.0 } {
-                    # Underflow of small elements
-                    incr count -1
-                    continue
-                } elseif { ($p*$p)/($q*$r) < $tolerance } {
-                    # Cols j,k are orthogonal
-                    incr count -1
-                    continue
-                } else {
-                    set q [expr {$q-$r}]
-                    set v [expr {sqrt(4.0*$p*$p + $q*$q)}]
-                    set c [expr {sqrt(($v+$q)/(2.0*$v))}]
-                    set s [expr {-$p/($v*$c)}]
-                    # s == sine of rotation angle, c == cosine
-                    # Note: -s in comparison with original LA!
-                }
-                #
-                # Rotation of A
-                #
-                set colj [getcol $A $j]
-                set colk [getcol $A $k]
-                foreach {colj colk} [rotate $c $s $colj $colk] {break}
-                setcol A $j $colj
-                setcol A $k $colk
-                #
-                # Rotation of V
-                #
-                set colj [getcol $V $j]
-                set colk [getcol $V $k]
-                foreach {colj colk} [rotate $c $s $colj $colk] {break}
-                setcol V $j $colj
-                setcol V $k $colk
-            } ;#k
-        } ;# j
-        #puts "pass=$isweep skipped rotations=$count"
-    } ;# isweep
-
-    set S {}
-    for {set j 0} {$j < $n} {incr j} {
-        set q [norm_two [getcol $A $j]]
-        lappend S $q
-        if { $q >= $tolerance } {
-            set newcol [scale [expr {1.0/$q}] [getcol $A $j]]
-            setcol A $j $newcol
-        }
-    } ;# j
-    return [list $A $S $V]
-}
-
-# eigenvectorsSVD --
-#     Determine the eigenvectors and eigenvalues of a real
-#     symmetric matrix via the SVD
-# Arguments:
-#     A          Matrix to be examined
-#     epsilon    Tolerance for the procedure (defaults to 2.3e-16)
-#
-# Result:
-#     List of the matrix of eigenvectors and the vector of corresponding
-#     eigenvalues
-# Note:
-#     This is taken directly from Hume's LA package, and adjusted
-#     to fit the different matrix format. Also changes are applied
-#     that can be found in the second edition of Nash's book
-#     "Compact numerical methods for computers"
-#
-proc ::math::linearalgebra::eigenvectorsSVD { A {epsilon 2.3e-16} } {
-    foreach {m n} [shape $A] {break}
-    if { $m != $n } {
-       return -code error "Expected a square matrix"
-    }
-
-    #
-    # Determine the shift h so that the matrix A+hI is positive
-    # definite (the Gershgorin region)
-    #
-    set h {}
-    set i 0
-    foreach row $matrix {
-        set aii [lindex $row $i]
-        set sum [expr {2.0*abs($aii) - [norm_one $row]}]
-        incr i
-
-        if { $h == {} || $sum < $h } {
-            set h $sum
-        }
-    }
-    if { $h <= $eps } {
-        set h [expr {$h - sqrt($eps)}]
-        # try to make smallest eigenvalue positive and not too small
-        set A [sub $A [mkIdentity $m $h]]
-    } else {
-        set h 0.0
-    }
-
-    #
-    # Determine the SVD decomposition: this holds the
-    # eigenvectors and eigenvalues
-    #
-    foreach {U S V} [determineSVD $A $eps] {break}
-
-    #
-    # Rescale and flip signs if all negative or zero
-    #
-    set evals {}
-    for {set j 0} {$j < $n} {incr j} {
-        set s 0.0
-        set notpositive 0
-        for {set i 0} {$i < $n} {incr i} {
-            set Aij [lindex $A $i $j]
-            if { $Aij <= 0.0 } {
-               incr notpositive
-            }
-            set s [expr {$s + $Aij*$Aij}]
-        }
-        set s [expr {sqrt($s)}]
-        if { $notpositive == $n } {
-            set sf [expr {0.0-$s}]
-        } else {
-            set sf $s
-        }
-        set colv [getcol $A $j]
-        setcol A [scale [expr {1.0/$sf}] $colv]
-        lappend evals [expr {$s+$h}]
-    }
-    return [list $A $evals]
-}
-
-# leastSquaresSVD --
-#     Determine the solution to the least-squares problem Ax ~ y
-#     via the singular value decomposition
-# Arguments:
-#     A          Matrix to be examined
-#     y          Dependent variable
-#     qmin       Minimum singular value to be considered (defaults to 0)
-#     epsilon    Tolerance for the procedure (defaults to 2.3e-16)
-#
-# Result:
-#     Vector x as the solution of the least-squares problem
-#
-proc ::math::linearalgebra::leastSquaresSVD { A y {qmin 0.0} {epsilon 2.3e-16} } {
-
-    foreach {m n} [shape $A] {break}
-    foreach {U S V} [determineSVD $A $epsilon] {break}
-
-    set tol [expr {$epsilon * $epsilon * $n * $n}]
-    #
-    # form Utrans*y into g
-    #
-    set g {}
-    for {set j 0} {$j < $n} {incr j} {
-        set s 0.0
-        for {set i 0} {$i < $m} {incr i} {
-            set Uij [lindex $U $i $j]
-            set yi  [lindex $y $i]
-            set s [expr {$s + $Uij*$yi}]
-        }
-        lappend g $s ;# g[j] = $s
-    }
-
-    #
-    # form VS+g = VS+Utrans*g
-    #
-    set x {}
-    for {set j 0} {$j < $n} {incr j} {
-        set s 0.0
-        for {set i 0} {$i < $n} {incr i} {
-            set zi [lindex $S $i]
-            if { $zi > $qmin } {
-                set Vji [lindex $V $j $i]
-                set gi  [lindex $g $i]
-                set s   [expr {$s + $Vji*$gi/$zi}]
-            }
-        }
-        lappend x $s
-    }
-    return $x
-}
-
-# choleski --
-#     Determine the Choleski decomposition of a symmetric,
-#     positive-semidefinite matrix (this condition is not checked!)
-#
-# Arguments:
-#     matrix     Matrix to be treated
-#
-# Result:
-#     Lower-triangular matrix (L) representing the Choleski decomposition:
-#        L Lt = matrix
-#
-proc ::math::linearalgebra::choleski { matrix } {
-    foreach {rows cols} [shape $matrix] {break}
-
-    set result $matrix
-
-    for { set j 0 } { $j < $cols } { incr j } {
-        if { $j > 0 } {
-            for { set i $j } { $i < $cols } { incr i } {
-                set sum [lindex $result $i $j]
-                for { set k 0 } { $k <= $j-1 } { incr k } {
-                    set Aki [lindex $result $i $k]
-                    set Akj [lindex $result $j $k]
-                    set sum [expr {$sum-$Aki*$Akj}]
-                }
-                lset result $i $j $sum
-            }
-        }
-
-        #
-        # Take care of a singular matrix
-        #
-        if { [lindex $result $j $j] <= 0.0 } {
-            lset result $j $j 0.0
-        }
-
-        #
-        # Scale the column
-        #
-        set s [expr {sqrt([lindex $result $j $j])}]
-        for { set i 0 } { $i < $cols } { incr i } {
-            if { $i >= $j } {
-                if { $s == 0.0 } {
-                    lset result $i $j 0.0
-                } else {
-                    lset result $i $j [expr {[lindex $result $i $j]/$s}]
-                }
-            } else {
-                lset result $i $j 0.0
-            }
-        }
-    }
-
-    return $result
-}
-
-# orthonormalizeColumns --
-#     Orthonormalize the columns of a matrix, using the modified
-#     Gram-Schmidt method
-# Arguments:
-#     matrix     Matrix to be treated
-#
-# Result:
-#     Matrix with pairwise orthogonal columns, each having length 1
-#
-proc ::math::linearalgebra::orthonormalizeColumns { matrix } {
-    transpose [orthonormalizeRows [transpose $matrix]]
-}
-
-# orthonormalizeRows --
-#     Orthonormalize the rows of a matrix, using the modified
-#     Gram-Schmidt method
-# Arguments:
-#     matrix     Matrix to be treated
-#
-# Result:
-#     Matrix with pairwise orthogonal rows, each having length 1
-#
-proc ::math::linearalgebra::orthonormalizeRows { matrix } {
-    set result $matrix
-    set rowno  0
-    foreach r $matrix {
-        set newrow [unitLengthVector [getrow $result $rowno]]
-        setrow result $rowno $newrow
-        incr rowno
-        set  rowno2 $rowno
-
-        #
-        # Update the matrix immediately: this is numerically
-        # more stable
-        #
-        foreach nextrow [lrange $result $rowno end] {
-            set factor  [dotproduct $newrow $nextrow]
-            set nextrow [sub_vect $nextrow [scale_vect $factor $newrow]]
-            setrow result $rowno2 $nextrow
-            incr rowno2
-        }
-    }
-    return $result
-}
-
-# to_LA --
-#     Convert a matrix or vector to the LA format
-# Arguments:
-#     mv         Matrix or vector to be converted
-#
-# Result:
-#     List according to LA conventions
-#
-proc ::math::linearalgebra::to_LA { mv } {
-    foreach {rows cols} [shape $mv] {
-        if { $cols == {} } {
-            set cols 0
-        }
-    }
-
-    set result [list 2 $rows $cols]
-    foreach row $mv {
-        set result [concat $result $row]
-    }
-    return $result
-}
-
-# from_LA --
-#     Convert a matrix or vector from the LA format
-# Arguments:
-#     mv         Matrix or vector to be converted
-#
-# Result:
-#     List according to current conventions
-#
-proc ::math::linearalgebra::from_LA { mv } {
-    foreach {rows cols} [lrange $mv 1 2] {break}
-
-    if { $cols != 0 } {
-        set result {}
-        set elem2  2
-        for { set i 0 } { $i < $rows } { incr i } {
-            set  elem1 [expr {$elem2+1}]
-            incr elem2 $cols
-            lappend result [lrange $mv $elem1 $elem2]
-        }
-    } else {
-        set result [lrange $mv 3 end]
-    }
-
-    return $result
-}
-
-#
-# Announce the package's presence
-#
-package provide math::linearalgebra 1.0.2
-
-if { 0 } {
-Te doen:
-behoorlijke testen!
-matmul
-solveGauss_band
-join_col, join_row
-kleinste-kwadraten met SVD en met Gauss
-PCA
-}
-
-if { 0 } {
-set matrix {{1.0  2.0 -1.0}
-            {3.0  1.1  0.5}
-            {1.0 -2.0  3.0}}
-set bvect  {{1.0  2.0 -1.0}
-            {3.0  1.1  0.5}
-            {1.0 -2.0  3.0}}
-puts [join [::math::linearalgebra::solveGauss $matrix $bvect] \n]
-set bvect  {{4.0   2.0}
-            {12.0  1.2}
-            {4.0  -2.0}}
-puts [join [::math::linearalgebra::solveGauss $matrix $bvect] \n]
-}
-
-if { 0 } {
-
-   set vect1 {1.0 2.0}
-   set vect2 {3.0 4.0}
-   ::math::linearalgebra::axpy_vect 1.0 $vect1 $vect2
-   ::math::linearalgebra::add_vect      $vect1 $vect2
-   puts [time {::math::linearalgebra::axpy_vect 1.0 $vect1 $vect2} 50000]
-   puts [time {::math::linearalgebra::axpy_vect 2.0 $vect1 $vect2} 50000]
-   puts [time {::math::linearalgebra::axpy_vect 1.0 $vect1 $vect2} 50000]
-   puts [time {::math::linearalgebra::axpy_vect 1.1 $vect1 $vect2} 50000]
-   puts [time {::math::linearalgebra::add_vect      $vect1 $vect2} 50000]
-}
-
-if { 0 } {
-set M {{1 2} {2 1}}
-puts "[::math::linearalgebra::determineSVD $M]"
-}
-if { 0 } {
-set M {{1 2} {2 1}}
-puts "[::math::linearalgebra::normMatrix $M]"
-}
-if { 0 } {
-set M {{1.3 2.3} {2.123 1}}
-puts "[::math::linearalgebra::show $M]"
-set M {{1.3 2.3 45 3.} {2.123 1 5.6 0.01}}
-puts "[::math::linearalgebra::show $M]"
-puts "[::math::linearalgebra::show $M %12.4f]"
-}
-if { 0 } {
-    set M {{1 0 0}
-           {1 1 0}
-           {1 1 1}}
-    puts [::math::linearalgebra::orthonormalizeRows $M]
-}
-if { 0 } {
-    set M [::math::linearalgebra::mkMoler 5]
-    puts [::math::linearalgebra::choleski $M]
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/liststat.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/liststat.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,95 +1,0 @@
-# liststat.tcl --
-#
-#    Set of operations on lists, meant for the statistics package
-#
-# version 0.1: initial implementation, january 2003
-
-namespace eval ::math::statistics {}
-
-# filter --
-#    Filter a list based on whether an expression is true for
-#    an element or not
-#
-# Arguments:
-#    varname        Name of the variable that represents the data in the
-#                   expression
-#    data           List to be filtered
-#    expression     (Logical) expression that is to be evaluated
-#
-# Result:
-#    List of those elements for which the expression is true
-# TODO:
-#    Substitute local variables in caller
-#
-proc ::math::statistics::filter { varname data expression } {
-   upvar $varname _x_
-   set result {}
-   set _x_ \$_x_
-   set expression [uplevel subst -nocommands [list $expression]]
-   foreach _x_ $data {
-      # FRINK: nocheck
-      if $expression {
-
-         lappend result $_x_
-      }
-   }
-   return $result
-}
-
-# map --
-#    Map the elements of a list according to an expression
-#
-# Arguments:
-#    varname        Name of the variable that represents the data in the
-#                   expression
-#    data           List whose elements must be transformed (mapped)
-#    expression     Expression that is evaluated with $varname an
-#                   element in the list
-#
-# Result:
-#    List of transformed elements
-#
-proc ::math::statistics::map { varname data expression } {
-   upvar $varname _x_
-   set result {}
-   set _x_ \$_x_
-   set expression [uplevel subst -nocommands [list $expression]]
-   foreach _x_ $data {
-      # FRINK: nocheck
-      lappend result [expr $expression]
-   }
-   return $result
-}
-
-# samplescount --
-#    Count the elements in each sublist and return a list of counts
-#
-# Arguments:
-#    varname        Name of the variable that represents the data in the
-#                   expression
-#    list           List of lists
-#    expression     Expression in that is evaluated with $varname an
-#                   element in the sublist (defaults to "true")
-#
-# Result:
-#    List of transformed elements
-#
-proc ::math::statistics::samplescount { varname list {expression 1} } {
-   upvar $varname _x_
-   set result {}
-   set _x_ \$_x_
-   set expression [uplevel subst -nocommands [list $expression]]
-   foreach data $list {
-      set number 0
-      foreach _x_ $data {
-         # FRINK: nocheck
-         if $expression {
-            incr number
-         }
-      }
-      lappend result $number
-   }
-   return $result
-}
-
-# End of list procedures
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/math.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/math.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,42 +1,0 @@
-# math.tcl --
-#
-#	Main 'package provide' script for the package 'math'.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: math.tcl,v 1.22 2006/09/20 22:16:02 andreas_kupries Exp $
-
-package require Tcl 8.2		;# uses [lindex $l end-$integer]
-
-# @mdgen OWNER: tclIndex
-
-namespace eval ::math {
-
-    variable version 1.2.4
-
-    # misc.tcl
-
-    namespace export	cov		fibonacci	integrate
-    namespace export	max		mean		min
-    namespace export	product		random		sigma
-    namespace export	stats		sum
-    namespace export	expectDouble    expectInteger
-
-    # combinatorics.tcl
-
-    namespace export	ln_Gamma	factorial	choose
-    namespace export	Beta
-
-    # Set up for auto-loading
-
-    variable home [file join [pwd] [file dirname [info script]]]
-    if {[lsearch -exact $::auto_path $home] == -1} {
-	lappend ::auto_path $home
-    }
-
-    package provide [namespace tail [namespace current]] $version
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/misc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/misc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,385 +1,0 @@
-# math.tcl --
-#
-#	Collection of math functions.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: misc.tcl,v 1.6 2005/10/10 14:02:47 arjenmarkus Exp $
-
-package require Tcl 8.2		;# uses [lindex $l end-$integer]
-namespace eval ::math {
-}
-
-# ::math::cov --
-#
-#	Return the coefficient of variation of three or more values
-#
-# Arguments:
-#	val1	first value
-#	val2	second value
-#	args	other values
-#
-# Results:
-#	cov	coefficient of variation expressed as percent value
-
-proc ::math::cov {val1 val2 args} {
-     set sum [ expr { $val1+$val2 } ]
-     set N [ expr { [ llength $args ] + 2 } ]
-     foreach val $args {
-        set sum [ expr { $sum+$val } ]
-     }
-     set mean [ expr { $sum/$N } ]
-     set sigma_sq 0
-     foreach val [ concat $val1 $val2 $args ] {
-        set sigma_sq [ expr { $sigma_sq+pow(($val-$mean),2) } ]
-     }
-     set sigma_sq [ expr { $sigma_sq/($N-1) } ] 
-     set sigma [ expr { sqrt($sigma_sq) } ]
-     if { $mean != 0.0 } { 
-        set cov [ expr { ($sigma/$mean)*100 } ]
-     } else {
-        return -code error -errorinfo "Cov undefined for data with zero mean" -errorcode {ARITH DOMAIN}
-     }
-     set cov
-}
-
-# ::math::fibonacci --
-#
-#	Return the n'th fibonacci number.
-#
-# Arguments:
-#	n	The index in the sequence to compute.
-#
-# Results:
-#	fib	The n'th fibonacci number.
-
-proc ::math::fibonacci {n} {
-    if { $n == 0 } {
-	return 0
-    } else {
-	set prev0 0
-	set prev1 1
-	for {set i 1} {$i < $n} {incr i} {
-	    set tmp $prev1
-	    incr prev1 $prev0
-	    set prev0 $tmp
-	}
-	return $prev1
-    }
-}
-
-# ::math::integrate --
-#
-#	calculate the area under a curve defined by a set of (x,y) data pairs.
-#	the x data must increase monotonically throughout the data set for the 
-#	calculation to be meaningful, therefore the monotonic condition is
-#	tested, and an error is thrown if the x value is found to be
-#	decreasing.
-#
-# Arguments:
-#	xy_pairs	list of x y pairs (eg, 0 0 10 10 20 20 ...); at least 5
-#			data pairs are required, and if the number of data
-#			pairs is even, a padding value of (x0, 0) will be
-#			added.
-# 
-# Results:
-#	result		A two-element list consisting of the area and error
-#			bound (calculation is "Simpson's rule")
-
-proc ::math::integrate { xy_pairs } {
-     
-     set length [ llength $xy_pairs ]
-     
-     if { $length < 10 } {
-        return -code error "at least 5 x,y pairs must be given"
-     }   
-     
-     ;## are we dealing with x,y pairs?
-     if { [ expr {$length % 2} ] } {
-        return -code error "unmatched xy pair in input"
-     }
-     
-     ;## are there an even number of pairs?  Augment.
-     if { ! [ expr {$length % 4} ] } {
-        set xy_pairs [ concat [ lindex $xy_pairs 0 ] 0 $xy_pairs ]
-     }
-     set x0   [ lindex $xy_pairs 0     ]
-     set x1   [ lindex $xy_pairs 2     ]
-     set xn   [ lindex $xy_pairs end-1 ]
-     set xnminus1 [ lindex $xy_pairs end-3 ]
-    
-     if { $x1 < $x0 } {
-        return -code error "monotonicity broken by x1"
-     }
-
-     if { $xn < $xnminus1 } {
-        return -code error "monotonicity broken by xn"
-     }   
-     
-     ;## handle the assymetrical elements 0, n, and n-1.
-     set sum [ expr {[ lindex $xy_pairs 1 ] + [ lindex $xy_pairs end ]} ]
-     set sum [ expr {$sum + (4*[ lindex $xy_pairs end-2 ])} ]
-
-     set data [ lrange $xy_pairs 2 end-4 ]
-     
-     set xmax $x1
-     set i 1
-     foreach {x1 y1 x2 y2} $data {
-        incr i
-        if { $x1 < $xmax } {
-           return -code error "monotonicity broken by x$i"
-        }
-        set xmax $x1
-        incr i
-        if { $x2 < $xmax } {
-           return -code error "monotonicity broken by x$i"
-        }
-        set xmax $x2
-        set sum [ expr {$sum + (4*$y1) + (2*$y2)} ]
-     }   
-     
-     if { $xmax > $xnminus1 } {
-        return -code error "monotonicity broken by xn-1"
-     }   
-    
-     set h [ expr { ( $xn - $x0 ) / $i } ]
-     set area [ expr { ( $h / 3.0 ) * $sum } ]
-     set err_bound  [ expr { ( ( $xn - $x0 ) / 180.0 ) * pow($h,4) * $xn } ]  
-     return [ list $area $err_bound ]
-}
-
-# ::math::max --
-#
-#	Return the maximum of two or more values
-#
-# Arguments:
-#	val	first value
-#	args	other values
-#
-# Results:
-#	max	maximum value
-
-proc ::math::max {val args} {
-    set max $val
-    foreach val $args {
-	if { $val > $max } {
-	    set max $val
-	}
-    }
-    set max
-}
-
-# ::math::mean --
-#
-#	Return the mean of two or more values
-#
-# Arguments:
-#	val	first value
-#	args	other values
-#
-# Results:
-#	mean	arithmetic mean value
-
-proc ::math::mean {val args} {
-    set sum $val
-    set N [ expr { [ llength $args ] + 1 } ]
-    foreach val $args {
-        set sum [ expr { $sum + $val } ]
-    }
-    set mean [expr { double($sum) / $N }]
-}
-
-# ::math::min --
-#
-#	Return the minimum of two or more values
-#
-# Arguments:
-#	val	first value
-#	args	other values
-#
-# Results:
-#	min	minimum value
-
-proc ::math::min {val args} {
-    set min $val
-    foreach val $args {
-	if { $val < $min } {
-	    set min $val
-	}
-    }
-    set min
-}
-
-# ::math::product --
-#
-#	Return the product of one or more values
-#
-# Arguments:
-#	val	first value
-#	args	other values
-#
-# Results:
-#	prod	 product of multiplying all values in the list
-
-proc ::math::product {val args} {
-    set prod $val
-    foreach val $args {
-        set prod [ expr { $prod*$val } ]
-    }
-    set prod
-}
-
-# ::math::random --
-#
-#	Return a random number in a given range.
-#
-# Arguments:
-#	args	optional arguments that specify the range within which to
-#		choose a number:
-#			(null)		choose a number between 0 and 1
-#			val		choose a number between 0 and val
-#			val1 val2	choose a number between val1 and val2
-#
-# Results:
-#	num	a random number in the range.
-
-proc ::math::random {args} {
-    set num [expr {rand()}]
-    if { [llength $args] == 0 } {
-	return $num
-    } elseif { [llength $args] == 1 } {
-	return [expr {int($num * [lindex $args 0])}]
-    } elseif { [llength $args] == 2 } {
-	foreach {lower upper} $args break
-	set range [expr {$upper - $lower}]
-	return [expr {int($num * $range) + $lower}]
-    } else {
-	set fn [lindex [info level 0] 0]
-	error "wrong # args: should be \"$fn ?value1? ?value2?\""
-    }
-}
-
-# ::math::sigma --
-#
-#	Return the standard deviation of three or more values
-#
-# Arguments:
-#	val1	first value
-#	val2	second value
-#	args	other values
-#
-# Results:
-#	sigma	population standard deviation value
-
-proc ::math::sigma {val1 val2 args} {
-     set sum [ expr { $val1+$val2 } ]
-     set N [ expr { [ llength $args ] + 2 } ]
-     foreach val $args {
-        set sum [ expr { $sum+$val } ]
-     }
-     set mean [ expr { $sum/$N } ]
-     set sigma_sq 0
-     foreach val [ concat $val1 $val2 $args ] {
-        set sigma_sq [ expr { $sigma_sq+pow(($val-$mean),2) } ]
-     }
-     set sigma_sq [ expr { $sigma_sq/($N-1) } ] 
-     set sigma [ expr { sqrt($sigma_sq) } ]
-     set sigma
-}     
-
-# ::math::stats --
-#
-#	Return the mean, standard deviation, and coefficient of variation as
-#	percent, as a list.
-#
-# Arguments:
-#	val1	first value
-#	val2	first value
-#	args	all other values
-#
-# Results:
-#	{mean stddev coefvar}
-
-proc ::math::stats {val1 val2 args} {
-     set sum [ expr { $val1+$val2 } ]
-     set N [ expr { [ llength $args ] + 2 } ]
-     foreach val $args {
-        set sum [ expr { $sum+$val } ]
-     }
-     set mean [ expr { $sum/$N } ]
-     set sigma_sq 0
-     foreach val [ concat $val1 $val2 $args ] {
-        set sigma_sq [ expr { $sigma_sq+pow(($val-$mean),2) } ]
-     }
-     set sigma_sq [ expr { $sigma_sq/($N-1) } ] 
-     set sigma [ expr { sqrt($sigma_sq) } ]
-     set cov [ expr { ($sigma/$mean)*100 } ]
-     return [ list $mean $sigma $cov ]
-}
-
-# ::math::sum --
-#
-#	Return the sum of one or more values
-#
-# Arguments:
-#	val	first value
-#	args	all other values
-#
-# Results:
-#	sum	arithmetic sum of all values in args
-
-proc ::math::sum {val args} {
-    set sum $val
-    foreach val $args {
-        set sum [ expr { $sum+$val } ]
-    }
-    set sum
-}
-
-#----------------------------------------------------------------------
-#
-# ::math::expectDouble --
-#
-#	Format an error message that an argument was expected to be
-#	double and wasn't
-#
-# Parameters:
-#	arg -- Misformatted argument
-#
-# Results:
-#	Returns an appropriate error message
-#
-# Side effects:
-#	None.
-#
-#----------------------------------------------------------------------
-
-proc ::math::expectDouble { arg } {
-    return [format "expected a floating-point number but found \"%.50s\"" $arg]
-}
-
-#----------------------------------------------------------------------
-#
-# ::math::expectInteger --
-#
-#	Format an error message that an argument was expected to be
-#	integer and wasn't
-#
-# Parameters:
-#	arg -- Misformatted argument
-#
-# Results:
-#	Returns an appropriate error message
-#
-# Side effects:
-#	None.
-#
-#----------------------------------------------------------------------
-
-proc ::math::expectInteger { arg } {
-    return [format "expected an integer but found \"%.50s\"" $arg]
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/mvlinreg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/mvlinreg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,262 +1,0 @@
-# mvreglin.tcl --
-#     Addition to the statistics package
-#     Copyright 2007 Eric Kemp-Benedict
-#     Released under the BSD license under any terms
-#     that allow it to be compatible with tcllib
-
-package require math::linearalgebra 1.0
-package require math::statistics 0.4
-
-# ::math::statistics --
-#     This file adds:
-#     mvlinreg = Multivariate Linear Regression
-#
-namespace eval ::math::statistics {
-    variable epsilon 1.0e-7
-
-    namespace export tstat mv-wls mv-ols
-
-    namespace import -force \
-        ::math::linearalgebra::mkMatrix \
-        ::math::linearalgebra::mkVector \
-        ::math::linearalgebra::mkIdentity \
-        ::math::linearalgebra::mkDiagonal \
-        ::math::linearalgebra::getrow \
-        ::math::linearalgebra::setrow \
-        ::math::linearalgebra::getcol \
-        ::math::linearalgebra::setcol \
-        ::math::linearalgebra::getelem \
-        ::math::linearalgebra::setelem \
-        ::math::linearalgebra::dotproduct \
-        ::math::linearalgebra::matmul \
-        ::math::linearalgebra::add \
-        ::math::linearalgebra::sub \
-        ::math::linearalgebra::solveGauss \
-        ::math::linearalgebra::transpose
-}
-
-# tstats --
-#     Returns inverse of the single-tailed t distribution
-#     given number of degrees of freedom & confidence
-#
-# Arguments:
-#     n        Number of degrees of freedom
-#     alpha    Confidence level (defaults to 0.05)
-#
-# Result:
-#     Inverse of the t-distribution
-#
-# Note:
-#     Iterates until result is within epsilon of the target.
-#     It is possible that the iteration does not converge
-#
-proc ::math::statistics::tstat {n {alpha 0.05}} {
-    variable epsilon
-    variable tvals
-
-    if [info exists tvals($n:$alpha)] {
-        return $tvals($n:$alpha)
-    }
-
-    set deltat [expr {100 * $epsilon}]
-    # For one-tailed distribution,
-    set ptarg [expr {1.000 - $alpha/2.0}]
-    set maxiter 100
-
-    # Initial value for t
-    set t 2.0
-
-    set niter 0
-    while {abs([::math::statistics::cdf-students-t $n $t] - $ptarg) > $epsilon} {
-        set pstar [::math::statistics::cdf-students-t $n $t]
-        set pl [::math::statistics::cdf-students-t $n [expr {$t - $deltat}]]
-        set ph [::math::statistics::cdf-students-t $n [expr {$t + $deltat}]]
-
-        set t [expr {$t + 2.0 * $deltat * ($ptarg - $pstar)/($ph - $pl)}]
-
-        incr niter
-        if {$niter == $maxiter} {
-            return -code error "::math::statistics::tstat: Did not converge after $niter iterations"
-        }
-    }
-
-    # Cache the result to shorten the call in future
-    set tvals($n:$alpha) $t
-
-    return $t
-}
-
-# mv-wls --
-#     Weighted Least Squares
-#
-# Arguments:
-#     data       Alternating list of weights and observations
-#
-# Result:
-#     List containing:
-#     * R-squared
-#     * Adjusted R-squared
-#     * Coefficients of x's in fit
-#     * Standard errors of the coefficients
-#     * 95% confidence bounds for coefficients
-#
-# Note:
-#     The observations are lists starting with the dependent variable y
-#     and then the values of the independent variables (x1, x2, ...):
-#
-#     mv-wls [list w [list y x's] w [list y x's] ...]
-#
-proc ::math::statistics::mv-wls {data} {
-
-    # Fill the matrices of x & y values, and weights
-    # For n points, k coefficients
-
-    # The number of points is equal to half the arguments (n weights, n points)
-    set n [expr {[llength $data]/2}]
-
-    set firstloop true
-    # Sum up all y values to take an average
-    set ysum 0
-    # Add up the weights
-    set wtsum 0
-    # Count over rows (points) as you go
-    set point 0
-    foreach {wt pt} $data {
-
-        # Check inputs
-        if {[string is double $wt] == 0} {
-            return -code error "::math::statistics::mv-wls: Weight \"$wt\" is not a number"
-            return {}
-        }
-
-        ## -- Check dimensions, initialize
-        if $firstloop {
-            # k = num of vals in pt = 1 + number of x's (because of constant)
-            set k [llength $pt]
-            if {$n <= [expr {$k + 1}]} {
-                return -code error "::math::statistics::mv-wls: Too few degrees of freedom: $k variables but only $n points"
-                return {}
-            }
-            set X [mkMatrix $n $k]
-            set y [mkVector $n]
-            set I_x [mkIdentity $k]
-            set I_y [mkIdentity $n]
-
-            set firstloop false
-
-        } else {
-            # Have to have same number of x's for all points
-            if {$k != [llength $pt]} {
-                return -code error "::math::statistics::mv-wls: Point \"$pt\" has wrong number of values (expected $k)"
-                # Clean up
-                return {}
-            }
-        }
-
-        ## -- Extract values from set of points
-        # Make a list of y values
-        set yval [expr {double([lindex $pt 0])}]
-        setelem y $point $yval
-        set ysum [expr {$ysum + $wt * $yval}]
-        set wtsum [expr {$wtsum + $wt}]
-        # Add x-values to the x-matrix
-        set xrow [lrange $pt 1 end]
-        # Add the constant (value = 1.0)
-        lappend xrow 1.0
-        setrow X $point $xrow
-        # Create list of weights & square root of weights
-        lappend w [expr {double($wt)}]
-        lappend sqrtw [expr {sqrt(double($wt))}]
-
-        incr point
-
-    }
-
-    set ymean [expr {double($ysum)/$wtsum}]
-    set W [mkDiagonal $w]
-    set sqrtW [mkDiagonal $sqrtw]
-
-    # Calculate sum os square differences for x's
-    for {set r 0} {$r < $k} {incr r} {
-        set xsqrsum 0.0
-        set xmeansum 0.0
-        # Calculate sum of squared differences as: sum(x^2) - (sum x)^2/n
-        for {set t 0} {$t < $n} {incr t} {
-            set xval [getelem $X $t $r]
-            set xmeansum [expr {$xmeansum + double($xval)}]
-            set xsqrsum [expr {$xsqrsum + double($xval * $xval)}]
-        }
-        lappend xsqr [expr {$xsqrsum - $xmeansum * $xmeansum/$n}]
-    }
-
-    ## -- Set up the X'WX matrix
-    set XtW [matmul [::math::linearalgebra::transpose $X] $W]
-    set XtWX [matmul $XtW $X]
-
-    # Invert
-    set M [solveGauss $XtWX $I_x]
-
-    set beta [matmul $M [matmul $XtW $y]]
-
-    ### -- Residuals & R-squared
-    # 1) Generate list of diagonals of the hat matrix
-    set H [matmul $X [matmul $M $XtW]]
-    for {set i 0} {$i < $n} {incr i} {
-        lappend h_ii [getelem $H $i $i]
-    }
-
-    set R [matmul $sqrtW [matmul [sub $I_y $H] $y]]
-    set yhat [matmul $H $y]
-
-    # 2) Generate list of residuals, sum of squared residuals, r-squared
-    set sstot 0.0
-    set ssreg 0.0
-    # Note: Relying on representation of Vector as a list for y, yhat
-    foreach yval $y wt $w yhatval $yhat {
-        set sstot [expr {$sstot + $wt * ($yval - $ymean) * ($yval - $ymean)}]
-        set ssreg [expr {$ssreg + $wt * ($yhatval - $ymean) * ($yhatval - $ymean)}]
-    }
-    set r2 [expr {double($ssreg)/$sstot}]
-    set adjr2 [expr {1.0 - (1.0 - $r2) * ($n - 1)/($n - $k)}]
-    set sumsqresid [dotproduct $R $R]
-    set s2 [expr {double($sumsqresid) / double($n - $k)}]
-
-    ### -- Confidence intervals for coefficients
-    set tvalue [tstat [expr {$n - $k}]]
-    for {set i 0} {$i < $k} {incr i} {
-        set stderr [expr {sqrt($s2 * [getelem $M $i $i])}]
-        set mid [lindex $beta $i]
-        lappend stderrs $stderr
-        lappend confinterval [list [expr {$mid - $tvalue * $stderr}] [expr {$mid + $tvalue * $stderr}]]
-    }
-
-    return [list $r2 $adjr2 $beta $stderrs $confinterval]
-}
-
-# mv-ols --
-#     Ordinary Least Squares
-#
-# Arguments:
-#     data       List of observations, list of lists
-#
-# Result:
-#     List containing:
-#     * R-squared
-#     * Adjusted R-squared
-#     * Coefficients of x's in fit
-#     * Standard errors of the coefficients
-#     * 95% confidence bounds for coefficients
-#
-# Note:
-#     The observations are lists starting with the dependent variable y
-#     and then the values of the independent variables (x1, x2, ...):
-#
-#     mv-ols [list y x's] [list y x's] ...
-#
-proc ::math::statistics::mv-ols {data} {
-    set newdata {}
-    foreach pt $data {
-        lappend newdata 1 $pt
-    }
-    return [mv-wls $newdata]
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/optimize.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/optimize.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1307 +1,0 @@
-#----------------------------------------------------------------------
-#
-# math/optimize.tcl --
-#
-#	This file contains functions for optimization of a function
-#	or expression.
-#
-# Copyright (c) 2004, by Arjen Markus.
-# Copyright (c) 2004, 2005 by Kevin B. Kenny.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: optimize.tcl,v 1.11 2005/09/28 04:51:22 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.4
-
-# math::optimize --
-#    Namespace for the commands
-#
-namespace eval ::math::optimize {
-   namespace export minimum  maximum solveLinearProgram linearProgramMaximum
-   namespace export min_bound_1d min_unbound_1d
-
-   # Possible extension: minimumExpr, maximumExpr
-}
-
-# minimum --
-#    Minimize a given function over a given interval
-#
-# Arguments:
-#    begin       Start of the interval
-#    end         End of the interval
-#    func        Name of the function to be minimized (takes one
-#                argument)
-#    maxerr      Maximum relative error (defaults to 1.0e-4)
-# Return value:
-#    Computed value for which the function is minimal
-# Notes:
-#    The function needs not to be differentiable, but it is supposed
-#    to be continuous. There is no provision for sub-intervals where
-#    the function is constant (this might happen when the maximum
-#    error is very small, < 1.0e-15)
-#
-# Warning:
-#    This procedure is deprecated - use min_bound_1d instead
-#
-proc ::math::optimize::minimum { begin end func {maxerr 1.0e-4} } {
-
-   set nosteps  [expr {3+int(-log($maxerr)/log(2.0))}]
-   set delta    [expr {0.5*($end-$begin)*$maxerr}]
-
-   for { set step 0 } { $step < $nosteps } { incr step } {
-      set x1 [expr {($end+$begin)/2.0}]
-      set x2 [expr {$x1+$delta}]
-
-      set fx1 [uplevel 1 $func $x1]
-      set fx2 [uplevel 1 $func $x2]
-
-      if {$fx1 < $fx2} {
-         set end   $x1
-      } else {
-         set begin $x1
-      }
-   }
-   return $x1
-}
-
-# maximum --
-#    Maximize a given function over a given interval
-#
-# Arguments:
-#    begin       Start of the interval
-#    end         End of the interval
-#    func        Name of the function to be maximized (takes one
-#                argument)
-#    maxerr      Maximum relative error (defaults to 1.0e-4)
-# Return value:
-#    Computed value for which the function is maximal
-# Notes:
-#    The function needs not to be differentiable, but it is supposed
-#    to be continuous. There is no provision for sub-intervals where
-#    the function is constant (this might happen when the maximum
-#    error is very small, < 1.0e-15)
-#
-# Warning:
-#    This procedure is deprecated - use max_bound_1d instead
-#
-proc ::math::optimize::maximum { begin end func {maxerr 1.0e-4} } {
-
-   set nosteps  [expr {3+int(-log($maxerr)/log(2.0))}]
-   set delta    [expr {0.5*($end-$begin)*$maxerr}]
-
-   for { set step 0 } { $step < $nosteps } { incr step } {
-      set x1 [expr {($end+$begin)/2.0}]
-      set x2 [expr {$x1+$delta}]
-
-      set fx1 [uplevel 1 $func $x1]
-      set fx2 [uplevel 1 $func $x2]
-
-      if {$fx1 > $fx2} {
-         set end   $x1
-      } else {
-         set begin $x1
-      }
-   }
-   return $x1
-}
-
-#----------------------------------------------------------------------
-#
-# min_bound_1d --
-#
-#       Find a local minimum of a function between two given
-#       abscissae. Derivative of f is not required.
-#
-# Usage:
-#       min_bound_1d f x1 x2 ?-option value?,,,
-#
-# Parameters:
-#       f - Function to minimize.  Must be expressed as a Tcl
-#           command, to which will be appended the value at which
-#           to evaluate the function.
-#       x1 - Lower bound of the interval in which to search for a
-#            minimum
-#       x2 - Upper bound of the interval in which to search for a minimum
-#
-# Options:
-#       -relerror value
-#               Gives the tolerance desired for the returned
-#               abscissa.  Default is 1.0e-7.  Should never be less
-#               than the square root of the machine precision.
-#       -maxiter n
-#               Constrains minimize_bound_1d to evaluate the function
-#               no more than n times.  Default is 100.  If convergence
-#               is not achieved after the specified number of iterations,
-#               an error is thrown.
-#       -guess value
-#               Gives a point between x1 and x2 that is an initial guess
-#               for the minimum.  f(guess) must be at most f(x1) or
-#               f(x2).
-#        -fguess value
-#                Gives the value of the ordinate at the value of '-guess'
-#                if known.  Default is to evaluate the function
-#       -abserror value
-#               Gives the desired absolute error for the returned
-#               abscissa.  Default is 1.0e-10.
-#       -trace boolean
-#               A true value causes a trace to the standard output
-#               of the function evaluations. Default is 0.
-#
-# Results:
-#       Returns a two-element list comprising the abscissa at which
-#       the function reaches a local minimum within the interval,
-#       and the value of the function at that point.
-#
-# Side effects:
-#       Whatever side effects arise from evaluating the given function.
-#
-#----------------------------------------------------------------------
-
-proc ::math::optimize::min_bound_1d { f x1 x2 args } {
-
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-
-    set phim1 0.6180339887498949
-    set twomphi 0.3819660112501051
-
-    array set params {
-        -relerror 1.0e-7
-        -abserror 1.0e-10
-        -maxiter 100
-        -trace 0
-        -fguess {}
-    }
-    set params(-guess) [expr { $phim1 * $x1 + $twomphi * $x2 }]
-
-    if { ( [llength $args] % 2 ) != 0 } {
-        return -code error -errorcode [list min_bound_1d wrongNumArgs] \
-            "wrong \# args, should be\
-                 \"[lreplace [info level 0] 1 end f x1 x2 ?-option value?...]\""
-    }
-    foreach { key value } $args {
-        if { ![info exists params($key)] } {
-            return -code error -errorcode [list min_bound_1d badoption $key] \
-                "unknown option \"$key\",\
-                     should be -abserror,\
-                     -fguess, -guess, -initial, -maxiter, -relerror,\
-                     or -trace"
-        }
-	set params($key) $value
-    }
-
-    # a and b presumably bracket the minimum of the function.  Make sure
-    # they're in ascending order.
-
-    if { $x1 < $x2 } {
-        set a $x1; set b $x2
-    } else {
-        set b $x1; set a $x2
-    }
-
-    set x $params(-guess);              # Best abscissa found so far
-    set w $x;                           # Second best abscissa found so far
-    set v $x;                           # Most recent earlier value of w
-
-    set e 0.0;                          # Distance moved on the step before
-					# last.
-
-    # Evaluate the function at the initial guess
-
-    if { $params(-fguess) ne {} } {
-        set fx $params(-fguess)
-    } else {
-        set s $f; lappend s $x; set fx [eval $s]
-        if { $params(-trace) } {
-            puts stdout "f($x) = $fx (initialisation)"
-        }
-    }
-    set fw $fx
-    set fv $fx
-
-    for { set iter 0 } { $iter < $params(-maxiter) } { incr iter } {
-
-        # Find the midpoint of the current interval
-
-        set xm [expr { 0.5 * ( $a + $b ) }]
-
-        # Compute the current tolerance for x, and twice its value
-
-        set tol [expr { $params(-relerror) * abs($x) + $params(-abserror) }]
-        set tol2 [expr { $tol + $tol }]
-        if { abs( $x - $xm ) <= $tol2 - 0.5 * ($b - $a) } {
-            return [list $x $fx]
-        }
-        set golden 1
-        if { abs($e) > $tol } {
-
-            # Use parabolic interpolation to find a minimum determined
-            # by the evaluations at x, v, and w.  The size of the step
-            # to take will be $p/$q.
-
-            set r [expr { ( $x - $w ) * ( $fx - $fv ) }]
-            set q [expr { ( $x - $v ) * ( $fx - $fw ) }]
-            set p [expr { ( $x - $v ) * $q - ( $x - $w ) * $r }]
-            set q [expr { 2. * ( $q - $r ) }]
-            if { $q > 0 } {
-                set p [expr { - $p }]
-            } else {
-                set q [expr { - $q }]
-            }
-            set olde $e
-            set e $d
-
-            # Test if parabolic interpolation results in less than half
-            # the movement of the step two steps ago.
-
-            if { abs($p) < abs( .5 * $q * $olde )
-                 && $p > $q * ( $a - $x )
-                 && $p < $q * ( $b - $x ) } {
-
-                set d [expr { $p / $q }]
-                set u [expr { $x + $d }]
-                if { ( $u - $a ) < $tol2 || ( $b - $u ) < $tol2 } {
-                    if { $xm-$x < 0 } {
-                        set d [expr { - $tol }]
-                    } else {
-                        set d $tol
-                    }
-                }
-                set golden 0
-            }
-        }
-
-        # If parabolic interpolation didn't come up with an acceptable
-        # result, use Golden Section instead.
-
-        if { $golden } {
-            if { $x >= $xm } {
-                set e [expr { $a - $x }]
-            } else {
-                set e [expr { $b - $x }]
-            }
-            set d [expr { $twomphi * $e }]
-        }
-
-        # At this point, d is the size of the step to take.  Make sure
-        # that it's at least $tol.
-
-        if { abs($d) >= $tol } {
-            set u [expr { $x + $d }]
-        } elseif { $d < 0 } {
-            set u [expr { $x - $tol }]
-        } else {
-            set u [expr { $x + $tol }]
-        }
-
-        # Evaluate the function
-
-        set s $f; lappend s $u; set fu [eval $s]
-        if { $params(-trace) } {
-            if { $golden } {
-                puts stdout "f($u)=$fu (golden section)"
-            } else {
-                puts stdout "f($u)=$fu (parabolic interpolation)"
-            }
-        }
-
-        if { $fu <= $fx } {
-            # We've the best abscissa so far.
-
-            if { $u >= $x } {
-                set a $x
-            } else {
-                set b $x
-            }
-            set v $w
-            set fv $fw
-            set w $x
-            set fw $fx
-            set x $u
-            set fx $fu
-        } else {
-
-            if { $u < $x } {
-                set a $u
-            } else {
-                set b $u
-            }
-            if { $fu <= $fw || $w == $x } {
-                # We've the second-best abscissa so far
-                set v $w
-                set fv $fw
-                set w $u
-                set fw $fu
-            } elseif { $fu <= $fv || $v == $x || $v == $w } {
-                # We've the third-best so far
-                set v $u
-                set fv $fu
-            }
-        }
-    }
-
-    return -code error -errorcode [list min_bound_1d noconverge $iter] \
-        "[lindex [info level 0] 0] failed to converge after $iter steps."
-
-}
-
-#----------------------------------------------------------------------
-#
-# brackmin --
-#
-#       Find a place along the number line where a given function has
-#       a local minimum.
-#
-# Usage:
-#       brackmin f x1 x2 ?trace?
-#
-# Parameters:
-#       f - Function to minimize
-#       x1 - Abscissa thought to be near the minimum
-#       x2 - Additional abscissa thought to be near the minimum
-#	trace - Boolean variable that, if true,
-#               causes 'brackmin' to print a trace of its function
-#               evaluations to the standard output.  Default is 0.
-#
-# Results:
-#       Returns a three element list {x1 y1 x2 y2 x3 y3} where
-#       y1=f(x1), y2=f(x2), y3=f(x3).  x2 lies between x1 and x3, and
-#       y1>y2, y3>y2, proving that there is a local minimum somewhere
-#       in the interval (x1,x3).
-#
-# Side effects:
-#       Whatever effects the evaluation of f has.
-#
-#----------------------------------------------------------------------
-
-proc ::math::optimize::brackmin { f x1 x2 {trace 0} } {
-
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-
-    set phi 1.6180339887498949
-    set epsilon 1.0e-20
-    set limit 50.
-
-    # Choose a and b so that f(a) < f(b)
-
-    set cmd $f; lappend cmd $x1; set fx1 [eval $cmd]
-    if { $trace } {
-        puts "f($x1) = $fx1 (initialisation)"
-    }
-    set cmd $f; lappend cmd $x2; set fx2 [eval $cmd]
-    if { $trace } {
-        puts "f($x2) = $fx2 (initialisation)"
-    }
-    if { $fx1 > $fx2 } {
-        set a $x1; set fa $fx1
-        set b $x2; set fb $fx2
-    } else {
-        set a $x2; set fa $fx2
-        set b $x1; set fb $fx1
-    }
-
-    # Choose a c in the downhill direction
-
-    set c [expr { $b + $phi * ($b - $a) }]
-    set cmd $f; lappend cmd $c; set fc [eval $cmd]
-    if { $trace } {
-        puts "f($c) = $fc (initial dilatation by phi)"
-    }
-
-    while { $fb >= $fc } {
-
-        # Try to do parabolic extrapolation to the minimum
-
-        set r [expr { ($b - $a) * ($fb - $fc) }]
-        set q [expr { ($b - $c) * ($fb - $fa) }]
-        if { abs( $q - $r ) > $epsilon } {
-            set denom [expr { $q - $r }]
-        } elseif { $q > $r } {
-            set denom $epsilon
-        } else {
-            set denom -$epsilon
-        }
-        set u [expr { $b - ( (($b - $c) * $q - ($b - $a) * $r)
-                             / (2. * $denom) ) }]
-        set ulimit [expr { $b + $limit * ( $c - $b ) }]
-
-        # Test the extrapolated abscissa
-
-        if { ($b - $u) * ($u - $c) > 0 } {
-
-            # u lies between b and c.  Try to interpolate
-
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (parabolic interpolation)"
-            }
-
-            if { $fu < $fc } {
-
-                # fb > fu and fc > fu, so there is a minimum between b and c
-                # with u as a starting guess.
-
-                return [list $b $fb $u $fu $c $fc]
-
-            }
-
-            if { $fu > $fb } {
-
-                # fb < fu, fb < fa, and u cannot lie between a and b
-                # (because it lies between a and c).  There is a minimum
-                # somewhere between a and u, with b a starting guess.
-
-                return [list $a $fa $b $fb $u $fu]
-
-            }
-
-            # Parabolic interpolation was useless. Expand the
-            # distance by a factor of phi and try again.
-
-            set u [expr { $c + $phi * ($c - $b) }]
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (parabolic interpolation failed)"
-            }
-
-
-        } elseif { ( $c - $u ) * ( $u - $ulimit ) > 0 } {
-
-            # u lies between $c and $ulimit.
-
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (parabolic extrapolation)"
-            }
-
-            if { $fu > $fc } {
-
-                # minimum lies between b and u, with c an initial guess.
-
-                return [list $b $fb $c $fc $u $fu]
-
-            }
-
-            # function is still decreasing fa > fb > fc > fu. Take
-            # another factor-of-phi step.
-
-            set b $c; set fb $fc
-            set c $u; set fc $fu
-            set u [expr { $c + $phi * ( $c - $b ) }]
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (parabolic extrapolation ok)"
-            }
-
-        } elseif { ($u - $ulimit) * ( $ulimit - $c ) >= 0 } {
-
-            # u went past ulimit.  Pull in to ulimit and evaluate there.
-
-            set u $ulimit
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (limited step)"
-            }
-
-        } else {
-
-            # parabolic extrapolation gave a useless value.
-
-            set u [expr { $c + $phi * ( $c - $b ) }]
-            set cmd $f; lappend cmd $u; set fu [eval $cmd]
-            if { $trace } {
-                puts "f($u) = $fu (parabolic extrapolation failed)"
-            }
-
-        }
-
-        set a $b; set fa $fb
-        set b $c; set fb $fc
-        set c $u; set fc $fu
-    }
-
-    return [list $a $fa $b $fb $c $fc]
-}
-
-#----------------------------------------------------------------------
-#
-# min_unbound_1d --
-#
-#	Minimize a function of one variable, unconstrained, derivatives
-#	not required.
-#
-# Usage:
-#       min_bound_1d f x1 x2 ?-option value?,,,
-#
-# Parameters:
-#       f - Function to minimize.  Must be expressed as a Tcl
-#           command, to which will be appended the value at which
-#           to evaluate the function.
-#       x1 - Initial guess at the minimum
-#       x2 - Second initial guess at the minimum, used to set the
-#	     initial length scale for the search.
-#
-# Options:
-#       -relerror value
-#               Gives the tolerance desired for the returned
-#               abscissa.  Default is 1.0e-7.  Should never be less
-#               than the square root of the machine precision.
-#       -maxiter n
-#               Constrains min_bound_1d to evaluate the function
-#               no more than n times.  Default is 100.  If convergence
-#               is not achieved after the specified number of iterations,
-#               an error is thrown.
-#       -abserror value
-#               Gives the desired absolute error for the returned
-#               abscissa.  Default is 1.0e-10.
-#       -trace boolean
-#               A true value causes a trace to the standard output
-#               of the function evaluations. Default is 0.
-#
-#----------------------------------------------------------------------
-
-proc ::math::optimize::min_unbound_1d { f x1 x2 args } {
-
-    set f [lreplace $f 0 0 [uplevel 1 [list namespace which [lindex $f 0]]]]
-
-    array set params {
-	-relerror 1.0e-7
-	-abserror 1.0e-10
-	-maxiter 100
-        -trace 0
-    }
-    if { ( [llength $args] % 2 ) != 0 } {
-        return -code error -errorcode [list min_unbound_1d wrongNumArgs] \
-            "wrong \# args, should be\
-                 \"[lreplace [info level 0] 1 end \
-                         f x1 x2 ?-option value?...]\""
-    }
-    foreach { key value } $args {
-        if { ![info exists params($key)] } {
-            return -code error -errorcode [list min_unbound_1d badoption $key] \
-                "unknown option \"$key\",\
-                     should be -trace"
-        }
-        set params($key) $value
-    }
-    foreach { a fa b fb c fc } [brackmin $f $x1 $x2 $params(-trace)] {
-	break
-    }
-    return [eval [linsert [array get params] 0 \
-		      min_bound_1d $f $a $c -guess $b -fguess $fb]]
-}
-
-#----------------------------------------------------------------------
-#
-# nelderMead --
-#
-#	Attempt to minimize/maximize a function using the downhill
-#	simplex method of Nelder and Mead.
-#
-# Usage:
-#	nelderMead f x ?-keyword value?
-#
-# Parameters:
-#	f - The function to minimize.  The function must be an incomplete
-#	    Tcl command, to which will be appended N parameters.
-#	x - The starting guess for the minimum; a vector of N parameters
-#	    to be passed to the function f.
-#
-# Options:
-#	-scale xscale
-#		Initial guess as to the problem scale.  If '-scale' is
-#		supplied, then the parameters will be varied by the
-#	        specified amounts.  The '-scale' parameter must of the
-#		same dimension as the 'x' vector, and all elements must
-#		be nonzero.  Default is 0.0001 times the 'x' vector,
-#		or 0.0001 for zero elements in the 'x' vector.
-#
-#	-ftol epsilon
-#		Requested tolerance in the function value; nelderMead
-#		returns if N+1 consecutive iterates all differ by less
-#		than the -ftol value.  Default is 1.0e-7
-#
-#	-maxiter N
-#		Maximum number of iterations to attempt.  Default is
-#		500.
-#
-#	-trace flag
-#		If '-trace 1' is supplied, nelderMead writes a record
-#		of function evaluations to the standard output as it
-#		goes.  Default is 0.
-#
-#----------------------------------------------------------------------
-
-proc ::math::optimize::nelderMead { f startx args } {
-    array set params {
-	-ftol 1.e-7
-	-maxiter 500
-	-scale {}
-	-trace 0
-    }
-
-    # Check arguments
-
-    if { ( [llength $args] % 2 ) != 0 } {
-        return -code error -errorcode [list nelderMead wrongNumArgs] \
-            "wrong \# args, should be\
-                 \"[lreplace [info level 0] 1 end \
-                         f x1 x2 ?-option value?...]\""
-    }
-    foreach { key value } $args {
-        if { ![info exists params($key)] } {
-            return -code error -errorcode [list nelderMead badoption $key] \
-                "unknown option \"$key\",\
-                     should be -ftol, -maxiter, -scale or -trace"
-        }
-        set params($key) $value
-    }
-    
-    # Construct the initial simplex
-
-    set vertices [list $startx]
-    if { [llength $params(-scale)] == 0 } {
-	set i 0
-	foreach x0 $startx {
-	    if { $x0 == 0 } {
-		set x1 0.0001
-	    } else {
-		set x1 [expr {1.0001 * $x0}]
-	    }
-	    lappend vertices [lreplace $startx $i $i $x1]
-	    incr i
-	}
-    } elseif { [llength $params(-scale)] != [llength $startx] } {
-	return -code error -errorcode [list nelderMead badOption -scale] \
-	    "-scale vector must be of same size as starting x vector"
-    } else {
-	set i 0
-	foreach x0 $startx s $params(-scale) {
-	    lappend vertices [lreplace $startx $i $i [expr { $x0 + $s }]]
-	    incr i
-	}
-    }
-
-    # Evaluate at the initial points
-
-    set n [llength $startx]
-    foreach x $vertices {
-	set cmd $f
-	foreach xx $x {
-	    lappend cmd $xx
-	}
-	set y [uplevel 1 $cmd]
-	if {$params(-trace)} {
-	    puts "nelderMead: evaluating initial point: x=[list $x] y=$y"
-	}
-	lappend yvec $y
-    }
-
-
-    # Loop adjusting the simplex in the 'vertices' array.
-
-    set nIter 0
-    while { 1 } {
-
-	# Find the highest, next highest, and lowest value in y,
-	# and save the indices.
-
-	set iBot 0
-	set yBot [lindex $yvec 0]
-	set iTop -1
-	set yTop [lindex $yvec 0]
-	set iNext -1
-	set i 0
-	foreach y $yvec {
-	    if { $y <= $yBot } {
-		set yBot $y
-		set iBot $i
-	    }
-	    if { $iTop < 0 || $y >= $yTop } {
-		set iNext $iTop
-		set yNext $yTop
-		set iTop $i
-		set yTop $y
-	    } elseif { $iNext < 0 || $y >= $yNext } {
-		set iNext $i
-		set yNext $y
-	    }
-	    incr i
-	}
-
-	# Return if the relative error is within an acceptable range
-
-	set rerror [expr { 2. * abs( $yTop - $yBot )
-			   / ( abs( $yTop ) + abs( $yBot ) ) }]
-	if { $rerror < $params(-ftol) } {
-	    set status ok
-	    break
-	}
-
-	# Count iterations
-
-	if { [incr nIter] > $params(-maxiter) } {
-	    set status too-many-iterations
-	    break
-	}
-	incr nIter
-
-	# Find the centroid of the face opposite the vertex that
-	# maximizes the function value.
-
-	set centroid {}
-	for { set i 0 } { $i < $n } { incr i } {
-	    lappend centroid 0.0
-	}
-	set i 0
-	foreach v $vertices {
-	    if { $i != $iTop } {
-		set newCentroid {}
-		foreach x0 $centroid x1 $v {
-		    lappend newCentroid [expr { $x0 + $x1 }]
-		}
-		set centroid $newCentroid
-	    }
-	    incr i
-	}
-	set newCentroid {}
-	foreach x $centroid {
-	    lappend newCentroid [expr { $x / $n }]
-	}
-	set centroid $newCentroid
-
-	# The first trial point is a reflection of the high point
-	# around the centroid
-
-	set trial {}
-	foreach x0 [lindex $vertices $iTop] x1 $centroid {
-	    lappend trial [expr {$x1 + ($x1 - $x0)}]
-	}
-	set cmd $f
-	foreach xx $trial {
-	    lappend cmd $xx
-	} 
-	set yTrial [uplevel 1 $cmd]
-	if { $params(-trace) } {
-	    puts "nelderMead: trying reflection: x=[list $trial] y=$yTrial"
-	}
-
-	# If that reflection yields a new minimum, replace the high point,
-	# and additionally try dilating in the same direction.
-
-	if { $yTrial < $yBot } {
-	    set trial2 {}
-	    foreach x0 $centroid x1 $trial {
-		lappend trial2 [expr { $x1 + ($x1 - $x0) }]
-	    }
-	    set cmd $f
-	    foreach xx $trial2 {
-		lappend cmd $xx
-	    }
-	    set yTrial2 [uplevel 1 $cmd]
-	    if { $params(-trace) } {
-		puts "nelderMead: trying dilated reflection:\
-                      x=[list $trial2] y=$y"
-	    }
-	    if { $yTrial2 < $yBot } {
-
-		# Additional dilation yields a new minimum
-
-		lset vertices $iTop $trial2
-		lset yvec $iTop $yTrial2
-	    } else {
-
-		# Additional dilation failed, but we can still use
-		# the first trial point.
-
-		lset vertices $iTop $trial
-		lset yvec $iTop $yTrial
-
-	    }
-	} elseif { $yTrial < $yNext } {
-
-	    # The reflected point isn't a new minimum, but it's
-	    # better than the second-highest.  Replace the old high
-	    # point and try again.
-
-	    lset vertices $iTop $trial
-	    lset yvec $iTop $yTrial
-
-	} else {
-
-	    # The reflected point is worse than the second-highest point.
-	    # If it's better than the highest, keep it... but in any case,
-	    # we want to try contracting the simplex, because a further
-	    # reflection will simply bring us back to the starting point.
-
-	    if { $yTrial < $yTop } {
-		lset vertices $iTop $trial
-		lset yvec $iTop $yTrial
-		set yTop $yTrial
-	    }
-	    set trial {}
-	    foreach x0 [lindex $vertices $iTop] x1 $centroid {
-		lappend trial [expr { ( $x0 + $x1 ) / 2. }]
-	    }
-	    set cmd $f
-	    foreach xx $trial {
-		lappend cmd $xx
-	    }
-	    set yTrial [uplevel 1 $cmd]
-	    if { $params(-trace) } {
-		puts "nelderMead: contracting from high point:\
-                      x=[list $trial] y=$y"
-	    }
-	    if { $yTrial < $yTop } {
-
-		# Contraction gave an improvement, so continue with
-		# the smaller simplex
-
-		lset vertices $iTop $trial
-		lset yvec $iTop $yTrial
-
-	    } else {
-
-		# Contraction gave no improvement either; we seem to
-		# be in a valley of peculiar topology.  Contract the
-		# simplex about the low point and try again.
-
-		set newVertices {}
-		set newYvec {}
-		set i 0
-		foreach v $vertices y $yvec {
-		    if { $i == $iBot } {
-			lappend newVertices $v
-			lappend newYvec $y
-		    } else {
-			set newv {}
-			foreach x0 $v x1 [lindex $vertices $iBot] {
-			    lappend newv [expr { ($x0 + $x1) / 2. }]
-			}
-			lappend newVertices $newv
-			set cmd $f
-			foreach xx $newv {
-			    lappend cmd $xx
-			}
-			lappend newYvec [uplevel 1 $cmd]
-			if { $params(-trace) } {
-			    puts "nelderMead: contracting about low point:\
-                                  x=[list $newv] y=$y"
-			}
-		    }
-		    incr i
-		}
-		set vertices $newVertices
-		set yvec $newYvec
-	    }
-
-	}
-
-    }
-    return [list y $yBot x [lindex $vertices $iBot] vertices $vertices yvec $yvec nIter $nIter status $status]
-
-}
-
-# solveLinearProgram
-#    Solve a linear program in standard form
-#
-# Arguments:
-#    objective     Vector defining the objective function
-#    constraints   Matrix of constraints (as a list of lists)
-#
-# Return value:
-#    Computed values for the coordinates or "unbounded" or "infeasible"
-#
-proc ::math::optimize::solveLinearProgram { objective constraints } {
-    #
-    # Check the arguments first and then put them in a more convenient
-    # form
-    #
-
-    foreach {nconst nvars matrix} \
-        [SimplexPrepareMatrix $objective $constraints] {break}
-
-    set solution [SimplexSolve $nconst nvars $matrix]
-
-    if { [llength $solution] > 1 } {
-        return [lrange $solution 0 [expr {$nvars-1}]]
-    } else {
-        return $solution
-    }
-}
-
-# linearProgramMaximum --
-#    Compute the value attained at the optimum
-#
-# Arguments:
-#    objective     The coefficients of the objective function
-#    result        The coordinate values as obtained by solving the program
-#
-# Return value:
-#    Value at the maximum point
-#
-proc ::math::optimize::linearProgramMaximum {objective result} {
-
-    set value    0.0
-
-    foreach coeff $objective coord $result {
-        set value [expr {$value+$coeff*$coord}]
-    }
-
-    return $value
-}
-
-# SimplexPrintMatrix
-#    Debugging routine: print the matrix in easy to read form
-#
-# Arguments:
-#    matrix        Matrix to be printed
-#
-# Return value:
-#    None
-#
-# Note:
-#    The tableau should be transposed ...
-#
-proc ::math::optimize::SimplexPrintMatrix {matrix} {
-    puts "\nBasis:\t[join [lindex $matrix 0] \t]"
-    foreach col [lrange $matrix 1 end] {
-        puts "      \t[join $col \t]"
-    }
-}
-
-# SimplexPrepareMatrix
-#    Prepare the standard tableau from all program data
-#
-# Arguments:
-#    objective     Vector defining the objective function
-#    constraints   Matrix of constraints (as a list of lists)
-#
-# Return value:
-#    List of values as a standard tableau and two values
-#    for the sizes
-#
-proc ::math::optimize::SimplexPrepareMatrix {objective constraints} {
-
-    #
-    # Check the arguments first
-    #
-    set nconst [llength $constraints]
-    set ncols {}
-    foreach row $constraints {
-        if { $ncols == {} } {
-            set ncols [llength $row]
-        } else {
-            if { $ncols != [llength $row] } {
-                return -code error -errorcode ARGS "Incorrectly formed constraints matrix"
-            }
-        }
-    }
-
-    set nvars [expr {$ncols-1}]
-
-    if { [llength $objective] != $nvars } {
-        return -code error -errorcode ARGS "Incorrect length for objective vector"
-    }
-
-    #
-    # Set up the tableau:
-    # Easiest manipulations if we store the columns first
-    # So:
-    # - First column is the list of variable indices in the basis
-    # - Second column is the list of maximum values
-    # - "nvars" columns that follow: the coefficients for the actual
-    #   variables
-    # - last "nconst" columns: the slack variables
-    #
-    set matrix   [list]
-    set lastrow  [concat $objective [list 0.0]]
-
-    set newcol   [list]
-    for {set idx 0} {$idx < $nconst} {incr idx} {
-        lappend newcol [expr {$nvars+$idx}]
-    }
-    lappend newcol "?"
-    lappend matrix $newcol
-
-    set zvector [list]
-    foreach row $constraints {
-        lappend zvector [lindex $row end]
-    }
-    lappend zvector 0.0
-    lappend matrix $zvector
-
-    for {set idx 0} {$idx < $nvars} {incr idx} {
-        set newcol [list]
-        foreach row $constraints {
-            lappend newcol [expr {double([lindex $row $idx])}]
-        }
-        lappend newcol [expr {-double([lindex $lastrow $idx])}]
-         lappend matrix $newcol
-    }
-
-    #
-    # Add the columns for the slack variables
-    #
-    set zeros {}
-    for {set idx 0} {$idx <= $nconst} {incr idx} {
-        lappend zeros 0.0
-    }
-    for {set idx 0} {$idx < $nconst} {incr idx} {
-        lappend matrix [lreplace $zeros $idx $idx 1.0]
-    }
-
-    return [list $nconst $nvars $matrix]
-}
-
-# SimplexSolve --
-#    Solve the given linear program using the simplex method
-#
-# Arguments:
-#    nconst        Number of constraints
-#    nvars         Number of actual variables
-#    tableau       Standard tableau (as a list of columns)
-#
-# Return value:
-#    List of values for the actual variables
-#
-proc ::math::optimize::SimplexSolve {nconst nvars tableau} {
-    set end 0
-    while { !$end } {
-
-        #
-        # Find the new variable to put in the basis
-        #
-        set nextcol [SimplexFindNextColumn $tableau]
-        if { $nextcol == -1 } {
-            set end 1
-            continue
-        }
-
-        #
-        # Now determine which one should leave
-        # TODO: is a lack of a proper row indeed an
-        #       indication of the infeasibility?
-        #
-        set nextrow [SimplexFindNextRow $tableau $nextcol]
-        if { $nextrow == -1 } {
-            return "infeasible"
-        }
-
-        #
-        # Make the vector for sweeping through the tableau
-        #
-        set vector [SimplexMakeVector $tableau $nextcol $nextrow]
-
-        #
-        # Sweep through the tableau
-        #
-        set tableau [SimplexNewTableau $tableau $nextcol $nextrow $vector]
-    }
-
-    #
-    # Now we can return the result
-    #
-    SimplexResult $tableau
-}
-
-# SimplexResult --
-#    Reconstruct the result vector
-#
-# Arguments:
-#    tableau       Standard tableau (as a list of columns)
-#
-# Return value:
-#    Vector of values representing the maximum point
-#
-proc ::math::optimize::SimplexResult {tableau} {
-    set result {}
-
-    set firstcol  [lindex $tableau 0]
-    set secondcol [lindex $tableau 1]
-    set result    {}
-
-    set nvars     [expr {[llength $tableau]-2}]
-    for {set i 0} {$i < $nvars } { incr i } {
-        lappend result 0.0
-    }
-
-    set idx 0
-    foreach col [lrange $firstcol 0 end-1] {
-        set result [lreplace $result $col $col [lindex $secondcol $idx]]
-        incr idx
-    }
-
-    return $result
-}
-
-# SimplexFindNextColumn --
-#    Find the next column - the one with the largest negative
-#    coefficient
-#
-# Arguments:
-#    tableau       Standard tableau (as a list of columns)
-#
-# Return value:
-#    Index of the column
-#
-proc ::math::optimize::SimplexFindNextColumn {tableau} {
-    set idx        0
-    set minidx    -1
-    set mincoeff   0.0
-
-    foreach col [lrange $tableau 2 end] {
-        set coeff [lindex $col end]
-        if { $coeff < 0.0 } {
-            if { $coeff < $mincoeff } {
-                set minidx $idx
-               set mincoeff $coeff
-            }
-        }
-        incr idx
-    }
-
-    return $minidx
-}
-
-# SimplexFindNextRow --
-#    Find the next row - the one with the largest negative
-#    coefficient
-#
-# Arguments:
-#    tableau       Standard tableau (as a list of columns)
-#    nextcol       Index of the variable that will replace this one
-#
-# Return value:
-#    Index of the row
-#
-proc ::math::optimize::SimplexFindNextRow {tableau nextcol} {
-    set idx        0
-    set minidx    -1
-    set mincoeff   {}
-
-    set bvalues [lrange [lindex $tableau 1] 0 end-1]
-    set yvalues [lrange [lindex $tableau [expr {2+$nextcol}]] 0 end-1]
-
-    foreach rowcoeff $bvalues divcoeff $yvalues {
-        if { $divcoeff > 0.0 } {
-            set coeff [expr {$rowcoeff/$divcoeff}]
-
-            if { $mincoeff == {} || $coeff < $mincoeff } {
-                set minidx $idx
-                set mincoeff $coeff
-            }
-        }
-        incr idx
-    }
-
-    return $minidx
-}
-
-# SimplexMakeVector --
-#    Make the "sweep" vector
-#
-# Arguments:
-#    tableau       Standard tableau (as a list of columns)
-#    nextcol       Index of the variable that will replace this one
-#    nextrow       Index of the variable in the base that will be replaced
-#
-# Return value:
-#    Vector to be used to update the coefficients of the tableau
-#
-proc ::math::optimize::SimplexMakeVector {tableau nextcol nextrow} {
-
-    set idx      0
-    set vector   {}
-    set column   [lindex $tableau [expr {2+$nextcol}]]
-    set divcoeff [lindex $column $nextrow]
-
-    foreach colcoeff $column {
-        if { $idx != $nextrow } {
-            set coeff [expr {-$colcoeff/$divcoeff}]
-        } else {
-            set coeff [expr {1.0/$divcoeff-1.0}]
-        }
-        lappend vector $coeff
-        incr idx
-    }
-
-    return $vector
-}
-
-# SimplexNewTableau --
-#    Sweep through the tableau and create the new one
-#
-# Arguments:
-#    tableau       Standard tableau (as a list of columns)
-#    nextcol       Index of the variable that will replace this one
-#    nextrow       Index of the variable in the base that will be replaced
-#    vector        Vector to sweep with
-#
-# Return value:
-#    New tableau
-#
-proc ::math::optimize::SimplexNewTableau {tableau nextcol nextrow vector} {
-
-    #
-    # The first column: replace the nextrow-th element
-    # The second column: replace the value at the nextrow-th element
-    # For all the others: the same receipe
-    #
-    set firstcol   [lreplace [lindex $tableau 0] $nextrow $nextrow $nextcol]
-    set newtableau [list $firstcol]
-
-    #
-    # The rest of the matrix
-    #
-    foreach column [lrange $tableau 1 end] {
-        set yval   [lindex $column $nextrow]
-        set newcol {}
-        foreach c $column vcoeff $vector {
-            set newval [expr {$c+$yval*$vcoeff}]
-            lappend newcol $newval
-        }
-        lappend newtableau $newcol
-    }
-
-    return $newtableau
-}
-
-# Now we can announce our presence
-package provide math::optimize 1.0
-
-if { ![info exists ::argv0] || [string compare $::argv0 [info script]] } {
-    return
-}
-
-namespace import math::optimize::min_bound_1d
-namespace import math::optimize::maximum
-namespace import math::optimize::nelderMead
-
-proc f {x y} {
-    set xx [expr { $x - 3.1415926535897932 / 2. }]
-    set v1 [expr { 0.3 * exp( -$xx*$xx / 2. ) }]
-    set d [expr { 10. * $y - sin(9. * $x) }]
-    set v2 [expr { exp(-10.*$d*$d)}]
-    set rv [expr { -$v1 - $v2 }]
-    return $rv
-}
-
-proc g {a b} {
-    set x1 [expr {0.1 - $a + $b}]
-    set x2 [expr {$a + $b - 1.}]
-    set x3 [expr {3.-8.*$a+8.*$a*$a-8.*$b+8.*$b*$b}]
-    set x4 [expr {$a/10. + $b/10. + $x1*$x1/3. + $x2*$x2 - $x2 * exp(1-$x3*$x3)}]
-    return $x4
-}
-
-if { ![package vsatisfies [package provide Tcl] 8.5] } {
-    set tcl_precision 17
-}
-puts "f"
-puts [math::optimize::nelderMead f {1. 0.} -scale {0.1 0.01} -trace 1]
-puts "g"
-puts [math::optimize::nelderMead g {0. 0.} -scale {1. 1.} -trace 1]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/pdf_stat.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/pdf_stat.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,713 +1,0 @@
-# pdf_stat.tcl --
-#
-#    Collection of procedures for evaluating probability and
-#    cumulative density functions
-#    Part of "math::statistics"
-#
-# version 0.1: initial implementation, january 2003
-
-# ::math::statistics --
-#   Namespace holding the procedures and variables
-#
-namespace eval ::math::statistics {
-
-    namespace export pdf-normal pdf-uniform \
-	    pdf-exponential \
-	    cdf-normal cdf-uniform \
-	    cdf-exponential \
-	    cdf-students-t \
-	    random-normal random-uniform \
-	    random-exponential \
-	    histogram-uniform
-
-    variable cdf_normal_prob     {}
-    variable cdf_normal_x        {}
-    variable cdf_toms322_cached  {}
-    variable initialised_cdf     0                 
-}
-
-# pdf-normal --
-#    Return the probabilities belonging to a normal distribution
-#
-# Arguments:
-#    mean     Mean of the distribution
-#    stdev    Standard deviation
-#    x        Value for which the probability must be determined
-#
-# Result:
-#    Probability of value x under the given distribution
-#
-proc ::math::statistics::pdf-normal { mean stdev x } {
-    variable NEGSTDEV
-    variable factorNormalPdf
-
-    if { $stdev <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $NEGSTDEV $NEGSTDEV
-    }
-
-    set xn   [expr {($x-$mean)/$stdev}]
-    set prob [expr {exp(-$xn*$xn/2.0)/$stdev/$factorNormalPdf}]
-
-    return $prob
-}
-
-# pdf-uniform --
-#    Return the probabilities belonging to a uniform distribution
-#    (parameters as minimum/maximum)
-#
-# Arguments:
-#    pmin      Minimum of the distribution
-#    pmax      Maximum of the distribution
-#    x         Value for which the probability must be determined
-#
-# Result:
-#    Probability of value x under the given distribution
-#
-proc ::math::statistics::pdf-uniform { pmin pmax x } {
-
-    if { $pmin >= $pmax } {
-	return -code error -errorcode ARG \
-		-errorinfo "Wrong order or zero range" \
-		"Wrong order or zero range"
-    }
-
-    set prob [expr {1.0/($pmax-$min)}]
-
-    if { $x < $pmin || $x > $pmax } { return 0.0 }
-
-    return $prob
-}
-
-# pdf-exponential --
-#    Return the probabilities belonging to an exponential
-#    distribution
-#
-# Arguments:
-#    mean     Mean of the distribution
-#    x        Value for which the probability must be determined
-#
-# Result:
-#    Probability of value x under the given distribution
-#
-proc ::math::statistics::pdf-exponential { mean x } {
-    variable NEGSTDEV
-    variable OUTOFRANGE
-
-    if { $stdev <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $NEGSTDEV $NEGSTDEV
-    }
-    if { $mean <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $OUTOFRANGE \
-		"$OUTOFRANGE: mean must be positive"
-    }
-
-    if { $x < 0.0 } { return 0.0 }
-    if { $x > 700.0*$mean } { return 0.0 }
-
-    set prob [expr {exp(-$x/$mean)/$mean}]
-
-    return $prob
-}
-
-# cdf-normal --
-#    Return the cumulative probability belonging to a normal distribution
-#
-# Arguments:
-#    mean     Mean of the distribution
-#    stdev    Standard deviation
-#    x        Value for which the probability must be determined
-#
-# Result:
-#    Cumulative probability of value x under the given distribution
-#
-proc ::math::statistics::cdf-normal { mean stdev x } {
-    variable NEGSTDEV
-
-    if { $stdev <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $NEGSTDEV $NEGSTDEV
-    }
-
-    set xn    [expr {($x-$mean)/$stdev}]
-    set prob1 [Cdf-toms322 1 5000 [expr {$xn*$xn}]]
-    if { $xn > 0.0 } {
-	set prob [expr {0.5+0.5*$prob1}]
-    } else {
-	set prob [expr {0.5-0.5*$prob1}]
-    }
-
-    return $prob
-}
-
-# cdf-students-t --
-#    Return the cumulative probability belonging to the
-#    Student's t distribution
-#
-# Arguments:
-#    degrees  Number of degrees of freedom
-#    x        Value for which the probability must be determined
-#
-# Result:
-#    Cumulative probability of value x under the given distribution
-#
-proc ::math::statistics::cdf-students-t { degrees x } {
-
-    if { $degrees <= 0 } {
-	return -code error -errorcode ARG -errorinfo \
-		"Number of degrees of freedom must be positive" \
-		"Number of degrees of freedom must be positive"
-    }
-
-    set prob1 [Cdf-toms322 1 $degrees [expr {$x*$x}]]
-    set prob  [expr {0.5+0.5*$prob1}]
-
-    return $prob
-}
-
-# cdf-uniform --
-#    Return the cumulative probabilities belonging to a uniform
-#    distribution (parameters as minimum/maximum)
-#
-# Arguments:
-#    pmin      Minimum of the distribution
-#    pmax      Maximum of the distribution
-#    x         Value for which the probability must be determined
-#
-# Result:
-#    Cumulative probability of value x under the given distribution
-#
-proc ::math::statistics::cdf-uniform { pmin pmax x } {
-
-    if { $pmin >= $pmax } {
-	return -code error -errorcode ARG \
-		-errorinfo "Wrong order or zero range" \
-	    }
-
-    set prob [expr {($x-$pmin)/($pmax-$min)}]
-
-    if { $x < $pmin } { return 0.0 }
-    if { $x > $pmax } { return 1.0 }
-
-    return $prob
-}
-
-# cdf-exponential --
-#    Return the cumulative probabilities belonging to an exponential
-#    distribution
-#
-# Arguments:
-#    mean     Mean of the distribution
-#    x        Value for which the probability must be determined
-#
-# Result:
-#    Cumulative probability of value x under the given distribution
-#
-proc ::math::statistics::cdf-exponential { mean x } {
-    variable NEGSTDEV
-    variable OUTOFRANGE
-
-    if { $mean <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $OUTOFRANGE \
-		"$OUTOFRANGE: mean must be positive"
-    }
-
-    if { $x <  0.0 } { return 0.0 }
-    if { $x > 30.0*$mean } { return 1.0 }
-
-    set prob [expr {1.0-exp(-$x/$mean)}]
-
-    return $prob
-}
-
-# Inverse-cdf-uniform --
-#    Return the argument belonging to the cumulative probability
-#    for a uniform distribution (parameters as minimum/maximum)
-#
-# Arguments:
-#    pmin      Minimum of the distribution
-#    pmax      Maximum of the distribution
-#    prob      Cumulative probability for which the "x" value must be
-#              determined
-#
-# Result:
-#    X value that gives the cumulative probability under the
-#    given distribution
-#
-proc ::math::statistics::Inverse-cdf-uniform { pmin pmax prob } {
-
-    if {0} {
-	if { $pmin >= $pmax } {
-	    return -code error -errorcode ARG \
-		    -errorinfo "Wrong order or zero range" \
-		    "Wrong order or zero range"
-	}
-    }
-
-    set x [expr {$pmin+$prob*($pmax-$pmin)}]
-
-    if { $x < $pmin } { return $pmin }
-    if { $x > $pmax } { return $pmax }
-
-    return $x
-}
-
-# Inverse-cdf-exponential --
-#    Return the argument belonging to the cumulative probability
-#    for an exponential distribution
-#
-# Arguments:
-#    mean      Mean of the distribution
-#    prob      Cumulative probability for which the "x" value must be
-#              determined
-#
-# Result:
-#    X value that gives the cumulative probability under the
-#    given distribution
-#
-proc ::math::statistics::Inverse-cdf-exponential { mean prob } {
-
-    if {0} {
-	if { $mean <= 0.0 } {
-	    return -code error -errorcode ARG \
-		    -errorinfo "Mean must be positive" \
-		    "Mean must be positive"
-	}
-    }
-
-    set x [expr {-$mean*log(1.0-$prob)}]
-
-    return $x
-}
-
-# Inverse-cdf-normal --
-#    Return the argument belonging to the cumulative probability
-#    for a normal distribution
-#
-# Arguments:
-#    mean      Mean of the distribution
-#    stdev     Standard deviation of the distribution
-#    prob      Cumulative probability for which the "x" value must be
-#              determined
-#
-# Result:
-#    X value that gives the cumulative probability under the
-#    given distribution
-#
-proc ::math::statistics::Inverse-cdf-normal { mean stdev prob } {
-    variable cdf_normal_prob
-    variable cdf_normal_x
-
-    variable initialised_cdf                      
-    if { $initialised_cdf == 0 } { 
-       Initialise-cdf-normal
-    }
-
-    # Look for the proper probability level first,
-    # then interpolate
-    #
-    # Note: the numerical data are connected to the length of
-    #       the lists - see Initialise-cdf-normal
-    #
-    set size 32
-    set idx  64
-    for { set i 0 } { $i <= 7 } { incr i } {
-	set upper [lindex $cdf_normal_prob $idx]
-	if { $prob > $upper } {
-	    set idx  [expr {$idx+$size}]
-	} else {
-	    set idx  [expr {$idx-$size}]
-	}
-	set size [expr {$size/2}]
-    }
-    #
-    # We have found a value that is close to the one we need,
-    # now find the enclosing interval
-    #
-    if { $upper < $prob } {
-	incr idx
-    }
-    set p1 [lindex $cdf_normal_prob [expr {$idx-1}]]
-    set p2 [lindex $cdf_normal_prob $idx]
-    set x1 [lindex $cdf_normal_x    [expr {$idx-1}]]
-    set x2 [lindex $cdf_normal_x    $idx           ]
-
-    set x  [expr {$x1+($x2-$x1)*($prob-$p1)/($p2-$p1)}]
-
-    return [expr {$mean+$stdev*$x}]
-}
-
-# Initialise-cdf-normal --
-#    Initialise the private data for the normal cdf
-#
-# Arguments:
-#    None
-# Result:
-#    None
-# Side effect:
-#    Variable cdf_normal_prob and cdf_normal_x are filled
-#    so that we can use these as a look-up table
-#
-proc ::math::statistics::Initialise-cdf-normal { } {
-    variable cdf_normal_prob
-    variable cdf_normal_x
-
-    variable initialised_cdf                      
-    set initialised_cdf 1           
-
-    set dx [expr {10.0/128.0}]
-
-    set cdf_normal_prob 0.5
-    set cdf_normal_x    0.0
-    for { set i 1 } { $i <= 64 } { incr i } {
-	set x    [expr {$i*$dx}]
-	if { $x != 0.0 } {
-	    set prob [Cdf-toms322 1 5000 [expr {$x*$x}]]
-	} else {
-	    set prob 0.0
-	}
-
-	set cdf_normal_x    [concat [expr {-$x}] $cdf_normal_x $x]
-	set cdf_normal_prob \
-		[concat [expr {0.5-0.5*$prob}] $cdf_normal_prob \
-		[expr {0.5+0.5*$prob}]]
-    }
-}
-
-# random-uniform --
-#    Return a list of random numbers satisfying a uniform
-#    distribution (parameters as minimum/maximum)
-#
-# Arguments:
-#    pmin      Minimum of the distribution
-#    pmax      Maximum of the distribution
-#    number    Number of values to generate
-#
-# Result:
-#    List of random numbers
-#
-proc ::math::statistics::random-uniform { pmin pmax number } {
-
-    if { $pmin >= $pmax } {
-	return -code error -errorcode ARG \
-		-errorinfo "Wrong order or zero range" \
-		"Wrong order or zero range"
-    }
-
-    set result {}
-    for { set i 0 }  {$i < $number } { incr i } {
-	lappend result [Inverse-cdf-uniform $pmin $pmax [expr {rand()}]]
-    }
-
-    return $result
-}
-
-# random-exponential --
-#    Return a list of random numbers satisfying an exponential
-#    distribution
-#
-# Arguments:
-#    mean      Mean of the distribution
-#    number    Number of values to generate
-#
-# Result:
-#    List of random numbers
-#
-proc ::math::statistics::random-exponential { mean number } {
-
-    if { $mean <= 0.0 } {
-	return -code error -errorcode ARG \
-		-errorinfo "Mean must be positive" \
-		"Mean must be positive"
-    }
-
-    set result {}
-    for { set i 0 }  {$i < $number } { incr i } {
-	lappend result [Inverse-cdf-exponential $mean [expr {rand()}]]
-    }
-
-    return $result
-}
-
-# random-normal --
-#    Return a list of random numbers satisfying a normal
-#    distribution
-#
-# Arguments:
-#    mean      Mean of the distribution
-#    stdev     Standard deviation of the distribution
-#    number    Number of values to generate
-#
-# Result:
-#    List of random numbers
-#
-proc ::math::statistics::random-normal { mean stdev number } {
-
-    if { $stdev <= 0.0 } {
-	return -code error -errorcode ARG \
-		-errorinfo "Standard deviation must be positive" \
-		"Standard deviation must be positive"
-    }
-
-    set result {}
-    for { set i 0 }  {$i < $number } { incr i } {
-	lappend result [Inverse-cdf-normal $mean $stdev [expr {rand()}]]
-    }
-
-    return $result
-}
-
-# Cdf-toms322 --
-#    Calculate the cumulative density function for several distributions
-#    according to TOMS322
-#
-# Arguments:
-#    m         First number of degrees of freedom
-#    n         Second number of degrees of freedom
-#    x         Value for which the cdf must be calculated
-#
-# Result:
-#    Cumulatve density at x - details depend on distribution
-#
-# Notes:
-#    F-ratios:
-#        m - degrees of freedom for numerator
-#        n - degrees of freedom for denominator
-#        x - F-ratio
-#    Student's t (two-tailed):
-#        m - 1
-#        n - degrees of freedom
-#        x - square of t
-#    Normal deviate (two-tailed):
-#        m - 1
-#        n - 5000
-#        x - square of deviate
-#    Chi-square:
-#        m - degrees of freedom
-#        n - 5000
-#        x - chi-square/m
-#    The original code can be found at <http://www.netlib.org>
-#
-proc ::math::statistics::Cdf-toms322 { m n x } {
-    set m [expr {$m < 300?  int($m) : 300}]
-    set n [expr {$n < 5000? int($n) : 5000}]
-    if { $m < 1 || $n < 1 } {
-	return -code error -errorcode ARG \
-		-errorinfo "Arguments m anf n must be greater/equal 1"
-    }
-
-    set a [expr {2*($m/2)-$m+2}]
-    set b [expr {2*($n/2)-$n+2}]
-    set w [expr {$x*double($m)/double($n)}]
-    set z [expr {1.0/(1.0+$w)}]
-
-    if { $a == 1 } {
-	if { $b == 1 } {
-	    set p [expr {sqrt($w)}]
-	    set y 0.3183098862
-	    set d [expr {$y*$z/$p}]
-	    set p [expr {2.0*$y*atan($p)}]
-	} else {
-	    set p [expr {sqrt($w*$z)}]
-	    set d [expr {$p*$z/(2.0*$w)}]
-	}
-    } else {
-	if { $b == 1 } {
-	    set p [expr {sqrt($z)}]
-	    set d [expr {$z*$p/2.0}]
-	    set p [expr {1.0-$p}]
-	} else {
-	    set d [expr {$z*$z}]
-	    set p [expr {$z*$w}]
-	}
-    }
-
-    set y [expr {2.0*$w/$z}]
-
-    if { $a == 1 } {
-	for { set j [expr {$b+2}] } { $j <= $n } { incr j 2 } {
-	    set d [expr {(1.0+double($a)/double($j-2)) * $d*$z}]
-	    set p [expr {$p+$d*$y/double($j-1)}]
-	}
-    } else {
-	set power [expr {($n-1)/2}]
-	set zk    [expr {pow($z,$power)}]
-	set d     [expr {($d*$zk*$n)/$b}]
-	set p     [expr {$p*$zk + $w*$z * ($zk-1.0)/($z-1.0)}]
-    }
-
-    set y [expr {$w*$z}]
-    set z [expr {2.0/$z}]
-    set b [expr {$n-2}]
-
-    for { set i [expr {$a+2}] } { $i <= $m } { incr i 2 } {
-	set j [expr {$i+$b}]
-	set d [expr {$y*$d*double($j)/double($i-2)}]
-	set p [expr {$p-$z*$d/double($j)}]
-    }
-    set prob $p
-    if  { $prob < 0.0 } { set prob 0.0 }
-    if  { $prob > 1.0 } { set prob 1.0 }
-
-    return $prob
-}
-
-# Inverse-cdf-toms322 --
-#    Return the argument belonging to the cumulative probability
-#    for an F, chi-square or t distribution
-#
-# Arguments:
-#    m         First number of degrees of freedom
-#    n         Second number of degrees of freedom
-#    prob      Cumulative probability for which the "x" value must be
-#              determined
-#
-# Result:
-#    X value that gives the cumulative probability under the
-#    given distribution
-#
-# Note:
-#    See the procedure Cdf-toms322 for more details
-#
-proc ::math::statistics::Inverse-cdf-toms322 { m n prob } {
-    variable cdf_toms322_cached
-    variable OUTOFRANGE
-
-    if { $prob <= 0 || $prob >= 1 } {
-	return -code error -errorcode $OUTOFRANGE $OUTOFRANGE
-    }
-
-    # Is the combination in cache? Then we can simply rely
-    # on that
-    #
-    foreach {m1 n1 prob1 x1} $cdf_toms322_cached {
-	if { $m1 == $m && $n1 == $n && $prob1 == $prob } {
-	    return $x1
-	}
-    }
-
-    #
-    # Otherwise first find a value of x for which Cdf(x) exceeds prob
-    #
-    set x1  1.0
-    set dx1 1.0
-    while { [Cdf-toms322 $m $n $x1] < $prob } {
-	set x1  [expr {$x1+$dx1}]
-	set dx1 [expr {2.0*$dx1}]
-    }
-
-    #
-    # Now, look closer
-    #
-    while { $dx1 > 0.0001 } {
-	set p1 [Cdf-toms322 $m $n $x1]
-	if { $p1 > $prob } {
-	    set x1  [expr {$x1-$dx1}]
-	} else {
-	    set x1  [expr {$x1+$dx1}]
-	}
-	set dx1 [expr {$dx1/2.0}]
-    }
-
-    #
-    # Cache the result
-    #
-    set last end
-    if { [llength $cdf_toms322_cached] > 27 } {
-	set last 26
-    }
-    set cdf_toms322_cached \
-	    [concat [list $m $n $prob $x1] [lrange $cdf_toms322_cached 0 $last]]
-
-    return $x1
-}
-
-# HistogramMake --
-#    Distribute the "observations" according to the cdf
-#
-# Arguments:
-#    cdf-values   Values for the cdf (relative number of observations)
-#    number       Total number of "observations" in the histogram
-#
-# Result:
-#    List of numbers, distributed over the buckets
-#
-proc ::math::statistics::HistogramMake { cdf-values number } {
-
-    set assigned  0
-    set result    {}
-    set residue   0.0
-    foreach cdfv $cdf-values {
-	set sum      [expr {$number*($cdfv + $residue)}]
-	set bucket   [expr {int($sum)}]
-	set residue  [expr {$sum-$bucket}]
-	set assigned [expr {$assigned-$bucket}]
-	lappend result $bucket
-    }
-    set remaining [expr {$number-$assigned}]
-    if { $remaining > 0 } {
-	lappend result $remaining
-    } else {
-	lappend result 0
-    }
-
-    return $result
-}
-
-# histogram-uniform --
-#    Return the expected histogram for a uniform distribution
-#
-# Arguments:
-#    min       Minimum the distribution
-#    max       Maximum the distribution
-#    limits    upper limits for the histogram buckets
-#    number    Total number of "observations" in the histogram
-#
-# Result:
-#    List of expected number of observations
-#
-proc ::math::statistics::histogram-uniform { min max limits number } {
-    if { $min >= $max } {
-	return -code error -errorcode ARG \
-		-errorinfo "Wrong order or zero range" \
-		"Wrong order or zero range"
-    }
-
-    set cdf_result {}
-    foreach limit $limits {
-	lappend cdf_result [cdf-uniform $min $max $limit]
-    }
-
-    return [HistogramMake $cdf_result $number]
-}
-
-#
-# Simple numerical tests
-#
-if { [info exists ::argv0] && ([file tail [info script]] == [file tail $::argv0]) } {
-
-    #
-    # Apparent accuracy: at least one digit more than the ones in the
-    # given numbers
-    #
-    puts "Normal distribution - two-tailed"
-    foreach z    {4.417 3.891 3.291 2.576 2.241 1.960 1.645 1.150 0.674
-    0.319 0.126 0.063 0.0125} \
-	    pexp {1.e-5 1.e-4 1.e-3 1.e-2 0.025 0.050 0.100 0.250 0.500
-    0.750 0.900 0.950 0.990 } {
-	set prob [::math::statistics::Cdf-toms322 1 5000 [expr {$z*$z}]]
-	puts "$z - $pexp - [expr {1.0-$prob}]"
-    }
-
-    puts "Normal distribution (inverted; one-tailed)"
-    foreach p {0.001 0.01 0.1 0.25 0.5 0.75 0.9 0.99 0.999} {
-	puts "$p - [::math::statistics::Inverse-cdf-normal 0.0 1.0 $p]"
-    }
-    puts "Normal random variables"
-    set rndvars [::math::statistics::random-normal 1.0 2.0 20]
-    puts $rndvars
-    puts "Normal uniform variables"
-    set rndvars [::math::statistics::random-uniform 1.0 2.0 20]
-    puts $rndvars
-    puts "Normal exponential variables"
-    set rndvars [::math::statistics::random-exponential 2.0 20]
-    puts $rndvars
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,27 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded math                    1.2.4 [list source [file join $dir math.tcl]]
-package ifneeded math::geometry          1.0.3 [list source [file join $dir geometry.tcl]]
-package ifneeded math::fuzzy             0.2   [list source [file join $dir fuzzy.tcl]]
-package ifneeded math::complexnumbers    1.0.2 [list source [file join $dir qcomplex.tcl]]
-package ifneeded math::special           0.2.1 [list source [file join $dir special.tcl]]
-package ifneeded math::constants         1.0.1 [list source [file join $dir constants.tcl]]
-package ifneeded math::polynomials       1.0.1 [list source [file join $dir polynomials.tcl]]
-package ifneeded math::rationalfunctions 1.0.1 [list source [file join $dir rational_funcs.tcl]]
-package ifneeded math::fourier           1.0.2 [list source [file join $dir fourier.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded math::roman             1.0   [list source [file join $dir romannumerals.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-# statistics depends on linearalgebra (for multi-variate linear regression).
-package ifneeded math::statistics        0.5   [list source [file join $dir statistics.tcl]]
-package ifneeded math::optimize          1.0   [list source [file join $dir optimize.tcl]]
-package ifneeded math::calculus          0.7   [list source [file join $dir calculus.tcl]]
-package ifneeded math::interpolate       1.0.2 [list source [file join $dir interpolate.tcl]]
-package ifneeded math::linearalgebra     1.0.2 [list source [file join $dir linalg.tcl]]
-package ifneeded math::bignum            3.1.1 [list source [file join $dir bignum.tcl]]
-package ifneeded math::bigfloat          1.2.1 [list source [file join $dir bigfloat.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-package ifneeded math::bigfloat          2.0 [list source [file join $dir bigfloat2.tcl]]
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/plotstat.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/plotstat.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,312 +1,0 @@
-# plotstat.tcl --
-#
-#    Set of very simple drawing routines, belonging to the statistics
-#    package
-#
-# version 0.1: initial implementation, january 2003
-
-namespace eval ::math::statistics {}
-
-# plot-scale
-#    Set the scale for a plot in the given canvas
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    xmin     Minimum x value
-#    xmax     Maximum x value
-#    ymin     Minimum y value
-#    ymax     Maximum y value
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Array elements set
-#
-proc ::math::statistics::plot-scale { canvas xmin xmax ymin ymax } {
-    variable plot
-
-    if { $xmin == $xmax } { set xmax [expr {1.1*$xmin+1.0}] }
-    if { $ymin == $ymax } { set ymax [expr {1.1*$ymin+1.0}] }
-
-    set plot($canvas,xmin) $xmin
-    set plot($canvas,xmax) $xmax
-    set plot($canvas,ymin) $ymin
-    set plot($canvas,ymax) $ymax
-
-    set cwidth  [$canvas cget -width]
-    set cheight [$canvas cget -height]
-    set cx      20
-    set cy      20
-    set cx2     [expr {$cwidth-$cx}]
-    set cy2     [expr {$cheight-$cy}]
-
-    set plot($canvas,cx)   $cx
-    set plot($canvas,cy)   $cy
-
-    set plot($canvas,dx)   [expr {($cwidth-2*$cx)/double($xmax-$xmin)}]
-    set plot($canvas,dy)   [expr {($cheight-2*$cy)/double($ymax-$ymin)}]
-    set plot($canvas,cx2)  $cx2
-    set plot($canvas,cy2)  $cy2
-
-    $canvas create line $cx $cy $cx $cy2 $cx2 $cy2 -tag axes
-}
-
-# plot-xydata
-#    Create a simple XY plot in the given canvas (collection of dots)
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    xdata    Series of independent data
-#    ydata    Series of dependent data
-#    tag      Tag to give to the plotted data (defaults to xyplot)
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple xy graph in the canvas
-#
-# Note:
-#    The tag can be used to manipulate the xy graph
-#
-proc ::math::statistics::plot-xydata { canvas xdata ydata {tag xyplot} } {
-    PlotXY $canvas points $tag $xdata $ydata
-}
-
-# plot-xyline
-#    Create a simple XY plot in the given canvas (continuous line)
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    xdata    Series of independent data
-#    ydata    Series of dependent data
-#    tag      Tag to give to the plotted data (defaults to xyplot)
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple xy graph in the canvas
-#
-# Note:
-#    The tag can be used to manipulate the xy graph
-#
-proc ::math::statistics::plot-xyline { canvas xdata ydata {tag xyplot} } {
-    PlotXY $canvas line $tag $xdata $ydata
-}
-
-# plot-tdata
-#    Create a simple XY plot in the given canvas (the index in the list
-#    is the horizontal coordinate; points)
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    tdata    Series of dependent data
-#    tag      Tag to give to the plotted data (defaults to xyplot)
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple xy graph in the canvas
-#
-# Note:
-#    The tag can be used to manipulate the xy graph
-#
-proc ::math::statistics::plot-tdata { canvas tdata {tag xyplot} } {
-    PlotXY $canvas points $tag {} $tdata
-}
-
-# plot-tline
-#    Create a simple XY plot in the given canvas (the index in the list
-#    is the horizontal coordinate; line)
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    tdata    Series of dependent data
-#    tag      Tag to give to the plotted data (defaults to xyplot)
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple xy graph in the canvas
-#
-# Note:
-#    The tag can be used to manipulate the xy graph
-#
-proc ::math::statistics::plot-tline { canvas tdata {tag xyplot} } {
-    PlotXY $canvas line $tag {} $tdata
-}
-
-# PlotXY
-#    Create a simple XY plot (points or lines) in the given canvas
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    type     Type: points or line
-#    tag      Tag to give to the plotted data
-#    xdata    Series of independent data (if empty: index used instead)
-#    ydata    Series of dependent data
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple xy graph in the canvas
-#
-# Note:
-#    This is the actual routine
-#
-proc ::math::statistics::PlotXY { canvas type tag xdata ydata } {
-    variable plot
-
-    if { ![info exists plot($canvas,xmin)] } {
-	return -code error -errorcode "No scaling given for canvas $canvas"
-    }
-
-    set xmin $plot($canvas,xmin)
-    set xmax $plot($canvas,xmax)
-    set ymin $plot($canvas,ymin)
-    set ymax $plot($canvas,ymax)
-    set dx   $plot($canvas,dx)
-    set dy   $plot($canvas,dy)
-    set cx   $plot($canvas,cx)
-    set cy   $plot($canvas,cy)
-    set cx2  $plot($canvas,cx2)
-    set cy2  $plot($canvas,cy2)
-
-    set plotpoints [expr {$type == "points"}]
-    set xpresent   [expr {[llength $xdata] > 0}]
-    set idx        0
-    set coords     {}
-
-    foreach y $ydata {
-	if { $xpresent } {
-	    set x [lindex $xdata $idx]
-	} else {
-	    set x $idx
-	}
-	incr idx
-
-	if { $x == {}    } continue
-	if { $y == {}    } continue
-	if { $x >  $xmax } continue
-	if { $x <  $xmin } continue
-	if { $y >  $ymax } continue
-	if { $y <  $ymin } continue
-
-	if { $plotpoints } {
-	    set xc [expr {$cx+$dx*($x-$xmin)-2}]
-	    set yc [expr {$cy2-$dy*($y-$ymin)-2}]
-	    set xc2 [expr {$xc+4}]
-	    set yc2 [expr {$yc+4}]
-	    $canvas create oval $xc $yc $xc2 $yc2 -tag $tag -fill black
-	} else {
-	    set xc [expr {$cx+$dx*($x-$xmin)}]
-	    set yc [expr {$cy2-$dy*($y-$ymin)}]
-	    lappend coords $xc $yc
-	}
-    }
-
-    if { ! $plotpoints } {
-	$canvas create line $coords -tag $tag
-    }
-}
-
-# plot-histogram
-#    Create a simple histogram in the given canvas
-#
-# Arguments:
-#    canvas   Canvas widget to use
-#    counts   Series of bucket counts
-#    limits   Series of upper limits for the buckets
-#    tag      Tag to give to the plotted data (defaults to xyplot)
-#
-# Result:
-#    None
-#
-# Side effect:
-#    Simple histogram in the canvas
-#
-# Note:
-#    The number of limits determines how many bars are drawn,
-#    the number of counts that is expected is one larger. The
-#    lower and upper limits of the first and last bucket are
-#    taken to be equal to the scale's extremes
-#
-proc ::math::statistics::plot-histogram { canvas counts limits {tag xyplot} } {
-    variable plot
-
-    if { ![info exists plot($canvas,xmin)] } {
-	return -code error -errorcode DATA "No scaling given for canvas $canvas"
-    }
-
-    if { ([llength $counts]-[llength $limits]) != 1 } {
-	return -code error -errorcode ARG \
-		"Number of counts does not correspond to number of limits"
-    }
-
-    set xmin $plot($canvas,xmin)
-    set xmax $plot($canvas,xmax)
-    set ymin $plot($canvas,ymin)
-    set ymax $plot($canvas,ymax)
-    set dx   $plot($canvas,dx)
-    set dy   $plot($canvas,dy)
-    set cx   $plot($canvas,cx)
-    set cy   $plot($canvas,cy)
-    set cx2  $plot($canvas,cx2)
-    set cy2  $plot($canvas,cy2)
-
-    #
-    # Construct a sufficiently long list of x-coordinates
-    #
-    set xdata [concat $xmin $limits $xmax]
-
-    set idx   0
-    foreach x $xdata y $counts {
-	incr idx
-
-	if { $y == {}    } continue
-
-	set x1 $x
-	if { $x <  $xmin } { set x1 $xmin }
-	if { $x >  $xmax } { set x1 $xmax }
-
-	if { $y >  $ymax } { set y $ymax }
-	if { $y <  $ymin } { set y $ymin }
-
-	set x2  [lindex $xdata $idx]
-	if { $x2 <  $xmin } { set x2 $xmin }
-	if { $x2 >  $xmax } { set x2 $xmax }
-
-	set xc  [expr {$cx+$dx*($x1-$xmin)}]
-	set xc2 [expr {$cx+$dx*($x2-$xmin)}]
-	set yc  [expr {$cy2-$dy*($y-$ymin)}]
-	set yc2 $cy2
-
-	$canvas create rectangle $xc $yc $xc2 $yc2 -tag $tag -fill blue
-    }
-}
-
-#
-# Simple test code
-#
-if { [info exists ::argv0] && ([file tail [info script]] == [file tail $::argv0]) } {
-
-    set xdata {1 2 3 4 5 10 20 6 7 8 1 3 4 5 6 7}
-    set ydata {2 3 4 5 6 10 20 7 8 1 3 4 5 6 7 1}
-
-    canvas .c
-    canvas .c2
-    pack   .c .c2 -side top -fill both
-    ::math::statistics::plot-scale .c  0 10 0 10
-    ::math::statistics::plot-scale .c2 0 20 0 10
-
-    ::math::statistics::plot-xydata .c  $xdata $ydata
-    ::math::statistics::plot-xyline .c  $xdata $ydata
-    ::math::statistics::plot-histogram .c2 {1 3 2 0.1 4 2} {-1 3 10 11 23}
-    ::math::statistics::plot-tdata  .c2 $xdata
-    ::math::statistics::plot-tline  .c2 $xdata
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/polynomials.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/polynomials.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,553 +1,0 @@
-# polynomials.tcl --
-#    Implement procedures to deal with polynomial functions
-#
-namespace eval ::math::polynomials {
-    variable count 0  ;# Count the number of specific commands
-    namespace eval v {}
-
-    namespace export polynomial polynCmd evalPolyn \
-                     degreePolyn coeffPolyn allCoeffsPolyn \
-                     derivPolyn  primitivePolyn \
-                     addPolyn    subPolyn multPolyn \
-                     divPolyn    remainderPolyn
-}
-
-
-# polynomial --
-#    Return a polynomial definition
-#
-# Arguments:
-#    coeffs       The coefficients of the polynomial
-# Result:
-#    Polynomial definition
-#
-proc ::math::polynomials::polynomial {coeffs} {
-
-    set rev_coeffs {}
-    set degree     -1
-    set index       0
-    foreach coeff $coeffs {
-        if { ! [string is double -strict $coeff] } {
-            return -code error "Coefficients must be real numbers"
-        }
-        set rev_coeffs [concat $coeff $rev_coeffs]
-        if { $coeff != 0.0 } {
-            set degree $index
-        }
-        incr index
-    }
-
-    #
-    # The leading coefficient must be non-zero
-    #
-    return [list POLYNOMIAL [lrange $rev_coeffs end-$degree end]]
-}
-
-# polynCmd --
-#    Return a procedure that implements a polynomial evaluation
-#
-# Arguments:
-#    coeffs       The coefficients of the polynomial (or a definition)
-# Result:
-#    New procedure
-#
-proc ::math::polynomials::polynCmd {coeffs} {
-    variable count
-
-    if { [lindex $coeffs 0] == "POLYNOMIAL" } {
-        set coeffs [allCoeffsPolyn $coeffs]
-    }
-
-    set degree [expr {[llength $coeffs]-1}]
-    set body "expr \{[join $coeffs +\$x*(][string repeat ) $degree]\}"
-
-    incr count
-    set name "::math::polynomials::v::POLYN$count"
-    proc $name {x} $body
-    return $name
-}
-
-# evalPolyn --
-#    Evaluate a polynomial at a given coordinate
-#
-# Arguments:
-#    polyn        Polynomial definition
-#    x            Coordinate
-# Result:
-#    Value at x
-#
-proc ::math::polynomials::evalPolyn {polyn x} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    if { ! [string is double $x] } {
-        return -code error "Coordinate must be a real number"
-    }
-
-    set result 0.0
-    foreach c [lindex $polyn 1] {
-        set result [expr {$result*$x+$c}]
-    }
-    return $result
-}
-
-# degreePolyn --
-#    Return the degree of the polynomial
-#
-# Arguments:
-#    polyn        Polynomial definition
-# Result:
-#    The degree
-#
-proc ::math::polynomials::degreePolyn {polyn} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    return [expr {[llength [lindex $polyn 1]]-1}]
-}
-
-# coeffPolyn --
-#    Return the coefficient of the index'th degree of the polynomial
-#
-# Arguments:
-#    polyn        Polynomial definition
-#    index        Degree for which to return the coefficient
-# Result:
-#    The coefficient of degree "index"
-#
-proc ::math::polynomials::coeffPolyn {polyn index} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    set coeffs [lindex $polyn 1]
-    if { $index < 0 || $index > [llength $coeffs] } {
-        return -code error "Index must be between 0 and [llength $coeffs]"
-    }
-    return [lindex $coeffs end-$index]
-}
-
-# allCoeffsPolyn --
-#    Return the coefficients of the polynomial
-#
-# Arguments:
-#    polyn        Polynomial definition
-# Result:
-#    The coefficients in ascending order
-#
-proc ::math::polynomials::allCoeffsPolyn {polyn} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    set rev_coeffs [lindex $polyn 1]
-    set coeffs {}
-    foreach c $rev_coeffs {
-        set coeffs [concat $c $coeffs]
-    }
-    return $coeffs
-}
-
-# derivPolyn --
-#    Return the derivative of the polynomial
-#
-# Arguments:
-#    polyn        Polynomial definition
-# Result:
-#    The new polynomial
-#
-proc ::math::polynomials::derivPolyn {polyn} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    set coeffs [lindex $polyn 1]
-    set new_coeffs {}
-    set idx        [degreePolyn $polyn]
-    foreach c [lrange $coeffs 0 end-1] {
-        lappend new_coeffs [expr {$idx*$c}]
-        incr idx -1
-    }
-    return [list POLYNOMIAL $new_coeffs]
-}
-
-# primitivePolyn --
-#    Return the primitive of the polynomial
-#
-# Arguments:
-#    polyn        Polynomial definition
-# Result:
-#    The new polynomial
-#
-proc ::math::polynomials::primitivePolyn {polyn} {
-    if { [lindex $polyn 0] != "POLYNOMIAL" } {
-        return -code error "Not a polynomial"
-    }
-    set coeffs [lindex $polyn 1]
-    set new_coeffs {}
-    set idx        [llength $coeffs]
-    foreach c [lrange $coeffs 0 end] {
-        lappend new_coeffs [expr {$c/double($idx)}]
-        incr idx -1
-    }
-    return [list POLYNOMIAL [concat $new_coeffs 0.0]]
-}
-
-# addPolyn --
-#    Add two polynomials and return the result
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The sum of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::addPolyn {polyn1 polyn2} {
-    if { [llength $polyn1] == 1 && [string is double -strict $polyn1] } {
-        set polyn1 [polynomial $polyn1]
-    }
-    if { [llength $polyn2] == 1 && [string is double -strict $polyn2] } {
-        set polyn2 [polynomial $polyn2]
-    }
-    if { [lindex $polyn1 0] != "POLYNOMIAL" ||
-         [lindex $polyn2 0] != "POLYNOMIAL"    } {
-        return -code error "Both arguments must be polynomials or a real number"
-    }
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    set extra1  [expr {[llength $coeffs2]-[llength $coeffs1]}]
-    while { $extra1 > 0 } {
-        set coeffs1 [concat 0.0 $coeffs1]
-        incr extra1 -1
-    }
-
-    set extra2  [expr {[llength $coeffs1]-[llength $coeffs2]}]
-    while { $extra2 > 0 } {
-        set coeffs2 [concat 0.0 $coeffs2]
-        incr extra2 -1
-    }
-
-    set new_coeffs {}
-    foreach c1 $coeffs1 c2 $coeffs2 {
-        lappend new_coeffs [expr {$c1+$c2}]
-    }
-    while { [lindex $new_coeffs 0] == 0.0 } {
-        set new_coeffs [lrange $new_coeffs 1 end]
-    }
-    return [list POLYNOMIAL $new_coeffs]
-}
-
-# subPolyn --
-#    Subtract two polynomials and return the result
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The difference of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::subPolyn {polyn1 polyn2} {
-    if { [llength $polyn1] == 1 && [string is double -strict $polyn1] } {
-        set polyn1 [polynomial $polyn1]
-    }
-    if { [llength $polyn2] == 1 && [string is double -strict $polyn2] } {
-        set polyn2 [polynomial $polyn2]
-    }
-    if { [lindex $polyn1 0] != "POLYNOMIAL" ||
-         [lindex $polyn2 0] != "POLYNOMIAL"    } {
-        return -code error "Both arguments must be polynomials or a real number"
-    }
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    set extra1  [expr {[llength $coeffs2]-[llength $coeffs1]}]
-    while { $extra1 > 0 } {
-        set coeffs1 [concat 0.0 $coeffs1]
-        incr extra1 -1
-    }
-
-    set extra2  [expr {[llength $coeffs1]-[llength $coeffs2]}]
-    while { $extra2 > 0 } {
-        set coeffs2 [concat 0.0 $coeffs2]
-        incr extra2 -1
-    }
-
-    set new_coeffs {}
-    foreach c1 $coeffs1 c2 $coeffs2 {
-        lappend new_coeffs [expr {$c1-$c2}]
-    }
-    while { [lindex $new_coeffs 0] == 0.0 } {
-        set new_coeffs [lrange $new_coeffs 1 end]
-    }
-    return [list POLYNOMIAL $new_coeffs]
-}
-
-# multPolyn --
-#    Multiply two polynomials and return the result
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The difference of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::multPolyn {polyn1 polyn2} {
-    if { [llength $polyn1] == 1 && [string is double -strict $polyn1] } {
-        set polyn1 [polynomial $polyn1]
-    }
-    if { [llength $polyn2] == 1 && [string is double -strict $polyn2] } {
-        set polyn2 [polynomial $polyn2]
-    }
-    if { [lindex $polyn1 0] != "POLYNOMIAL" ||
-         [lindex $polyn2 0] != "POLYNOMIAL"    } {
-        return -code error "Both arguments must be polynomials or a real number"
-    }
-
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    #
-    # Take care of the null polynomial
-    #
-    if { $coeffs1 == {} || $coeffs2 == {} } {
-        return [polynomial {}]
-    }
-
-    set zeros {}
-    foreach c $coeffs1 {
-        lappend zeros 0.0
-    }
-
-    set new_coeffs [lrange $zeros 1 end]
-    foreach c $coeffs2 {
-        lappend new_coeffs 0.0
-    }
-
-    set idx        0
-    foreach c $coeffs1 {
-        set term_coeffs {}
-        foreach c2 $coeffs2 {
-            lappend term_coeffs [expr {$c*$c2}]
-        }
-        set term_coeffs [concat [lrange $zeros 0 [expr {$idx-1}]] \
-                                $term_coeffs \
-                                [lrange $zeros [expr {$idx+1}] end]]
-
-        set sum_coeffs {}
-        foreach t $term_coeffs n $new_coeffs {
-            lappend sum_coeffs [expr {$t+$n}]
-        }
-        set new_coeffs $sum_coeffs
-        incr idx
-    }
-
-    return [list POLYNOMIAL $new_coeffs]
-}
-
-# divPolyn --
-#    Divide two polynomials and return the quotient
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The difference of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::divPolyn {polyn1 polyn2} {
-    if { [llength $polyn1] == 1 && [string is double -strict $polyn1] } {
-        set polyn1 [polynomial $polyn1]
-    }
-    if { [llength $polyn2] == 1 && [string is double -strict $polyn2] } {
-        set polyn2 [polynomial $polyn2]
-    }
-    if { [lindex $polyn1 0] != "POLYNOMIAL" ||
-         [lindex $polyn2 0] != "POLYNOMIAL"    } {
-        return -code error "Both arguments must be polynomials or a real number"
-    }
-
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    #
-    # Take care of the null polynomial
-    #
-    if { $coeffs1 == {} } {
-        return [polynomial {}]
-    }
-    if { $coeffs2 == {} } {
-        return -code error "Denominator can not be zero"
-    }
-
-    foreach {quotient remainder} [DivRemPolyn $polyn1 $polyn2] {break}
-    return $quotient
-}
-
-# remainderPolyn --
-#    Divide two polynomials and return the remainder
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The difference of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::remainderPolyn {polyn1 polyn2} {
-    if { [llength $polyn1] == 1 && [string is double -strict $polyn1] } {
-        set polyn1 [polynomial $polyn1]
-    }
-    if { [llength $polyn2] == 1 && [string is double -strict $polyn2] } {
-        set polyn2 [polynomial $polyn2]
-    }
-    if { [lindex $polyn1 0] != "POLYNOMIAL" ||
-         [lindex $polyn2 0] != "POLYNOMIAL"    } {
-        return -code error "Both arguments must be polynomials or a real number"
-    }
-
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    #
-    # Take care of the null polynomial
-    #
-    if { $coeffs1 == {} } {
-        return [polynomial {}]
-    }
-    if { $coeffs2 == {} } {
-        return -code error "Denominator can not be zero"
-    }
-
-    foreach {quotient remainder} [DivRemPolyn $polyn1 $polyn2] {break}
-    return $remainder
-}
-
-# DivRemPolyn --
-#    Divide two polynomials and return the quotient and remainder
-#
-# Arguments:
-#    polyn1       First polynomial or a scalar
-#    polyn2       Second polynomial or a scalar
-# Result:
-#    The difference of the two polynomials
-# Note:
-#    Make sure that the first coefficient is not zero
-#
-proc ::math::polynomials::DivRemPolyn {polyn1 polyn2} {
-
-    set coeffs1 [lindex $polyn1 1]
-    set coeffs2 [lindex $polyn2 1]
-
-    set steps [expr { [degreePolyn $polyn1] - [degreePolyn $polyn2] + 1 }]
-
-    #
-    # Special case: polynomial 1 has lower degree than polynomial 2
-    #
-    if { $steps <= 0 } {
-        return [list [polynomial 0.0] $polyn1]
-    } else {
-        set extra_coeffs {}
-        for { set i 1 } { $i < $steps } { incr i } {
-            lappend extra_coeffs 0.0
-        }
-        lappend extra_coeffs 1.0
-    }
-
-    set c2 [lindex $coeffs2 0]
-    set quot_coeffs {}
-
-    for { set i 0 } { $i < $steps } { incr i } {
-        set c1     [lindex $coeffs1 0]
-        set factor [expr {$c1/$c2}]
-
-        set fpolyn [multPolyn $polyn2 \
-                              [polynomial [lrange $extra_coeffs $i end]]]
-
-        set newpol [subPolyn $polyn1 [multPolyn $fpolyn $factor]]
-
-        #
-        # Due to rounding errors, a very small, parasitical
-        # term may still exist. Remove it
-        #
-        if { [degreePolyn $newpol] == [degreePolyn $polyn1] } {
-            set new_coeffs [lrange [allCoeffsPolyn $newpol] 0 end-1]
-            set newpol     [polynomial $new_coeffs]
-        }
-        set polyn1 $newpol
-        set coeffs1 [lindex $polyn1 1]
-        set quot_coeffs [concat $factor $quot_coeffs]
-    }
-    set quotient [polynomial $quot_coeffs]
-
-    return [list $quotient $polyn1]
-}
-
-#
-# Announce our presence
-#
-package provide math::polynomials 1.0.1
-
-# some tests --
-#
-if { 0 } {
-set tcl_precision 17
-
-set f1    [::math::polynomials::polynomial {1 2 3}]
-set f2    [::math::polynomials::polynomial {1 2 3 0}]
-set f3    [::math::polynomials::polynomial {0 0 0 0}]
-set f4    [::math::polynomials::polynomial {5 7}]
-set cmdf1 [::math::polynomials::polynCmd {1 2 3}]
-
-foreach x {0 1 2 3 4 5} {
-    puts "[::math::polynomials::evalPolyn $f1 $x] -- \
-[expr {1.0+2.0*$x+3.0*$x*$x}] -- \
-[$cmdf1 $x] -- [::math::polynomials::evalPolyn $f3 $x]"
-}
-
-puts "Degree: [::math::polynomials::degreePolyn $f1] (expected: 2)"
-puts "Degree: [::math::polynomials::degreePolyn $f2] (expected: 2)"
-foreach d {0 1 2} {
-    puts "Coefficient $d = [::math::polynomials::coeffPolyn $f2 $d]"
-}
-puts "All coefficients = [::math::polynomials::allCoeffsPolyn $f2]"
-
-puts "Derivative = [::math::polynomials::derivPolyn $f1]"
-puts "Primitive  = [::math::polynomials::primitivePolyn $f1]"
-
-puts "Add:       [::math::polynomials::addPolyn $f1 $f4]"
-puts "Add:       [::math::polynomials::addPolyn $f4 $f1]"
-puts "Subtract:  [::math::polynomials::subPolyn $f1 $f4]"
-puts "Multiply:  [::math::polynomials::multPolyn $f1 $f4]"
-
-set f1    [::math::polynomials::polynomial {1 2 3}]
-set f2    [::math::polynomials::polynomial {0 1}]
-
-puts "Divide:    [::math::polynomials::divPolyn $f1 $f2]"
-puts "Remainder: [::math::polynomials::remainderPolyn $f1 $f2]"
-
-set f1    [::math::polynomials::polynomial {1 2 3}]
-set f2    [::math::polynomials::polynomial {1 1}]
-
-puts "Divide:    [::math::polynomials::divPolyn $f1 $f2]"
-puts "Remainder: [::math::polynomials::remainderPolyn $f1 $f2]"
-
-set f1 [::math::polynomials::polynomial {1 2 3}]
-set f2 [::math::polynomials::polynomial {0 1}]
-set f3 [::math::polynomials::divPolyn $f2 $f1]
-set coeffs [::math::polynomials::allCoeffsPolyn $f3]
-puts "Coefficients: $coeffs"
-set f3 [::math::polynomials::divPolyn $f1 $f2]
-set coeffs [::math::polynomials::allCoeffsPolyn $f3]
-puts "Coefficients: $coeffs"
-set f1 [::math::polynomials::polynomial {1 2 3}]
-set f2 [::math::polynomials::polynomial {0}]
-set f3 [::math::polynomials::divPolyn $f2 $f1]
-set coeffs [::math::polynomials::allCoeffsPolyn $f3]
-puts "Coefficients: $coeffs"
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/qcomplex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/qcomplex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,178 +1,0 @@
-# qcomplex.tcl --
-#    Small module for dealing with complex numbers
-#    The design goal was to make the operations as fast
-#    as possible, not to offer a nice interface. So:
-#    - complex numbers are represented as lists of two elements
-#    - there is hardly any error checking, all arguments are assumed
-#      to be complex numbers already (with a few obvious exceptions)
-#    Missing:
-#    the inverse trigonometric functions and the hyperbolic functions
-#
-
-namespace eval ::math::complexnumbers {
-    namespace export + - / * conj exp sin cos tan real imag mod arg log pow sqrt tostring
-}
-
-# complex --
-#    Create a new complex number
-# Arguments:
-#    real      The real part
-#    imag      The imaginary part
-# Result:
-#    New complex number
-#
-proc ::math::complexnumbers::complex {real imag} {
-    return [list $real $imag]
-}
-
-# binary operations --
-#    Implement the basic binary operations
-# Arguments:
-#    z1        First argument
-#    z2        Second argument
-# Result:
-#    New complex number
-#
-proc ::math::complexnumbers::+ {z1 z2} {
-    set result {}
-    foreach c $z1 d $z2 {
-        lappend result [expr {$c+$d}]
-    }
-    return $result
-}
-proc ::math::complexnumbers::- {z1 {z2 {}}} {
-    if { $z2 == {} } {
-        set z2 $z1
-        set z1 {0.0 0.0}
-    }
-    set result {}
-    foreach c $z1 d $z2 {
-        lappend result [expr {$c-$d}]
-    }
-    return $result
-}
-proc ::math::complexnumbers::* {z1 z2} {
-    set result {}
-    foreach {c1 d1} $z1 {break}
-    foreach {c2 d2} $z2 {break}
-
-    return [list [expr {$c1*$c2-$d1*$d2}] [expr {$c1*$d2+$c2*$d1}]]
-}
-proc ::math::complexnumbers::/ {z1 z2} {
-    set result {}
-    foreach {c1 d1} $z1 {break}
-    foreach {c2 d2} $z2 {break}
-
-    set denom [expr {$c2*$c2+$d2*$d2}]
-    return [list [expr {($c1*$c2+$d1*$d2)/$denom}] \
-                 [expr {(-$c1*$d2+$c2*$d1)/$denom}]]
-}
-
-# unary operations --
-#    Implement the basic unary operations
-# Arguments:
-#    z1        Argument
-# Result:
-#    New complex number
-#
-proc ::math::complexnumbers::conj {z1} {
-    foreach {c d} $z1 {break}
-    return [list $c [expr {-$d}]]
-}
-proc ::math::complexnumbers::real {z1} {
-    foreach {c d} $z1 {break}
-    return $c
-}
-proc ::math::complexnumbers::imag {z1} {
-    foreach {c d} $z1 {break}
-    return $d
-}
-proc ::math::complexnumbers::mod {z1} {
-    foreach {c d} $z1 {break}
-    return [expr {hypot($c,$d)}]
-}
-proc ::math::complexnumbers::arg {z1} {
-    foreach {c d} $z1 {break}
-    if { $c != 0.0 || $d != 0.0 } {
-        return [expr {atan2($d,$c)}]
-    } else {
-        return 0.0
-    }
-}
-
-# elementary functions --
-#    Implement the elementary functions
-# Arguments:
-#    z1        Argument
-#    z2        Second argument (if any)
-# Result:
-#    New complex number
-#
-proc ::math::complexnumbers::exp {z1} {
-    foreach {c d} $z1 {break}
-    return [list [expr {exp($c)*cos($d)}] [expr {exp($c)*sin($d)}]]
-}
-proc ::math::complexnumbers::cos {z1} {
-    foreach {c d} $z1 {break}
-    return [list [expr {cos($c)*cosh($d)}] [expr {-sin($c)*sinh($d)}]]
-}
-proc ::math::complexnumbers::sin {z1} {
-    foreach {c d} $z1 {break}
-    return [list [expr {sin($c)*cosh($d)}] [expr {cos($c)*sinh($d)}]]
-}
-proc ::math::complexnumbers::tan {z1} {
-    return [/ [sin $z1] [cos $z1]]
-}
-proc ::math::complexnumbers::log {z1} {
-    return [list [expr {log([mod $z1])}] [arg $z1]]
-}
-proc ::math::complexnumbers::sqrt {z1} {
-    set argz [expr {0.5*[arg $z1]}]
-    set modz [expr {sqrt([mod $z1])}]
-    return [list [expr {$modz*cos($argz)}] [expr {$modz*sin($argz)}]]
-}
-proc ::math::complexnumbers::pow {z1 z2} {
-    return [exp [* [log $z1] $z2]]
-}
-# transformational functions --
-#    Implement transformational functions
-# Arguments:
-#    z1        Argument
-# Result:
-#    String like 1+i
-#
-proc ::math::complexnumbers::tostring {z1} {
-    foreach {c d} $z1 {break}
-    if { $d == 0.0 } {
-        return "$c"
-    } else {
-        if { $c == 0.0 } {
-            if { $d == 1.0 } {
-                return "i"
-            } elseif { $d == -1.0 } {
-                return "-i"
-            } else {
-                return "${d}i"
-            }
-        } else {
-            if { $d > 0.0 } {
-                if { $d == 1.0 } {
-                    return "$c+i"
-                } else {
-                    return "$c+${d}i"
-                }
-            } else {
-                if { $d == -1.0 } {
-                    return "$c-i"
-                } else {
-                    return "$c${d}i"
-                }
-            }
-        }
-    }
-}
-
-#
-# Announce our presence
-#
-package provide math::complexnumbers 1.0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/rational_funcs.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/rational_funcs.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,356 +1,0 @@
-# rational_funcs.tcl --
-#    Implement procedures to deal with rational functions
-#
-
-package require math::polynomials
-
-namespace eval ::math::rationalfunctions {
-    variable count 0  ;# Count the number of specific commands
-    namespace eval v {}
-
-    namespace export rationalFunction ratioCmd evalRatio \
-                     coeffsNumerator coeffsDenominator \
-                     derivRatio  \
-                     addRatio    subRatio multRatio \
-                     divRatio
-
-    namespace import ::math::polynomials::*
-}
-
-
-# rationalFunction --
-#    Return a rational function definition
-#
-# Arguments:
-#    num          The coefficients of the numerator
-#    den          The coefficients of the denominator
-# Result:
-#    Rational function definition
-#
-proc ::math::rationalfunctions::rationalFunction {num den} {
-
-    foreach coeffs [list $num $den] {
-        foreach coeff $coeffs {
-            if { ! [string is double -strict $coeff] } {
-                return -code error "Coefficients must be real numbers"
-            }
-        }
-    }
-
-    #
-    # The leading coefficient must be non-zero
-    #
-    return [list RATIONAL_FUNCTION [polynomial $num] [polynomial $den]]
-}
-
-# ratioCmd --
-#    Return a procedure that implements a rational function evaluation
-#
-# Arguments:
-#    num          The coefficients of the numerator
-#    den          The coefficients of the denominator
-# Result:
-#    New procedure
-#
-proc ::math::rationalfunctions::ratioCmd {num {den {}}} {
-    variable count
-
-    if { [llength $den] == 0 } {
-        if { [lindex $num 0] == "RATIONAL_FUNCTION" } {
-            set den [lindex $num 2]
-            set num [lindex $num 1]
-        }
-    }
-
-    set degree1 [expr {[llength $num]-1}]
-    set degree2 [expr {[llength $num]-1}]
-    set body "expr \{([join $num +\$x*(][string repeat ) $degree1])/\
-(double([join $den +\$x*(][string repeat ) $degree2])\}"
-
-    incr count
-    set name "::math::rationalfunctions::v::RATIO$count"
-    proc $name {x} $body
-    return $name
-}
-
-# evalRatio --
-#    Evaluate a rational function at a given coordinate
-#
-# Arguments:
-#    ratio        Rational function definition
-#    x            Coordinate
-# Result:
-#    Value at x
-#
-proc ::math::rationalfunctions::evalRatio {ratio x} {
-    if { [lindex $ratio 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Not a rational function"
-    }
-    if { ! [string is double $x] } {
-        return -code error "Coordinate must be a real number"
-    }
-
-    set num 0.0
-    foreach c [lindex [lindex $ratio 1] 1] {
-        set num [expr {$num*$x+$c}]
-    }
-
-    set den 0.0
-    foreach c [lindex [lindex $ratio 2] 1] {
-        set den [expr {$den*$x+$c}]
-    }
-    return [expr {$num/double($den)}]
-}
-
-# coeffsNumerator --
-#    Return the coefficients of the numerator
-#
-# Arguments:
-#    ratio        Rational function definition
-# Result:
-#    The coefficients in ascending order
-#
-proc ::math::rationalfunctions::coeffsNumerator {ratio} {
-    if { [lindex $ratio 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Not a rational function"
-    }
-    set polyn [lindex $ratio 1]
-    return [allCoeffsPolyn $polyn]
-}
-
-# coeffsDenominator --
-#    Return the coefficients of the denominator
-#
-# Arguments:
-#    ratio        Rational function definition
-# Result:
-#    The coefficients in ascending order
-#
-proc ::math::rationalfunctions::coeffsDenominator {ratio} {
-    if { [lindex $ratio 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Not a rational function"
-    }
-    set polyn [lindex $ratio 2]
-    return [allCoeffsPolyn $polyn]
-}
-
-# derivRatio --
-#    Return the derivative of the rational function
-#
-# Arguments:
-#    polyn        Polynomial definition
-# Result:
-#    The new polynomial
-#
-proc ::math::rationalfunctions::derivRatio {ratio} {
-    if { [lindex $ratio 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Not a rational function"
-    }
-    set num_polyn [lindex $ratio 1]
-    set den_polyn [lindex $ratio 2]
-    set num_deriv [derivPolyn $num_polyn]
-    set den_deriv [derivPolyn $den_polyn]
-    set num       [subPolyn [multPolyn $num_deriv $den_polyn] \
-                            [multPolyn $den_deriv $num_polyn] ]
-    set den       [multPolyn $den_polyn $den_polyn]
-
-    return [list RATIONAL_FUNCTION $num $den]
-}
-
-# addRatio --
-#    Add two rational functions and return the result
-#
-# Arguments:
-#    ratio1       First rational function or a scalar
-#    ratio2       Second rational function or a scalar
-# Result:
-#    The sum of the two functions
-# Note:
-#    TODO: Check for the same denominator
-#
-proc ::math::rationalfunctions::addRatio {ratio1 ratio2} {
-    if { [llength $ratio1] == 1 && [string is double -strict $ratio1] } {
-        set polyn1 [rationalFunction $ratio1 1.0]
-    }
-    if { [llength $ratio2] == 1 && [string is double -strict $ratio2] } {
-        set ratio2 [rationalFunction $ratio1 1.0]
-    }
-    if { [lindex $ratio1 0] != "RATIONAL_FUNCTION" ||
-         [lindex $ratio2 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Both arguments must be rational functions or a real number"
-    }
-
-    set num1    [lindex $ratio1 1]
-    set den1    [lindex $ratio1 2]
-    set num2    [lindex $ratio2 1]
-    set den2    [lindex $ratio2 2]
-
-    set newnum  [addPolyn [multPolyn $num1 $den2] \
-                          [multPolyn $num2 $den1] ]
-
-    set newden  [multPolyn $den1 $den2]
-
-    return [list RATIONAL_FUNCTION $newnum $newden]
-}
-
-# subRatio --
-#    Subtract two rational functions and return the result
-#
-# Arguments:
-#    ratio1       First rational function or a scalar
-#    ratio2       Second rational function or a scalar
-# Result:
-#    The difference of the two functions
-# Note:
-#    TODO: Check for the same denominator
-#
-proc ::math::rationalfunctions::subRatio {ratio1 ratio2} {
-    if { [llength $ratio1] == 1 && [string is double -strict $ratio1] } {
-        set polyn1 [rationalFunction $ratio1 1.0]
-    }
-    if { [llength $ratio2] == 1 && [string is double -strict $ratio2] } {
-        set ratio2 [rationalFunction $ratio1 1.0]
-    }
-    if { [lindex $ratio1 0] != "RATIONAL_FUNCTION" ||
-         [lindex $ratio2 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Both arguments must be rational functions or a real number"
-    }
-
-    set num1    [lindex $ratio1 1]
-    set den1    [lindex $ratio1 2]
-    set num2    [lindex $ratio2 1]
-    set den2    [lindex $ratio2 2]
-
-    set newnum  [subPolyn [multPolyn $num1 $den2] \
-                          [multPolyn $num2 $den1] ]
-
-    set newden  [multPolyn $den1 $den2]
-
-    return [list RATIONAL_FUNCTION $newnum $newden]
-}
-
-# multRatio --
-#    Multiply two rational functions and return the result
-#
-# Arguments:
-#    ratio1       First rational function or a scalar
-#    ratio2       Second rational function or a scalar
-# Result:
-#    The product of the two functions
-# Note:
-#    TODO: Check for the same denominator
-#
-proc ::math::rationalfunctions::multRatio {ratio1 ratio2} {
-    if { [llength $ratio1] == 1 && [string is double -strict $ratio1] } {
-        set polyn1 [rationalFunction $ratio1 1.0]
-    }
-    if { [llength $ratio2] == 1 && [string is double -strict $ratio2] } {
-        set ratio2 [rationalFunction $ratio1 1.0]
-    }
-    if { [lindex $ratio1 0] != "RATIONAL_FUNCTION" ||
-         [lindex $ratio2 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Both arguments must be rational functions or a real number"
-    }
-
-    set num1    [lindex $ratio1 1]
-    set den1    [lindex $ratio1 2]
-    set num2    [lindex $ratio2 1]
-    set den2    [lindex $ratio2 2]
-
-    set newnum  [multPolyn $num1 $num2]
-    set newden  [multPolyn $den1 $den2]
-
-    return [list RATIONAL_FUNCTION $newnum $newden]
-}
-
-# divRatio --
-#    Divide two rational functions and return the result
-#
-# Arguments:
-#    ratio1       First rational function or a scalar
-#    ratio2       Second rational function or a scalar
-# Result:
-#    The quotient of the two functions
-# Note:
-#    TODO: Check for the same denominator
-#
-proc ::math::rationalfunctions::divRatio {ratio1 ratio2} {
-    if { [llength $ratio1] == 1 && [string is double -strict $ratio1] } {
-        set polyn1 [rationalFunction $ratio1 1.0]
-    }
-    if { [llength $ratio2] == 1 && [string is double -strict $ratio2] } {
-        set ratio2 [rationalFunction $ratio1 1.0]
-    }
-    if { [lindex $ratio1 0] != "RATIONAL_FUNCTION" ||
-         [lindex $ratio2 0] != "RATIONAL_FUNCTION" } {
-        return -code error "Both arguments must be rational functions or a real number"
-    }
-
-    set num1    [lindex $ratio1 1]
-    set den1    [lindex $ratio1 2]
-    set num2    [lindex $ratio2 1]
-    set den2    [lindex $ratio2 2]
-
-    set newnum  [multPolyn $num1 $den2]
-    set newden  [multPolyn $num2 $den1]
-
-    return [list RATIONAL_FUNCTION $newnum $newden]
-}
-
-#
-# Announce our presence
-#
-package provide math::rationalfunctions 1.0.1
-
-# some tests --
-#
-if { 0 } {
-set tcl_precision 17
-
-set f1    [::math::rationalfunctions::rationalFunction {1 2 3} {1 4}]
-set f2    [::math::rationalfunctions::rationalFunction {1 2 3 0} {1 4}]
-set f3    [::math::rationalfunctions::rationalFunction {0 0 0 0} {1}]
-set f4    [::math::rationalfunctions::rationalFunction {5 7} {1}]
-set cmdf1 [::math::rationalfunctions::ratioCmd {1 2 3} {1 4}]
-
-foreach x {0 1 2 3 4 5} {
-    puts "[::math::rationalfunctions::evalRatio $f1 $x] -- \
-[expr {(1.0+2.0*$x+3.0*$x*$x)/double(1.0+4.0*$x)}] -- \
-[$cmdf1 $x] -- [::math::rationalfunctions::evalRatio $f3 $x]"
-}
-
-puts "All coefficients = [::math::rationalfunctions::coeffsNumerator $f2]"
-puts "                   [::math::rationalfunctions::coeffsDenominator $f2]"
-
-puts "Derivative = [::math::rationalfunctions::derivRatio $f1]"
-
-puts "Add:       [::math::rationalfunctions::addRatio $f1 $f4]"
-puts "Add:       [::math::rationalfunctions::addRatio $f4 $f1]"
-puts "Subtract:  [::math::rationalfunctions::subRatio $f1 $f4]"
-puts "Multiply:  [::math::rationalfunctions::multRatio $f1 $f4]"
-
-set f1    [::math::rationalfunctions::rationalFunction {1 2 3} 1]
-set f2    [::math::rationalfunctions::rationalFunction {0 1} 1]
-
-puts "Divide:    [::math::rationalfunctions::divRatio $f1 $f2]"
-
-set f1    [::math::rationalfunctions::rationalFunction {1 2 3} 1]
-set f2    [::math::rationalfunctions::rationalFunction {1 1} {1 2}]
-
-puts "Divide:    [::math::rationalfunctions::divRatio $f1 $f2]"
-
-set f1 [::math::rationalfunctions::rationalFunction {1 2 3} 1]
-set f2 [::math::rationalfunctions::rationalFunction {0 1} {0 0 1}]
-set f3 [::math::rationalfunctions::divRatio $f2 $f1]
-set coeffs [::math::rationalfunctions::coeffsNumerator $f3]
-puts "Coefficients: $coeffs"
-set f3 [::math::rationalfunctions::divRatio $f1 $f2]
-set coeffs [::math::rationalfunctions::coeffsNumerator $f3]
-puts "Coefficients: $coeffs"
-set f1 [::math::rationalfunctions::rationalFunction {1 2 3} {1 2}]
-set f2 [::math::rationalfunctions::rationalFunction {0} {1}]
-set f3 [::math::rationalfunctions::divRatio $f2 $f1]
-set coeffs [::math::rationalfunctions::coeffsNumerator $f3]
-puts "Coefficients: $coeffs"
-puts "Eval null function: [::math::rationalfunctions::evalRatio $f2 1]"
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/romannumerals.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/romannumerals.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,164 +1,0 @@
-#==========================================================================
-# Roman Numeral Utility Functions
-#==========================================================================
-# Description
-#
-#   A set of utility routines for handling and manipulating
-#   roman numerals.
-#-------------------------------------------------------------------------
-# Copyright/License
-#
-#   This code was originally harvested from the Tcler's
-#   wiki at http://wiki.tcl.tk/1823 and as such is free
-#   for any use for any purpose.
-#-------------------------------------------------------------------------
-# Modification history
-#
-#   27 Sep 2005 Kenneth Green
-#       Original version derived from wiki code
-#-------------------------------------------------------------------------
-
-package provide math::roman 1.0
-
-#==========================================================================
-# Namespace
-#==========================================================================
-namespace eval ::math::roman {
-    namespace export tointeger toroman
-
-    # We dont export 'sort' or 'expr' to prevent collision
-    # with existing commands. These functions are less likely to be
-    # commonly used and have to be accessed as fully-scoped names.
-
-    # romanvalues - array that maps roman letters to integer values.
-    #
-    variable romanvalues
-
-    # i2r - list of integer-roman tuples
-    variable i2r {1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 9 IX 5 V 4 IV 1 I}
-
-    # sortkey - list of patterns to supporting sorting of roman numerals
-    variable sortkey {IX VIIII L Y XC YXXXX C Z D {\^} ZM {\^ZZZZ} M _}
-    variable rsortkey {_ M {\^ZZZZ} ZM {\^} D Z C YXXXX XC Y L VIIII IX}
-
-    # Initialise array variables
-    array set romanvalues {M 1000 D 500 C 100 L 50 X 10 V 5 I 1}
-}
-
-#==========================================================================
-# Public Functions
-#==========================================================================
-
-#----------------------------------------------------------
-# Roman numerals sorted
-#
-proc ::math::roman::sort list {
-    variable sortkey
-    variable rsortkey
-
-    foreach {from to} $sortkey {
-        regsub -all $from $list $to list
-    }
-    set list [lsort $list]
-    foreach {from to} $rsortkey {
-        regsub -all $from $list $to list
-    }
-    return $list
-}
-
-#----------------------------------------------------------
-# Roman numerals from integer
-#
-proc ::math::roman::toroman {i} {
-    variable i2r
-
-    set res ""
-    foreach {value roman} $i2r {
-        while {$i>=$value} {
-            append res $roman
-            incr i -$value
-        }
-    }
-    return $res
-}
-
-#----------------------------------------------------------
-# Roman numerals parsed into integer:
-#
-proc ::math::roman::tointeger {s} {
-    variable romanvalues
-
-    set last 99999
-    set res  0
-    foreach i [split [string toupper $s] ""] {
-        if { [catch {set val $romanvalues($i)}] } {
-            return -code error "roman::tointeger - un-Roman digit $i in $s"
-        }
-        incr res $val
-        if { $val > $last } {
-            incr res [::expr -2*$last]
-        }
-        set last $val
-    }
-    return $res
-}
-
-#----------------------------------------------------------
-# Roman numeral arithmetic
-#
-proc ::math::roman::expr args {
-
-    if { [string first \$ $args] >= 0 } {
-        set args [uplevel subst $args]
-    }
-
-    regsub -all {[^IVXLCDM]} $args { & } args
-    foreach i $args {
-        catch {set i [tointeger $i]}
-        lappend res $i
-    }
-    return [toroman [::expr $res]]
-}
-
-#==========================================================
-# Developer test code
-#
-if { 0 } {
-
-    puts "Basic int-to-roman-to-int conversion test"
-    for { set i 0 } {$i < 50} {incr i} {
-        set r [::math::roman::toroman   $i]
-        set j [::math::roman::tointeger $r]
-        puts [format "%5d   %-15s %s" $i $r $j]
-        if { $i != $j } {
-            error "Invalid conversion: $i -> $r -> $j"
-        }
-    }
-
-    puts ""
-    puts "roman arithmetic test"
-    set x 23
-    set xr [::math::roman::toroman $x]
-    set y 77
-    set yr [::math::roman::toroman $y]
-    set xr+yr [::math::roman::expr $xr + $yr]
-    set yr-xr [::math::roman::expr $yr - $xr]
-    set xr*yr [::math::roman::expr $xr * $yr]
-    set yr/xr [::math::roman::expr $yr / $xr]
-    set yr/xr2 [::math::roman::expr {$yr / $xr}]
-    puts "$x + $y\t\t= [expr $x + $y]"
-    puts "$x * $y\t\t= [expr $x * $y]"
-    puts "$y - $x\t\t= [expr $y - $x]"
-    puts "$y / $x\t\t= [expr $y / $x]"
-    puts "$xr + $yr\t= ${xr+yr} = [::math::roman::tointeger ${xr+yr}]"
-    puts "$xr * $yr\t= ${xr*yr} = [::math::roman::tointeger ${xr*yr}]"
-    puts "$yr - $xr\t= ${yr-xr} = [::math::roman::tointeger ${yr-xr}]"
-    puts "$yr / $xr\t= ${yr/xr} = [::math::roman::tointeger ${yr/xr}]"
-    puts "$yr / $xr\t= ${yr/xr2} = [::math::roman::tointeger ${yr/xr2}]"
-
-    puts ""
-    puts "roman sorting test"
-    set l {X III IV I V}
-    puts "IN : $l"
-    puts "OUT: [::math::roman::sort $l]"
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/special.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/special.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,188 +1,0 @@
-# special.tcl --
-#    Provide well-known special mathematical functions
-#
-# This file contains a collection of tests for one or more of the Tcllib
-# procedures.  Sourcing this file into Tcl runs the tests and
-# generates output for errors.  No output means no errors were found.
-#
-# Copyright (c) 2004 by Arjen Markus. All rights reserved.
-#
-# RCS: @(#) $Id: special.tcl,v 1.10 2007/06/26 18:55:18 kennykb Exp $
-#
-package require math
-package require math::constants
-package require math::statistics
-
-# namespace special
-#    Create a convenient namespace for the "special" mathematical functions
-#
-namespace eval ::math::special {
-    #
-    # Define a number of common mathematical constants
-    #
-    ::math::constants::constants pi
-    variable halfpi [expr {$pi/2.0}]
-
-    #
-    # Functions defined in other math submodules
-    #
-    if { [info commands Beta] == {} } {
-       namespace import ::math::Beta
-    }
-    if { [info commands Beta] == {} } {
-       namespace import ::math::ln_Gamma
-    }
-
-    #
-    # Export the various functions
-    #
-    namespace export Beta ln_Gamma Gamma erf erfc fresnel_C fresnel_S sinc
-}
-
-# Gamma --
-#    The Gamma function - synonym for "factorial"
-#
-proc ::math::special::Gamma {x} {
-    ::math::factorial [expr { $x + 1 }]
-}
-
-# erf --
-#    The error function
-# Arguments:
-#    x          The value for which the function must be evaluated
-# Result:
-#    erf(x)
-#
-proc ::math::special::erf {x} {
-    set x2 $x
-    if { $x > 0.0 } {
-        set x2 [expr {-$x}]
-    }
-    if { $x2 != 0.0 } {
-        set r [::math::statistics::cdf-normal 0.0 [expr {sqrt(0.5)}] $x2]
-        if { $x > 0.0 } {
-            return [expr {1.0-2.0*$r}]
-        } else {
-            return [expr {2.0*$r-1.0}]
-        }
-    } else {
-        return 0.0
-    }
-}
-
-# erfc --
-#    The complement of the error function
-# Arguments:
-#    x          The value for which the function must be evaluated
-# Result:
-#    erfc(x) = 1.0-erf(x)
-#
-proc ::math::special::erfc {x} {
-    set x2 $x
-    if { $x > 0.0 } {
-        set x2 [expr {-$x}]
-    }
-    if { $x2 != 0.0 } {
-        set r [::math::statistics::cdf-normal 0.0 [expr {sqrt(0.5)}] $x2]
-        if { $x > 0.0 } {
-            return [expr {2.0*$r}]
-        } else {
-            return [expr {2.0-2.0*$r}]
-        }
-    } else {
-        return 1.0
-    }
-}
-
-# ComputeFG --
-#    Compute the auxiliary functions f and g
-#
-# Arguments:
-#    x            Parameter of the integral (x>=0)
-# Result:
-#    Approximate values for f and g
-# Note:
-#    See Abramowitz and Stegun. The accuracy is 2.0e-3.
-#
-proc ::math::special::ComputeFG {x} {
-    list [expr {(1.0+0.926*$x)/(2.0+1.792*$x+3.104*$x*$x)}] \
-        [expr {1.0/(2.0+4.142*$x+3.492*$x*$x+6.670*$x*$x*$x)}]
-}
-
-# fresnel_C --
-#    Compute the Fresnel cosine integral
-#
-# Arguments:
-#    x            Parameter of the integral (x>=0)
-# Result:
-#    Value of C(x) = integral from 0 to x of cos(0.5*pi*x^2)
-# Note:
-#    This relies on a rational approximation of the two auxiliary functions f and g
-#
-proc ::math::special::fresnel_C {x} {
-    variable halfpi
-    if { $x < 0.0 } {
-        error "Domain error: x must be non-negative"
-    }
-
-    if { $x == 0.0 } {
-        return 0.0
-    }
-
-    foreach {f g} [ComputeFG $x] {break}
-
-    set xarg [expr {$halfpi*$x*$x}]
-
-    return [expr {0.5+$f*sin($xarg)-$g*cos($xarg)}]
-}
-
-# fresnel_S --
-#    Compute the Fresnel sine integral
-#
-# Arguments:
-#    x            Parameter of the integral (x>=0)
-# Result:
-#    Value of S(x) = integral from 0 to x of sin(0.5*pi*x^2)
-# Note:
-#    This relies on a rational approximation of the two auxiliary functions f and g
-#
-proc ::math::special::fresnel_S {x} {
-    variable halfpi
-    if { $x < 0.0 } {
-        error "Domain error: x must be non-negative"
-    }
-
-    if { $x == 0.0 } {
-        return 0.0
-    }
-
-    foreach {f g} [ComputeFG $x] {break}
-
-    set xarg [expr {$halfpi*$x*$x}]
-
-    return [expr {0.5-$f*cos($xarg)-$g*sin($xarg)}]
-}
-
-# sinc --
-#    Compute the sinc function
-# Arguments:
-#    x       Value of the argument
-# Result:
-#    sin(x)/x
-#
-proc ::math::special::sinc {x} {
-    if { $x == 0.0 } {
-        return 1.0
-    } else {
-        return [expr {sin($x)/$x}]
-    }
-}
-
-# Bessel functions and elliptic integrals --
-#
-source [file join [file dirname [info script]] "bessel.tcl"]
-source [file join [file dirname [info script]] "classic_polyns.tcl"]
-source [file join [file dirname [info script]] "elliptic.tcl"]
-source [file join [file dirname [info script]] "exponential.tcl"]
-
-package provide math::special 0.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/statistics.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/statistics.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1430 +1,0 @@
-# statistics.tcl --
-#
-#    Package for basic statistical analysis
-#
-# version 0.1:   initial implementation, january 2003
-# version 0.1.1: added linear regression, june 2004
-# version 0.1.2: border case in stdev taken care of
-# version 0.1.3: moved initialisation of CDF to first call, november 2004
-# version 0.3:   added test for normality (as implemented by Torsten Reincke), march 2006
-#                (also fixed an error in the export list)
-# version 0.4:   added the multivariate linear regression procedures by
-#                Eric Kemp-Benedict, february 2007
-# version 0.5:   added the population standard deviation and variance,
-#                as suggested by Dimitrios Zachariadis
-
-package provide math::statistics 0.5
-
-# ::math::statistics --
-#   Namespace holding the procedures and variables
-#
-
-namespace eval ::math::statistics {
-    #
-    # Safer: change to short procedures
-    #
-    namespace export mean min max number var stdev pvar pstdev basic-stats corr \
-	    histogram interval-mean-stdev t-test-mean quantiles \
-	    test-normal lillieforsFit \
-	    autocorr crosscorr filter map samplescount median \
-	    test-2x2 print-2x2 control-xbar test_xbar \
-	    control-Rchart test-Rchart
-    #
-    # Error messages
-    #
-    variable NEGSTDEV   {Zero or negative standard deviation}
-    variable TOOFEWDATA {Too few or invalid data}
-    variable OUTOFRANGE {Argument out of range}
-
-    #
-    # Coefficients involved
-    #
-    variable factorNormalPdf
-    set factorNormalPdf [expr {sqrt(8.0*atan(1.0))}]
-
-    # xbar/R-charts:
-    # Data from:
-    #    Peter W.M. John:
-    #    Statistical methods in engineering and quality assurance
-    #    Wiley and Sons, 1990
-    #
-    variable control_factors {
-        A2 {1.880 1.093 0.729 0.577 0.483 0.419 0.419}
-        D3 {0.0   0.0   0.0   0.0   0.0   0.076 0.076}
-        D4 {3.267 2.574 2.282 2.114 2.004 1.924 1.924}
-    }
-}
-
-# mean, min, max, number, var, stdev, pvar, pstdev --
-#    Return the mean (minimum, maximum) value of a list of numbers
-#    or number of non-missing values
-#
-# Arguments:
-#    type     Type of value to be returned
-#    values   List of values to be examined
-#
-# Results:
-#    Value that was required
-#
-#
-namespace eval ::math::statistics {
-    foreach type {mean min max number stdev var pstdev pvar} {
-	proc $type { values } "BasicStats $type \$values"
-    }
-    proc basic-stats { values } "BasicStats all \$values"
-}
-
-# BasicStats --
-#    Return the one or all of the basic statistical properties
-#
-# Arguments:
-#    type     Type of value to be returned
-#    values   List of values to be examined
-#
-# Results:
-#    Value that was required
-#
-proc ::math::statistics::BasicStats { type values } {
-    variable TOOFEWDATA
-
-    set min    {}
-    set max    {}
-    set mean   {}
-    set stdev  {}
-    set var    {}
-
-    set sum    0.0
-    set sumsq  0.0
-    set number 0
-
-    foreach value $values {
-	if { $value == {} } {
-	    continue
-	}
-	set value [expr {double($value)}]
-
-	incr number
-	set  sum    [expr {$sum+$value}]
-	set  sumsq  [expr {$sumsq+$value*$value}]
-
-	if { $min == {} || $value < $min } {
-	    set min $value
-	}
-	if { $max == {} || $value > $max } {
-	    set max $value
-	}
-    }
-
-    if { $number > 0 } {
-	set mean [expr {$sum/$number}]
-    } else {
-	return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-
-    if { $number > 1 } {
-	set var    [expr {($sumsq-$mean*$sum)/double($number-1)}]
-        #
-        # Take care of a rare situation: uniform data might
-        # cause a tiny negative difference
-        #
-        if { $var < 0.0 } {
-           set var 0.0
-        }
-	set stdev  [expr {sqrt($var)}]
-    }
-	set pvar [expr {($sumsq-$mean*$sum)/double($number)}]
-        #
-        # Take care of a rare situation: uniform data might
-        # cause a tiny negative difference
-        #
-        if { $pvar < 0.0 } {
-           set pvar 0.0
-        }
-	set pstdev  [expr {sqrt($pvar)}]
-
-    set all [list $mean $min $max $number $stdev $var $pstdev $pvar]
-
-    #
-    # Return the appropriate value
-    #
-    if { [lsearch {all mean min max number stdev var pstdev pvar} $type] >= 0 } {
-	# FRINK: nocheck
-	return [set $type]
-    } else {
-	return -code error \
-		-errorcode ARG -errorinfo [list unknown type of statistic -- $type] \
-		[list unknown type of statistic -- $type]
-    }
-}
-
-# histogram --
-#    Return histogram information from a list of numbers
-#
-# Arguments:
-#    limits   Upper limits for the buckets (in increasing order)
-#    values   List of values to be examined
-#
-# Results:
-#    List of number of values in each bucket (length is one more than
-#    the number of limits)
-#
-#
-proc ::math::statistics::histogram { limits values } {
-
-    if { [llength $limits] < 1 } {
-	return -code error -errorcode ARG -errorinfo {No limits given} {No limits given}
-    }
-
-    set limits [lsort -real -increasing $limits]
-
-    for { set index 0 } { $index <= [llength $limits] } { incr index } {
-	set buckets($index) 0
-    }
-    set last [llength $limits]
-
-    foreach value $values {
-	if { $value == {} } {
-	    continue
-	}
-
-	set index 0
-	set found 0
-	foreach limit $limits {
-	    if { $value <= $limit } {
-		set found 1
-		incr buckets($index)
-		break
-	    }
-	    incr index
-	}
-
-	if { $found == 0 } {
-	    incr buckets($last)
-	}
-    }
-
-    set result {}
-    for { set index 0 } { $index <= $last } { incr index } {
-	lappend result $buckets($index)
-    }
-
-    return $result
-}
-
-# corr --
-#    Return the correlation coefficient of two sets of data
-#
-# Arguments:
-#    data1    List with the first set of data
-#    data2    List with the second set of data
-#
-# Result:
-#    Correlation coefficient of the two
-#
-proc ::math::statistics::corr { data1 data2 } {
-    variable TOOFEWDATA
-
-    set number  0
-    set sum1    0.0
-    set sum2    0.0
-    set sumsq1  0.0
-    set sumsq2  0.0
-    set sumprod 0.0
-
-    foreach value1 $data1 value2 $data2 {
-	if { $value1 == {} || $value2 == {} } {
-	    continue
-	}
-	set  value1  [expr {double($value1)}]
-	set  value2  [expr {double($value2)}]
-
-	set  sum1    [expr {$sum1+$value1}]
-	set  sum2    [expr {$sum2+$value2}]
-	set  sumsq1  [expr {$sumsq1+$value1*$value1}]
-	set  sumsq2  [expr {$sumsq2+$value2*$value2}]
-	set  sumprod [expr {$sumprod+$value1*$value2}]
-	incr number
-    }
-    if { $number > 0 } {
-	set numerator   [expr {$number*$sumprod-$sum1*$sum2}]
-	set denom1      [expr {sqrt($number*$sumsq1-$sum1*$sum1)}]
-	set denom2      [expr {sqrt($number*$sumsq2-$sum2*$sum2)}]
-	if { $denom1 != 0.0 && $denom2 != 0.0 } {
-	    set corr_coeff  [expr {$numerator/$denom1/$denom2}]
-	} elseif { $denom1 != 0.0 || $denom2 != 0.0 } {
-	    set corr_coeff  0.0 ;# Uniform against non-uniform
-	} else {
-	    set corr_coeff  1.0 ;# Both uniform
-	}
-
-    } else {
-	return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-    return $corr_coeff
-}
-
-# lillieforsFit --
-#     Calculate the goodness of fit according to Lilliefors
-#     (goodness of fit to a normal distribution)
-#
-# Arguments:
-#     values          List of values to be tested for normality
-#
-# Result:
-#     Value of the statistic D
-#
-proc ::math::statistics::lillieforsFit {values} {
-    #
-    # calculate the goodness of fit according to Lilliefors
-    # (goodness of fit to a normal distribution)
-    #
-    # values -> list of values to be tested for normality
-    # (these values are sampled counts)
-    #
-
-    # calculate standard deviation and mean of the sample:
-    set n [llength $values]
-    if { $n < 5 } {
-        return -code error "Insufficient number of data (at least five required)"
-    }
-    set sd   [stdev $values]
-    set mean [mean $values]
-
-    # sort the sample for further processing:
-    set values [lsort -real $values]
-
-    # standardize the sample data (Z-scores):
-    foreach x $values {
-        lappend stdData [expr {($x - $mean)/double($sd)}]
-    }
-
-    # compute the value of the distribution function at every sampled point:
-    foreach x $stdData {
-        lappend expData [pnorm $x]
-    }
-
-    # compute D+:
-    set i 0
-    foreach x $expData {
-        incr i
-        lappend dplus [expr {$i/double($n)-$x}]
-    }
-    set dplus [lindex [lsort -real $dplus] end]
-
-    # compute D-:
-    set i 0
-    foreach x $expData {
-        incr i
-        lappend dminus [expr {$x-($i-1)/double($n)}]
-    }
-    set dminus [lindex [lsort -real $dminus] end]
-
-    # Calculate the test statistic D
-    # by finding the maximal vertical difference
-    # between the sample and the expectation:
-    #
-    set D [expr {$dplus > $dminus ? $dplus : $dminus}]
-
-    # We now use the modified statistic Z,
-    # because D is only reliable
-    # if the p-value is smaller than 0.1
-    return [expr {$D * (sqrt($n) - 0.01 + 0.831/sqrt($n))}]
-}
-
-# pnorm --
-#     Calculate the cumulative distribution function (cdf)
-#     for the standard normal distribution like in the statistical
-#     software 'R' (mean=0 and sd=1)
-#
-# Arguments:
-#     x               Value fro which the cdf should be calculated
-#
-# Result:
-#     Value of the statistic D
-#
-proc ::math::statistics::pnorm {x} {
-    #
-    # cumulative distribution function (cdf)
-    # for the standard normal distribution like in the statistical software 'R'
-    # (mean=0 and sd=1)
-    #
-    # x -> value for which the cdf should be calculated
-    #
-    set sum [expr {double($x)}]
-    set oldSum 0.0
-    set i 1
-    set denom 1.0
-    while {$sum != $oldSum} {
-            set oldSum $sum
-            incr i 2
-            set denom [expr {$denom*$i}]
-            #puts "$i - $denom"
-            set sum [expr {$oldSum + pow($x,$i)/$denom}]
-    }
-    return [expr {0.5 + $sum * exp(-0.5 * $x*$x - 0.91893853320467274178)}]
-}
-
-# pnorm_quicker --
-#     Calculate the cumulative distribution function (cdf)
-#     for the standard normal distribution - quicker alternative
-#     (less accurate)
-#
-# Arguments:
-#     x               Value for which the cdf should be calculated
-#
-# Result:
-#     Value of the statistic D
-#
-proc ::math::statistics::pnorm_quicker {x} {
-
-    set n [expr {abs($x)}]
-    set n [expr {1.0 + $n*(0.04986735 + $n*(0.02114101 + $n*(0.00327763 \
-            + $n*(0.0000380036 + $n*(0.0000488906 + $n*0.000005383)))))}]
-    set n [expr {1.0/pow($n,16)}]
-    #
-    if {$x >= 0} {
-        return [expr {1 - $n/2.0}]
-    } else {
-        return [expr {$n/2.0}]
-    }
-}
-
-# test-normal --
-#     Test for normality (using method Lilliefors)
-#
-# Arguments:
-#     data            Values that need to be tested
-#     confidence      ...
-#
-# Result:
-#     1 if of the statistic D
-#
-proc ::math::statistics::test-normal {data confidence} {
-    set D [lillieforsFit $data]
-
-    set Dcrit --
-    if { abs($confidence-0.80) < 0.0001 } {
-        set Dcrit 0.741
-    }
-    if { abs($confidence-0.85) < 0.0001 } {
-        set Dcrit 0.775
-    }
-    if { abs($confidence-0.90) < 0.0001 } {
-        set Dcrit 0.819
-    }
-    if { abs($confidence-0.95) < 0.0001 } {
-        set Dcrit 0.895
-    }
-    if { abs($confidence-0.99) < 0.0001 } {
-        set Dcrit 1.035
-    }
-    if { $Dcrit != "--" } {
-        return [expr {$D > $Dcrit ? 1 : 0 }]
-    } else {
-        return -code error "Confidence level must be one of: 0.80, 0.85, 0.90, 0.95 or 0.99"
-    }
-}
-
-# t-test-mean --
-#    Test whether the mean value of a sample is in accordance with the
-#    estimated normal distribution with a certain level of confidence
-#    (Student's t test)
-#
-# Arguments:
-#    data         List of raw data values (small sample)
-#    est_mean     Estimated mean of the distribution
-#    est_stdev    Estimated stdev of the distribution
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#
-# Result:
-#    1 if the test is positive, 0 otherwise. If there are too few data,
-#    returns an empty string
-#
-proc ::math::statistics::t-test-mean { data est_mean est_stdev confidence } {
-    variable NEGSTDEV
-    variable TOOFEWDATA
-
-    if { $est_stdev <= 0.0 } {
-	return -code error -errorcode ARG -errorinfo $NEGSTDEV $NEGSTDEV
-    }
-
-    set allstats        [BasicStats all $data]
-
-    set conf2           [expr {(1.0+$confidence)/2.0}]
-
-    set sample_mean     [lindex $allstats 0]
-    set sample_number   [lindex $allstats 3]
-
-    if { $sample_number > 1 } {
-	set tzero   [expr {abs($sample_mean-$est_mean)/$est_stdev * \
-		sqrt($sample_number-1)}]
-	set degrees [expr {$sample_number-1}]
-	set prob    [cdf-students-t $degrees $tzero]
-
-	return [expr {$prob<$conf2}]
-
-    } else {
-	return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-}
-
-# interval-mean-stdev --
-#    Return the interval containing the mean value and one
-#    containing the standard deviation with a certain
-#    level of confidence (assuming a normal distribution)
-#
-# Arguments:
-#    data         List of raw data values
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#
-# Result:
-#    List having the following elements: lower and upper bounds of
-#    mean, lower and upper bounds of stdev
-#
-#
-proc ::math::statistics::interval-mean-stdev { data confidence } {
-    variable TOOFEWDATA
-    variable student_t_table
-
-    set allstats [BasicStats all $data]
-
-    set conf2    [expr {(1.0+$confidence)/2.0}]
-    set mean     [lindex $allstats 0]
-    set number   [lindex $allstats 3]
-    set stdev    [lindex $allstats 4]
-
-    if { $number > 1 } {
-	set degrees    [expr {$number-1}]
-	set student_t \
-		[::math::interpolation::interpolate2d $student_t_table \
-		$degrees $conf2]
-	set mean_lower [expr {$mean-$student_t*$stdev/sqrt($number)}]
-	set mean_upper [expr {$mean+$student_t*$stdev/sqrt($number)}]
-	set stdev_lower {}
-	set stdev_upper {}
-	return [list $mean_lower $mean_upper $stdev_lower $stdev_upper]
-    } else {
-	return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-}
-
-# quantiles --
-#    Return the quantiles for a given set of data or histogram
-#
-# Arguments:
-#    (two arguments)
-#    data         List of raw data values
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#    (three arguments)
-#    limits       List of upper limits from histogram
-#    counts       List of counts for for each interval in histogram
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#
-# Result:
-#    List of quantiles
-#
-proc ::math::statistics::quantiles { arg1 arg2 {arg3 {}} } {
-    variable TOOFEWDATA
-
-    if { [catch {
-	if { $arg3 == {} } {
-	    set result \
-		    [::math::statistics::QuantilesRawData $arg1 $arg2]
-	} else {
-	    set result \
-		    [::math::statistics::QuantilesHistogram $arg1 $arg2 $arg3]
-	}
-    } msg] } {
-	return -code error -errorcode $msg $msg
-    }
-    return $result
-}
-
-# QuantilesRawData --
-#    Return the quantiles based on raw data
-#
-# Arguments:
-#    data         List of raw data values
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#
-# Result:
-#    List of quantiles
-#
-proc ::math::statistics::QuantilesRawData { data confidence } {
-    variable TOOFEWDATA
-    variable OUTOFRANGE
-
-    if { [llength $confidence] <= 0 } {
-	return -code error -errorcode ARG "$TOOFEWDATA - quantiles"
-    }
-
-    if { [llength $data] <= 0 } {
-	return -code error -errorcode ARG "$TOOFEWDATA - raw data"
-    }
-
-    foreach cond $confidence {
-	if { $cond <= 0.0 || $cond >= 1.0 } {
-	    return -code error -errorcode ARG "$OUTOFRANGE - quantiles"
-	}
-    }
-
-    #
-    # Sort the data first
-    #
-    set sorted_data [lsort -real -increasing $data]
-
-    #
-    # Determine the list element lower or equal to the quantile
-    # and return the corresponding value
-    #
-    set result      {}
-    set number_data [llength $sorted_data]
-    foreach cond $confidence {
-	set elem [expr {round($number_data*$cond)-1}]
-	if { $elem < 0 } {
-	    set elem 0
-	}
-	lappend result [lindex $sorted_data $elem]
-    }
-
-    return $result
-}
-
-# QuantilesHistogram --
-#    Return the quantiles based on histogram information only
-#
-# Arguments:
-#    limits       Upper limits for histogram intervals
-#    counts       Counts for each interval
-#    confidence   Confidence level (0.95 or 0.99 for instance)
-#
-# Result:
-#    List of quantiles
-#
-proc ::math::statistics::QuantilesHistogram { limits counts confidence } {
-    variable TOOFEWDATA
-    variable OUTOFRANGE
-
-    if { [llength $confidence] <= 0 } {
-	return -code error -errorcode ARG "$TOOFEWDATA - quantiles"
-    }
-
-    if { [llength $confidence] <= 0 } {
-	return -code error -errorcode ARG "$TOOFEWDATA - histogram limits"
-    }
-
-    if { [llength $counts] <= [llength $limits] } {
-	return -code error -errorcode ARG "$TOOFEWDATA - histogram counts"
-    }
-
-    foreach cond $confidence {
-	if { $cond <= 0.0 || $cond >= 1.0 } {
-	    return -code error -errorcode ARG "$OUTOFRANGE - quantiles"
-	}
-    }
-
-    #
-    # Accumulate the histogram counts first
-    #
-    set sum 0
-    set accumulated_counts {}
-    foreach count $counts {
-	set sum [expr {$sum+$count}]
-	lappend accumulated_counts $sum
-    }
-    set total_counts $sum
-
-    #
-    # Determine the list element lower or equal to the quantile
-    # and return the corresponding value (use interpolation if
-    # possible)
-    #
-    set result      {}
-    foreach cond $confidence {
-	set found       0
-	set bound       [expr {round($total_counts*$cond)}]
-	set lower_limit {}
-	set lower_count 0
-	foreach acc_count $accumulated_counts limit $limits {
-	    if { $acc_count >= $bound } {
-		set found 1
-		break
-	    }
-	    set lower_limit $limit
-	    set lower_count $acc_count
-	}
-
-	if { $lower_limit == {} || $limit == {} || $found == 0 } {
-	    set quant $limit
-	    if { $limit == {} } {
-		set quant $lower_limit
-	    }
-	} else {
-	    set quant [expr {$limit+($lower_limit-$limit) *
-	    ($acc_count-$bound)/($acc_count-$lower_count)}]
-	}
-	lappend result $quant
-    }
-
-    return $result
-}
-
-# autocorr --
-#    Return the autocorrelation function (assuming equidistance between
-#    samples)
-#
-# Arguments:
-#    data         Raw data for which the autocorrelation must be determined
-#
-# Result:
-#    List of autocorrelation values (about 1/2 the number of raw data)
-#
-proc ::math::statistics::autocorr { data } {
-    variable TOOFEWDATA
-
-    if { [llength $data] <= 1 } {
-	return -code error -errorcode ARG "$TOOFEWDATA"
-    }
-
-    return [crosscorr $data $data]
-}
-
-# crosscorr --
-#    Return the cross-correlation function (assuming equidistance
-#    between samples)
-#
-# Arguments:
-#    data1        First set of raw data
-#    data2        Second set of raw data
-#
-# Result:
-#    List of cross-correlation values (about 1/2 the number of raw data)
-#
-# Note:
-#    The number of data pairs is not kept constant - because tests
-#    showed rather awkward results when it was kept constant.
-#
-proc ::math::statistics::crosscorr { data1 data2 } {
-    variable TOOFEWDATA
-
-    if { [llength $data1] <= 1 || [llength $data2] <= 1 } {
-	return -code error -errorcode ARG "$TOOFEWDATA"
-    }
-
-    #
-    # First determine the number of data pairs
-    #
-    set number1 [llength $data1]
-    set number2 [llength $data2]
-
-    set basic_stat1 [basic-stats $data1]
-    set basic_stat2 [basic-stats $data2]
-    set vmean1      [lindex $basic_stat1 0]
-    set vmean2      [lindex $basic_stat2 0]
-    set vvar1       [lindex $basic_stat1 end]
-    set vvar2       [lindex $basic_stat2 end]
-
-    set number_pairs $number1
-    if { $number1 > $number2 } {
-	set number_pairs $number2
-    }
-    set number_values $number_pairs
-    set number_delays [expr {$number_values/2.0}]
-
-    set scale [expr {sqrt($vvar1*$vvar2)}]
-
-    set result {}
-    for { set delay 0 } { $delay < $number_delays } { incr delay } {
-	set sumcross 0.0
-	set no_cross 0
-	for { set idx 0 } { $idx < $number_values } { incr idx } {
-	    set value1 [lindex $data1 $idx]
-	    set value2 [lindex $data2 [expr {$idx+$delay}]]
-	    if { $value1 != {} && $value2 != {} } {
-		set  sumcross \
-			[expr {$sumcross+($value1-$vmean1)*($value2-$vmean2)}]
-		incr no_cross
-	    }
-	}
-	lappend result [expr {$sumcross/($no_cross*$scale)}]
-
-	incr number_values -1
-    }
-
-    return $result
-}
-
-# mean-histogram-limits
-#    Determine reasonable limits based on mean and standard deviation
-#    for a histogram
-#
-# Arguments:
-#    mean         Mean of the data
-#    stdev        Standard deviation
-#    number       Number of limits to generate (defaults to 8)
-#
-# Result:
-#    List of limits
-#
-proc ::math::statistics::mean-histogram-limits { mean stdev {number 8} } {
-    variable NEGSTDEV
-
-    if { $stdev <= 0.0 } {
-	return -code error -errorcode ARG "$NEGSTDEV"
-    }
-    if { $number < 1 } {
-	return -code error -errorcode ARG "Number of limits must be positive"
-    }
-
-    #
-    # Always: between mean-3.0*stdev and mean+3.0*stdev
-    # number = 2: -0.25, 0.25
-    # number = 3: -0.25, 0, 0.25
-    # number = 4: -1, -0.25, 0.25, 1
-    # number = 5: -1, -0.25, 0, 0.25, 1
-    # number = 6: -2, -1, -0.25, 0.25, 1, 2
-    # number = 7: -2, -1, -0.25, 0, 0.25, 1, 2
-    # number = 8: -3, -2, -1, -0.25, 0.25, 1, 2, 3
-    #
-    switch -- $number {
-	"1" { set limits {0.0} }
-	"2" { set limits {-0.25 0.25} }
-	"3" { set limits {-0.25 0.0 0.25} }
-	"4" { set limits {-1.0 -0.25 0.25 1.0} }
-	"5" { set limits {-1.0 -0.25 0.0 0.25 1.0} }
-	"6" { set limits {-2.0 -1.0 -0.25 0.25 1.0 2.0} }
-	"7" { set limits {-2.0 -1.0 -0.25 0.0 0.25 1.0 2.0} }
-	"8" { set limits {-3.0 -2.0 -1.0 -0.25 0.25 1.0 2.0 3.0} }
-	"9" { set limits {-3.0 -2.0 -1.0 -0.25 0.0 0.25 1.0 2.0 3.0} }
-	default {
-	    set dlim [expr {6.0/double($number-1)}]
-	    for {set i 0} {$i <$number} {incr i} {
-		lappend limits [expr {$dlim*($i-($number-1)/2.0)}]
-	    }
-	}
-    }
-
-    set result {}
-    foreach limit $limits {
-	lappend result [expr {$mean+$limit*$stdev}]
-    }
-
-    return $result
-}
-
-# minmax-histogram-limits
-#    Determine reasonable limits based on minimum and maximum bounds
-#    for a histogram
-#
-# Arguments:
-#    min          Estimated minimum
-#    max          Estimated maximum
-#    number       Number of limits to generate (defaults to 8)
-#
-# Result:
-#    List of limits
-#
-proc ::math::statistics::minmax-histogram-limits { min max {number 8} } {
-    variable NEGSTDEV
-
-    if { $number < 1 } {
-	return -code error -errorcode ARG "Number of limits must be positive"
-    }
-    if { $min >= $max } {
-	return -code error -errorcode ARG "Minimum must be lower than maximum"
-    }
-
-    set result {}
-    set dlim [expr {($max-$min)/double($number-1)}]
-    for {set i 0} {$i <$number} {incr i} {
-	lappend result [expr {$min+$dlim*$i}]
-    }
-
-    return $result
-}
-
-# linear-model
-#    Determine the coefficients for a linear regression between
-#    two series of data (the model: Y = A + B*X)
-#
-# Arguments:
-#    xdata        Series of independent (X) data
-#    ydata        Series of dependent (Y) data
-#    intercept    Whether to use an intercept or not (optional)
-#
-# Result:
-#    List of the following items:
-#    - (Estimate of) Intercept A
-#    - (Estimate of) Slope B
-#    - Standard deviation of Y relative to fit
-#    - Correlation coefficient R2
-#    - Number of degrees of freedom df
-#    - Standard error of the intercept A
-#    - Significance level of A
-#    - Standard error of the slope B
-#    - Significance level of B
-#
-#
-proc ::math::statistics::linear-model { xdata ydata {intercept 1} } {
-   variable TOOFEWDATA
-
-   if { [llength $xdata] < 3 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: not enough independent data"
-   }
-   if { [llength $ydata] < 3 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: not enough dependent data"
-   }
-   if { [llength $xdata] != [llength $ydata] } {
-      return -code error -errorcode ARG "$TOOFEWDATA: number of dependent data differs from number of independent data"
-   }
-
-   set sumx  0.0
-   set sumy  0.0
-   set sumx2 0.0
-   set sumy2 0.0
-   set sumxy 0.0
-   set df    0
-   foreach x $xdata y $ydata {
-      if { $x != "" && $y != "" } {
-         set sumx  [expr {$sumx+$x}]
-         set sumy  [expr {$sumy+$y}]
-         set sumx2 [expr {$sumx2+$x*$x}]
-         set sumy2 [expr {$sumy2+$y*$y}]
-         set sumxy [expr {$sumxy+$x*$y}]
-         incr df
-      }
-   }
-
-   if { $df <= 2 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: too few valid data"
-   }
-   if { $sumx2 == 0.0 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: independent values are all the same"
-   }
-
-   #
-   # Calculate the intermediate quantities
-   #
-   set sx  [expr {$sumx2-$sumx*$sumx/$df}]
-   set sy  [expr {$sumy2-$sumy*$sumy/$df}]
-   set sxy [expr {$sumxy-$sumx*$sumy/$df}]
-
-   #
-   # Calculate the coefficients
-   #
-   if { $intercept } {
-      set B [expr {$sxy/$sx}]
-      set A [expr {($sumy-$B*$sumx)/$df}]
-   } else {
-      set B [expr {$sumxy/$sumx2}]
-      set A 0.0
-   }
-
-   #
-   # Calculate the error estimates
-   #
-   set stdevY 0.0
-   set varY   0.0
-
-   if { $intercept } {
-      set ve [expr {$sy-$B*$sxy}]
-      if { $ve >= 0.0 } {
-         set varY [expr {$ve/($df-2)}]
-      }
-   } else {
-      set ve [expr {$sumy2-$B*$sumxy}]
-      if { $ve >= 0.0 } {
-         set varY [expr {$ve/($df-1)}]
-      }
-   }
-   set seY [expr {sqrt($varY)}]
-
-   if { $intercept } {
-      set R2    [expr {$sxy*$sxy/($sx*$sy)}]
-      set seA   [expr {$seY*sqrt(1.0/$df+$sumx*$sumx/($sx*$df*$df))}]
-      set seB   [expr {sqrt($varY/$sx)}]
-      set tA    {}
-      set tB    {}
-      if { $seA != 0.0 } {
-         set tA    [expr {$A/$seA*sqrt($df-2)}]
-      }
-      if { $seB != 0.0 } {
-         set tB    [expr {$B/$seB*sqrt($df-2)}]
-      }
-   } else {
-      set R2    [expr {$sumxy*$sumxy/($sumx2*$sumy2)}]
-      set seA   {}
-      set tA    {}
-      set tB    {}
-      set seB   [expr {sqrt($varY/$sumx2)}]
-      if { $seB != 0.0 } {
-         set tB    [expr {$B/$seB*sqrt($df-1)}]
-      }
-   }
-
-   #
-   # Return the list of parameters
-   #
-   return [list $A $B $seY $R2 $df $seA $tA $seB $tB]
-}
-
-# linear-residuals
-#    Determine the difference between actual data and predicted from
-#    the linear model
-#
-# Arguments:
-#    xdata        Series of independent (X) data
-#    ydata        Series of dependent (Y) data
-#    intercept    Whether to use an intercept or not (optional)
-#
-# Result:
-#    List of differences
-#
-proc ::math::statistics::linear-residuals { xdata ydata {intercept 1} } {
-   variable TOOFEWDATA
-
-   if { [llength $xdata] < 3 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: no independent data"
-   }
-   if { [llength $ydata] < 3 } {
-      return -code error -errorcode ARG "$TOOFEWDATA: no dependent data"
-   }
-   if { [llength $xdata] != [llength $ydata] } {
-      return -code error -errorcode ARG "$TOOFEWDATA: number of dependent data differs from number of independent data"
-   }
-
-   foreach {A B} [linear-model $xdata $ydata $intercept] {break}
-
-   set result {}
-   foreach x $xdata y $ydata {
-      set residue [expr {$y-$A-$B*$x}]
-      lappend result $residue
-   }
-   return $result
-}
-
-# median
-#    Determine the median from a list of data
-#
-# Arguments:
-#    data         (Unsorted) list of data
-#
-# Result:
-#    Median (either the middle value or the mean of two values in the
-#    middle)
-#
-# Note:
-#    Adapted from the Wiki page "Stats", code provided by JPS
-#
-proc ::math::statistics::median { data } {
-    set org_data $data
-    set data     {}
-    foreach value $org_data {
-        if { $value != {} } {
-            lappend data $value
-        }
-    }
-    set len [llength $data]
-
-    set data [lsort -real $data]
-    if { $len % 2 } {
-        lindex $data [expr {($len-1)/2}]
-    } else {
-        expr {([lindex $data [expr {($len / 2) - 1}]] \
-		+ [lindex $data [expr {$len / 2}]]) / 2.0}
-    }
-}
-
-# test-2x2 --
-#     Compute the chi-square statistic for a 2x2 table
-#
-# Arguments:
-#     a           Element upper-left
-#     b           Element upper-right
-#     c           Element lower-left
-#     d           Element lower-right
-# Return value:
-#     Chi-square
-# Note:
-#     There is only one degree of freedom - this is important
-#     when comparing the value to the tabulated values
-#     of chi-square
-#
-proc ::math::statistics::test-2x2 { a b c d } {
-    set ab     [expr {$a+$b}]
-    set ac     [expr {$a+$c}]
-    set bd     [expr {$b+$d}]
-    set cd     [expr {$c+$d}]
-    set N      [expr {$a+$b+$c+$d}]
-    set det    [expr {$a*$d-$b*$c}]
-    set result [expr {double($N*$det*$det)/double($ab*$cd*$ac*$bd)}]
-}
-
-# print-2x2 --
-#     Print a 2x2 table
-#
-# Arguments:
-#     a           Element upper-left
-#     b           Element upper-right
-#     c           Element lower-left
-#     d           Element lower-right
-# Return value:
-#     Printed version with marginals
-#
-proc ::math::statistics::print-2x2 { a b c d } {
-    set ab     [expr {$a+$b}]
-    set ac     [expr {$a+$c}]
-    set bd     [expr {$b+$d}]
-    set cd     [expr {$c+$d}]
-    set N      [expr {$a+$b+$c+$d}]
-    set chisq  [test-2x2 $a $b $c $d]
-
-    set    line   [string repeat - 10]
-    set    result [format "%10d%10d | %10d\n" $a $b $ab]
-    append result [format "%10d%10d | %10d\n" $c $d $cd]
-    append result [format "%10s%10s + %10s\n" $line $line $line]
-    append result [format "%10d%10d | %10d\n" $ac $bd $N]
-    append result "Chisquare = $chisq\n"
-    append result "Difference is significant?\n"
-    append result "   at 95%: [expr {$chisq<3.84146? "no":"yes"}]\n"
-    append result "   at 99%: [expr {$chisq<6.63490? "no":"yes"}]"
-}
-
-# control-xbar --
-#     Determine the control lines for an x-bar chart
-#
-# Arguments:
-#     data        List of observed values (at least 20*nsamples)
-#     nsamples    Number of data per subsamples (default: 4)
-# Return value:
-#     List of: mean, lower limit, upper limit, number of data per
-#     subsample. Can be used in the test-xbar procedure
-#
-proc ::math::statistics::control-xbar { data {nsamples 4} } {
-    variable TOOFEWDATA
-    variable control_factors
-
-    #
-    # Check the number of data
-    #
-    if { $nsamples <= 1 } {
-        return -code error -errorcode DATA -errorinfo $OUTOFRANGE \
-            "Number of data per subsample must be at least 2"
-    }
-    if { [llength $data] < 20*$nsamples } {
-        return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-
-    set nogroups [expr {[llength $data]/$nsamples}]
-    set mrange   0.0
-    set xmeans   0.0
-    for { set i 0 } { $i < $nogroups } { incr i } {
-        set subsample [lrange $data [expr {$i*$nsamples}] [expr {$i*$nsamples+$nsamples-1}]]
-
-        set xmean 0.0
-        set xmin  [lindex $subsample 0]
-        set xmax  $xmin
-        foreach d $subsample {
-            set xmean [expr {$xmean+$d}]
-            set xmin  [expr {$xmin<$d? $xmin : $d}]
-            set xmax  [expr {$xmax>$d? $xmax : $d}]
-        }
-        set xmean [expr {$xmean/double($nsamples)}]
-
-        set xmeans [expr {$xmeans+$xmean}]
-        set mrange [expr {$mrange+($xmax-$xmin)}]
-    }
-
-    #
-    # Determine the control lines
-    #
-    set xmeans [expr {$xmeans/double($nogroups)}]
-    set mrange [expr {$mrange/double($nogroups)}]
-    set A2     [lindex [lindex $control_factors 1] $nsamples]
-    if { $A2 == "" } { set A2 [lindex [lindex $control_factors 1] end] }
-
-    return [list $xmeans [expr {$xmeans-$A2*$mrange}] \
-                         [expr {$xmeans+$A2*$mrange}] $nsamples]
-}
-
-# test-xbar --
-#     Determine if any data points lie outside the x-bar control limits
-#
-# Arguments:
-#     control     List returned by control-xbar with control data
-#     data        List of observed values
-# Return value:
-#     Indices of any subsamples that violate the control limits
-#
-proc ::math::statistics::test-xbar { control data } {
-    foreach {xmean xlower xupper nsamples} $control {break}
-
-    if { [llength $data] < 1 } {
-        return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-
-    set nogroups [expr {[llength $data]/$nsamples}]
-    if { $nogroups <= 0 } {
-        set nogroup  1
-        set nsamples [llength $data]
-    }
-
-    set result {}
-
-    for { set i 0 } { $i < $nogroups } { incr i } {
-        set subsample [lrange $data [expr {$i*$nsamples}] [expr {$i*$nsamples+$nsamples-1}]]
-
-        set xmean 0.0
-        foreach d $subsample {
-            set xmean [expr {$xmean+$d}]
-        }
-        set xmean [expr {$xmean/double($nsamples)}]
-
-        if { $xmean < $xlower } { lappend result $i }
-        if { $xmean > $xupper } { lappend result $i }
-    }
-
-    return $result
-}
-
-# control-Rchart --
-#     Determine the control lines for an R chart
-#
-# Arguments:
-#     data        List of observed values (at least 20*nsamples)
-#     nsamples    Number of data per subsamples (default: 4)
-# Return value:
-#     List of: mean range, lower limit, upper limit, number of data per
-#     subsample. Can be used in the test-Rchart procedure
-#
-proc ::math::statistics::control-Rchart { data {nsamples 4} } {
-    variable TOOFEWDATA
-    variable control_factors
-
-    #
-    # Check the number of data
-    #
-    if { $nsamples <= 1 } {
-        return -code error -errorcode DATA -errorinfo $OUTOFRANGE \
-            "Number of data per subsample must be at least 2"
-    }
-    if { [llength $data] < 20*$nsamples } {
-        return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-
-    set nogroups [expr {[llength $data]/$nsamples}]
-    set mrange   0.0
-    for { set i 0 } { $i < $nogroups } { incr i } {
-        set subsample [lrange $data [expr {$i*$nsamples}] [expr {$i*$nsamples+$nsamples-1}]]
-
-        set xmin  [lindex $subsample 0]
-        set xmax  $xmin
-        foreach d $subsample {
-            set xmin  [expr {$xmin<$d? $xmin : $d}]
-            set xmax  [expr {$xmax>$d? $xmax : $d}]
-        }
-        set mrange [expr {$mrange+($xmax-$xmin)}]
-    }
-
-    #
-    # Determine the control lines
-    #
-    set mrange [expr {$mrange/double($nogroups)}]
-    set D3     [lindex [lindex $control_factors 3] $nsamples]
-    set D4     [lindex [lindex $control_factors 5] $nsamples]
-    if { $D3 == "" } { set D3 [lindex [lindex $control_factors 3] end] }
-    if { $D4 == "" } { set D4 [lindex [lindex $control_factors 5] end] }
-
-    return [list $mrange [expr {$D3*$mrange}] \
-                         [expr {$D4*$mrange}] $nsamples]
-}
-
-# test-Rchart --
-#     Determine if any data points lie outside the R-chart control limits
-#
-# Arguments:
-#     control     List returned by control-xbar with control data
-#     data        List of observed values
-# Return value:
-#     Indices of any subsamples that violate the control limits
-#
-proc ::math::statistics::test-Rchart { control data } {
-    foreach {rmean rlower rupper nsamples} $control {break}
-
-    #
-    # Check the number of data
-    #
-    if { [llength $data] < 1 } {
-        return -code error -errorcode DATA -errorinfo $TOOFEWDATA $TOOFEWDATA
-    }
-
-    set nogroups [expr {[llength $data]/$nsamples}]
-
-    set result {}
-    for { set i 0 } { $i < $nogroups } { incr i } {
-        set subsample [lrange $data [expr {$i*$nsamples}] [expr {$i*$nsamples+$nsamples-1}]]
-
-        set xmin  [lindex $subsample 0]
-        set xmax  $xmin
-        foreach d $subsample {
-            set xmin  [expr {$xmin<$d? $xmin : $d}]
-            set xmax  [expr {$xmax>$d? $xmax : $d}]
-        }
-        set range [expr {$xmax-$xmin}]
-
-        if { $range < $rlower } { lappend result $i }
-        if { $range > $rupper } { lappend result $i }
-    }
-
-    return $result
-}
-
-
-
-#
-# Load the auxiliary scripts
-#
-source [file join [file dirname [info script]] pdf_stat.tcl]
-source [file join [file dirname [info script]] plotstat.tcl]
-source [file join [file dirname [info script]] liststat.tcl]
-source [file join [file dirname [info script]] mvlinreg.tcl]
-
-#
-# Define the tables
-#
-namespace eval ::math::statistics {
-    variable student_t_table
-
-    #   set student_t_table [::math::interpolation::defineTable student_t
-    #          {X        80%    90%    95%    98%    99%}
-    #          {X      0.80   0.90   0.95   0.98   0.99
-    #           1      3.078  6.314 12.706 31.821 63.657
-    #           2      1.886  2.920  4.303  6.965  9.925
-    #           3      1.638  2.353  3.182  4.541  5.841
-    #           5      1.476  2.015  2.571  3.365  4.032
-    #          10      1.372  1.812  2.228  2.764  3.169
-    #          15      1.341  1.753  2.131  2.602  2.947
-    #          20      1.325  1.725  2.086  2.528  2.845
-    #          30      1.310  1.697  2.042  2.457  2.750
-    #          60      1.296  1.671  2.000  2.390  2.660
-    #         1.0e9    1.282  1.645  1.960  2.326  2.576 }]
-
-    # PM
-    #set chi_squared_table [::math::interpolation::defineTable chi_square
-    #   ...
-}
-
-#
-# Simple test code
-#
-if { [info exists ::argv0] && ([file tail [info script]] == [file tail $::argv0]) } {
-
-    console show
-    puts [interp aliases]
-
-    set values {1 1 1 1 {}}
-    puts [::math::statistics::basic-stats $values]
-    set values {1 2 3 4}
-    puts [::math::statistics::basic-stats $values]
-    set values {1 -1 1 -2}
-    puts [::math::statistics::basic-stats $values]
-    puts [::math::statistics::mean   $values]
-    puts [::math::statistics::min    $values]
-    puts [::math::statistics::max    $values]
-    puts [::math::statistics::number $values]
-    puts [::math::statistics::stdev  $values]
-    puts [::math::statistics::var    $values]
-
-    set novals 100
-    #set maxvals 100001
-    set maxvals 1001
-    while { $novals < $maxvals } {
-	set values {}
-	for { set i 0 } { $i < $novals } { incr i } {
-	    lappend values [expr {rand()}]
-	}
-	puts [::math::statistics::basic-stats $values]
-	puts [::math::statistics::histogram {0.0 0.2 0.4 0.6 0.8 1.0} $values]
-	set novals [expr {$novals*10}]
-    }
-
-    puts "Normal distribution:"
-    puts "X=0:  [::math::statistics::pdf-normal 0.0 1.0 0.0]"
-    puts "X=1:  [::math::statistics::pdf-normal 0.0 1.0 1.0]"
-    puts "X=-1: [::math::statistics::pdf-normal 0.0 1.0 -1.0]"
-
-    set data1 {0.0 1.0 3.0 4.0 100.0 -23.0}
-    set data2 {1.0 2.0 4.0 5.0 101.0 -22.0}
-    set data3 {0.0 2.0 6.0 8.0 200.0 -46.0}
-    set data4 {2.0 6.0 8.0 200.0 -46.0 1.0}
-    set data5 {100.0 99.0 90.0 93.0 5.0 123.0}
-    puts "Correlation data1 and data1: [::math::statistics::corr $data1 $data1]"
-    puts "Correlation data1 and data2: [::math::statistics::corr $data1 $data2]"
-    puts "Correlation data1 and data3: [::math::statistics::corr $data1 $data3]"
-    puts "Correlation data1 and data4: [::math::statistics::corr $data1 $data4]"
-    puts "Correlation data1 and data5: [::math::statistics::corr $data1 $data5]"
-
-    #   set data {1.0 2.0 2.3 4.0 3.4 1.2 0.6 5.6}
-    #   puts [::math::statistics::basicStats $data]
-    #   puts [::math::statistics::interval-mean-stdev $data 0.90]
-    #   puts [::math::statistics::interval-mean-stdev $data 0.95]
-    #   puts [::math::statistics::interval-mean-stdev $data 0.99]
-
-    #   puts "\nTest mean values:"
-    #   puts [::math::statistics::test-mean $data 2.0 0.1 0.90]
-    #   puts [::math::statistics::test-mean $data 2.0 0.5 0.90]
-    #   puts [::math::statistics::test-mean $data 2.0 1.0 0.90]
-    #   puts [::math::statistics::test-mean $data 2.0 2.0 0.90]
-
-    set rc [catch {
-	set m [::math::statistics::mean {}]
-    } msg ] ; # {}
-    puts "Result: $rc $msg"
-
-    puts "\nTest quantiles:"
-    set data      {1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0}
-    set quantiles {0.11 0.21 0.51 0.91 0.99}
-    set limits    {2.1 4.1 6.1 8.1}
-    puts [::math::statistics::quantiles $data $quantiles]
-
-    set histogram [::math::statistics::histogram $limits $data]
-    puts [::math::statistics::quantiles $limits $histogram $quantiles]
-
-    puts "\nTest autocorrelation:"
-    set data      {1.0 -1.0 1.0 -1.0 1.0 -1.0 1.0 -1.0 1.0}
-    puts [::math::statistics::autocorr $data]
-    set data      {1.0 -1.1 2.0 -0.6 3.0 -4.0 0.5 0.9 -1.0}
-    puts [::math::statistics::autocorr $data]
-
-    puts "\nTest histogram limits:"
-    puts [::math::statistics::mean-histogram-limits   1.0 1.0]
-    puts [::math::statistics::mean-histogram-limits   1.0 1.0 4]
-    puts [::math::statistics::minmax-histogram-limits 1.0 10.0 10]
-
-}
-
-#
-# Test xbar/R-chart procedures
-#
-if { 0 } {
-    set data {}
-    for { set i 0 } { $i < 500 } { incr i } {
-        lappend data [expr {rand()}]
-    }
-    set limits [::math::statistics::control-xbar $data]
-    puts $limits
-
-    puts "Outliers? [::math::statistics::test-xbar $limits $data]"
-
-    set newdata {1.0 1.0 1.0 1.0 0.5 0.5 0.5 0.5 10.0 10.0 10.0 10.0}
-    puts "Outliers? [::math::statistics::test-xbar $limits $newdata] -- 0 2"
-
-    set limits [::math::statistics::control-Rchart $data]
-    puts $limits
-
-    puts "Outliers? [::math::statistics::test-Rchart $limits $data]"
-
-    set newdata {0.0 1.0 2.0 1.0 0.4 0.5 0.6 0.5 10.0  0.0 10.0 10.0}
-    puts "Outliers? [::math::statistics::test-Rchart $limits $newdata] -- 0 2"
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/math/tclIndex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/math/tclIndex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,26 +1,0 @@
-# Tcl autoload index file, version 2.0
-# This file is generated by the "auto_mkindex" command
-# and sourced to set up indexing information for one or
-# more commands.  Typically each line is a command that
-# sets an element in the auto_index array, where the
-# element name is the name of a command and the value is
-# a script that loads the command.
-
-set auto_index(::math::cov) [list source [file join $dir misc.tcl]]
-set auto_index(::math::fibonacci) [list source [file join $dir misc.tcl]]
-set auto_index(::math::integrate) [list source [file join $dir misc.tcl]]
-set auto_index(::math::max) [list source [file join $dir misc.tcl]]
-set auto_index(::math::mean) [list source [file join $dir misc.tcl]]
-set auto_index(::math::min) [list source [file join $dir misc.tcl]]
-set auto_index(::math::product) [list source [file join $dir misc.tcl]]
-set auto_index(::math::random) [list source [file join $dir misc.tcl]]
-set auto_index(::math::sigma) [list source [file join $dir misc.tcl]]
-set auto_index(::math::stats) [list source [file join $dir misc.tcl]]
-set auto_index(::math::sum) [list source [file join $dir misc.tcl]]
-set auto_index(::math::expectDouble) [list source [file join $dir misc.tcl]]
-set auto_index(::math::InitializeFactorial) [list source [file join $dir combinatorics.tcl]]
-set auto_index(::math::InitializePascal) [list source [file join $dir combinatorics.tcl]]
-set auto_index(::math::ln_Gamma) [list source [file join $dir combinatorics.tcl]]
-set auto_index(::math::factorial) [list source [file join $dir combinatorics.tcl]]
-set auto_index(::math::choose) [list source [file join $dir combinatorics.tcl]]
-set auto_index(::math::Beta) [list source [file join $dir combinatorics.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md4/md4.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md4/md4.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,572 +1,0 @@
-# md4.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This is a Tcl-only implementation of the MD4 hash algorithm as described in 
-# RFC 1320 ( http://www.ietf.org/rfc/rfc1320.txt )
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: md4.tcl,v 1.19 2006/09/19 23:36:17 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-catch {package require md4c 1.0};       # tcllib critcl alternative
-
-# @mdgen EXCLUDE: md4c.tcl
-
-namespace eval ::md4 {
-    variable version 1.0.4
-    variable rcsid {$Id: md4.tcl,v 1.19 2006/09/19 23:36:17 andreas_kupries Exp $}
-    variable accel
-    array set accel {critcl 0 cryptkit 0}
-
-    namespace export md4 hmac MD4Init MD4Update MD4Final
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# MD4Init - create and initialize an MD4 state variable. This will be
-# cleaned up when we call MD4Final
-#
-proc ::md4::MD4Init {} {
-    variable uid
-    variable accel
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # RFC1320:3.3 - Initialize MD4 state structure
-    array set state \
-        [list \
-             A [expr {0x67452301}] \
-             B [expr {0xefcdab89}] \
-             C [expr {0x98badcfe}] \
-             D [expr {0x10325476}] \
-             n 0 i "" ]
-    if {$accel(cryptkit)} {
-        cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_MD4
-    }
-    return $token
-}
-
-proc ::md4::MD4Update {token data} {
-    variable accel
-    upvar #0 $token state
-
-    if {$accel(critcl)} {
-        if {[info exists state(md4c)]} {
-            set state(md4c) [md4c $data $state(md4c)]
-        } else {
-            set state(md4c) [md4c $data]
-        }
-        return
-    } elseif {[info exists state(ckctx)]} {
-        if {[string length $data] > 0} {
-            cryptkit::cryptEncrypt $state(ckctx) $data
-        }
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        MD4Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-proc ::md4::MD4Final {token} {
-    upvar #0 $token state
-
-    if {[info exists state(md4c)]} {
-        set r $state(md4c)
-        unset state
-        return $r
-    } elseif {[info exists state(ckctx)]} {
-        cryptkit::cryptEncrypt $state(ckctx) ""
-        cryptkit::cryptGetAttributeString $state(ckctx) \
-            CRYPT_CTXINFO_HASHVALUE r 16
-        cryptkit::cryptDestroyContext $state(ckctx)
-        # If nothing was hashed, we get no r variable set!
-        if {[info exists r]} {
-            unset state
-            return $r
-        }
-    }
-
-    # RFC1320:3.1 - Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # RFC1320:3.2 - Append length in bits as little-endian wide int.
-    append state(i) [binary format ii [expr {8 * $state(n)}] 0]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        MD4Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # RFC1320:3.5 - Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-proc ::md4::HMACInit {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the MD4 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [MD4Init]
-        MD4Update $tok $K
-        set K [MD4Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [MD4Init]
-    MD4Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-proc ::md4::HMACUpdate {token data} {
-    MD4Update $token $data
-    return
-}
-
-proc ::md4::HMACFinal {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set tok [MD4Init];                  # init the outer hashing function
-    MD4Update $tok $state(Ko);          # prepare with the outer pad.
-    MD4Update $tok [MD4Final $token];   # hash the inner result
-    return [MD4Final $tok]
-}
-
-# -------------------------------------------------------------------------
-
-set ::md4::MD4Hash_body {
-    variable $token
-    upvar 0 $token state
-
-    # RFC1320:3.4 - Process Message in 16-Word Blocks
-    binary scan $msg i* blocks
-    foreach {X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15} $blocks {
-        set A $state(A)
-        set B $state(B)
-        set C $state(C)
-        set D $state(D)
-
-        # Round 1
-        # Let [abcd k s] denote the operation
-        #   a = (a + F(b,c,d) + X[k]) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  0  3]  [DABC  1  7]  [CDAB  2 11]  [BCDA  3 19]
-        set A [expr {($A + [F $B $C $D] + $X0) <<< 3}]
-        set D [expr {($D + [F $A $B $C] + $X1) <<< 7}]
-        set C [expr {($C + [F $D $A $B] + $X2) <<< 11}]
-        set B [expr {($B + [F $C $D $A] + $X3) <<< 19}]
-        # [ABCD  4  3]  [DABC  5  7]  [CDAB  6 11]  [BCDA  7 19]
-        set A [expr {($A + [F $B $C $D] + $X4) <<< 3}]
-        set D [expr {($D + [F $A $B $C] + $X5) <<< 7}]
-        set C [expr {($C + [F $D $A $B] + $X6) <<< 11}]
-        set B [expr {($B + [F $C $D $A] + $X7) <<< 19}]
-        # [ABCD  8  3]  [DABC  9  7]  [CDAB 10 11]  [BCDA 11 19]
-        set A [expr {($A + [F $B $C $D] + $X8) <<< 3}]
-        set D [expr {($D + [F $A $B $C] + $X9) <<< 7}]
-        set C [expr {($C + [F $D $A $B] + $X10) <<< 11}]
-        set B [expr {($B + [F $C $D $A] + $X11) <<< 19}]
-        # [ABCD 12  3]  [DABC 13  7]  [CDAB 14 11]  [BCDA 15 19]
-        set A [expr {($A + [F $B $C $D] + $X12) <<< 3}]
-        set D [expr {($D + [F $A $B $C] + $X13) <<< 7}]
-        set C [expr {($C + [F $D $A $B] + $X14) <<< 11}]
-        set B [expr {($B + [F $C $D $A] + $X15) <<< 19}]
-
-        # Round 2.
-        # Let [abcd k s] denote the operation
-        #   a = (a + G(b,c,d) + X[k] + 5A827999) <<< s
-        # Do the following 16 operations.
-        # [ABCD  0  3]  [DABC  4  5]  [CDAB  8  9]  [BCDA 12 13]
-        set A [expr {($A + [G $B $C $D] + $X0  + 0x5a827999) <<< 3}]
-        set D [expr {($D + [G $A $B $C] + $X4  + 0x5a827999) <<< 5}]
-        set C [expr {($C + [G $D $A $B] + $X8  + 0x5a827999) <<< 9}]
-        set B [expr {($B + [G $C $D $A] + $X12 + 0x5a827999) <<< 13}]
-        # [ABCD  1  3]  [DABC  5  5]  [CDAB  9  9]  [BCDA 13 13]
-        set A [expr {($A + [G $B $C $D] + $X1  + 0x5a827999) <<< 3}]
-        set D [expr {($D + [G $A $B $C] + $X5  + 0x5a827999) <<< 5}]
-        set C [expr {($C + [G $D $A $B] + $X9  + 0x5a827999) <<< 9}]
-        set B [expr {($B + [G $C $D $A] + $X13 + 0x5a827999) <<< 13}]
-        # [ABCD  2  3]  [DABC  6  5]  [CDAB 10  9]  [BCDA 14 13]
-        set A [expr {($A + [G $B $C $D] + $X2  + 0x5a827999) <<< 3}]
-        set D [expr {($D + [G $A $B $C] + $X6  + 0x5a827999) <<< 5}]
-        set C [expr {($C + [G $D $A $B] + $X10 + 0x5a827999) <<< 9}]
-        set B [expr {($B + [G $C $D $A] + $X14 + 0x5a827999) <<< 13}]
-        # [ABCD  3  3]  [DABC  7  5]  [CDAB 11  9]  [BCDA 15 13]
-        set A [expr {($A + [G $B $C $D] + $X3  + 0x5a827999) <<< 3}]
-        set D [expr {($D + [G $A $B $C] + $X7  + 0x5a827999) <<< 5}]
-        set C [expr {($C + [G $D $A $B] + $X11 + 0x5a827999) <<< 9}]
-        set B [expr {($B + [G $C $D $A] + $X15 + 0x5a827999) <<< 13}]
-        
-        # Round 3.
-        # Let [abcd k s] denote the operation
-        #   a = (a + H(b,c,d) + X[k] + 6ED9EBA1) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  0  3]  [DABC  8  9]  [CDAB  4 11]  [BCDA 12 15]
-        set A [expr {($A + [H $B $C $D] + $X0  + 0x6ed9eba1) <<< 3}]
-        set D [expr {($D + [H $A $B $C] + $X8  + 0x6ed9eba1) <<< 9}]
-        set C [expr {($C + [H $D $A $B] + $X4  + 0x6ed9eba1) <<< 11}]
-        set B [expr {($B + [H $C $D $A] + $X12 + 0x6ed9eba1) <<< 15}]
-        # [ABCD  2  3]  [DABC 10  9]  [CDAB  6 11]  [BCDA 14 15]
-        set A [expr {($A + [H $B $C $D] + $X2  + 0x6ed9eba1) <<< 3}]
-        set D [expr {($D + [H $A $B $C] + $X10 + 0x6ed9eba1) <<< 9}]
-        set C [expr {($C + [H $D $A $B] + $X6  + 0x6ed9eba1) <<< 11}]
-        set B [expr {($B + [H $C $D $A] + $X14 + 0x6ed9eba1) <<< 15}]
-        # [ABCD  1  3]  [DABC  9  9]  [CDAB  5 11]  [BCDA 13 15]
-        set A [expr {($A + [H $B $C $D] + $X1  + 0x6ed9eba1) <<< 3}]
-        set D [expr {($D + [H $A $B $C] + $X9  + 0x6ed9eba1) <<< 9}]
-        set C [expr {($C + [H $D $A $B] + $X5  + 0x6ed9eba1) <<< 11}]
-        set B [expr {($B + [H $C $D $A] + $X13 + 0x6ed9eba1) <<< 15}]
-        # [ABCD  3  3]  [DABC 11  9]  [CDAB  7 11]  [BCDA 15 15]
-        set A [expr {($A + [H $B $C $D] + $X3  + 0x6ed9eba1) <<< 3}]
-        set D [expr {($D + [H $A $B $C] + $X11 + 0x6ed9eba1) <<< 9}]
-        set C [expr {($C + [H $D $A $B] + $X7  + 0x6ed9eba1) <<< 11}]
-        set B [expr {($B + [H $C $D $A] + $X15 + 0x6ed9eba1) <<< 15}]
-
-        # Then perform the following additions. (That is, increment each
-        # of the four registers by the value it had before this block
-        # was started.)
-        incr state(A) $A
-        incr state(B) $B
-        incr state(C) $C
-        incr state(D) $D
-    }
-
-    return
-}
-
-proc ::md4::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::md4::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {0xFF & $v}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}]
-}
-
-# 32bit rotate-left
-proc ::md4::<<< {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-# Convert our <<< pseudo-operator into a procedure call.
-regsub -all -line \
-    {\[expr {(.*) <<< (\d+)}\]} \
-    $::md4::MD4Hash_body \
-    {[<<< [expr {\1}] \2]} \
-    ::md4::MD4Hash_body
-
-# RFC1320:3.4 - function F
-proc ::md4::F {X Y Z} {
-    return [expr {($X & $Y) | ((~$X) & $Z)}]
-}
-
-# Inline the F function
-regsub -all -line \
-    {\[F (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md4::MD4Hash_body \
-    {( (\1 \& \2) | ((~\1) \& \3) )} \
-    ::md4::MD4Hash_body
-    
-# RFC1320:3.4 - function G
-proc ::md4::G {X Y Z} {
-    return [expr {($X & $Y) | ($X & $Z) | ($Y & $Z)}]
-}
-
-# Inline the G function
-regsub -all -line \
-    {\[G (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md4::MD4Hash_body \
-    {((\1 \& \2) | (\1 \& \3) | (\2 \& \3))} \
-    ::md4::MD4Hash_body
-
-# RFC1320:3.4 - function H
-proc ::md4::H {X Y Z} {
-    return [expr {$X ^ $Y ^ $Z}]
-}
-
-# Inline the H function
-regsub -all -line \
-    {\[H (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md4::MD4Hash_body \
-    {(\1 ^ \2 ^ \3)} \
-    ::md4::MD4Hash_body
-
-# Define the MD4 hashing procedure with inline functions.
-proc ::md4::MD4Hash {token msg} $::md4::MD4Hash_body
-
-# -------------------------------------------------------------------------
-
-if {[package provide Trf] != {}} {
-    interp alias {} ::md4::Hex {} ::hex -mode encode --
-} else {
-    proc ::md4::Hex {data} {
-        binary scan $data H* result
-        return [string toupper $result]
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::md4::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require md4c}]} {
-                set r [expr {[info command ::md4::md4c] != {}}]
-            }
-        }
-        cryptkit {
-            if {![catch {package require cryptkit}]} {
-                set r [expr {![catch {cryptkit::cryptInit}]}]
-            }
-        }
-        #trf {
-        #    if {![catch {package require Trf}]} {
-        #        set r [expr {![catch {::md4 aa} msg]}]
-        #    }
-        #}
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::md4::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::md4::Chunk {token channel {chunksize 4096}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    MD4Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::md4::md4 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0 } { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"md4 ?-hex? -filename file | string\""
-        }
-        set tok [MD4Init]
-        MD4Update $tok [lindex $args 0]
-        set r [MD4Final $tok]
-
-    } else {
-
-        set tok [MD4Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [MD4Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::md4::hmac {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -key       { set opts(-key) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0 } { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac ?-hex? -key key -filename file | string\""
-        }
-        set tok [HMACInit $opts(-key)]
-        HMACUpdate $tok [lindex $args 0]
-        set r [HMACFinal $tok]
-
-    } else {
-
-        set tok [HMACInit $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [HMACFinal $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::md4 {
-    foreach e {critcl cryptkit} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide md4 $::md4::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md4/md4c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md4/md4c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,125 +1,0 @@
-# md4c.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This provides a C implementation of MD4 using the sample code from RFC1320
-# and wrapping this up in a Tcl package.
-#
-# The tcl interface code is based upon the md5c code from critcl by JCW.
-#
-# INSTALLATION
-# ------------
-# This package uses critcl (http://wiki.tcl.tk/critcl). To build do:
-#  critcl -libdir <your-tcl-lib-dir> -pkg md4c md4c
-#
-# $Id: md4c.tcl,v 1.4 2004/01/15 06:36:13 andreas_kupries Exp $
-
-package require critcl
-package provide md4c 1.0.0
-
-critcl::cheaders md4.h
-critcl::csources md4.c
-
-namespace eval ::md4 {
-
-    critcl::ccode {
-        #include "md4.h"
-
-        /*
-         * define a Tcl object type for the MD4 state 
-         */
-        static Tcl_ObjType md4_type;
-    
-        static void md4_free_rep(Tcl_Obj *obj)
-        {
-            MD4_CTX *ctx = (MD4_CTX *)obj->internalRep.otherValuePtr;
-            Tcl_Free((char *)ctx);
-        }
-
-        static void md4_dup_rep(Tcl_Obj *obj, Tcl_Obj *dup)
-        {
-            MD4_CTX *ctx = (MD4_CTX *)obj->internalRep.otherValuePtr;
-            dup->internalRep.otherValuePtr = (MD4_CTX *)Tcl_Alloc(sizeof(MD4_CTX));
-            memcpy(dup->internalRep.otherValuePtr, ctx, sizeof(MD4_CTX));
-            dup->typePtr = &md4_type;
-        }
-
-        static void md4_string_rep(Tcl_Obj* obj)
-        {
-            unsigned char buf[16];
-            Tcl_Obj* temp;
-            char* str;
-            MD4_CTX *dup = (MD4_CTX *)obj->internalRep.otherValuePtr;
-            
-            MD4Final(buf, dup);
-            
-            /* convert via a byte array to properly handle null bytes */
-            temp = Tcl_NewByteArrayObj(buf, sizeof buf);
-            Tcl_IncrRefCount(temp);
-            
-            str = Tcl_GetStringFromObj(temp, &obj->length);
-            obj->bytes = Tcl_Alloc(obj->length + 1);
-            memcpy(obj->bytes, str, obj->length + 1);
-            
-            Tcl_DecrRefCount(temp);
-        }
-    
-        static int md4_from_any(Tcl_Interp* interp, Tcl_Obj* obj)
-        {
-            /* assert(0); */
-            return TCL_ERROR;
-        }
-        
-        static Tcl_ObjType md4_type = {
-            "md4c", md4_free_rep, md4_dup_rep, md4_string_rep, md4_from_any
-        };
-
-    }
-
-    critcl::ccommand md4c {dummy interp objc objv} {
-        MD4_CTX *ctx;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        /* Tcl_RegisterObjType(&md4_type); */
-        
-        if (objc < 2 || objc > 3) {
-            Tcl_WrongNumArgs(interp, 1, objv, "data ?context?");
-            return TCL_ERROR;
-        }
-        
-        if (objc == 3) {
-            if (objv[2]->typePtr != &md4_type 
-                && md4_from_any(interp, objv[2]) != TCL_OK)
-                return TCL_ERROR;
-            obj = objv[2];
-            if (Tcl_IsShared(obj))
-                obj = Tcl_DuplicateObj(obj);
-        } else {
-            obj = Tcl_NewObj();
-            ctx = (MD4_CTX *)Tcl_Alloc(sizeof(MD4_CTX));
-            MD4Init(ctx);
-        
-            if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
-                obj->typePtr->freeIntRepProc(obj);
-        
-            obj->internalRep.otherValuePtr = ctx;
-            obj->typePtr = &md4_type;
-        }
-    
-        Tcl_SetObjResult(interp, obj);
-        Tcl_IncrRefCount(obj); //!! huh?
-        
-        Tcl_InvalidateStringRep(obj);
-        ctx = (MD4_CTX *)obj->internalRep.otherValuePtr;
-    
-        data = Tcl_GetByteArrayFromObj(objv[1], &size);
-        MD4Update(ctx, data, size);
-    
-        return TCL_OK;
-    }
-}
-
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md4/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md4/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-# This package has been tested with tcl 8.2.3 and above.
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded md4 1.0.4 [list source [file join $dir md4.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,454 +1,0 @@
-##################################################
-#
-# md5.tcl - MD5 in Tcl
-# Author: Don Libes <libes@nist.gov>, July 1999
-# Version 1.2.0
-#
-# MD5  defined by RFC 1321, "The MD5 Message-Digest Algorithm"
-# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
-#
-# Most of the comments below come right out of RFC 1321; That's why
-# they have such peculiar numbers.  In addition, I have retained
-# original syntax, bugs in documentation (yes, really), etc. from the
-# RFC.  All remaining bugs are mine.
-#
-# HMAC implementation by D. J. Hagberg <dhagberg@millibits.com> and
-# is based on C code in RFC 2104.
-#
-# For more info, see: http://expect.nist.gov/md5pure
-#
-# - Don
-#
-# Modified by Miguel Sofer to use inlines and simple variables
-##################################################
-
-# @mdgen EXCLUDE: md5c.tcl
-
-package require Tcl 8.2
-namespace eval ::md5 {
-}
-
-if {![catch {package require Trf 2.0}] && ![catch {::md5 -- test}]} {
-    # Trf is available, so implement the functionality provided here
-    # in terms of calls to Trf for speed.
-
-    proc ::md5::md5 {msg} {
-	string tolower [::hex -mode encode -- [::md5 -- $msg]]
-    }
-
-    # hmac: hash for message authentication
-
-    # MD5 of Trf and MD5 as defined by this package have slightly
-    # different results. Trf returns the digest in binary, here we get
-    # it as hex-string. In the computation of the HMAC the latter
-    # requires back conversion into binary in some places. With Trf we
-    # can use omit these.
-
-    proc ::md5::hmac {key text} {
-	# if key is longer than 64 bytes, reset it to MD5(key).  If shorter, 
-	# pad it out with null (\x00) chars.
-	set keyLen [string length $key]
-	if {$keyLen > 64} {
-	    #old: set key [binary format H32 [md5 $key]]
-	    set key [::md5 -- $key]
-	    set keyLen [string length $key]
-	}
-    
-	# ensure the key is padded out to 64 chars with nulls.
-	set padLen [expr {64 - $keyLen}]
-	append key [binary format "a$padLen" {}]
-
-	# Split apart the key into a list of 16 little-endian words
-	binary scan $key i16 blocks
-
-	# XOR key with ipad and opad values
-	set k_ipad {}
-	set k_opad {}
-	foreach i $blocks {
-	    append k_ipad [binary format i [expr {$i ^ 0x36363636}]]
-	    append k_opad [binary format i [expr {$i ^ 0x5c5c5c5c}]]
-	}
-    
-	# Perform inner md5, appending its results to the outer key
-	append k_ipad $text
-	#old: append k_opad [binary format H* [md5 $k_ipad]]
-	append k_opad [::md5 -- $k_ipad]
-
-	# Perform outer md5
-	#old: md5 $k_opad
-	string tolower [::hex -mode encode -- [::md5 -- $k_opad]]
-    }
-
-} else {
-    # Without Trf use the all-tcl implementation by Don Libes.
-
-    # T will be inlined after the definition of md5body
-
-    # test md5
-    #
-    # This proc is not necessary during runtime and may be omitted if you
-    # are simply inserting this file into a production program.
-    #
-    proc ::md5::test {} {
-	foreach {msg expected} {
-	    ""
-	    "d41d8cd98f00b204e9800998ecf8427e"
-	    "a"
-	    "0cc175b9c0f1b6a831c399e269772661"
-	    "abc"
-	    "900150983cd24fb0d6963f7d28e17f72"
-	    "message digest"
-	    "f96b697d7cb7938d525a2f31aaf161d0"
-	    "abcdefghijklmnopqrstuvwxyz"
-	    "c3fcd3d76192e4007dfb496cca67e13b"
-	    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-	    "d174ab98d277d9f5a5611c2c9f419d9f"
-	    "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
-	    "57edf4a22be3c955ac49da2e2107b67a"
-	} {
-	    puts "testing: md5 \"$msg\""
-	    set computed [md5 $msg]
-	    puts "expected: $expected"
-	    puts "computed: $computed"
-	    if {0 != [string compare $computed $expected]} {
-		puts "FAILED"
-	    } else {
-		puts "SUCCEEDED"
-	    }
-	}
-    }
-
-    # time md5
-    #
-    # This proc is not necessary during runtime and may be omitted if you
-    # are simply inserting this file into a production program.
-    #
-    proc ::md5::time {} {
-	foreach len {10 50 100 500 1000 5000 10000} {
-	    set time [::time {md5 [format %$len.0s ""]} 100]
-	    set msec [lindex $time 0]
-	    puts "input length $len: [expr {$msec/1000}] milliseconds per interation"
-	}
-    }
-
-    #
-    # We just define the body of md5pure::md5 here; later we
-    # regsub to inline a few function calls for speed
-    #
-
-    set ::md5::md5body {
-
-	#
-	# 3.1 Step 1. Append Padding Bits
-	#
-
-	set msgLen [string length $msg]
-
-	set padLen [expr {56 - $msgLen%64}]
-	if {$msgLen % 64 > 56} {
-	    incr padLen 64
-	}
-
-	# pad even if no padding required
-	if {$padLen == 0} {
-	    incr padLen 64
-	}
-
-	# append single 1b followed by 0b's
-	append msg [binary format "a$padLen" \200]
-
-	#
-	# 3.2 Step 2. Append Length
-	#
-
-	# RFC doesn't say whether to use little- or big-endian
-	# code demonstrates little-endian
-	# This step limits our input to size 2^32b or 2^24B
-	append msg [binary format "i1i1" [expr {8*$msgLen}] 0]
-	
-	#
-	# 3.3 Step 3. Initialize MD Buffer
-	#
-
-	set A [expr 0x67452301]
-	set B [expr 0xefcdab89]
-	set C [expr 0x98badcfe]
-	set D [expr 0x10325476]
-
-	#
-	# 3.4 Step 4. Process Message in 16-Word Blocks
-	#
-
-	# process each 16-word block
-	# RFC doesn't say whether to use little- or big-endian
-	# code says little-endian
-	binary scan $msg i* blocks
-
-	# loop over the message taking 16 blocks at a time
-
-	foreach {X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15} $blocks {
-
-	    # Save A as AA, B as BB, C as CC, and D as DD.
-	    set AA $A
-	    set BB $B
-	    set CC $C
-	    set DD $D
-
-	    # Round 1.
-	    # Let [abcd k s i] denote the operation
-	    #      a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).
-	    # [ABCD  0  7  1]  [DABC  1 12  2]  [CDAB  2 17  3]  [BCDA  3 22  4]
-	    set A [expr {$B + [<<< [expr {$A + [F $B $C $D] + $X0  + $T01}]  7]}]
-	    set D [expr {$A + [<<< [expr {$D + [F $A $B $C] + $X1  + $T02}] 12]}]
-	    set C [expr {$D + [<<< [expr {$C + [F $D $A $B] + $X2  + $T03}] 17]}]
-	    set B [expr {$C + [<<< [expr {$B + [F $C $D $A] + $X3  + $T04}] 22]}]
-	    # [ABCD  4  7  5]  [DABC  5 12  6]  [CDAB  6 17  7]  [BCDA  7 22  8]
-	    set A [expr {$B + [<<< [expr {$A + [F $B $C $D] + $X4  + $T05}]  7]}]
-	    set D [expr {$A + [<<< [expr {$D + [F $A $B $C] + $X5  + $T06}] 12]}]
-	    set C [expr {$D + [<<< [expr {$C + [F $D $A $B] + $X6  + $T07}] 17]}]
-	    set B [expr {$C + [<<< [expr {$B + [F $C $D $A] + $X7  + $T08}] 22]}]
-	    # [ABCD  8  7  9]  [DABC  9 12 10]  [CDAB 10 17 11]  [BCDA 11 22 12]
-	    set A [expr {$B + [<<< [expr {$A + [F $B $C $D] + $X8  + $T09}]  7]}]
-	    set D [expr {$A + [<<< [expr {$D + [F $A $B $C] + $X9  + $T10}] 12]}]
-	    set C [expr {$D + [<<< [expr {$C + [F $D $A $B] + $X10 + $T11}] 17]}]
-	    set B [expr {$C + [<<< [expr {$B + [F $C $D $A] + $X11 + $T12}] 22]}]
-	    # [ABCD 12  7 13]  [DABC 13 12 14]  [CDAB 14 17 15]  [BCDA 15 22 16]
-	    set A [expr {$B + [<<< [expr {$A + [F $B $C $D] + $X12 + $T13}]  7]}]
-	    set D [expr {$A + [<<< [expr {$D + [F $A $B $C] + $X13 + $T14}] 12]}]
-	    set C [expr {$D + [<<< [expr {$C + [F $D $A $B] + $X14 + $T15}] 17]}]
-	    set B [expr {$C + [<<< [expr {$B + [F $C $D $A] + $X15 + $T16}] 22]}]
-
-	    # Round 2.
-	    # Let [abcd k s i] denote the operation
-	    #      a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s).
-	    # Do the following 16 operations.
-	    # [ABCD  1  5 17]  [DABC  6  9 18]  [CDAB 11 14 19]  [BCDA  0 20 20]
-	    set A [expr {$B + [<<< [expr {$A + [G $B $C $D] + $X1  + $T17}]  5]}]
-	    set D [expr {$A + [<<< [expr {$D + [G $A $B $C] + $X6  + $T18}]  9]}]
-	    set C [expr {$D + [<<< [expr {$C + [G $D $A $B] + $X11 + $T19}] 14]}]
-	    set B [expr {$C + [<<< [expr {$B + [G $C $D $A] + $X0  + $T20}] 20]}]
-	    # [ABCD  5  5 21]  [DABC 10  9 22]  [CDAB 15 14 23]  [BCDA  4 20 24]
-	    set A [expr {$B + [<<< [expr {$A + [G $B $C $D] + $X5  + $T21}]  5]}]
-	    set D [expr {$A + [<<< [expr {$D + [G $A $B $C] + $X10 + $T22}]  9]}]
-	    set C [expr {$D + [<<< [expr {$C + [G $D $A $B] + $X15 + $T23}] 14]}]
-	    set B [expr {$C + [<<< [expr {$B + [G $C $D $A] + $X4  + $T24}] 20]}]
-	    # [ABCD  9  5 25]  [DABC 14  9 26]  [CDAB  3 14 27]  [BCDA  8 20 28]
-	    set A [expr {$B + [<<< [expr {$A + [G $B $C $D] + $X9  + $T25}]  5]}]
-	    set D [expr {$A + [<<< [expr {$D + [G $A $B $C] + $X14 + $T26}]  9]}]
-	    set C [expr {$D + [<<< [expr {$C + [G $D $A $B] + $X3  + $T27}] 14]}]
-	    set B [expr {$C + [<<< [expr {$B + [G $C $D $A] + $X8  + $T28}] 20]}]
-	    # [ABCD 13  5 29]  [DABC  2  9 30]  [CDAB  7 14 31]  [BCDA 12 20 32]
-	    set A [expr {$B + [<<< [expr {$A + [G $B $C $D] + $X13 + $T29}]  5]}]
-	    set D [expr {$A + [<<< [expr {$D + [G $A $B $C] + $X2  + $T30}]  9]}]
-	    set C [expr {$D + [<<< [expr {$C + [G $D $A $B] + $X7  + $T31}] 14]}]
-	    set B [expr {$C + [<<< [expr {$B + [G $C $D $A] + $X12 + $T32}] 20]}]
-
-	    # Round 3.
-	    # Let [abcd k s t] [sic] denote the operation
-	    #     a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s).
-	    # Do the following 16 operations.
-	    # [ABCD  5  4 33]  [DABC  8 11 34]  [CDAB 11 16 35]  [BCDA 14 23 36]
-	    set A [expr {$B + [<<< [expr {$A + [H $B $C $D] + $X5  + $T33}]  4]}]
-	    set D [expr {$A + [<<< [expr {$D + [H $A $B $C] + $X8  + $T34}] 11]}]
-	    set C [expr {$D + [<<< [expr {$C + [H $D $A $B] + $X11 + $T35}] 16]}]
-	    set B [expr {$C + [<<< [expr {$B + [H $C $D $A] + $X14 + $T36}] 23]}]
-	    # [ABCD  1  4 37]  [DABC  4 11 38]  [CDAB  7 16 39]  [BCDA 10 23 40]
-	    set A [expr {$B + [<<< [expr {$A + [H $B $C $D] + $X1  + $T37}]  4]}]
-	    set D [expr {$A + [<<< [expr {$D + [H $A $B $C] + $X4  + $T38}] 11]}]
-	    set C [expr {$D + [<<< [expr {$C + [H $D $A $B] + $X7  + $T39}] 16]}]
-	    set B [expr {$C + [<<< [expr {$B + [H $C $D $A] + $X10 + $T40}] 23]}]
-	    # [ABCD 13  4 41]  [DABC  0 11 42]  [CDAB  3 16 43]  [BCDA  6 23 44]
-	    set A [expr {$B + [<<< [expr {$A + [H $B $C $D] + $X13 + $T41}]  4]}]
-	    set D [expr {$A + [<<< [expr {$D + [H $A $B $C] + $X0  + $T42}] 11]}]
-	    set C [expr {$D + [<<< [expr {$C + [H $D $A $B] + $X3  + $T43}] 16]}]
-	    set B [expr {$C + [<<< [expr {$B + [H $C $D $A] + $X6  + $T44}] 23]}]
-	    # [ABCD  9  4 45]  [DABC 12 11 46]  [CDAB 15 16 47]  [BCDA  2 23 48]
-	    set A [expr {$B + [<<< [expr {$A + [H $B $C $D] + $X9  + $T45}]  4]}]
-	    set D [expr {$A + [<<< [expr {$D + [H $A $B $C] + $X12 + $T46}] 11]}]
-	    set C [expr {$D + [<<< [expr {$C + [H $D $A $B] + $X15 + $T47}] 16]}]
-	    set B [expr {$C + [<<< [expr {$B + [H $C $D $A] + $X2  + $T48}] 23]}]
-
-	    # Round 4.
-	    # Let [abcd k s t] [sic] denote the operation
-	    #     a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s).
-	    # Do the following 16 operations.
-	    # [ABCD  0  6 49]  [DABC  7 10 50]  [CDAB 14 15 51]  [BCDA  5 21 52]
-	    set A [expr {$B + [<<< [expr {$A + [I $B $C $D] + $X0  + $T49}]  6]}]
-	    set D [expr {$A + [<<< [expr {$D + [I $A $B $C] + $X7  + $T50}] 10]}]
-	    set C [expr {$D + [<<< [expr {$C + [I $D $A $B] + $X14 + $T51}] 15]}]
-	    set B [expr {$C + [<<< [expr {$B + [I $C $D $A] + $X5  + $T52}] 21]}]
-	    # [ABCD 12  6 53]  [DABC  3 10 54]  [CDAB 10 15 55]  [BCDA  1 21 56]
-	    set A [expr {$B + [<<< [expr {$A + [I $B $C $D] + $X12 + $T53}]  6]}]
-	    set D [expr {$A + [<<< [expr {$D + [I $A $B $C] + $X3  + $T54}] 10]}]
-	    set C [expr {$D + [<<< [expr {$C + [I $D $A $B] + $X10 + $T55}] 15]}]
-	    set B [expr {$C + [<<< [expr {$B + [I $C $D $A] + $X1  + $T56}] 21]}]
-	    # [ABCD  8  6 57]  [DABC 15 10 58]  [CDAB  6 15 59]  [BCDA 13 21 60]
-	    set A [expr {$B + [<<< [expr {$A + [I $B $C $D] + $X8  + $T57}]  6]}]
-	    set D [expr {$A + [<<< [expr {$D + [I $A $B $C] + $X15 + $T58}] 10]}]
-	    set C [expr {$D + [<<< [expr {$C + [I $D $A $B] + $X6  + $T59}] 15]}]
-	    set B [expr {$C + [<<< [expr {$B + [I $C $D $A] + $X13 + $T60}] 21]}]
-	    # [ABCD  4  6 61]  [DABC 11 10 62]  [CDAB  2 15 63]  [BCDA  9 21 64]
-	    set A [expr {$B + [<<< [expr {$A + [I $B $C $D] + $X4  + $T61}]  6]}]
-	    set D [expr {$A + [<<< [expr {$D + [I $A $B $C] + $X11 + $T62}] 10]}]
-	    set C [expr {$D + [<<< [expr {$C + [I $D $A $B] + $X2  + $T63}] 15]}]
-	    set B [expr {$C + [<<< [expr {$B + [I $C $D $A] + $X9  + $T64}] 21]}]
-
-	    # Then perform the following additions. (That is increment each
-	    #   of the four registers by the value it had before this block
-	    #   was started.)
-	    incr A $AA
-	    incr B $BB
-	    incr C $CC
-	    incr D $DD
-	}
-	# 3.5 Step 5. Output
-
-	# ... begin with the low-order byte of A, and end with the high-order byte
-	# of D.
-
-	return [bytes $A][bytes $B][bytes $C][bytes $D]
-    }
-
-    #
-    # Here we inline/regsub the functions F, G, H, I and <<< 
-    #
-
-    namespace eval ::md5 {
-	#proc md5pure::F {x y z} {expr {(($x & $y) | ((~$x) & $z))}}
-	regsub -all -- {\[ *F +(\$.) +(\$.) +(\$.) *\]} $md5body {((\1 \& \2) | ((~\1) \& \3))} md5body
-
-	#proc md5pure::G {x y z} {expr {(($x & $z) | ($y & (~$z)))}}
-	regsub -all -- {\[ *G +(\$.) +(\$.) +(\$.) *\]} $md5body {((\1 \& \3) | (\2 \& (~\3)))} md5body
-
-	#proc md5pure::H {x y z} {expr {$x ^ $y ^ $z}}
-	regsub -all -- {\[ *H +(\$.) +(\$.) +(\$.) *\]} $md5body {(\1 ^ \2 ^ \3)} md5body
-
-	#proc md5pure::I {x y z} {expr {$y ^ ($x | (~$z))}}
-	regsub -all -- {\[ *I +(\$.) +(\$.) +(\$.) *\]} $md5body {(\2 ^ (\1 | (~\3)))} md5body
-
-	# bitwise left-rotate
-	if {0} {
-	    proc md5pure::<<< {x i} {
-		# This works by bitwise-ORing together right piece and left
-		# piece so that the (original) right piece becomes the left
-		# piece and vice versa.
-		#
-		# The (original) right piece is a simple left shift.
-		# The (original) left piece should be a simple right shift
-		# but Tcl does sign extension on right shifts so we
-		# shift it 1 bit, mask off the sign, and finally shift
-		# it the rest of the way.
-		
-		# expr {($x << $i) | ((($x >> 1) & 0x7fffffff) >> (31-$i))}
-
-		#
-		# New version, faster when inlining
-		# We replace inline (computing at compile time):
-		#   R$i -> (32 - $i)
-		#   S$i -> (0x7fffffff >> (31-$i))
-		#
-
-		expr { ($x << $i) | (($x >> [set R$i]) & [set S$i])}
-	    }
-	}
-	# inline <<<
-	regsub -all -- {\[ *<<< +\[ *expr +({[^\}]*})\] +([0-9]+) *\]} $md5body {(([set x [expr \1]] << \2) |  (($x >> R\2) \& S\2))} md5body
-
-	# now replace the R and S
-	set map {}
-	foreach i { 
-	    7 12 17 22
-	    5  9 14 20
-	    4 11 16 23
-	    6 10 15 21 
-	} {
-	    lappend map R$i [expr {32 - $i}] S$i [expr {0x7fffffff >> (31-$i)}]
-	}
-	
-	# inline the values of T
-	foreach \
-		tName {
-	    T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 
-	    T11 T12 T13 T14 T15 T16 T17 T18 T19 T20 
-	    T21 T22 T23 T24 T25 T26 T27 T28 T29 T30 
-	    T31 T32 T33 T34 T35 T36 T37 T38 T39 T40 
-	    T41 T42 T43 T44 T45 T46 T47 T48 T49 T50 
-	    T51 T52 T53 T54 T55 T56 T57 T58 T59 T60 
-	    T61 T62 T63 T64 } \
-		tVal {
-	    0xd76aa478 0xe8c7b756 0x242070db 0xc1bdceee
-	    0xf57c0faf 0x4787c62a 0xa8304613 0xfd469501
-	    0x698098d8 0x8b44f7af 0xffff5bb1 0x895cd7be
-	    0x6b901122 0xfd987193 0xa679438e 0x49b40821
-
-	    0xf61e2562 0xc040b340 0x265e5a51 0xe9b6c7aa
-	    0xd62f105d 0x2441453  0xd8a1e681 0xe7d3fbc8
-	    0x21e1cde6 0xc33707d6 0xf4d50d87 0x455a14ed
-	    0xa9e3e905 0xfcefa3f8 0x676f02d9 0x8d2a4c8a
-
-	    0xfffa3942 0x8771f681 0x6d9d6122 0xfde5380c
-	    0xa4beea44 0x4bdecfa9 0xf6bb4b60 0xbebfbc70
-	    0x289b7ec6 0xeaa127fa 0xd4ef3085 0x4881d05
-	    0xd9d4d039 0xe6db99e5 0x1fa27cf8 0xc4ac5665
-
-	    0xf4292244 0x432aff97 0xab9423a7 0xfc93a039
-	    0x655b59c3 0x8f0ccc92 0xffeff47d 0x85845dd1
-	    0x6fa87e4f 0xfe2ce6e0 0xa3014314 0x4e0811a1
-	    0xf7537e82 0xbd3af235 0x2ad7d2bb 0xeb86d391
-	} {
-	    lappend map \$$tName $tVal
-	}
-	set md5body [string map $map $md5body]
-	
-
-	# Finally, define the proc
-	proc md5 {msg} $md5body
-
-	# unset auxiliary variables
-	unset md5body tName tVal map
-    }
-
-    proc ::md5::byte0 {i} {expr {0xff & $i}}
-    proc ::md5::byte1 {i} {expr {(0xff00 & $i) >> 8}}
-    proc ::md5::byte2 {i} {expr {(0xff0000 & $i) >> 16}}
-    proc ::md5::byte3 {i} {expr {((0xff000000 & $i) >> 24) & 0xff}}
-
-    proc ::md5::bytes {i} {
-	format %0.2x%0.2x%0.2x%0.2x [byte0 $i] [byte1 $i] [byte2 $i] [byte3 $i]
-    }
-
-    # hmac: hash for message authentication
-    proc ::md5::hmac {key text} {
-	# if key is longer than 64 bytes, reset it to MD5(key).  If shorter, 
-	# pad it out with null (\x00) chars.
-	set keyLen [string length $key]
-	if {$keyLen > 64} {
-	    set key [binary format H32 [md5 $key]]
-	    set keyLen [string length $key]
-	}
-
-	# ensure the key is padded out to 64 chars with nulls.
-	set padLen [expr {64 - $keyLen}]
-	append key [binary format "a$padLen" {}]
-	
-	# Split apart the key into a list of 16 little-endian words
-	binary scan $key i16 blocks
-
-	# XOR key with ipad and opad values
-	set k_ipad {}
-	set k_opad {}
-	foreach i $blocks {
-	    append k_ipad [binary format i [expr {$i ^ 0x36363636}]]
-	    append k_opad [binary format i [expr {$i ^ 0x5c5c5c5c}]]
-	}
-    
-	# Perform inner md5, appending its results to the outer key
-	append k_ipad $text
-	append k_opad [binary format H* [md5 $k_ipad]]
-
-	# Perform outer md5
-	md5 $k_opad
-    }
-}
-
-package provide md5 1.4.4
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,155 +1,0 @@
-# md5c.tcl - 
-#
-# Wrapper for RSA's Message Digest in C
-#
-# Written by Jean-Claude Wippler <jcw@equi4.com>
-#
-# $Id: md5c.tcl,v 1.3 2004/01/15 06:36:13 andreas_kupries Exp $
-
-package require critcl;                 # needs critcl
-package provide md5c 0.11;              # 
-
-critcl::cheaders md5.h;                 # The RSA header file
-critcl::csources md5.c;                 # The RSA MD5 implementation.
-
-namespace eval ::md5 {
-
-    critcl::ccode {
-        #include "md5.h"
-        #include <malloc.h>
-        #include <memory.h>
-        #include <assert.h>
-        
-        static
-        Tcl_ObjType md5_type; /* fast internal access representation */
-        
-        static void 
-        md5_free_rep(Tcl_Obj* obj)
-        {
-            MD5_CTX* mp = (MD5_CTX*) obj->internalRep.otherValuePtr;
-            free(mp);
-        }
-        
-        static void
-        md5_dup_rep(Tcl_Obj* obj, Tcl_Obj* dup)
-        {
-            MD5_CTX* mp = (MD5_CTX*) obj->internalRep.otherValuePtr;
-            dup->internalRep.otherValuePtr = malloc(sizeof *mp);
-            memcpy(dup->internalRep.otherValuePtr, mp, sizeof *mp);
-            dup->typePtr = &md5_type;
-        }
-        
-        static void
-        md5_string_rep(Tcl_Obj* obj)
-        {
-            unsigned char buf[16];
-            Tcl_Obj* temp;
-            char* str;
-            MD5_CTX dup = *(MD5_CTX*) obj->internalRep.otherValuePtr;
-            
-            MD5Final(buf, &dup);
-            
-            /* convert via a byte array to properly handle null bytes */
-            temp = Tcl_NewByteArrayObj(buf, sizeof buf);
-            Tcl_IncrRefCount(temp);
-            
-            str = Tcl_GetStringFromObj(temp, &obj->length);
-            obj->bytes = Tcl_Alloc(obj->length + 1);
-            memcpy(obj->bytes, str, obj->length + 1);
-            
-            Tcl_DecrRefCount(temp);
-        }
-        
-        static int
-        md5_from_any(Tcl_Interp* ip, Tcl_Obj* obj)
-        {
-            assert(0);
-            return TCL_ERROR;
-        }
-        
-        static
-        Tcl_ObjType md5_type = {
-            "md5c", md5_free_rep, md5_dup_rep, md5_string_rep, md5_from_any
-        };
-    }
-    
-    critcl::ccommand md5c {dummy ip objc objv} {
-        MD5_CTX* mp;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        //Tcl_RegisterObjType(&md5_type);
-        
-        if (objc < 2 || objc > 3) {
-            Tcl_WrongNumArgs(ip, 1, objv, "data ?context?");
-            return TCL_ERROR;
-        }
-        
-        if (objc == 3) {
-            if (objv[2]->typePtr != &md5_type && md5_from_any(ip, objv[2]) != TCL_OK)
-            return TCL_ERROR;
-            obj = objv[2];
-            if (Tcl_IsShared(obj))
-            obj = Tcl_DuplicateObj(obj);
-        } else {
-            obj = Tcl_NewObj();
-            mp = (MD5_CTX*) malloc(sizeof *mp);
-            MD5Init(mp);
-            
-            if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
-            obj->typePtr->freeIntRepProc(obj);
-            
-            obj->internalRep.otherValuePtr = mp;
-            obj->typePtr = &md5_type;
-        }
-        
-        Tcl_SetObjResult(ip, obj);
-        Tcl_IncrRefCount(obj); //!! huh?
-        
-        Tcl_InvalidateStringRep(obj);
-        mp = (MD5_CTX*) obj->internalRep.otherValuePtr;
-        
-        data = Tcl_GetByteArrayFromObj(objv[1], &size);
-        MD5Update(mp, data, size);
-        
-        return TCL_OK;
-    }
-}
-
-if {[info exists pkgtest] && $pkgtest} {
-
-  proc md5c_try {} {
-    foreach {msg expected} {
-      ""
-      "d41d8cd98f00b204e9800998ecf8427e"
-      "a"
-      "0cc175b9c0f1b6a831c399e269772661"
-      "abc"
-      "900150983cd24fb0d6963f7d28e17f72"
-      "message digest"
-      "f96b697d7cb7938d525a2f31aaf161d0"
-      "abcdefghijklmnopqrstuvwxyz"
-      "c3fcd3d76192e4007dfb496cca67e13b"
-      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-      "d174ab98d277d9f5a5611c2c9f419d9f"
-      "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
-      "57edf4a22be3c955ac49da2e2107b67a"
-    } {
-      puts "testing: ::md5::md5c \"$msg\""
-      binary scan [::md5::md5c $msg] H* computed
-      puts "computed: $computed"
-      if {0 != [string compare $computed $expected]} {
-	puts "expected: $expected"
-	puts "FAILED"
-      }
-    }
-
-    foreach len {10 50 100 500 1000 5000 10000} {
-      set blanks [format %$len.0s ""]
-      puts "input length $len: [time {md5c $blanks} 1000]"
-    }
-  }
-
-  md5c_try
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5x.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5/md5x.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,714 +1,0 @@
-# md5.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# MD5  defined by RFC 1321, "The MD5 Message-Digest Algorithm"
-# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
-#
-# This is an implementation of MD5 based upon the example code given in
-# RFC 1321 and upon the tcllib MD4 implementation and taking some ideas
-# from the earlier tcllib md5 version by Don Libes.
-#
-# This implementation permits incremental updating of the hash and 
-# provides support for external compiled implementations either using
-# critcl (md5c) or Trf.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: md5x.tcl,v 1.17 2006/09/19 23:36:17 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::md5 {
-    variable version 2.0.5
-    variable rcsid {$Id: md5x.tcl,v 1.17 2006/09/19 23:36:17 andreas_kupries Exp $}
-    variable accel
-    array set accel {critcl 0 cryptkit 0 trf 0}
-
-    namespace export md5 hmac MD5Init MD5Update MD5Final
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# MD5Init --
-#
-#   Create and initialize an MD5 state variable. This will be
-#   cleaned up when we call MD5Final
-#
-proc ::md5::MD5Init {} {
-    variable accel
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # RFC1321:3.3 - Initialize MD5 state structure
-    array set state \
-        [list \
-             A [expr {0x67452301}] \
-             B [expr {0xefcdab89}] \
-             C [expr {0x98badcfe}] \
-             D [expr {0x10325476}] \
-             n 0 i "" ]
-    if {$accel(cryptkit)} {
-        cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_MD5
-    } elseif {$accel(trf)} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::md5 -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-# MD5Update --
-#
-#   This is called to add more data into the hash. You may call this
-#   as many times as you require. Note that passing in "ABC" is equivalent
-#   to passing these letters in as separate calls -- hence this proc 
-#   permits hashing of chunked data
-#
-#   If we have a C-based implementation available, then we will use
-#   it here in preference to the pure-Tcl implementation.
-#
-proc ::md5::MD5Update {token data} {
-    variable accel
-    upvar #0 $token state
-
-    if {$accel(critcl)} {
-        if {[info exists state(md5c)]} {
-            set state(md5c) [md5c $data $state(md5c)]
-        } else {
-            set state(md5c) [md5c $data]
-        }
-        return
-    } elseif {[info exists state(ckctx)]} {
-        if {[string length $data] > 0} {
-            cryptkit::cryptEncrypt $state(ckctx) $data
-        }
-        return
-    } elseif {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        MD5Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-# MD5Final --
-#
-#    This procedure is used to close the current hash and returns the
-#    hash data. Once this procedure has been called the hash context
-#    is freed and cannot be used again.
-#
-#    Note that the output is 128 bits represented as binary data.
-#
-proc ::md5::MD5Final {token} {
-    upvar #0 $token state
-
-    # Check for either of the C-compiled versions.
-    if {[info exists state(md5c)]} {
-        set r $state(md5c)
-        unset state
-        return $r
-    } elseif {[info exists state(ckctx)]} {
-        cryptkit::cryptEncrypt $state(ckctx) ""
-        cryptkit::cryptGetAttributeString $state(ckctx) \
-            CRYPT_CTXINFO_HASHVALUE r 16
-        cryptkit::cryptDestroyContext $state(ckctx)
-        # If nothing was hashed, we get no r variable set!
-        if {[info exists r]} {
-            unset state
-            return $r
-        }
-    } elseif {[info exists state(trf)]} {
-        close $state(trf)
-        set r $state(trfwrite)
-        unset state
-        return $r
-    }
-
-    # RFC1321:3.1 - Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # RFC1321:3.2 - Append length in bits as little-endian wide int.
-    append state(i) [binary format ii [expr {8 * $state(n)}] 0]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        MD5Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # RFC1321:3.5 - Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-
-# HMACInit --
-#
-#    This is equivalent to the MD5Init procedure except that a key is
-#    added into the algorithm
-#
-proc ::md5::HMACInit {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the MD5 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [MD5Init]
-        MD5Update $tok $K
-        set K [MD5Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [MD5Init]
-    MD5Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-# HMACUpdate --
-#
-#    Identical to calling MD5Update
-#
-proc ::md5::HMACUpdate {token data} {
-    MD5Update $token $data
-    return
-}
-
-# HMACFinal --
-#
-#    This is equivalent to the MD5Final procedure. The hash context is
-#    closed and the binary representation of the hash result is returned.
-#
-proc ::md5::HMACFinal {token} {
-    upvar #0 $token state
-
-    set tok [MD5Init];                  # init the outer hashing function
-    MD5Update $tok $state(Ko);          # prepare with the outer pad.
-    MD5Update $tok [MD5Final $token];   # hash the inner result
-    return [MD5Final $tok]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  This is the core MD5 algorithm. It is a lot like the MD4 algorithm but
-#  includes an extra round and a set of constant modifiers throughout.
-# 
-# Note:
-#  This function body is substituted later on to inline some of the 
-#  procedures and to make is a bit more comprehensible.
-#
-set ::md5::MD5Hash_body {
-    variable $token
-    upvar 0 $token state
-
-    # RFC1321:3.4 - Process Message in 16-Word Blocks
-    binary scan $msg i* blocks
-    foreach {X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15} $blocks {
-        set A $state(A)
-        set B $state(B)
-        set C $state(C)
-        set D $state(D)
-
-        # Round 1
-        # Let [abcd k s i] denote the operation
-        #   a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).
-        # Do the following 16 operations.
-        # [ABCD  0  7  1]  [DABC  1 12  2]  [CDAB  2 17  3]  [BCDA  3 22  4]
-        set A [expr {$B + (($A + [F $B $C $D] + $X0 + $T01) <<< 7)}]
-        set D [expr {$A + (($D + [F $A $B $C] + $X1 + $T02) <<< 12)}]
-        set C [expr {$D + (($C + [F $D $A $B] + $X2 + $T03) <<< 17)}]
-        set B [expr {$C + (($B + [F $C $D $A] + $X3 + $T04) <<< 22)}]
-        # [ABCD  4  7  5]  [DABC  5 12  6]  [CDAB  6 17  7]  [BCDA  7 22  8]
-        set A [expr {$B + (($A + [F $B $C $D] + $X4 + $T05) <<< 7)}]
-        set D [expr {$A + (($D + [F $A $B $C] + $X5 + $T06) <<< 12)}]
-        set C [expr {$D + (($C + [F $D $A $B] + $X6 + $T07) <<< 17)}]
-        set B [expr {$C + (($B + [F $C $D $A] + $X7 + $T08) <<< 22)}]
-        # [ABCD  8  7  9]  [DABC  9 12 10]  [CDAB 10 17 11]  [BCDA 11 22 12]
-        set A [expr {$B + (($A + [F $B $C $D] + $X8 + $T09) <<< 7)}]
-        set D [expr {$A + (($D + [F $A $B $C] + $X9 + $T10) <<< 12)}]
-        set C [expr {$D + (($C + [F $D $A $B] + $X10 + $T11) <<< 17)}]
-        set B [expr {$C + (($B + [F $C $D $A] + $X11 + $T12) <<< 22)}]
-        # [ABCD 12  7 13]  [DABC 13 12 14]  [CDAB 14 17 15]  [BCDA 15 22 16]
-        set A [expr {$B + (($A + [F $B $C $D] + $X12 + $T13) <<< 7)}]
-        set D [expr {$A + (($D + [F $A $B $C] + $X13 + $T14) <<< 12)}]
-        set C [expr {$D + (($C + [F $D $A $B] + $X14 + $T15) <<< 17)}]
-        set B [expr {$C + (($B + [F $C $D $A] + $X15 + $T16) <<< 22)}]
-
-        # Round 2.
-        # Let [abcd k s i] denote the operation
-        #   a = b + ((a + G(b,c,d) + X[k] + Ti) <<< s)
-        # Do the following 16 operations.
-        # [ABCD  1  5 17]  [DABC  6  9 18]  [CDAB 11 14 19]  [BCDA  0 20 20]
-        set A [expr {$B + (($A + [G $B $C $D] + $X1  + $T17) <<<  5)}]
-        set D [expr {$A + (($D + [G $A $B $C] + $X6  + $T18) <<<  9)}]
-        set C [expr {$D + (($C + [G $D $A $B] + $X11 + $T19) <<< 14)}]
-        set B [expr {$C + (($B + [G $C $D $A] + $X0  + $T20) <<< 20)}]
-        # [ABCD  5  5 21]  [DABC 10  9 22]  [CDAB 15 14 23]  [BCDA  4 20 24]
-        set A [expr {$B + (($A + [G $B $C $D] + $X5  + $T21) <<<  5)}]
-        set D [expr {$A + (($D + [G $A $B $C] + $X10 + $T22) <<<  9)}]
-        set C [expr {$D + (($C + [G $D $A $B] + $X15 + $T23) <<< 14)}]
-        set B [expr {$C + (($B + [G $C $D $A] + $X4  + $T24) <<< 20)}]
-        # [ABCD  9  5 25]  [DABC 14  9 26]  [CDAB  3 14 27]  [BCDA  8 20 28]
-        set A [expr {$B + (($A + [G $B $C $D] + $X9  + $T25) <<<  5)}]
-        set D [expr {$A + (($D + [G $A $B $C] + $X14 + $T26) <<<  9)}]
-        set C [expr {$D + (($C + [G $D $A $B] + $X3  + $T27) <<< 14)}]
-        set B [expr {$C + (($B + [G $C $D $A] + $X8  + $T28) <<< 20)}]
-        # [ABCD 13  5 29]  [DABC  2  9 30]  [CDAB  7 14 31]  [BCDA 12 20 32]
-        set A [expr {$B + (($A + [G $B $C $D] + $X13 + $T29) <<<  5)}]
-        set D [expr {$A + (($D + [G $A $B $C] + $X2  + $T30) <<<  9)}]
-        set C [expr {$D + (($C + [G $D $A $B] + $X7  + $T31) <<< 14)}]
-        set B [expr {$C + (($B + [G $C $D $A] + $X12 + $T32) <<< 20)}]
-        
-        # Round 3.
-        # Let [abcd k s i] denote the operation
-        #   a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s)
-        # Do the following 16 operations.
-        # [ABCD  5  4 33]  [DABC  8 11 34]  [CDAB 11 16 35]  [BCDA 14 23 36]
-        set A [expr {$B + (($A + [H $B $C $D] + $X5  + $T33) <<<  4)}]
-        set D [expr {$A + (($D + [H $A $B $C] + $X8  + $T34) <<< 11)}]
-        set C [expr {$D + (($C + [H $D $A $B] + $X11 + $T35) <<< 16)}]
-        set B [expr {$C + (($B + [H $C $D $A] + $X14 + $T36) <<< 23)}]
-        # [ABCD  1  4 37]  [DABC  4 11 38]  [CDAB  7 16 39]  [BCDA 10 23 40]
-        set A [expr {$B + (($A + [H $B $C $D] + $X1  + $T37) <<<  4)}]
-        set D [expr {$A + (($D + [H $A $B $C] + $X4  + $T38) <<< 11)}]
-        set C [expr {$D + (($C + [H $D $A $B] + $X7  + $T39) <<< 16)}]
-        set B [expr {$C + (($B + [H $C $D $A] + $X10 + $T40) <<< 23)}]
-        # [ABCD 13  4 41]  [DABC  0 11 42]  [CDAB  3 16 43]  [BCDA  6 23 44]
-        set A [expr {$B + (($A + [H $B $C $D] + $X13 + $T41) <<<  4)}]
-        set D [expr {$A + (($D + [H $A $B $C] + $X0  + $T42) <<< 11)}]
-        set C [expr {$D + (($C + [H $D $A $B] + $X3  + $T43) <<< 16)}]
-        set B [expr {$C + (($B + [H $C $D $A] + $X6  + $T44) <<< 23)}]
-        # [ABCD  9  4 45]  [DABC 12 11 46]  [CDAB 15 16 47]  [BCDA  2 23 48]
-        set A [expr {$B + (($A + [H $B $C $D] + $X9  + $T45) <<<  4)}]
-        set D [expr {$A + (($D + [H $A $B $C] + $X12 + $T46) <<< 11)}]
-        set C [expr {$D + (($C + [H $D $A $B] + $X15 + $T47) <<< 16)}]
-        set B [expr {$C + (($B + [H $C $D $A] + $X2  + $T48) <<< 23)}]
-
-        # Round 4.
-        # Let [abcd k s i] denote the operation
-        #   a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s)
-        # Do the following 16 operations.
-        # [ABCD  0  6 49]  [DABC  7 10 50]  [CDAB 14 15 51]  [BCDA  5 21 52]
-        set A [expr {$B + (($A + [I $B $C $D] + $X0  + $T49) <<<  6)}]
-        set D [expr {$A + (($D + [I $A $B $C] + $X7  + $T50) <<< 10)}]
-        set C [expr {$D + (($C + [I $D $A $B] + $X14 + $T51) <<< 15)}]
-        set B [expr {$C + (($B + [I $C $D $A] + $X5  + $T52) <<< 21)}]
-        # [ABCD 12  6 53]  [DABC  3 10 54]  [CDAB 10 15 55]  [BCDA  1 21 56]
-        set A [expr {$B + (($A + [I $B $C $D] + $X12 + $T53) <<<  6)}]
-        set D [expr {$A + (($D + [I $A $B $C] + $X3  + $T54) <<< 10)}]
-        set C [expr {$D + (($C + [I $D $A $B] + $X10 + $T55) <<< 15)}]
-        set B [expr {$C + (($B + [I $C $D $A] + $X1  + $T56) <<< 21)}]
-        # [ABCD  8  6 57]  [DABC 15 10 58]  [CDAB  6 15 59]  [BCDA 13 21 60]
-        set A [expr {$B + (($A + [I $B $C $D] + $X8  + $T57) <<<  6)}]
-        set D [expr {$A + (($D + [I $A $B $C] + $X15 + $T58) <<< 10)}]
-        set C [expr {$D + (($C + [I $D $A $B] + $X6  + $T59) <<< 15)}]
-        set B [expr {$C + (($B + [I $C $D $A] + $X13 + $T60) <<< 21)}]
-        # [ABCD  4  6 61]  [DABC 11 10 62]  [CDAB  2 15 63]  [BCDA  9 21 64]
-        set A [expr {$B + (($A + [I $B $C $D] + $X4  + $T61) <<<  6)}]
-        set D [expr {$A + (($D + [I $A $B $C] + $X11 + $T62) <<< 10)}]
-        set C [expr {$D + (($C + [I $D $A $B] + $X2  + $T63) <<< 15)}]
-        set B [expr {$C + (($B + [I $C $D $A] + $X9  + $T64) <<< 21)}]
-
-        # Then perform the following additions. (That is, increment each
-        # of the four registers by the value it had before this block
-        # was started.)
-        incr state(A) $A
-        incr state(B) $B
-        incr state(C) $C
-        incr state(D) $D
-    }
-
-    return
-}
-
-proc ::md5::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::md5::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {0xFF & $v}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}]
-}
-
-# 32bit rotate-left
-proc ::md5::<<< {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-# Convert our <<< pseudo-operator into a procedure call.
-regsub -all -line \
-    {\[expr {(\$[ABCD]) \+ \(\((.*)\)\s+<<<\s+(\d+)\)}\]} \
-    $::md5::MD5Hash_body \
-    {[expr {int(\1 + [<<< [expr {\2}] \3])}]} \
-    ::md5::MD5Hash_bodyX
-
-# RFC1321:3.4 - function F
-proc ::md5::F {X Y Z} {
-    return [expr {($X & $Y) | ((~$X) & $Z)}]
-}
-
-# Inline the F function
-regsub -all -line \
-    {\[F (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md5::MD5Hash_bodyX \
-    {( (\1 \& \2) | ((~\1) \& \3) )} \
-    ::md5::MD5Hash_bodyX
-    
-# RFC1321:3.4 - function G
-proc ::md5::G {X Y Z} {
-    return [expr {(($X & $Z) | ($Y & (~$Z)))}]
-}
-
-# Inline the G function
-regsub -all -line \
-    {\[G (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md5::MD5Hash_bodyX \
-    {(((\1 \& \3) | (\2 \& (~\3))))} \
-    ::md5::MD5Hash_bodyX
-
-# RFC1321:3.4 - function H
-proc ::md5::H {X Y Z} {
-    return [expr {$X ^ $Y ^ $Z}]
-}
-
-# Inline the H function
-regsub -all -line \
-    {\[H (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md5::MD5Hash_bodyX \
-    {(\1 ^ \2 ^ \3)} \
-    ::md5::MD5Hash_bodyX
-
-# RFC1321:3.4 - function I
-proc ::md5::I {X Y Z} {
-    return [expr {$Y ^ ($X | (~$Z))}]
-}
-
-# Inline the I function
-regsub -all -line \
-    {\[I (\$[ABCD]) (\$[ABCD]) (\$[ABCD])\]} \
-    $::md5::MD5Hash_bodyX \
-    {(\2 ^ (\1 | (~\3)))} \
-    ::md5::MD5Hash_bodyX
-
-
-# RFC 1321:3.4 step 4: inline the set of constant modifiers.
-namespace eval md5 {
-    foreach tName {
-        T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 
-        T11 T12 T13 T14 T15 T16 T17 T18 T19 T20 
-        T21 T22 T23 T24 T25 T26 T27 T28 T29 T30 
-        T31 T32 T33 T34 T35 T36 T37 T38 T39 T40 
-        T41 T42 T43 T44 T45 T46 T47 T48 T49 T50 
-        T51 T52 T53 T54 T55 T56 T57 T58 T59 T60 
-        T61 T62 T63 T64 
-    }  tVal {
-        0xd76aa478 0xe8c7b756 0x242070db 0xc1bdceee
-        0xf57c0faf 0x4787c62a 0xa8304613 0xfd469501
-        0x698098d8 0x8b44f7af 0xffff5bb1 0x895cd7be
-        0x6b901122 0xfd987193 0xa679438e 0x49b40821
-        
-        0xf61e2562 0xc040b340 0x265e5a51 0xe9b6c7aa
-        0xd62f105d 0x2441453  0xd8a1e681 0xe7d3fbc8
-        0x21e1cde6 0xc33707d6 0xf4d50d87 0x455a14ed
-        0xa9e3e905 0xfcefa3f8 0x676f02d9 0x8d2a4c8a
-        
-        0xfffa3942 0x8771f681 0x6d9d6122 0xfde5380c
-        0xa4beea44 0x4bdecfa9 0xf6bb4b60 0xbebfbc70
-        0x289b7ec6 0xeaa127fa 0xd4ef3085 0x4881d05
-        0xd9d4d039 0xe6db99e5 0x1fa27cf8 0xc4ac5665
-        
-        0xf4292244 0x432aff97 0xab9423a7 0xfc93a039
-        0x655b59c3 0x8f0ccc92 0xffeff47d 0x85845dd1
-        0x6fa87e4f 0xfe2ce6e0 0xa3014314 0x4e0811a1
-        0xf7537e82 0xbd3af235 0x2ad7d2bb 0xeb86d391
-    } {
-        lappend map \$$tName $tVal
-    }
-    set ::md5::MD5Hash_bodyX [string map $map $::md5::MD5Hash_bodyX]
-    unset map
-}
-
-# Define the MD5 hashing procedure with inline functions.
-proc ::md5::MD5Hash {token msg} $::md5::MD5Hash_bodyX
-
-# -------------------------------------------------------------------------
-
-if {[package provide Trf] != {}} {
-    interp alias {} ::md5::Hex {} ::hex -mode encode --
-} else {
-    proc ::md5::Hex {data} {
-        binary scan $data H* result
-        return [string toupper $result]
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::md5::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require md5c}]} {
-                set r [expr {[info command ::md5::md5c] != {}}]
-            }
-        }
-        cryptkit {
-            if {![catch {package require cryptkit}]} {
-                set r [expr {![catch {cryptkit::cryptInit}]}]
-            }
-        }
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::md5 aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::md5::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::md5::Chunk {token channel {chunksize 4096}} {
-    upvar #0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    MD5Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::md5::md5 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err\nlen: [llength $args]"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"md5 ?-hex? -filename file | string\""
-        }
-        set tok [MD5Init]
-        MD5Update $tok [lindex $args 0]
-        set r [MD5Final $tok]
-
-    } else {
-
-        set tok [MD5Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [MD5Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::md5::hmac {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -key       { set opts(-key) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac ?-hex? -key key -filename file | string\""
-        }
-        set tok [HMACInit $opts(-key)]
-        HMACUpdate $tok [lindex $args 0]
-        set r [HMACFinal $tok]
-
-    } else {
-
-        set tok [HMACInit $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [HMACFinal $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::md5 {
-    foreach e {critcl cryptkit trf} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide md5 $::md5::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded md5 2.0.5 [list source [file join $dir md5x.tcl]]
-package ifneeded md5 1.4.4 [list source [file join $dir md5.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/md5crypt.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/md5crypt.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,144 +1,0 @@
-# md5crypt.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This file provides a pure tcl implementation of the BSD MD5 crypt algorithm.
-# The implementation is based upon the OpenBSD code which is in turn based upon
-# the original code by Poul-Henning Kamp. 
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-# @mdgen EXCLUDE: md5cryptc.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-package require md5 2;                  # tcllib 1.5
-
-# Try and load a compiled extension to help.
-if {[catch {package require tcllibc}]} {
-    catch {package require md5cryptc}
-}
-
-namespace eval md5crypt {
-    variable version 1.0.0
-    variable rcsid {$Id: md5crypt.tcl,v 1.4 2005/12/09 18:27:17 andreas_kupries Exp $}
-    variable itoa64 \
-        {./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}
-
-    namespace import -force ::md5::MD5Init ::md5::MD5Update ::md5::MD5Final
-    namespace export md5crypt
-}
-
-proc ::md5crypt::to64_tcl {v n} {
-    variable itoa64
-    for {} {$n > 0} {incr n -1} {
-        set i [expr {$v & 0x3f}]
-        append s [string index $itoa64 $i]
-        set v [expr {($v >> 6) & 0x3FFFFFFF}]
-    }
-    return $s
-}
-
-proc ::md5crypt::md5crypt_tcl {magic pw salt} {
-    set sp 0
-
-    set start 0
-    if {[string match "${magic}*" $salt]} {
-        set start [string length $magic]
-    }
-    set end [string first $ $salt $start]
-    if {$end < 0} {set end [string length $salt]} else {incr end -1}
-    if {$end - $start > 7} {set end [expr {$start + 7}]}
-    set salt [string range $salt $start $end]
-
-    set ctx [MD5Init]
-    MD5Update $ctx $pw
-    MD5Update $ctx $magic
-    MD5Update $ctx $salt
-
-    set ctx2 [MD5Init]
-    MD5Update $ctx2 $pw
-    MD5Update $ctx2 $salt
-    MD5Update $ctx2 $pw
-    set H2 [MD5Final $ctx2]
-
-    for {set pl [string length $pw]} {$pl > 0} {incr pl -16} {
-        set tl [expr {($pl > 16 ? 16 : $pl) - 1}]
-        MD5Update $ctx [string range $H2 0 $tl]
-    }
-    
-    for {set i [string length $pw]} {$i != 0} {set i [expr {$i >> 1}]} {
-        if {$i & 1} {
-            set c \0
-        } else {
-            set c [string index $pw 0]
-        }
-        MD5Update $ctx $c
-    }
-    
-    set result "${magic}${salt}\$"
-    
-    set H [MD5Final $ctx]
-
-    for {set i 0} {$i < 1000} {incr i} {
-        set ctx [MD5Init]
-        if {$i & 1} {
-            MD5Update $ctx $pw
-        } else {
-            MD5Update $ctx $H
-        }
-        if {$i % 3} {
-            MD5Update $ctx $salt
-        }
-        if {$i % 7} {
-            MD5Update $ctx $pw
-        }
-        if {$i & 1} {
-            MD5Update $ctx $H
-        } else {
-            MD5Update $ctx $pw
-        }
-        set H [MD5Final $ctx]
-    }
-
-    binary scan $H c* Vs
-    foreach v $Vs {lappend V [expr {$v & 0xFF}]}
-    set l [expr {([lindex $V 0] << 16) | ([lindex $V  6] << 8) | [lindex $V 12]}]
-    append result [to64 $l 4]
-    set l [expr {([lindex $V 1] << 16) | ([lindex $V  7] << 8) | [lindex $V 13]}]
-    append result [to64 $l 4]
-    set l [expr {([lindex $V 2] << 16) | ([lindex $V  8] << 8) | [lindex $V 14]}]
-    append result [to64 $l 4]
-    set l [expr {([lindex $V 3] << 16) | ([lindex $V  9] << 8) | [lindex $V 15]}]
-    append result [to64 $l 4]
-    set l [expr {([lindex $V 4] << 16) | ([lindex $V 10] << 8) | [lindex $V  5]}]
-    append result [to64 $l 4]
-    set l [expr {[lindex $V 11]}]
-    append result [to64 $l 2]
-    
-    return $result
-}
-
-if {[info command ::md5crypt::to64_c] == {}} {
-    interp alias {} ::md5crypt::to64 {} ::md5crypt::to64_tcl
-} else {
-    interp alias {} ::md5crypt::to64 {} ::md5crypt::to64_c
-}
-
-if {[info command ::md5crypt::md5crypt_c] == {}} {
-    interp alias {} ::md5crypt::md5crypt {} ::md5crypt::md5crypt_tcl {$1$}
-    interp alias {} ::md5crypt::aprcrypt {} ::md5crypt::md5crypt_tcl {$apr1$}
-} else {
-    interp alias {} ::md5crypt::md5crypt {} ::md5crypt::md5crypt_c {$1$}
-    interp alias {} ::md5crypt::aprcrypt {} ::md5crypt::md5crypt_c {$apr1$}
-}
-
-# -------------------------------------------------------------------------
-
-package provide md5crypt $::md5crypt::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/md5cryptc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/md5cryptc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,172 +1,0 @@
-# md5cryptc.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This is a critcl-based wrapper to provide a Tcl implementation of the md5crypt
-# function. The C code here is based upon the OpenBSD source, which is in turn
-# derived from the original implementation by Poul-Henning Kamp
-#
-# The original C source license reads:
-#/*
-# * ----------------------------------------------------------------------------
-# * "THE BEER-WARE LICENSE" (Revision 42):
-# * <phk@login.dknet.dk> wrote this file.  As long as you retain this notice you
-# * can do whatever you want with this stuff. If we meet some day, and you think
-# * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
-# * ----------------------------------------------------------------------------
-# */
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-
-package require critcl
-package provide md5cryptc 1.0
-
-critcl::cheaders ../md5/md5.h
-#critcl::csources ../md5/md5.c
-
-namespace eval ::md5crypt {
-    critcl::ccode {
-#include "md5.h"
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-        static unsigned char itoa64[] =
-            "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-        
-        static void to64(char *s, unsigned int v, int n)
-        {
-            while (--n >= 0) {
-                *s++ = itoa64[v&0x3f];
-                v >>= 6;
-            }
-        }
-        
-        static void dump(const char *s, unsigned int len) 
-        {
-            unsigned int i;
-            for (i = 0; i < len; i++)
-                printf("%02X", s[i]&0xFF);
-            putchar('\n');
-        }
-        
-        static char * md5crypt(const char *pw,
-                               const char *salt,
-                               const char *magic)
-        {
-            static char     passwd[120], *p;
-            static const unsigned char *sp,*ep;
-            unsigned char	final[16];
-            int sl,pl,i;
-            MD5_CTX	ctx,ctx1;
-            unsigned long l;
-            
-            /* Refine the Salt first */
-            sp = (const unsigned char *)salt;
-            
-            /* If it starts with the magic string, then skip that */
-            if(!strncmp((const char *)sp,(const char *)magic,strlen((const char *)magic)))
-                sp += strlen((const char *)magic);
-            
-            /* It stops at the first '$', max 8 chars */
-            for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
-                continue;
-            
-            /* get the length of the true salt */
-            sl = ep - sp;
-            
-            MD5Init(&ctx);
-            
-            /* The password first, since that is what is most unknown */
-            MD5Update(&ctx,(const unsigned char *)pw,strlen(pw));
-            
-            /* Then our magic string */
-            MD5Update(&ctx,magic,strlen((const char *)magic));
-            
-            /* Then the raw salt */
-            MD5Update(&ctx,sp,sl);
-            
-            /* Then just as many characters of the MD5(pw,salt,pw) */
-            MD5Init(&ctx1);
-            MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
-            MD5Update(&ctx1,sp,sl);
-            MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
-            MD5Final(final,&ctx1);
-            
-            for(pl = strlen(pw); pl > 0; pl -= 16) {
-                int tl = pl > 16 ? 16 : pl;
-                MD5Update(&ctx,final,pl>16 ? 16 : pl);
-            }
-            
-            /* Don't leave anything around in vm they could use. */
-            memset(final,0,sizeof final);
-            
-            /* Then something really weird... */
-            for (i = strlen(pw); i ; i >>= 1) {
-                if(i&1)
-                    MD5Update(&ctx, final, 1);
-                else
-                    MD5Update(&ctx, (const unsigned char *)pw, 1);
-            }
-            
-            /* Now make the output string */
-            snprintf(passwd, sizeof(passwd), "%s%.*s$", (char *)magic,
-                    sl, (const char *)sp);
-            
-            MD5Final(final,&ctx);
-            
-            /*
-             * and now, just to make sure things don't run too fast
-             * On a 60 Mhz Pentium this takes 34 msec, so you would
-             * need 30 seconds to build a 1000 entry dictionary...
-             */
-            for(i=0;i<1000;i++) {
-                MD5Init(&ctx1);
-                if(i & 1)
-                    MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
-                else
-                    MD5Update(&ctx1,final,16);
-                
-                if(i % 3)
-                    MD5Update(&ctx1,sp,sl);
-                
-                if(i % 7)
-                    MD5Update(&ctx1,pw,strlen(pw));
-                
-                if(i & 1)
-                    MD5Update(&ctx1,final,16);
-                else
-                    MD5Update(&ctx1,pw,strlen(pw));
-                MD5Final(final,&ctx1);
-            }
-
-            p = passwd + strlen(passwd);
-            
-            l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
-            l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
-            l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
-            l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
-            l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
-            l =		       final[11]		; to64(p,l,2); p += 2;
-            *p = '\0';
-            
-            /* Don't leave anything around in vm they could use. */
-            memset(final,0,sizeof final);
-            
-            return passwd;
-        }            
-    }
-    critcl::cproc to64_c {Tcl_Interp* interp int v int n} ok {
-        char s[5];
-        to64(s, (unsigned int)v, n); 
-        Tcl_SetStringObj(Tcl_GetObjResult(interp), s, n);
-        return TCL_OK;
-    }
-
-    critcl::cproc md5crypt_c {Tcl_Interp* interp char* magic char* pw char* salt} ok {
-        char* s = md5crypt(pw, salt, magic);
-        Tcl_SetStringObj(Tcl_GetObjResult(interp), s, strlen(s));
-        return TCL_OK;
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/md5crypt/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-# package index for md5crypt
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded md5crypt 1.0.0 [list source [file join $dir md5crypt.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/mime/mime.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/mime/mime.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3899 +1,0 @@
-# mime.tcl - MIME body parts
-#
-# (c) 1999-2000 Marshall T. Rose
-# (c) 2000      Brent Welch
-# (c) 2000      Sandeep Tamhankar
-# (c) 2000      Dan Kuchler
-# (c) 2000-2001 Eric Melski
-# (c) 2001      Jeff Hobbs
-# (c) 2001-2007 Andreas Kupries
-# (c) 2002-2003 David Welton
-# (c) 2003-2006 Pat Thoyts
-# (c) 2005      Benjamin Riefenstahl
-#
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# Influenced by Borenstein's/Rose's safe-tcl (circa 1993) and Darren New's
-# unpublished package of 1999.
-#
-
-# new string features and inline scan are used, requiring 8.3.
-package require Tcl 8.3
-
-package provide mime 1.5.2
-
-if {[catch {package require Trf 2.0}]} {
-
-    # Fall-back to tcl-based procedures of base64 and quoted-printable encoders
-    # Warning!
-    # These are a fragile emulations of the more general calling sequence
-    # that appears to work with this code here.
-
-    package require base64 2.0
-    set ::major [lindex [split [package require md5] .] 0]
-
-    # Create these commands in the mime namespace so that they
-    # won't collide with things at the global namespace level
-
-    namespace eval ::mime {
-        proc base64 {-mode what -- chunk} {
-   	    return [base64::$what $chunk]
-        }
-        proc quoted-printable {-mode what -- chunk} {
-  	    return [mime::qp_$what $chunk]
-        }
-
-	if {$::major < 2} {
-	    # md5 v1, result is hex string ready for use.
-	    proc md5 {-- string} {
-		return [md5::md5 $string]
-	    }
-	} else {
-	    # md5 v2, need option to get hex string
-	    proc md5 {-- string} {
-		return [md5::md5 -hex $string]
-	    }
-	}
-    }
-
-    unset ::major
-}        
-
-#
-# state variables:
-#
-#     canonicalP: input is in its canonical form
-#     content: type/subtype
-#     params: seralized array of key/value pairs (keys are lower-case)
-#     encoding: transfer encoding
-#     version: MIME-version
-#     header: serialized array of key/value pairs (keys are lower-case)
-#     lowerL: list of header keys, lower-case
-#     mixedL: list of header keys, mixed-case
-#     value: either "file", "parts", or "string"
-#
-#     file: input file
-#     fd: cached file-descriptor, typically for root
-#     root: token for top-level part, for (distant) subordinates
-#     offset: number of octets from beginning of file/string
-#     count: length in octets of (encoded) content
-#
-#     parts: list of bodies (tokens)
-#
-#     string: input string
-#
-#     cid: last child-id assigned
-#
-
-
-namespace eval ::mime {
-    variable mime
-    array set mime { uid 0 cid 0 }
-
-# 822 lexemes
-    variable addrtokenL  [list ";"          ","         \
-                               "<"          ">"         \
-                               ":"          "."         \
-                               "("          ")"         \
-                               "@"          "\""        \
-                               "\["         "\]"        \
-                               "\\"]
-    variable addrlexemeL [list LX_SEMICOLON LX_COMMA    \
-                               LX_LBRACKET  LX_RBRACKET \
-                               LX_COLON     LX_DOT      \
-                               LX_LPAREN    LX_RPAREN   \
-                               LX_ATSIGN    LX_QUOTE    \
-                               LX_LSQUARE   LX_RSQUARE   \
-                               LX_QUOTE]
-
-# 2045 lexemes
-    variable typetokenL  [list ";"          ","         \
-                               "<"          ">"         \
-                               ":"          "?"         \
-                               "("          ")"         \
-                               "@"          "\""        \
-                               "\["         "\]"        \
-                               "="          "/"         \
-                               "\\"]
-    variable typelexemeL [list LX_SEMICOLON LX_COMMA    \
-                               LX_LBRACKET  LX_RBRACKET \
-                               LX_COLON     LX_QUESTION \
-                               LX_LPAREN    LX_RPAREN   \
-                               LX_ATSIGN    LX_QUOTE    \
-                               LX_LSQUARE   LX_RSQUARE  \
-                               LX_EQUALS    LX_SOLIDUS  \
-                               LX_QUOTE]
-
-    set encList [list \
-            ascii US-ASCII \
-            big5 Big5 \
-            cp1250 Windows-1250 \
-            cp1251 Windows-1251 \
-            cp1252 Windows-1252 \
-            cp1253 Windows-1253 \
-            cp1254 Windows-1254 \
-            cp1255 Windows-1255 \
-            cp1256 Windows-1256 \
-            cp1257 Windows-1257 \
-            cp1258 Windows-1258 \
-            cp437 IBM437 \
-            cp737 "" \
-            cp775 IBM775 \
-            cp850 IBM850 \
-            cp852 IBM852 \
-            cp855 IBM855 \
-            cp857 IBM857 \
-            cp860 IBM860 \
-            cp861 IBM861 \
-            cp862 IBM862 \
-            cp863 IBM863 \
-            cp864 IBM864 \
-            cp865 IBM865 \
-            cp866 IBM866 \
-            cp869 IBM869 \
-            cp874 "" \
-            cp932 "" \
-            cp936 GBK \
-            cp949 "" \
-            cp950 "" \
-            dingbats "" \
-	    ebcdic "" \
-            euc-cn EUC-CN \
-            euc-jp EUC-JP \
-            euc-kr EUC-KR \
-            gb12345 GB12345 \
-            gb1988 GB1988 \
-            gb2312 GB2312 \
-            iso2022 ISO-2022 \
-            iso2022-jp ISO-2022-JP \
-            iso2022-kr ISO-2022-KR \
-            iso8859-1 ISO-8859-1 \
-            iso8859-2 ISO-8859-2 \
-            iso8859-3 ISO-8859-3 \
-            iso8859-4 ISO-8859-4 \
-            iso8859-5 ISO-8859-5 \
-            iso8859-6 ISO-8859-6 \
-            iso8859-7 ISO-8859-7 \
-            iso8859-8 ISO-8859-8 \
-            iso8859-9 ISO-8859-9 \
-            iso8859-10 ISO-8859-10 \
-            iso8859-13 ISO-8859-13 \
-            iso8859-14 ISO-8859-14 \
-            iso8859-15 ISO-8859-15 \
-            iso8859-16 ISO-8859-16 \
-            jis0201 JIS_X0201 \
-            jis0208 JIS_C6226-1983 \
-            jis0212 JIS_X0212-1990 \
-            koi8-r KOI8-R \
-            koi8-u KOI8-U \
-            ksc5601 KS_C_5601-1987 \
-            macCentEuro "" \
-            macCroatian "" \
-            macCyrillic "" \
-            macDingbats "" \
-            macGreek "" \
-            macIceland "" \
-            macJapan "" \
-            macRoman "" \
-            macRomania "" \
-            macThai "" \
-            macTurkish "" \
-            macUkraine "" \
-            shiftjis Shift_JIS \
-            symbol "" \
-            tis-620 TIS-620 \
-            unicode "" \
-            utf-8 UTF-8]
-
-    variable encodings
-    array set encodings $encList
-    variable reversemap
-    foreach {enc mimeType} $encList {
-        if {$mimeType != ""} {
-            set reversemap([string tolower $mimeType]) $enc
-        }
-    } 
-
-    set encAliasList [list \
-            ascii ANSI_X3.4-1968 \
-            ascii iso-ir-6 \
-            ascii ANSI_X3.4-1986 \
-            ascii ISO_646.irv:1991 \
-            ascii ASCII \
-            ascii ISO646-US \
-            ascii us \
-            ascii IBM367 \
-            ascii cp367 \
-            cp437 cp437 \
-            cp437 437 \
-            cp775 cp775 \
-            cp850 cp850 \
-            cp850 850 \
-            cp852 cp852 \
-            cp852 852 \
-            cp855 cp855 \
-            cp855 855 \
-            cp857 cp857 \
-            cp857 857 \
-            cp860 cp860 \
-            cp860 860 \
-            cp861 cp861 \
-            cp861 861 \
-            cp861 cp-is \
-            cp862 cp862 \
-            cp862 862 \
-            cp863 cp863 \
-            cp863 863 \
-            cp864 cp864 \
-            cp865 cp865 \
-            cp865 865 \
-            cp866 cp866 \
-            cp866 866 \
-            cp869 cp869 \
-            cp869 869 \
-            cp869 cp-gr \
-            cp936 CP936 \
-            cp936 MS936 \
-            cp936 Windows-936 \
-            iso8859-1 ISO_8859-1:1987 \
-            iso8859-1 iso-ir-100 \
-            iso8859-1 ISO_8859-1 \
-            iso8859-1 latin1 \
-            iso8859-1 l1 \
-            iso8859-1 IBM819 \
-            iso8859-1 CP819 \
-            iso8859-2 ISO_8859-2:1987 \
-            iso8859-2 iso-ir-101 \
-            iso8859-2 ISO_8859-2 \
-            iso8859-2 latin2 \
-            iso8859-2 l2 \
-            iso8859-3 ISO_8859-3:1988 \
-            iso8859-3 iso-ir-109 \
-            iso8859-3 ISO_8859-3 \
-            iso8859-3 latin3 \
-            iso8859-3 l3 \
-            iso8859-4 ISO_8859-4:1988 \
-            iso8859-4 iso-ir-110 \
-            iso8859-4 ISO_8859-4 \
-            iso8859-4 latin4 \
-            iso8859-4 l4 \
-            iso8859-5 ISO_8859-5:1988 \
-            iso8859-5 iso-ir-144 \
-            iso8859-5 ISO_8859-5 \
-            iso8859-5 cyrillic \
-            iso8859-6 ISO_8859-6:1987 \
-            iso8859-6 iso-ir-127 \
-            iso8859-6 ISO_8859-6 \
-            iso8859-6 ECMA-114 \
-            iso8859-6 ASMO-708 \
-            iso8859-6 arabic \
-            iso8859-7 ISO_8859-7:1987 \
-            iso8859-7 iso-ir-126 \
-            iso8859-7 ISO_8859-7 \
-            iso8859-7 ELOT_928 \
-            iso8859-7 ECMA-118 \
-            iso8859-7 greek \
-            iso8859-7 greek8 \
-            iso8859-8 ISO_8859-8:1988 \
-            iso8859-8 iso-ir-138 \
-            iso8859-8 ISO_8859-8 \
-            iso8859-8 hebrew \
-            iso8859-9 ISO_8859-9:1989 \
-            iso8859-9 iso-ir-148 \
-            iso8859-9 ISO_8859-9 \
-            iso8859-9 latin5 \
-            iso8859-9 l5 \
-            iso8859-10 iso-ir-157 \
-            iso8859-10 l6 \
-            iso8859-10 ISO_8859-10:1992 \
-            iso8859-10 latin6 \
-            iso8859-14 iso-ir-199 \
-            iso8859-14 ISO_8859-14:1998 \
-            iso8859-14 ISO_8859-14 \
-            iso8859-14 latin8 \
-            iso8859-14 iso-celtic \
-            iso8859-14 l8 \
-            iso8859-15 ISO_8859-15 \
-            iso8859-15 Latin-9 \
-            iso8859-16 iso-ir-226 \
-            iso8859-16 ISO_8859-16:2001 \
-            iso8859-16 ISO_8859-16 \
-            iso8859-16 latin10 \
-            iso8859-16 l10 \
-            jis0201 X0201 \
-            jis0208 iso-ir-87 \
-            jis0208 x0208 \
-            jis0208 JIS_X0208-1983 \
-            jis0212 x0212 \
-            jis0212 iso-ir-159 \
-            ksc5601 iso-ir-149 \
-            ksc5601 KS_C_5601-1989 \
-            ksc5601 KSC5601 \
-            ksc5601 korean \
-            shiftjis MS_Kanji \
-            utf-8 UTF8]
-
-    foreach {enc mimeType} $encAliasList {
-        set reversemap([string tolower $mimeType]) $enc
-    }
-
-    namespace export initialize finalize getproperty \
-                     getheader setheader \
-                     getbody \
-                     copymessage \
-                     mapencoding \
-                     reversemapencoding \
-                     parseaddress \
-                     parsedatetime \
-                     uniqueID
-}
-
-# ::mime::initialize --
-#
-#	Creates a MIME part, and returnes the MIME token for that part.
-#
-# Arguments:
-#	args   Args can be any one of the following:
-#                  ?-canonical type/subtype
-#                  ?-param    {key value}?...
-#                  ?-encoding value?
-#                  ?-header   {key value}?... ?
-#                  (-file name | -string value | -parts {token1 ... tokenN})
-#
-#       If the -canonical option is present, then the body is in
-#       canonical (raw) form and is found by consulting either the -file,
-#       -string, or -part option. 
-#
-#       In addition, both the -param and -header options may occur zero
-#       or more times to specify "Content-Type" parameters (e.g.,
-#       "charset") and header keyword/values (e.g.,
-#       "Content-Disposition"), respectively. 
-#
-#       Also, -encoding, if present, specifies the
-#       "Content-Transfer-Encoding" when copying the body.
-#
-#       If the -canonical option is not present, then the MIME part
-#       contained in either the -file or the -string option is parsed,
-#       dynamically generating subordinates as appropriate.
-#
-# Results:
-#	An initialized mime token.
-
-proc ::mime::initialize {args} {
-    global errorCode errorInfo
-
-    variable mime
-
-    set token [namespace current]::[incr mime(uid)]
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[set code [catch { eval [linsert $args 0 mime::initializeaux $token] } \
-                         result]]} {
-        set ecode $errorCode
-        set einfo $errorInfo
-
-        catch { mime::finalize $token -subordinates dynamic }
-
-        return -code $code -errorinfo $einfo -errorcode $ecode $result
-    }
-
-    return $token
-}
-
-# ::mime::initializeaux --
-#
-#	Configures the MIME token created in mime::initialize based on
-#       the arguments that mime::initialize supports.
-#
-# Arguments:
-#       token  The MIME token to configure.
-#	args   Args can be any one of the following:
-#                  ?-canonical type/subtype
-#                  ?-param    {key value}?...
-#                  ?-encoding value?
-#                  ?-header   {key value}?... ?
-#                  (-file name | -string value | -parts {token1 ... tokenN})
-#
-# Results:
-#       Either configures the mime token, or throws an error.
-
-proc ::mime::initializeaux {token args} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set params [set state(params) ""]
-    set state(encoding) ""
-    set state(version) "1.0"
-
-    set state(header) ""
-    set state(lowerL) ""
-    set state(mixedL) ""
-
-    set state(cid) 0
-
-    set argc [llength $args]
-    for {set argx 0} {$argx < $argc} {incr argx} {
-        set option [lindex $args $argx]
-        if {[incr argx] >= $argc} {
-            error "missing argument to $option"
-        }
-	set value [lindex $args $argx]
-
-        switch -- $option {
-            -canonical {
-                set state(content) [string tolower $value]
-            }
-
-            -param {
-                if {[llength $value] != 2} {
-                    error "-param expects a key and a value, not $value"
-                }
-                set lower [string tolower [set mixed [lindex $value 0]]]
-                if {[info exists params($lower)]} {
-                    error "the $mixed parameter may be specified at most once"
-                }
-
-                set params($lower) [lindex $value 1]
-                set state(params) [array get params]
-            }
-
-            -encoding {
-                switch -- [set state(encoding) [string tolower $value]] {
-                    7bit - 8bit - binary - quoted-printable - base64 {
-                    }
-
-                    default {
-                        error "unknown value for -encoding $state(encoding)"
-                    }
-                }
-            }
-
-            -header {
-                if {[llength $value] != 2} {
-                    error "-header expects a key and a value, not $value"
-                }
-                set lower [string tolower [set mixed [lindex $value 0]]]
-                if {![string compare $lower content-type]} {
-                    error "use -canonical instead of -header $value"
-                }
-                if {![string compare $lower content-transfer-encoding]} {
-                    error "use -encoding instead of -header $value"
-                }
-                if {(![string compare $lower content-md5]) \
-                        || (![string compare $lower mime-version])} {
-                    error "don't go there..."
-                }
-                if {[lsearch -exact $state(lowerL) $lower] < 0} {
-                    lappend state(lowerL) $lower
-                    lappend state(mixedL) $mixed
-                }               
-
-                array set header $state(header)
-                lappend header($lower) [lindex $value 1]
-                set state(header) [array get header]
-            }
-
-            -file {
-                set state(file) $value
-            }
-
-            -parts {
-                set state(parts) $value
-            }
-
-            -string {
-                set state(string) $value
-
-		set state(lines) [split $value "\n"]
-		set state(lines.count) [llength $state(lines)]
-		set state(lines.current) 0
-            }
-
-            -root {
-                # the following are internal options
-
-                set state(root) $value
-            }
-
-            -offset {
-                set state(offset) $value
-            }
-
-            -count {
-                set state(count) $value
-            }
-
-	    -lineslist { 
-		set state(lines) $value 
-		set state(lines.count) [llength $state(lines)]
-		set state(lines.current) 0
-		#state(string) is needed, but will be built when required
-		set state(string) ""
-	    }
-
-            default {
-                error "unknown option $option"
-            }
-        }
-    }
-
-    #We only want one of -file, -parts or -string:
-    set valueN 0
-    foreach value [list file parts string] {
-        if {[info exists state($value)]} {
-            set state(value) $value
-            incr valueN
-        }
-    }
-    if {$valueN != 1 && ![info exists state(lines)]} {
-        error "specify exactly one of -file, -parts, or -string"
-    }
-
-    if {[set state(canonicalP) [info exists state(content)]]} {
-        switch -- $state(value) {
-            file {
-                set state(offset) 0
-            }
-
-            parts {
-                switch -glob -- $state(content) {
-                    text/*
-                        -
-                    image/*
-                        -
-                    audio/*
-                        -
-                    video/* {
-                        error "-canonical $state(content) and -parts do not mix"
-                    }
-    
-                    default {
-                        if {[string compare $state(encoding) ""]} {
-                            error "-encoding and -parts do not mix"
-                        }
-                    }
-                }
-            }
-	    default {# Go ahead}
-        }
-
-        if {[lsearch -exact $state(lowerL) content-id] < 0} {
-            lappend state(lowerL) content-id
-            lappend state(mixedL) Content-ID
-
-            array set header $state(header)
-            lappend header(content-id) [uniqueID]
-            set state(header) [array get header]
-        }
-
-        set state(version) 1.0
-
-        return
-    }
-
-    if {[string compare $state(params) ""]} {
-        error "-param requires -canonical"
-    }
-    if {[string compare $state(encoding) ""]} {
-        error "-encoding requires -canonical"
-    }
-    if {[string compare $state(header) ""]} {
-        error "-header requires -canonical"
-    }
-    if {[info exists state(parts)]} {
-        error "-parts requires -canonical"
-    }
-
-    if {[set fileP [info exists state(file)]]} {
-        if {[set openP [info exists state(root)]]} {
-	    # FRINK: nocheck
-            variable $state(root)
-            upvar 0 $state(root) root
-
-            set state(fd) $root(fd)
-        } else {
-            set state(root) $token
-            set state(fd) [open $state(file) { RDONLY }]
-            set state(offset) 0
-            seek $state(fd) 0 end
-            set state(count) [tell $state(fd)]
-
-            fconfigure $state(fd) -translation binary
-        }
-    }
-
-    set code [catch { mime::parsepart $token } result]
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    if {$fileP} {
-        if {!$openP} {
-            unset state(root)
-            catch { close $state(fd) }
-        }
-        unset state(fd)
-    }
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::mime::parsepart --
-#
-#       Parses the MIME headers and attempts to break up the message
-#       into its various parts, creating a MIME token for each part.
-#
-# Arguments:
-#       token  The MIME token to parse.
-#
-# Results:
-#       Throws an error if it has problems parsing the MIME token,
-#       otherwise it just sets up the appropriate variables.
-
-proc ::mime::parsepart {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[set fileP [info exists state(file)]]} {
-        seek $state(fd) [set pos $state(offset)] start
-        set last [expr {$state(offset)+$state(count)-1}]
-    } else {
-        set string $state(string)
-    }
-
-    set vline ""
-    while {1} {
-        set blankP 0
-        if {$fileP} {
-            if {($pos > $last) || ([set x [gets $state(fd) line]] <= 0)} {
-                set blankP 1
-            } else {
-                incr pos [expr {$x+1}]
-            }
-        } else {
-
-	    if { $state(lines.current) >= $state(lines.count) } {
-		set blankP 1
-		set line ""
-	    } else {
-		set line [lindex $state(lines) $state(lines.current)]
-		incr state(lines.current)
-		set x [string length $line]
-		if { $x == 0 } { set blankP 1 }
-	    }
-
-        }
-
-         if {(!$blankP) && ([string last "\r" $line] == [expr {$x-1}])} {
-	    
-             set line [string range $line 0 [expr {$x-2}]]
-             if {$x == 1} {
-                 set blankP 1
-             }
-         }
-
-        if {(!$blankP) \
-                && (([string first " " $line] == 0) \
-                        || ([string first "\t" $line] == 0))} {
-            append vline "\n" $line
-            continue
-        }      
-
-        if {![string compare $vline ""]} {
-            if {$blankP} {
-                break
-            }
-
-            set vline $line
-            continue
-        }
-
-        if {([set x [string first ":" $vline]] <= 0) \
-                || (![string compare \
-                             [set mixed \
-                                  [string trimright \
-                                          [string range \
-                                                  $vline 0 [expr {$x-1}]]]] \
-                            ""])} {
-            error "improper line in header: $vline"
-        }
-        set value [string trim [string range $vline [expr {$x+1}] end]]
-        switch -- [set lower [string tolower $mixed]] {
-            content-type {
-                if {[info exists state(content)]} {
-                    error "multiple Content-Type fields starting with $vline"
-                }
-
-                if {![catch { set x [parsetype $token $value] }]} {
-                    set state(content) [lindex $x 0]
-                    set state(params) [lindex $x 1]
-                }
-            }
-
-            content-md5 {
-            }
-
-            content-transfer-encoding {
-                if {([string compare $state(encoding) ""]) \
-                        && ([string compare $state(encoding) \
-                                    [string tolower $value]])} {
-                    error "multiple Content-Transfer-Encoding fields starting with $vline"
-                }
-
-                set state(encoding) [string tolower $value]
-            }
-
-            mime-version {
-                set state(version) $value
-            }
-
-            default {
-                if {[lsearch -exact $state(lowerL) $lower] < 0} {
-                    lappend state(lowerL) $lower
-                    lappend state(mixedL) $mixed
-                }
-
-                array set header $state(header)
-                lappend header($lower) $value
-                set state(header) [array get header]
-            }
-        }
-
-        if {$blankP} {
-            break
-        }
-        set vline $line
-    }
-
-    if {![info exists state(content)]} {
-        set state(content) text/plain
-        set state(params) [list charset us-ascii]
-    }
-
-    if {![string match multipart/* $state(content)]} {
-        if {$fileP} {
-            set x [tell $state(fd)]
-            incr state(count) [expr {$state(offset)-$x}]
-            set state(offset) $x
-        } else {
-	    # rebuild string, this is cheap and needed by other functions    
-	    set state(string) [join [lrange $state(lines) \
-					 $state(lines.current) end] "\n"]
-        }
-
-        if {[string match message/* $state(content)]} {
-	    # FRINK: nocheck
-            variable [set child $token-[incr state(cid)]]
-
-            set state(value) parts
-            set state(parts) $child
-            if {$fileP} {
-                mime::initializeaux $child \
-                    -file $state(file) -root $state(root) \
-                    -offset $state(offset) -count $state(count)
-            } else {
-		mime::initializeaux $child \
-		    -lineslist [lrange $state(lines) \
-				    $state(lines.current) end] 
-            }
-        }
-
-        return
-    } 
-
-    set state(value) parts
-
-    set boundary ""
-    foreach {k v} $state(params) {
-        if {![string compare $k boundary]} {
-            set boundary $v
-            break
-        }
-    }
-    if {![string compare $boundary ""]} {
-        error "boundary parameter is missing in $state(content)"
-    }
-    if {![string compare [string trim $boundary] ""]} {
-        error "boundary parameter is empty in $state(content)"
-    }
-
-    if {$fileP} {
-        set pos [tell $state(fd)]
-    }
-
-    set inP 0
-    set moreP 1
-    while {$moreP} {
-        if {$fileP} {
-            if {$pos > $last} {
-                 error "termination string missing in $state(content)"
-                 set line "--$boundary--"
-            } else {
-              if {[set x [gets $state(fd) line]] < 0} {
-                  error "end-of-file encountered while parsing $state(content)"
-              }
-           }
-            incr pos [expr {$x+1}]
-        } else {
-
-	    if { $state(lines.current) >= $state(lines.count) } {
-		error "end-of-string encountered while parsing $state(content)"
-	    } else {
-		set line [lindex $state(lines) $state(lines.current)]
-		incr state(lines.current)
-		set x [string length $line]
-	    }
-
-            set x [string length $line]
-        }
-        if {[string last "\r" $line] == [expr {$x-1}]} {
-            set line [string range $line 0 [expr {$x-2}]]
-        }
-
-        if {[string first "--$boundary" $line] != 0} {
-             if {$inP && !$fileP} {
- 		lappend start $line
-             }
-
-             continue
-        }
-
-        if {!$inP} {
-            if {![string compare $line "--$boundary"]} {
-                set inP 1
-                if {$fileP} {
-                    set start $pos
-                } else {
-		    set start [list]
-                }
-            }
-
-            continue
-        }
-
-        if {([set moreP [string compare $line "--$boundary--"]]) \
-                && ([string compare $line "--$boundary"])} {
-            if {$inP && !$fileP} {
-		lappend start $line
-            }
-            continue
-        }
-	# FRINK: nocheck
-        variable [set child $token-[incr state(cid)]]
-
-        lappend state(parts) $child
-
-        if {$fileP} {
-            if {[set count [expr {$pos-($start+$x+3)}]] < 0} {
-                set count 0
-            }
-
-            mime::initializeaux $child \
-                -file $state(file) -root $state(root) \
-                -offset $start -count $count
-
-            seek $state(fd) [set start $pos] start
-        } else {
-	    mime::initializeaux $child -lineslist $start
-            set start ""
-        }
-    }
-}
-
-# ::mime::parsetype --
-#
-#       Parses the string passed in and identifies the content-type and
-#       params strings.
-#
-# Arguments:
-#       token  The MIME token to parse.
-#       string The content-type string that should be parsed.
-#
-# Results:
-#       Returns the content and params for the string as a two element
-#       tcl list.
-
-proc ::mime::parsetype {token string} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    variable typetokenL
-    variable typelexemeL
-
-    set state(input)   $string
-    set state(buffer)  ""
-    set state(lastC)   LX_END
-    set state(comment) ""
-    set state(tokenL)  $typetokenL
-    set state(lexemeL) $typelexemeL
-
-    set code [catch { mime::parsetypeaux $token $string } result]    
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    unset state(input)   \
-          state(buffer)  \
-          state(lastC)   \
-          state(comment) \
-          state(tokenL)  \
-          state(lexemeL)
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::mime::parsetypeaux --
-#
-#       A helper function for mime::parsetype.  Parses the specified
-#       string looking for the content type and params.
-#
-# Arguments:
-#       token  The MIME token to parse.
-#       string The content-type string that should be parsed.
-#
-# Results:
-#       Returns the content and params for the string as a two element
-#       tcl list.
-
-proc ::mime::parsetypeaux {token string} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[string compare [parselexeme $token] LX_ATOM]} {
-        error [format "expecting type (found %s)" $state(buffer)]
-    }
-    set type [string tolower $state(buffer)]
-
-    switch -- [parselexeme $token] {
-        LX_SOLIDUS {
-        }
-
-        LX_END {
-            if {[string compare $type message]} {
-                error "expecting type/subtype (found $type)"
-            }
-
-            return [list message/rfc822 ""]
-        }
-
-        default {
-            error [format "expecting \"/\" (found %s)" $state(buffer)]
-        }
-    }
-
-    if {[string compare [parselexeme $token] LX_ATOM]} {
-        error [format "expecting subtype (found %s)" $state(buffer)]
-    }
-    append type [string tolower /$state(buffer)]
-
-    array set params ""
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_END {
-                return [list $type [array get params]]
-            }
-
-            LX_SEMICOLON {
-            }
-
-            default {
-                error [format "expecting \";\" (found %s)" $state(buffer)]
-            }
-        }
-
-        switch -- [parselexeme $token] {
-            LX_END {
-                return [list $type [array get params]]
-            }
-
-            LX_ATOM {
-            }
-
-            default {
-                error [format "expecting attribute (found %s)" $state(buffer)]
-            }
-        }
-
-        set attribute [string tolower $state(buffer)]
-
-        if {[string compare [parselexeme $token] LX_EQUALS]} {
-            error [format "expecting \"=\" (found %s)" $state(buffer)]
-        }
-
-        switch -- [parselexeme $token] {
-            LX_ATOM {
-            }
-
-            LX_QSTRING {
-                set state(buffer) \
-                    [string range $state(buffer) 1 \
-                            [expr {[string length $state(buffer)]-2}]]
-            }
-
-            default {
-                error [format "expecting value (found %s)" $state(buffer)]
-            }
-        }
-        set params($attribute) $state(buffer)
-    }
-}
-
-# ::mime::finalize --
-#
-#   mime::finalize destroys a MIME part.
-#
-#   If the -subordinates option is present, it specifies which
-#   subordinates should also be destroyed. The default value is
-#   "dynamic".
-#
-# Arguments:
-#       token  The MIME token to parse.
-#       args   Args can be optionally be of the following form:
-#              ?-subordinates "all" | "dynamic" | "none"?
-#
-# Results:
-#       Returns an empty string.
-
-proc ::mime::finalize {token args} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options [list -subordinates dynamic]
-    array set options $args
-
-    switch -- $options(-subordinates) {
-        all {
-            if {![string compare $state(value) parts]} {
-                foreach part $state(parts) {
-                    eval [linsert $args 0 mime::finalize $part]
-                }
-            }
-        }
-
-        dynamic {
-            for {set cid $state(cid)} {$cid > 0} {incr cid -1} {
-                eval [linsert $args 0 mime::finalize $token-$cid]
-            }
-        }
-
-        none {
-        }
-
-        default {
-            error "unknown value for -subordinates $options(-subordinates)"
-        }
-    }
-
-    foreach name [array names state] {
-        unset state($name)
-    }
-    # FRINK: nocheck
-    unset $token
-}
-
-# ::mime::getproperty --
-#
-#   mime::getproperty returns the properties of a MIME part.
-#
-#   The properties are:
-#
-#       property    value
-#       ========    =====
-#       content     the type/subtype describing the content
-#       encoding    the "Content-Transfer-Encoding"
-#       params      a list of "Content-Type" parameters
-#       parts       a list of tokens for the part's subordinates
-#       size        the approximate size of the content (unencoded)
-#
-#   The "parts" property is present only if the MIME part has
-#   subordinates.
-#
-#   If mime::getproperty is invoked with the name of a specific
-#   property, then the corresponding value is returned; instead, if
-#   -names is specified, a list of all properties is returned;
-#   otherwise, a serialized array of properties and values is returned.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       property   One of 'content', 'encoding', 'params', 'parts', and
-#                  'size'. Defaults to returning a serialized array of
-#                  properties and values.
-#
-# Results:
-#       Returns the properties of a MIME part
-
-proc ::mime::getproperty {token {property ""}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -- $property {
-        "" {
-            array set properties [list content  $state(content) \
-                                       encoding $state(encoding) \
-                                       params   $state(params) \
-                                       size     [getsize $token]]
-            if {[info exists state(parts)]} {
-                set properties(parts) $state(parts)
-            }
-
-            return [array get properties]
-        }
-
-        -names {
-            set names [list content encoding params]
-            if {[info exists state(parts)]} {
-                lappend names parts
-            }
-
-            return $names
-        }
-
-        content
-            -
-        encoding
-            -
-        params {
-            return $state($property)
-        }
-
-        parts {
-            if {![info exists state(parts)]} {
-                error "MIME part is a leaf"
-            }
-
-            return $state(parts)
-        }
-
-        size {
-            return [getsize $token]
-        }
-
-        default {
-            error "unknown property $property"
-        }
-    }
-}
-
-# ::mime::getsize --
-#
-#    Determine the size (in bytes) of a MIME part/token
-#
-# Arguments:
-#       token      The MIME token to parse.
-#
-# Results:
-#       Returns the size in bytes of the MIME token.
-
-proc ::mime::getsize {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -- $state(value)/$state(canonicalP) {
-        file/0 {
-            set size $state(count)
-        }
-
-        file/1 {
-            return [file size $state(file)]
-        }
-
-        parts/0
-            -
-        parts/1 {
-            set size 0
-            foreach part $state(parts) {
-                incr size [getsize $part]
-            }
-
-            return $size
-        }
-
-        string/0 {
-            set size [string length $state(string)]
-        }
-
-        string/1 {
-            return [string length $state(string)]
-        }
-	default {
-	    error "Unknown combination \"$state(value)/$state(canonicalP)\""
-	}
-    }
-
-    if {![string compare $state(encoding) base64]} {
-        set size [expr {($size*3+2)/4}]
-    }
-
-    return $size
-}
-
-# ::mime::getheader --
-#
-#    mime::getheader returns the header of a MIME part.
-#
-#    A header consists of zero or more key/value pairs. Each value is a
-#    list containing one or more strings.
-#
-#    If mime::getheader is invoked with the name of a specific key, then
-#    a list containing the corresponding value(s) is returned; instead,
-#    if -names is specified, a list of all keys is returned; otherwise, a
-#    serialized array of keys and values is returned. Note that when a
-#    key is specified (e.g., "Subject"), the list returned usually
-#    contains exactly one string; however, some keys (e.g., "Received")
-#    often occur more than once in the header, accordingly the list
-#    returned usually contains more than one string.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       key        Either a key or '-names'.  If it is '-names' a list
-#                  of all keys is returned.
-#
-# Results:
-#       Returns the header of a MIME part.
-
-proc ::mime::getheader {token {key ""}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set header $state(header)
-    switch -- $key {
-        "" {
-            set result ""
-            foreach lower $state(lowerL) mixed $state(mixedL) {
-                lappend result $mixed $header($lower)
-            }
-            return $result
-        }
-
-        -names {
-            return $state(mixedL)
-        }
-
-        default {
-            set lower [string tolower [set mixed $key]]
-
-            if {![info exists header($lower)]} {
-                error "key $mixed not in header"
-            }
-            return $header($lower)
-        }
-    }
-}
-
-# ::mime::setheader --
-#
-#    mime::setheader writes, appends to, or deletes the value associated
-#    with a key in the header.
-#
-#    The value for -mode is one of: 
-#
-#       write: the key/value is either created or overwritten (the
-#       default);
-#
-#       append: a new value is appended for the key (creating it as
-#       necessary); or,
-#
-#       delete: all values associated with the key are removed (the
-#       "value" parameter is ignored).
-#
-#    Regardless, mime::setheader returns the previous value associated
-#    with the key.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       key        The name of the key whose value should be set.
-#       value      The value for the header key to be set to.
-#       args       An optional argument of the form:
-#                  ?-mode "write" | "append" | "delete"?
-#
-# Results:
-#       Returns previous value associated with the specified key.
-
-proc ::mime::setheader {token key value args} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options [list -mode write]
-    array set options $args
-
-    switch -- [set lower [string tolower $key]] {
-        content-md5
-            -
-        content-type
-            -
-        content-transfer-encoding
-            -
-        mime-version {
-            error "key $key may not be set"
-        }
-	default {# Skip key}
-    }
-
-    array set header $state(header)
-    if {[set x [lsearch -exact $state(lowerL) $lower]] < 0} {
-        if {![string compare $options(-mode) delete]} {
-            error "key $key not in header"
-        }
-
-        lappend state(lowerL) $lower
-        lappend state(mixedL) $key
-
-        set result ""
-    } else {
-        set result $header($lower)
-    }
-    switch -- $options(-mode) {
-        append {
-            lappend header($lower) $value
-        }
-
-        delete {
-            unset header($lower)
-            set state(lowerL) [lreplace $state(lowerL) $x $x]
-            set state(mixedL) [lreplace $state(mixedL) $x $x]
-        }
-
-        write {
-            set header($lower) [list $value]
-        }
-
-        default {
-            error "unknown value for -mode $options(-mode)"
-        }
-    }
-
-    set state(header) [array get header]
-
-    return $result
-}
-
-# ::mime::getbody --
-#
-#    mime::getbody returns the body of a leaf MIME part in canonical form.
-#
-#    If the -command option is present, then it is repeatedly invoked
-#    with a fragment of the body as this:
-#
-#        uplevel #0 $callback [list "data" $fragment]
-#
-#    (The -blocksize option, if present, specifies the maximum size of
-#    each fragment passed to the callback.)
-#    When the end of the body is reached, the callback is invoked as:
-#
-#        uplevel #0 $callback "end"
-#
-#    Alternatively, if an error occurs, the callback is invoked as:
-#
-#        uplevel #0 $callback [list "error" reason]
-#
-#    Regardless, the return value of the final invocation of the callback
-#    is propagated upwards by mime::getbody.
-#
-#    If the -command option is absent, then the return value of
-#    mime::getbody is a string containing the MIME part's entire body.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       args       Optional arguments of the form:
-#                  ?-decode? ?-command callback ?-blocksize octets? ?
-#
-# Results:
-#       Returns a string containing the MIME part's entire body, or
-#       if '-command' is specified, the return value of the command
-#       is returned.
-
-proc ::mime::getbody {token args} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set decode 0
-    if {[set pos [lsearch -exact $args -decode]] >= 0} {
-        set decode 1
-        set args [lreplace $args $pos $pos]
-    }
-
-    array set options [list -command [list mime::getbodyaux $token] \
-                            -blocksize 4096]
-    array set options $args
-    if {$options(-blocksize) < 1} {
-        error "-blocksize expects a positive integer, not $options(-blocksize)"
-    }
-
-    set code 0
-    set ecode ""
-    set einfo ""
-
-    switch -- $state(value)/$state(canonicalP) {
-        file/0 {
-            set fd [open $state(file) { RDONLY }]
-
-            set code [catch {
-                fconfigure $fd -translation binary
-                seek $fd [set pos $state(offset)] start
-                set last [expr {$state(offset)+$state(count)-1}]
-
-                set fragment ""
-                while {$pos <= $last} {
-                    if {[set cc [expr {($last-$pos)+1}]] \
-                            > $options(-blocksize)} {
-                        set cc $options(-blocksize)
-                    }
-                    incr pos [set len \
-                                  [string length [set chunk [read $fd $cc]]]]
-                    switch -exact -- $state(encoding) {
-                        base64
-                            -
-                        quoted-printable {
-                            if {([set x [string last "\n" $chunk]] > 0) \
-                                    && ($x+1 != $len)} {
-                                set chunk [string range $chunk 0 $x]
-                                seek $fd [incr pos [expr {($x+1)-$len}]] start
-                            }
-                            set chunk [$state(encoding) -mode decode \
-                                                        -- $chunk]
-                        }
-			7bit - 8bit - binary - "" {
-			    # Bugfix for [#477088]
-			    # Go ahead, leave chunk alone
-			}
-			default {
-			    error "Can't handle content encoding \"$state(encoding)\""
-			}
-                    }
-                    append fragment $chunk
-
-                    set cc [expr {$options(-blocksize)-1}]
-                    while {[string length $fragment] > $options(-blocksize)} {
-                        uplevel #0 $options(-command) \
-                                   [list data \
-                                         [string range $fragment 0 $cc]]
-
-                        set fragment [string range \
-                                             $fragment $options(-blocksize) \
-                                             end]
-                    }
-                }
-                if {[string length $fragment] > 0} {
-                    uplevel #0 $options(-command) [list data $fragment]
-                }
-            } result]
-            set ecode $errorCode
-            set einfo $errorInfo
-
-            catch { close $fd }
-        }
-
-        file/1 {
-            set fd [open $state(file) { RDONLY }]
-
-            set code [catch {
-                fconfigure $fd -translation binary
-
-                while {[string length \
-                               [set fragment \
-                                    [read $fd $options(-blocksize)]]] > 0} {
-                    uplevel #0 $options(-command) [list data $fragment]
-                }
-            } result]
-            set ecode $errorCode
-            set einfo $errorInfo
-
-            catch { close $fd }
-        }
-
-        parts/0
-            -
-        parts/1 {
-            error "MIME part isn't a leaf"
-        }
-
-        string/0
-            -
-        string/1 {
-            switch -- $state(encoding)/$state(canonicalP) {
-                base64/0
-                    -
-                quoted-printable/0 {
-                    set fragment [$state(encoding) -mode decode \
-                                                   -- $state(string)]
-                }
-
-                default {
-		    # Not a bugfix for [#477088], but clarification
-		    # This handles no-encoding, 7bit, 8bit, and binary.
-                    set fragment $state(string)
-                }
-            }
-
-            set code [catch {
-                set cc [expr {$options(-blocksize)-1}]
-                while {[string length $fragment] > $options(-blocksize)} {
-                    uplevel #0 $options(-command) \
-                            [list data [string range $fragment 0 $cc]]
-
-                    set fragment [string range $fragment \
-                                         $options(-blocksize) end]
-                }
-                if {[string length $fragment] > 0} {
-                    uplevel #0 $options(-command) [list data $fragment]
-                }
-            } result]
-            set ecode $errorCode
-            set einfo $errorInfo
-	}
-	default {
-	    error "Unknown combination \"$state(value)/$state(canonicalP)\""
-	}
-    }
-
-    set code [catch {
-        if {$code} {
-            uplevel #0 $options(-command) [list error $result]
-        } else {
-            uplevel #0 $options(-command) [list end]
-        }
-    } result]
-    set ecode $errorCode
-    set einfo $errorInfo    
-
-    if {$code} {
-        return -code $code -errorinfo $einfo -errorcode $ecode $result
-    }
-
-    if {$decode} {
-        array set params [mime::getproperty $token params]
-
-        if {[info exists params(charset)]} {
-            set charset $params(charset)
-        } else {
-            set charset US-ASCII
-        }
-
-        set enc [reversemapencoding $charset]
-        if {$enc != ""} {
-            set result [::encoding convertfrom $enc $result]
-        } else {
-            return -code error "-decode failed: can't reversemap charset $charset"
-        }
-    }
-
-    return $result
-}
-
-# ::mime::getbodyaux --
-#
-#    Builds up the body of the message, fragment by fragment.  When
-#    the entire message has been retrieved, it is returned.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       reason     One of 'data', 'end', or 'error'.
-#       fragment   The section of data data fragment to extract a
-#                  string from.
-#
-# Results:
-#       Returns nothing, except when called with the 'end' argument
-#       in which case it returns a string that contains all of the
-#       data that 'getbodyaux' has been called with.  Will throw an
-#       error if it is called with the reason of 'error'.
-
-proc ::mime::getbodyaux {token reason {fragment ""}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -- $reason {
-        data {
-            append state(getbody) $fragment
-	    return ""
-        }
-
-        end {
-            if {[info exists state(getbody)]} {
-                set result $state(getbody)
-                unset state(getbody)
-            } else {
-                set result ""
-            }
-
-            return $result
-        }
-
-        error {
-            catch { unset state(getbody) }
-            error $reason
-        }
-
-	default {
-	    error "Unknown reason \"$reason\""
-	}
-    }
-}
-
-# ::mime::copymessage --
-#
-#    mime::copymessage copies the MIME part to the specified channel.
-#
-#    mime::copymessage operates synchronously, and uses fileevent to
-#    allow asynchronous operations to proceed independently.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       channel    The channel to copy the message to.
-#
-# Results:
-#       Returns nothing unless an error is thrown while the message
-#       is being written to the channel.
-
-proc ::mime::copymessage {token channel} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set openP [info exists state(fd)]
-
-    set code [catch { mime::copymessageaux $token $channel } result]
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    if {(!$openP) && ([info exists state(fd)])} {
-        if {![info exists state(root)]} {
-            catch { close $state(fd) }
-        }
-        unset state(fd)
-    }
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::mime::copymessageaux --
-#
-#    mime::copymessageaux copies the MIME part to the specified channel.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#       channel    The channel to copy the message to.
-#
-# Results:
-#       Returns nothing unless an error is thrown while the message
-#       is being written to the channel.
-
-proc ::mime::copymessageaux {token channel} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set header $state(header)
-
-    if {[string compare $state(version) ""]} {
-        puts $channel "MIME-Version: $state(version)"
-    }
-    foreach lower $state(lowerL) mixed $state(mixedL) {
-        foreach value $header($lower) {
-            puts $channel "$mixed: $value"
-        }
-    }
-    if {(!$state(canonicalP)) \
-            && ([string compare [set encoding $state(encoding)] ""])} {
-        puts $channel "Content-Transfer-Encoding: $encoding"
-    }
-
-    puts -nonewline $channel "Content-Type: $state(content)"
-    set boundary ""
-    foreach {k v} $state(params) {
-        if {![string compare $k boundary]} {
-            set boundary $v
-        }
-
-        puts -nonewline $channel ";\n              $k=\"$v\""
-    }
-
-    set converter ""
-    set encoding ""
-    if {[string compare $state(value) parts]} {
-        puts $channel ""
-
-        if {$state(canonicalP)} {
-            if {![string compare [set encoding $state(encoding)] ""]} {
-                set encoding [encoding $token]
-            }
-            if {[string compare $encoding ""]} {
-                puts $channel "Content-Transfer-Encoding: $encoding"
-            }
-            switch -- $encoding {
-                base64
-                    -
-                quoted-printable {
-                    set converter $encoding
-                }
-		7bit - 8bit - binary - "" {
-		    # Bugfix for [#477088], also [#539952]
-		    # Go ahead
-		}
-		default {
-		    error "Can't handle content encoding \"$encoding\""
-		}
-            }
-        }
-    } elseif {([string match multipart/* $state(content)]) \
-                    && (![string compare $boundary ""])} {
-# we're doing everything in one pass...
-        set key [clock seconds]$token[info hostname][array get state]
-        set seqno 8
-        while {[incr seqno -1] >= 0} {
-            set key [md5 -- $key]
-        }
-        set boundary "----- =_[string trim [base64 -mode encode -- $key]]"
-
-        puts $channel ";\n              boundary=\"$boundary\""
-    } else {
-        puts $channel ""
-    }
-
-    if {[info exists state(error)]} {
-        unset state(error)
-    }
-                
-    switch -- $state(value) {
-        file {
-            set closeP 1
-            if {[info exists state(root)]} {
-		# FRINK: nocheck
-                variable $state(root)
-                upvar 0 $state(root) root 
-
-                if {[info exists root(fd)]} {
-                    set fd $root(fd)
-                    set closeP 0
-                } else {
-                    set fd [set state(fd) \
-                                [open $state(file) { RDONLY }]]
-                }
-                set size $state(count)
-            } else {
-                set fd [set state(fd) [open $state(file) { RDONLY }]]
-		# read until eof
-                set size -1
-            }
-            seek $fd $state(offset) start
-            if {$closeP} {
-                fconfigure $fd -translation binary
-            }
-
-            puts $channel ""
-
-	    while {($size != 0) && (![eof $fd])} {
-		if {$size < 0 || $size > 32766} {
-		    set X [read $fd 32766]
-		} else {
-		    set X [read $fd $size]
-		}
-		if {$size > 0} {
-		    set size [expr {$size - [string length $X]}]
-		}
-		if {[string compare $converter ""]} {
-		    puts -nonewline $channel [$converter -mode encode -- $X]
-		} else {
-		    puts -nonewline $channel $X
-		}
-	    }
-
-            if {$closeP} {
-                catch { close $state(fd) }
-                unset state(fd)
-            }
-        }
-
-        parts {
-            if {(![info exists state(root)]) \
-                    && ([info exists state(file)])} {
-                set state(fd) [open $state(file) { RDONLY }]
-                fconfigure $state(fd) -translation binary
-            }
-
-            switch -glob -- $state(content) {
-                message/* {
-                    puts $channel ""
-                    foreach part $state(parts) {
-                        mime::copymessage $part $channel
-                        break
-                    }
-                }
-
-                default {
-		    # Note RFC 2046: See buildmessageaux for details.
-
-                    foreach part $state(parts) {
-                        puts $channel "\n--$boundary"
-                        mime::copymessage $part $channel
-                    }
-                    puts $channel "\n--$boundary--"
-                }
-            }
-
-            if {[info exists state(fd)]} {
-                catch { close $state(fd) }
-                unset state(fd)
-            }
-        }
-
-        string {
-            if {[catch { fconfigure $channel -buffersize } blocksize]} {
-                set blocksize 4096
-            } elseif {$blocksize < 512} {
-                set blocksize 512
-            }
-            set blocksize [expr {($blocksize/4)*3}]
-
-	    # [893516]
-	    fconfigure $channel -buffersize $blocksize
-
-            puts $channel ""
-
-            if {[string compare $converter ""]} {
-                puts -nonewline $channel [$converter -mode encode -- $state(string)]
-            } else {
-		puts -nonewline $channel $state(string)
-	    }
-        }
-	default {
-	    error "Unknown value \"$state(value)\""
-	}
-    }
-
-    flush $channel
-
-    if {[info exists state(error)]} {
-        error $state(error)
-    }
-}
-
-# ::mime::buildmessage --
-#
-#     The following is a clone of the copymessage code to build up the
-#     result in memory, and, unfortunately, without using a memory channel.
-#     I considered parameterizing the "puts" calls in copy message, but
-#     the need for this procedure may go away, so I'm living with it for
-#     the moment.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#
-# Results:
-#       Returns the message that has been built up in memory.
-
-proc ::mime::buildmessage {token} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set openP [info exists state(fd)]
-
-    set code [catch { mime::buildmessageaux $token } result]
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    if {(!$openP) && ([info exists state(fd)])} {
-        if {![info exists state(root)]} {
-            catch { close $state(fd) }
-        }
-        unset state(fd)
-    }
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::mime::buildmessageaux --
-#
-#     The following is a clone of the copymessageaux code to build up the
-#     result in memory, and, unfortunately, without using a memory channel.
-#     I considered parameterizing the "puts" calls in copy message, but
-#     the need for this procedure may go away, so I'm living with it for
-#     the moment.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#
-# Results:
-#       Returns the message that has been built up in memory.
-
-proc ::mime::buildmessageaux {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set header $state(header)
-
-    set result ""
-    if {[string compare $state(version) ""]} {
-        append result "MIME-Version: $state(version)\r\n"
-    }
-    foreach lower $state(lowerL) mixed $state(mixedL) {
-        foreach value $header($lower) {
-            append result "$mixed: $value\r\n"
-        }
-    }
-    if {(!$state(canonicalP)) \
-            && ([string compare [set encoding $state(encoding)] ""])} {
-        append result "Content-Transfer-Encoding: $encoding\r\n"
-    }
-
-    append result "Content-Type: $state(content)"
-    set boundary ""
-    foreach {k v} $state(params) {
-        if {![string compare $k boundary]} {
-            set boundary $v
-        }
-
-        append result ";\r\n              $k=\"$v\""
-    }
-
-    set converter ""
-    set encoding ""
-    if {[string compare $state(value) parts]} {
-        append result \r\n
-
-        if {$state(canonicalP)} {
-            if {![string compare [set encoding $state(encoding)] ""]} {
-                set encoding [encoding $token]
-            }
-            if {[string compare $encoding ""]} {
-                append result "Content-Transfer-Encoding: $encoding\r\n"
-            }
-            switch -- $encoding {
-                base64
-                    -
-                quoted-printable {
-                    set converter $encoding
-                }
-		7bit - 8bit - binary - "" {
-		    # Bugfix for [#477088]
-		    # Go ahead
-		}
-		default {
-		    error "Can't handle content encoding \"$encoding\""
-		}
-            }
-        }
-    } elseif {([string match multipart/* $state(content)]) \
-                    && (![string compare $boundary ""])} {
-# we're doing everything in one pass...
-        set key [clock seconds]$token[info hostname][array get state]
-        set seqno 8
-        while {[incr seqno -1] >= 0} {
-            set key [md5 -- $key]
-        }
-        set boundary "----- =_[string trim [base64 -mode encode -- $key]]"
-
-        append result ";\r\n              boundary=\"$boundary\"\r\n"
-    } else {
-        append result "\r\n"
-    }
-
-    if {[info exists state(error)]} {
-        unset state(error)
-    }
-                
-    switch -- $state(value) {
-        file {
-            set closeP 1
-            if {[info exists state(root)]} {
-		# FRINK: nocheck
-                variable $state(root)
-                upvar 0 $state(root) root 
-
-                if {[info exists root(fd)]} {
-                    set fd $root(fd)
-                    set closeP 0
-                } else {
-                    set fd [set state(fd) \
-                                [open $state(file) { RDONLY }]]
-                }
-                set size $state(count)
-            } else {
-                set fd [set state(fd) [open $state(file) { RDONLY }]]
-                set size -1	;# Read until EOF
-            }
-            seek $fd $state(offset) start
-            if {$closeP} {
-                fconfigure $fd -translation binary
-            }
-
-            append result "\r\n"
-
-	    while {($size != 0) && (![eof $fd])} {
-		if {$size < 0 || $size > 32766} {
-		    set X [read $fd 32766]
-		} else {
-		    set X [read $fd $size]
-		}
-		if {$size > 0} {
-		    set size [expr {$size - [string length $X]}]
-		}
-		if {[string compare $converter ""]} {
-		    append result [$converter -mode encode -- $X]
-		} else {
-		    append result $X
-		}
-	    }
-
-            if {$closeP} {
-                catch { close $state(fd) }
-                unset state(fd)
-            }
-        }
-
-        parts {
-            if {(![info exists state(root)]) \
-                    && ([info exists state(file)])} {
-                set state(fd) [open $state(file) { RDONLY }]
-                fconfigure $state(fd) -translation binary
-            }
-
-            switch -glob -- $state(content) {
-                message/* {
-                    append result "\r\n"
-                    foreach part $state(parts) {
-                        append result [buildmessage $part]
-                        break
-                    }
-                }
-
-                default {
-		    # Note RFC 2046:
-		    #
-		    # The boundary delimiter MUST occur at the
-		    # beginning of a line, i.e., following a CRLF, and
-		    # the initial CRLF is considered to be attached to
-		    # the boundary delimiter line rather than part of
-		    # the preceding part.
-		    #
-		    # - The above means that the CRLF before $boundary
-		    #   is needed per the RFC, and the parts must not
-		    #   have a closing CRLF of their own. See Tcllib bug
-		    #   1213527, and patch 1254934 for the problems when
-		    #   both file/string brnaches added CRLF after the
-		    #   body parts.
-
-                    foreach part $state(parts) {
-                        append result "\r\n--$boundary\r\n"
-                        append result [buildmessage $part]
-                    }
-                    append result "\r\n--$boundary--\r\n"
-                }
-            }
-
-            if {[info exists state(fd)]} {
-                catch { close $state(fd) }
-                unset state(fd)
-            }
-        }
-
-        string {
-            append result "\r\n"
-
-	    if {[string compare $converter ""]} {
-		append result [$converter -mode encode -- $state(string)]
-	    } else {
-		append result $state(string)
-	    }
-        }
-	default {
-	    error "Unknown value \"$state(value)\""
-	}
-    }
-
-    if {[info exists state(error)]} {
-        error $state(error)
-    }
-    return $result
-}
-
-# ::mime::encoding --
-#
-#     Determines how a token is encoded.
-#
-# Arguments:
-#       token      The MIME token to parse.
-#
-# Results:
-#       Returns the encoding of the message (the null string, base64,
-#       or quoted-printable).
-
-proc ::mime::encoding {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -glob -- $state(content) {
-        audio/*
-            -
-        image/*
-            -
-        video/* {
-            return base64
-        }
-
-        message/*
-            -
-        multipart/* {
-            return ""
-        }
-	default {# Skip}
-    }
-
-    set asciiP 1
-    set lineP 1
-    switch -- $state(value) {
-        file {
-            set fd [open $state(file) { RDONLY }]
-            fconfigure $fd -translation binary
-
-            while {[gets $fd line] >= 0} {
-                if {$asciiP} {
-                    set asciiP [encodingasciiP $line]
-                }
-                if {$lineP} {
-                    set lineP [encodinglineP $line]
-                }
-                if {(!$asciiP) && (!$lineP)} {
-                    break
-                }
-            }
-
-            catch { close $fd }
-        }
-
-        parts {
-            return ""
-        }
-
-        string {
-            foreach line [split $state(string) "\n"] {
-                if {$asciiP} {
-                    set asciiP [encodingasciiP $line]
-                }
-                if {$lineP} {
-                    set lineP [encodinglineP $line]
-                }
-                if {(!$asciiP) && (!$lineP)} {
-                    break
-                }
-            }
-        }
-	default {
-	    error "Unknown value \"$state(value)\""
-	}
-    }
-
-    switch -glob -- $state(content) {
-        text/* {
-            if {!$asciiP} {
-                foreach {k v} $state(params) {
-                    if {![string compare $k charset]} {
-                        set v [string tolower $v]
-                        if {([string compare $v us-ascii]) \
-                                && (![string match {iso-8859-[1-8]} $v])} {
-                            return base64
-                        }
-
-                        break
-                    }
-                }
-            }
-
-            if {!$lineP} {
-                return quoted-printable
-            }
-        }
-
-        
-        default {
-            if {(!$asciiP) || (!$lineP)} {
-                return base64
-            }
-        }
-    }
-
-    return ""
-}
-
-# ::mime::encodingasciiP --
-#
-#     Checks if a string is a pure ascii string, or if it has a non-standard
-#     form.
-#
-# Arguments:
-#       line    The line to check.
-#
-# Results:
-#       Returns 1 if \r only occurs at the end of lines, and if all
-#       characters in the line are between the ASCII codes of 32 and 126.
-
-proc ::mime::encodingasciiP {line} {
-    foreach c [split $line ""] {
-        switch -- $c {
-            " " - "\t" - "\r" - "\n" {
-            }
-
-            default {
-                binary scan $c c c
-                if {($c < 32) || ($c > 126)} {
-                    return 0
-                }
-            }
-        }
-    }
-    if {([set r [string first "\r" $line]] < 0) \
-            || ($r == [expr {[string length $line]-1}])} {
-        return 1
-    }
-
-    return 0
-}
-
-# ::mime::encodinglineP --
-#
-#     Checks if a string is a line is valid to be processed.
-#
-# Arguments:
-#       line    The line to check.
-#
-# Results:
-#       Returns 1 the line is less than 76 characters long, the line
-#       contains more characters than just whitespace, the line does
-#       not start with a '.', and the line does not start with 'From '.
-
-proc ::mime::encodinglineP {line} {
-    if {([string length $line] > 76) \
-            || ([string compare $line [string trimright $line]]) \
-            || ([string first . $line] == 0) \
-            || ([string first "From " $line] == 0)} {
-        return 0
-    }
-
-    return 1
-}
-
-# ::mime::fcopy --
-#
-#	Appears to be unused.
-#
-# Arguments:
-#
-# Results:
-# 
-
-proc ::mime::fcopy {token count {error ""}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[string compare $error ""]} {
-        set state(error) $error
-    }
-    set state(doneP) 1
-}
-
-# ::mime::scopy --
-#
-#	Copy a portion of the contents of a mime token to a channel.
-#
-# Arguments:
-#	token     The token containing the data to copy.
-#       channel   The channel to write the data to.
-#       offset    The location in the string to start copying
-#                 from.
-#       len       The amount of data to write.
-#       blocksize The block size for the write operation.
-#
-# Results:
-#	The specified portion of the string in the mime token is
-#       copied to the specified channel.
-
-proc ::mime::scopy {token channel offset len blocksize} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {$len <= 0} {
-        set state(doneP) 1
-        fileevent $channel writable ""
-        return
-    }
-
-    if {[set cc $len] > $blocksize} {
-        set cc $blocksize
-    }
-
-    if {[catch { puts -nonewline $channel \
-                      [string range $state(string) $offset \
-                              [expr {$offset+$cc-1}]]
-                 fileevent $channel writable \
-                           [list mime::scopy $token $channel \
-                                             [incr offset $cc] \
-                                             [incr len -$cc] \
-                                             $blocksize]
-               } result]} {
-        set state(error) $result
-        set state(doneP) 1
-        fileevent $channel writable ""
-    }
-    return
-}
-
-# ::mime::qp_encode --
-#
-#	Tcl version of quote-printable encode
-#
-# Arguments:
-#	string        The string to quote.
-#       encoded_word  Boolean value to determine whether or not encoded words
-#                     (RFC 2047) should be handled or not. (optional)
-#
-# Results:
-#	The properly quoted string is returned.
-
-proc ::mime::qp_encode {string {encoded_word 0} {no_softbreak 0}} {
-    # 8.1+ improved string manipulation routines used.
-    # Replace outlying characters, characters that would normally
-    # be munged by EBCDIC gateways, and special Tcl characters "[\]{}
-    # with =xx sequence
-
-    regsub -all -- \
-	    {[\x00-\x08\x0B-\x1E\x21-\x24\x3D\x40\x5B-\x5E\x60\x7B-\xFF]} \
-	    $string {[format =%02X [scan "\\&" %c]]} string
-
-    # Replace the format commands with their result
-
-    set string [subst -novariable $string]
-
-    # soft/hard newlines and other
-    # Funky cases for SMTP compatibility
-    set mapChars [list " \n" "=20\n" "\t\n" "=09\n" \
-	    "\n\.\n" "\n=2E\n" "\nFrom " "\n=46rom "]
-    if {$encoded_word} {
-	# Special processing for encoded words (RFC 2047)
-	lappend mapChars " " "_"
-    }
-    set string [string map $mapChars $string]
-
-    # Break long lines - ugh
-
-    # Implementation of FR #503336
-    if {$no_softbreak} {
-	set result $string
-    } else {
-	set result ""
-	foreach line [split $string \n] {
-	    while {[string length $line] > 72} {
-		set chunk [string range $line 0 72]
-		if {[regexp -- (=|=.)$ $chunk dummy end]} {
-		    
-		    # Don't break in the middle of a code
-
-		    set len [expr {72 - [string length $end]}]
-		    set chunk [string range $line 0 $len]
-		    incr len
-		    set line [string range $line $len end]
-		} else {
-		    set line [string range $line 73 end]
-		}
-		append result $chunk=\n
-	    }
-	    append result $line\n
-	}
-    
-	# Trim off last \n, since the above code has the side-effect
-	# of adding an extra \n to the encoded string and return the
-	# result.
-	set result [string range $result 0 end-1]
-    }
-
-    # If the string ends in space or tab, replace with =xx
-
-    set lastChar [string index $result end]
-    if {$lastChar==" "} {
-	set result [string replace $result end end "=20"]
-    } elseif {$lastChar=="\t"} {
-	set result [string replace $result end end "=09"]
-    }
-
-    return $result
-}
-
-# ::mime::qp_decode --
-#
-#	Tcl version of quote-printable decode
-#
-# Arguments:
-#	string        The quoted-prinatble string to decode.
-#       encoded_word  Boolean value to determine whether or not encoded words
-#                     (RFC 2047) should be handled or not. (optional)
-#
-# Results:
-#	The decoded string is returned.
-
-proc ::mime::qp_decode {string {encoded_word 0}} {
-    # 8.1+ improved string manipulation routines used.
-    # Special processing for encoded words (RFC 2047)
-
-    if {$encoded_word} {
-	# _ == \x20, even if SPACE occupies a different code position
-	set string [string map [list _ \u0020] $string]
-    }
-
-    # smash the white-space at the ends of lines since that must've been
-    # generated by an MUA.
-
-    regsub -all -- {[ \t]+\n} $string "\n" string
-    set string [string trimright $string " \t"]
-
-    # Protect the backslash for later subst and
-    # smash soft newlines, has to occur after white-space smash
-    # and any encoded word modification.
-
-    set string [string map [list "\\" "\\\\" "=\n" ""] $string]
-
-    # Decode specials
-
-    regsub -all -nocase {=([a-f0-9][a-f0-9])} $string {\\u00\1} string
-
-    # process \u unicode mapped chars
-
-    return [subst -novar -nocommand $string]
-}
-
-# ::mime::parseaddress --
-#
-#       This was originally written circa 1982 in C. we're still using it
-#       because it recognizes virtually every buggy address syntax ever
-#       generated!
-#
-#       mime::parseaddress takes a string containing one or more 822-style
-#       address specifications and returns a list of serialized arrays, one
-#       element for each address specified in the argument.
-#
-#    Each serialized array contains these properties:
-#
-#       property    value
-#       ========    =====
-#       address     local@domain
-#       comment     822-style comment
-#       domain      the domain part (rhs)
-#       error       non-empty on a parse error
-#       group       this address begins a group
-#       friendly    user-friendly rendering
-#       local       the local part (lhs)
-#       memberP     this address belongs to a group
-#       phrase      the phrase part
-#       proper      822-style address specification
-#       route       822-style route specification (obsolete)
-#
-#    Note that one or more of these properties may be empty.
-#
-# Arguments:
-#	string        The address string to parse
-#
-# Results:
-#	Returns a list of serialized arrays, one element for each address
-#       specified in the argument.
-
-proc ::mime::parseaddress {string} {
-    global errorCode errorInfo
-
-    variable mime
-
-    set token [namespace current]::[incr mime(uid)]
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set code [catch { mime::parseaddressaux $token $string } result]
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    foreach name [array names state] {
-        unset state($name)
-    }
-    # FRINK: nocheck
-    catch { unset $token }
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::mime::parseaddressaux --
-#
-#       This was originally written circa 1982 in C. we're still using it
-#       because it recognizes virtually every buggy address syntax ever
-#       generated!
-#
-#       mime::parseaddressaux does the actually parsing for mime::parseaddress
-#
-#    Each serialized array contains these properties:
-#
-#       property    value
-#       ========    =====
-#       address     local@domain
-#       comment     822-style comment
-#       domain      the domain part (rhs)
-#       error       non-empty on a parse error
-#       group       this address begins a group
-#       friendly    user-friendly rendering
-#       local       the local part (lhs)
-#       memberP     this address belongs to a group
-#       phrase      the phrase part
-#       proper      822-style address specification
-#       route       822-style route specification (obsolete)
-#
-#    Note that one or more of these properties may be empty.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#	string        The address string to parse
-#
-# Results:
-#	Returns a list of serialized arrays, one element for each address
-#       specified in the argument.
-
-proc ::mime::parseaddressaux {token string} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    variable addrtokenL
-    variable addrlexemeL
-
-    set state(input)   $string
-    set state(glevel)  0
-    set state(buffer)  ""
-    set state(lastC)   LX_END
-    set state(tokenL)  $addrtokenL
-    set state(lexemeL) $addrlexemeL
-
-    set result ""
-    while {[addr_next $token]} {
-        if {[string compare [set tail $state(domain)] ""]} {
-            set tail @$state(domain)
-        } else {
-            set tail @[info hostname]
-        }
-        if {[string compare [set address $state(local)] ""]} {
-            append address $tail
-        }
-
-        if {[string compare $state(phrase) ""]} {
-            set state(phrase) [string trim $state(phrase) "\""]
-            foreach t $state(tokenL) {
-                if {[string first $t $state(phrase)] >= 0} {
-                    set state(phrase) \"$state(phrase)\"
-                    break
-                }
-            }
-
-            set proper "$state(phrase) <$address>"
-        } else {
-            set proper $address
-        }
-
-        if {![string compare [set friendly $state(phrase)] ""]} {
-            if {[string compare [set note $state(comment)] ""]} {
-                if {[string first "(" $note] == 0} {
-                    set note [string trimleft [string range $note 1 end]]
-                }
-                if {[string last ")" $note] \
-                        == [set len [expr {[string length $note]-1}]]} {
-                    set note [string range $note 0 [expr {$len-1}]]
-                }
-                set friendly $note
-            }
-
-            if {(![string compare $friendly ""]) \
-                    && ([string compare [set mbox $state(local)] ""])} {
-                set mbox [string trim $mbox "\""]
-
-                if {[string first "/" $mbox] != 0} {
-                    set friendly $mbox
-                } elseif {[string compare \
-                                  [set friendly [addr_x400 $mbox PN]] \
-                                  ""]} {
-                } elseif {([string compare \
-                                   [set friendly [addr_x400 $mbox S]] \
-                                   ""]) \
-                            && ([string compare \
-                                        [set g [addr_x400 $mbox G]] \
-                                        ""])} {
-                    set friendly "$g $friendly"
-                }
-
-                if {![string compare $friendly ""]} {
-                    set friendly $mbox
-                }
-            }
-        }
-        set friendly [string trim $friendly "\""]
-
-        lappend result [list address  $address        \
-                             comment  $state(comment) \
-                             domain   $state(domain)  \
-                             error    $state(error)   \
-                             friendly $friendly       \
-                             group    $state(group)   \
-                             local    $state(local)   \
-                             memberP  $state(memberP) \
-                             phrase   $state(phrase)  \
-                             proper   $proper         \
-                             route    $state(route)]
-
-    }
-
-    unset state(input)   \
-          state(glevel)  \
-          state(buffer)  \
-          state(lastC)   \
-          state(tokenL)  \
-          state(lexemeL)
-
-    return $result
-}
-
-# ::mime::addr_next --
-#
-#       Locate the next address in a mime token.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns 1 if there is another address, and 0 if there is not.
-
-proc ::mime::addr_next {token} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    foreach prop {comment domain error group local memberP phrase route} {
-        catch { unset state($prop) }
-    }
-
-    switch -- [set code [catch { mime::addr_specification $token } result]] {
-        0 {
-            if {!$result} {
-                return 0
-            }
-
-            switch -- $state(lastC) {
-                LX_COMMA
-                    -
-                LX_END {
-                }
-                default {
-                    # catch trailing comments...
-                    set lookahead $state(input)
-                    mime::parselexeme $token
-                    set state(input) $lookahead
-                }
-            }
-        }
-
-        7 {
-            set state(error) $result
-
-            while {1} {
-                switch -- $state(lastC) {
-                    LX_COMMA
-                        -
-                    LX_END {
-                        break
-                    }
-
-                    default {
-                        mime::parselexeme $token
-                    }
-                }
-            }
-        }
-
-        default {
-            set ecode $errorCode
-            set einfo $errorInfo
-
-            return -code $code -errorinfo $einfo -errorcode $ecode $result
-        }
-    }
-
-    foreach prop {comment domain error group local memberP phrase route} {
-        if {![info exists state($prop)]} {
-            set state($prop) ""
-        }
-    }
-
-    return 1
-}
-
-# ::mime::addr_specification --
-#
-#   Uses lookahead parsing to determine whether there is another
-#   valid e-mail address or not.  Throws errors if unrecognized
-#   or invalid e-mail address syntax is used.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns 1 if there is another address, and 0 if there is not.
-
-proc ::mime::addr_specification {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set lookahead $state(input)
-    switch -- [parselexeme $token] {
-        LX_ATOM
-            -
-        LX_QSTRING {
-            set state(phrase) $state(buffer)
-        }
-
-        LX_SEMICOLON {
-            if {[incr state(glevel) -1] < 0} {
-                return -code 7 "extraneous semi-colon"
-            }
-
-            catch { unset state(comment) }
-            return [addr_specification $token]
-        }
-
-        LX_COMMA {
-            catch { unset state(comment) }
-            return [addr_specification $token]
-        }
-
-        LX_END {
-            return 0
-        }
-
-        LX_LBRACKET {
-            return [addr_routeaddr $token]
-        }
-
-        LX_ATSIGN {
-            set state(input) $lookahead
-            return [addr_routeaddr $token 0]
-        }
-
-        default {
-            return -code 7 \
-                   [format "unexpected character at beginning (found %s)" \
-                           $state(buffer)]
-        }
-    }
-
-    switch -- [parselexeme $token] {
-        LX_ATOM
-            -
-        LX_QSTRING {
-            append state(phrase) " " $state(buffer)
-
-            return [addr_phrase $token]
-        }
-
-        LX_LBRACKET {
-            return [addr_routeaddr $token]
-        }
-
-        LX_COLON {
-            return [addr_group $token]
-        }
-
-        LX_DOT {
-            set state(local) "$state(phrase)$state(buffer)"
-            unset state(phrase)
-            mime::addr_routeaddr $token 0
-            mime::addr_end $token
-        }
-
-        LX_ATSIGN {
-            set state(memberP) $state(glevel)
-            set state(local) $state(phrase)
-            unset state(phrase)
-            mime::addr_domain $token
-            mime::addr_end $token
-        }
-
-        LX_SEMICOLON
-            -
-        LX_COMMA
-            -
-        LX_END {
-            set state(memberP) $state(glevel)
-            if {(![string compare $state(lastC) LX_SEMICOLON]) \
-                    && ([incr state(glevel) -1] < 0)} {
-                return -code 7 "extraneous semi-colon"
-            }
-
-            set state(local) $state(phrase)
-            unset state(phrase)
-        }
-
-        default {
-            return -code 7 [format "expecting mailbox (found %s)" \
-                                   $state(buffer)]
-        }
-    }
-
-    return 1
-}
-
-# ::mime::addr_routeaddr --
-#
-#       Parses the domain portion of an e-mail address.  Finds the '@'
-#       sign and then calls mime::addr_route to verify the domain.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns 1 if there is another address, and 0 if there is not.
-
-proc ::mime::addr_routeaddr {token {checkP 1}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set lookahead $state(input)
-    if {![string compare [parselexeme $token] LX_ATSIGN]} {
-        mime::addr_route $token
-    } else {
-        set state(input) $lookahead
-    }
-
-    mime::addr_local $token
-
-    switch -- $state(lastC) {
-        LX_ATSIGN {
-            mime::addr_domain $token
-        }
-
-        LX_SEMICOLON
-            -
-        LX_RBRACKET
-            -
-        LX_COMMA
-            -
-        LX_END {
-        }
-
-        default {
-            return -code 7 \
-                   [format "expecting at-sign after local-part (found %s)" \
-                           $state(buffer)]
-        }
-    }
-
-    if {($checkP) && ([string compare $state(lastC) LX_RBRACKET])} {
-        return -code 7 [format "expecting right-bracket (found %s)" \
-                               $state(buffer)]
-    }
-
-    return 1
-}
-
-# ::mime::addr_route --
-#
-#    Attempts to parse the portion of the e-mail address after the @.
-#    Tries to verify that the domain definition has a valid form.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_route {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set state(route) @
-
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_ATOM
-                -
-            LX_DLITERAL {
-                append state(route) $state(buffer)
-            }
-
-            default {
-                return -code 7 \
-                       [format "expecting sub-route in route-part (found %s)" \
-                               $state(buffer)]
-            }
-        }
-
-        switch -- [parselexeme $token] {
-            LX_COMMA {
-                append state(route) $state(buffer)
-                while {1} {
-                    switch -- [parselexeme $token] {
-                        LX_COMMA {
-                        }
-
-                        LX_ATSIGN {
-                            append state(route) $state(buffer)
-                            break
-                        }
-
-                        default {
-                            return -code 7 \
-                                   [format "expecting at-sign in route (found %s)" \
-                                           $state(buffer)]
-                        }
-                    }
-                }
-            }
-
-            LX_ATSIGN
-                -
-            LX_DOT {
-                append state(route) $state(buffer)
-            }
-
-            LX_COLON {
-                append state(route) $state(buffer)
-                return
-            }
-
-            default {
-                return -code 7 \
-                       [format "expecting colon to terminate route (found %s)" \
-                               $state(buffer)]
-            }
-        }
-    }
-}
-
-# ::mime::addr_domain --
-#
-#    Attempts to parse the portion of the e-mail address after the @.
-#    Tries to verify that the domain definition has a valid form.
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_domain {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_ATOM
-                -
-            LX_DLITERAL {
-                append state(domain) $state(buffer)
-            }
-
-            default {
-                return -code 7 \
-                       [format "expecting sub-domain in domain-part (found %s)" \
-                               $state(buffer)]
-            }
-        }
-
-        switch -- [parselexeme $token] {
-            LX_DOT {
-                append state(domain) $state(buffer)
-            }
-
-            LX_ATSIGN {
-                append state(local) % $state(domain)
-                unset state(domain)
-            }
-
-            default {
-                return
-            }
-        }
-    }
-}
-
-# ::mime::addr_local --
-#
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_local {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set state(memberP) $state(glevel)
-
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_ATOM
-                -
-            LX_QSTRING {
-                append state(local) $state(buffer)
-            }
-
-            default {
-                return -code 7 \
-                       [format "expecting mailbox in local-part (found %s)" \
-                               $state(buffer)]
-            }
-        }
-
-        switch -- [parselexeme $token] {
-            LX_DOT {
-                append state(local) $state(buffer)
-            }
-
-            default {
-                return
-            }
-        }
-    }
-}
-
-# ::mime::addr_phrase --
-#
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-
-proc ::mime::addr_phrase {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_ATOM
-                -
-            LX_QSTRING {
-                append state(phrase) " " $state(buffer)
-            }
-
-            default {
-                break
-            }
-        }
-    }
-
-    switch -- $state(lastC) {
-        LX_LBRACKET {
-            return [addr_routeaddr $token]
-        }
-
-        LX_COLON {
-            return [addr_group $token]
-        }
-
-        LX_DOT {
-            append state(phrase) $state(buffer)
-            return [addr_phrase $token]   
-        }
-
-        default {
-            return -code 7 \
-                   [format "found phrase instead of mailbox (%s%s)" \
-                           $state(phrase) $state(buffer)]
-        }
-    }
-}
-
-# ::mime::addr_group --
-#
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_group {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[incr state(glevel)] > 1} {
-        return -code 7 [format "nested groups not allowed (found %s)" \
-                               $state(phrase)]
-    }
-
-    set state(group) $state(phrase)
-    unset state(phrase)
-
-    set lookahead $state(input)
-    while {1} {
-        switch -- [parselexeme $token] {
-            LX_SEMICOLON
-                -
-            LX_END {
-                set state(glevel) 0
-                return 1
-            }
-
-            LX_COMMA {
-            }
-
-            default {
-                set state(input) $lookahead
-                return [addr_specification $token]
-            }
-        }
-    }
-}
-
-# ::mime::addr_end --
-#
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_end {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -- $state(lastC) {
-        LX_SEMICOLON {
-            if {[incr state(glevel) -1] < 0} {
-                return -code 7 "extraneous semi-colon"
-            }
-        }
-
-        LX_COMMA
-            -
-        LX_END {
-        }
-
-        default {
-            return -code 7 [format "junk after local@domain (found %s)" \
-                                   $state(buffer)]
-        }
-    }    
-}
-
-# ::mime::addr_x400 --
-#
-#
-# Arguments:
-#       token         The MIME token to work from.
-#
-# Results:
-#	Returns nothing if successful, and throws an error if invalid
-#       syntax is found.
-
-proc ::mime::addr_x400 {mbox key} {
-    if {[set x [string first "/$key=" [string toupper $mbox]]] < 0} {
-        return ""
-    }
-    set mbox [string range $mbox [expr {$x+[string length $key]+2}] end]
-
-    if {[set x [string first "/" $mbox]] > 0} {
-        set mbox [string range $mbox 0 [expr {$x-1}]]
-    }
-
-    return [string trim $mbox "\""]
-}
-
-# ::mime::parsedatetime --
-#
-#    Fortunately the clock command in the Tcl 8.x core does all the heavy 
-#    lifting for us (except for timezone calculations).
-#
-#    mime::parsedatetime takes a string containing an 822-style date-time
-#    specification and returns the specified property.
-#
-#    The list of properties and their ranges are:
-#
-#       property     range
-#       ========     =====
-#       clock        raw result of "clock scan"
-#       hour         0 .. 23
-#       lmonth       January, February, ..., December
-#       lweekday     Sunday, Monday, ... Saturday
-#       mday         1 .. 31
-#       min          0 .. 59
-#       mon          1 .. 12
-#       month        Jan, Feb, ..., Dec
-#       proper       822-style date-time specification
-#       rclock       elapsed seconds between then and now
-#       sec          0 .. 59
-#       wday         0 .. 6 (Sun .. Mon)
-#       weekday      Sun, Mon, ..., Sat
-#       yday         1 .. 366
-#       year         1900 ...
-#       zone         -720 .. 720 (minutes east of GMT)
-#
-# Arguments:
-#       value       Either a 822-style date-time specification or '-now'
-#                   if the current date/time should be used.
-#       property    The property (from the list above) to return
-#
-# Results:
-#	Returns the string value of the 'property' for the date/time that was
-#       specified in 'value'.
-
-namespace eval ::mime {
-        variable WDAYS_SHORT  [list Sun Mon Tue Wed Thu Fri Sat]
-        variable WDAYS_LONG   [list Sunday Monday Tuesday Wednesday Thursday \
-                                    Friday Saturday]
-
-        # Counting months starts at 1, so just insert a dummy element
-        # at index 0.
-        variable MONTHS_SHORT [list "" \
-                                    Jan Feb Mar Apr May Jun \
-                                    Jul Aug Sep Oct Nov Dec]
-        variable MONTHS_LONG  [list "" \
-                                    January February March April May June July \
-                                    August Sepember October November December]
-}
-proc ::mime::parsedatetime {value property} {
-    if {![string compare $value -now]} {
-        set clock [clock seconds]
-    } elseif {[regexp {^(.*) ([+-])([0-9][0-9])([0-9][0-9])$} $value \
-                 -> value zone_sign zone_hour zone_min]} {
-        set clock [clock scan $value -gmt 1]
-        if {[info exists zone_min]} {
-            set zone_min [scan $zone_min %d]
-            set zone_hour [scan $zone_hour %d]
-            set zone [expr {60*($zone_min+60*$zone_hour)}]
-            if {[string equal $zone_sign "+"]} {
-                set zone -$zone
-            }
-            incr clock $zone
-        }
-    } else {
-        set clock [clock scan $value]
-    }
-
-    switch -- $property {
-        clock {
-            return $clock
-        }
-
-        hour {
-            set value [clock format $clock -format %H]
-        }
-
-        lmonth {
-            variable MONTHS_LONG
-            return [lindex $MONTHS_LONG \
-                            [scan [clock format $clock -format %m] %d]]
-        }
-
-        lweekday {
-            variable WDAYS_LONG
-            return [lindex $WDAYS_LONG [clock format $clock -format %w]]
-        }
-
-        mday {
-            set value [clock format $clock -format %d]
-        }
-
-        min {
-            set value [clock format $clock -format %M]
-        }
-
-        mon {
-            set value [clock format $clock -format %m]
-        }
-
-        month {
-            variable MONTHS_SHORT
-            return [lindex $MONTHS_SHORT \
-                            [scan [clock format $clock -format %m] %d]]
-        }
-
-        proper {
-            set gmt [clock format $clock -format "%Y-%m-%d %H:%M:%S" \
-                           -gmt true]
-            if {[set diff [expr {($clock-[clock scan $gmt])/60}]] < 0} {
-                set s -
-                set diff [expr {-($diff)}]
-            } else {
-                set s +
-            }
-            set zone [format %s%02d%02d $s [expr {$diff/60}] [expr {$diff%60}]]
-
-            variable WDAYS_SHORT
-            set wday [lindex $WDAYS_SHORT [clock format $clock -format %w]]
-            variable MONTHS_SHORT
-            set mon [lindex $MONTHS_SHORT \
-                             [scan [clock format $clock -format %m] %d]]
-
-            return [clock format $clock \
-                          -format "$wday, %d $mon %Y %H:%M:%S $zone"]
-        }
-
-        rclock {
-            if {![string compare $value -now]} {
-                return 0
-            } else {
-                return [expr {[clock seconds]-$clock}]
-            }
-        }
-
-        sec {
-            set value [clock format $clock -format %S]
-        }
-
-        wday {
-            return [clock format $clock -format %w]
-        }
-
-        weekday {
-            variable WDAYS_SHORT
-            return [lindex $WDAYS_SHORT [clock format $clock -format %w]]
-        }
-
-        yday {
-            set value [clock format $clock -format %j]
-        }
-
-        year {
-            set value [clock format $clock -format %Y]
-        }
-
-        zone {
-	    set value [string trim [string map [list "\t" " "] $value]]
-            if {[set x [string last " " $value]] < 0} {
-                return 0
-            }
-            set value [string range $value [expr {$x+1}] end]
-            switch -- [set s [string index $value 0]] {
-                + - - {
-                    if {![string compare $s +]} {
-                        set s ""
-                    }
-                    set value [string trim [string range $value 1 end]]
-                    if {([string length $value] != 4) \
-                            || ([scan $value %2d%2d h m] != 2) \
-                            || ($h > 12) \
-                            || ($m > 59) \
-                            || (($h == 12) && ($m > 0))} {
-                        error "malformed timezone-specification: $value"
-                    }
-                    set value $s[expr {$h*60+$m}]
-                }
-
-                default {
-                    set value [string toupper $value]
-                    set z1 [list  UT GMT EST EDT CST CDT MST MDT PST PDT]
-                    set z2 [list   0   0  -5  -4  -6  -5  -7  -6  -8  -7]
-                    if {[set x [lsearch -exact $z1 $value]] < 0} {
-                        error "unrecognized timezone-mnemonic: $value"
-                    }
-                    set value [expr {[lindex $z2 $x]*60}]
-                }
-            }
-        }
-
-        date2gmt
-            -
-        date2local
-            -
-        dst
-            -
-        sday
-            -
-        szone
-            -
-        tzone
-            -
-        default {
-            error "unknown property $property"
-        }
-    }
-
-    if {![string compare [set value [string trimleft $value 0]] ""]} {
-        set value 0
-    }
-    return $value
-}
-
-# ::mime::uniqueID --
-#
-#    Used to generate a 'globally unique identifier' for the content-id.
-#    The id is built from the pid, the current time, the hostname, and
-#    a counter that is incremented each time a message is sent.
-#
-# Arguments:
-#
-# Results:
-#	Returns the a string that contains the globally unique identifier
-#       that should be used for the Content-ID of an e-mail message.
-
-proc ::mime::uniqueID {} {
-    variable mime
-
-    return "<[pid].[clock seconds].[incr mime(cid)]@[info hostname]>"
-}
-
-# ::mime::parselexeme --
-#
-#    Used to implement a lookahead parser.
-#
-# Arguments:
-#       token    The MIME token to operate on.
-#
-# Results:
-#	Returns the next token found by the parser.
-
-proc ::mime::parselexeme {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set state(input) [string trimleft $state(input)]
-
-    set state(buffer) ""
-    if {![string compare $state(input) ""]} {
-        set state(buffer) end-of-input
-        return [set state(lastC) LX_END]
-    }
-
-    set c [string index $state(input) 0]
-    set state(input) [string range $state(input) 1 end]
-
-    if {![string compare $c "("]} {
-        set noteP 0
-        set quoteP 0
-
-        while {1} {
-            append state(buffer) $c
-
-            switch -- $c/$quoteP {
-                "(/0" {
-                    incr noteP
-                }
-
-                "\\/0" {
-                    set quoteP 1
-                }
-
-                ")/0" {
-                    if {[incr noteP -1] < 1} {
-                        if {[info exists state(comment)]} {
-                            append state(comment) " "
-                        }
-                        append state(comment) $state(buffer)
-
-                        return [parselexeme $token]
-                    }
-                }
-
-                default {
-                    set quoteP 0
-                }
-            }
-
-            if {![string compare [set c [string index $state(input) 0]] ""]} {
-                set state(buffer) "end-of-input during comment"
-                return [set state(lastC) LX_ERR]
-            }
-            set state(input) [string range $state(input) 1 end]
-        }
-    }
-
-    if {![string compare $c "\""]} {
-        set firstP 1
-        set quoteP 0
-
-        while {1} {
-            append state(buffer) $c
-
-            switch -- $c/$quoteP {
-                "\\/0" {
-                    set quoteP 1
-                }
-
-                "\"/0" {
-                    if {!$firstP} {
-                        return [set state(lastC) LX_QSTRING]
-                    }
-                    set firstP 0
-                }
-
-                default {
-                    set quoteP 0
-                }
-            }
-
-            if {![string compare [set c [string index $state(input) 0]] ""]} {
-                set state(buffer) "end-of-input during quoted-string"
-                return [set state(lastC) LX_ERR]
-            }
-            set state(input) [string range $state(input) 1 end]
-        }
-    }
-
-    if {![string compare $c "\["]} {
-        set quoteP 0
-
-        while {1} {
-            append state(buffer) $c
-
-            switch -- $c/$quoteP {
-                "\\/0" {
-                    set quoteP 1
-                }
-
-                "\]/0" {
-                    return [set state(lastC) LX_DLITERAL]
-                }
-
-                default {
-                    set quoteP 0
-                }
-            }
-
-            if {![string compare [set c [string index $state(input) 0]] ""]} {
-                set state(buffer) "end-of-input during domain-literal"
-                return [set state(lastC) LX_ERR]
-            }
-            set state(input) [string range $state(input) 1 end]
-        }
-    }
-
-    if {[set x [lsearch -exact $state(tokenL) $c]] >= 0} {
-        append state(buffer) $c
-
-        return [set state(lastC) [lindex $state(lexemeL) $x]]
-    }
-
-    while {1} {
-        append state(buffer) $c
-
-        switch -- [set c [string index $state(input) 0]] {
-            "" - " " - "\t" - "\n" {
-                break
-            }
-
-            default {
-                if {[lsearch -exact $state(tokenL) $c] >= 0} {
-                    break
-                }
-            }
-        }
-
-        set state(input) [string range $state(input) 1 end]
-    }
-
-    return [set state(lastC) LX_ATOM]
-}
-
-# ::mime::mapencoding --
-#
-#    mime::mapencodings maps tcl encodings onto the proper names for their
-#    MIME charset type.  This is only done for encodings whose charset types
-#    were known.  The remaining encodings return "" for now.
-#
-# Arguments:
-#       enc      The tcl encoding to map.
-#
-# Results:
-#	Returns the MIME charset type for the specified tcl encoding, or ""
-#       if none is known.
-
-proc ::mime::mapencoding {enc} {
-
-    variable encodings
-
-    if {[info exists encodings($enc)]} {
-        return $encodings($enc)
-    }
-    return ""
-}
-
-# ::mime::reversemapencoding --
-#
-#    mime::reversemapencodings maps MIME charset types onto tcl encoding names.
-#    Those that are unknown return "".
-#
-# Arguments:
-#       mimeType  The MIME charset to convert into a tcl encoding type.
-#
-# Results:
-#	Returns the tcl encoding name for the specified mime charset, or ""
-#       if none is known.
-
-proc ::mime::reversemapencoding {mimeType} {
-
-    variable reversemap
-    
-    set lmimeType [string tolower $mimeType]
-    if {[info exists reversemap($lmimeType)]} {
-        return $reversemap($lmimeType)
-    }
-    return ""
-}
-
-# ::mime::word_encode --
-#
-#    Word encodes strings as per RFC 2047.
-#
-# Arguments:
-#       charset   The character set to encode the message to.
-#       method    The encoding method (base64 or quoted-printable).
-#       string    The string to encode.
-#       ?-charset_encoded   0 or 1      Whether the data is already encoded
-#                                       in the specified charset (default 1)
-#       ?-maxlength         maxlength   The maximum length of each encoded
-#                                       word to return (default 66)
-#
-# Results:
-#	Returns a word encoded string.
-
-proc ::mime::word_encode {charset method string {args}} {
-
-    variable encodings
-
-    if {![info exists encodings($charset)]} {
-	error "unknown charset '$charset'"
-    }
-
-    if {$encodings($charset) == ""} {
-	error "invalid charset '$charset'"
-    }
-
-    if {$method != "base64" && $method != "quoted-printable"} {
-	error "unknown method '$method', must be base64 or quoted-printable"
-    }
-
-    # default to encoded and a length that won't make the Subject header to long
-    array set options [list -charset_encoded 1 -maxlength 66]
-    array set options $args
-
-    if { $options(-charset_encoded) } {
-    	set unencoded_string [::encoding convertfrom $charset $string]
-    } else {
-        set unencoded_string $string
-    }
-
-    set string_length [string length $unencoded_string]
-
-    if {!$string_length} {
-	return ""
-    }
-
-    set string_bytelength [string bytelength $unencoded_string]
-
-    # the 7 is for =?, ?Q?, ?= delimiters of the encoded word
-    set maxlength [expr {$options(-maxlength) - [string length $encodings($charset)] - 7}]
-    switch -exact -- $method {
-	base64 {
-            if { $maxlength < 4 } {
-                error "maxlength $options(-maxlength) too short for chosen\
-                    charset and encoding"
-            }
-            set count 0
-            set maxlength [expr {($maxlength / 4) * 3}]
-            while { $count < $string_length } {
-                set length 0
-                set enc_string ""
-                while { ($length < $maxlength) && ($count < $string_length) } {
-                    set char [string range $unencoded_string $count $count]
-                    set enc_char [::encoding convertto $charset $char]
-                    if { ($length + [string length $enc_char]) > $maxlength } {
-                        set length $maxlength
-                    } else {
-                        append enc_string $enc_char
-                        incr count
-                        incr length [string length $enc_char]
-                    }
-                }
-                set encoded_word [string map [list \n {}] \
-				      [base64 -mode encode -- $enc_string]]
-                append result "=?$encodings($charset)?B?$encoded_word?=\n "
-            }
-            # Trim off last "\n ", since the above code has the side-effect
-            # of adding an extra "\n " to the encoded string.
-
-            set result [string range $result 0 end-2]
-	}
-	quoted-printable {
-            if { $maxlength < 1 } {
-                error "maxlength $options(-maxlength) too short for chosen\
-                    charset and encoding"
-            }
-            set count 0
-            while { $count < $string_length } {
-            set length 0
-            set encoded_word ""
-            while { ($length < $maxlength) && ($count < $string_length) } {
-                set char [string range $unencoded_string $count $count]
-                set enc_char [::encoding convertto $charset $char]
-                set qp_enc_char [qp_encode $enc_char 1]
-                set qp_enc_char_length [string length $qp_enc_char]
-                if { $qp_enc_char_length > $maxlength } {
-                    error "maxlength $options(-maxlength) too short for chosen\
-                        charset and encoding"
-                }
-		if { ($length + [string length $qp_enc_char]) > $maxlength } {
-                    set length $maxlength
-                } else {
-                    append encoded_word $qp_enc_char
-                    incr count
-                    incr length [string length $qp_enc_char]
-                }
-            }
-	    append result "=?$encodings($charset)?Q?$encoded_word?=\n "
-            }
-            # Trim off last "\n ", since the above code has the side-effect
-            # of adding an extra "\n " to the encoded string.
-
-            set result [string range $result 0 end-2]
-	}
-	"" {
-	    # Go ahead
-	}
-	default {
-	    error "Can't handle content encoding \"$method\""
-	}
-    }
-
-    return $result
-}
-
-# ::mime::word_decode --
-#
-#    Word decodes strings that have been word encoded as per RFC 2047.
-#
-# Arguments:
-#       encoded   The word encoded string to decode.
-#
-# Results:
-#	Returns the string that has been decoded from the encoded message.
-
-proc ::mime::word_decode {encoded} {
-
-    variable reversemap
-
-    if {[regexp -- {=\?([^?]+)\?(.)\?([^?]*)\?=} $encoded \
-		- charset method string] != 1} {
-	error "malformed word-encoded expression '$encoded'"
-    }
-
-    set enc [reversemapencoding $charset]
-    if {[string equal "" $enc]} {
-	error "unknown charset '$charset'"
-    }
-
-    switch -exact -- $method {
-	b -
-	B {
-            set method base64
-        }
-	q -
-	Q {
-            set method quoted-printable
-        }
-	default {
-	    error "unknown method '$method', must be B or Q"
-        }
-    }
-
-    switch -exact -- $method {
-	base64 {
-	    set result [base64 -mode decode -- $string]
-	}
-	quoted-printable {
-	    set result [qp_decode $string 1]
-	}
-	"" {
-	    # Go ahead
-	}
-	default {
-	    error "Can't handle content encoding \"$method\""
-	}
-    }
-
-    return [list $enc $method $result]
-}
-
-# ::mime::field_decode --
-#
-#    Word decodes strings that have been word encoded as per RFC 2047
-#    and converts the string from the original encoding/charset to UTF.
-#
-# Arguments:
-#       field     The string to decode
-#
-# Results:
-#	Returns the decoded string in UTF.
-
-proc ::mime::field_decode {field} {
-    # ::mime::field_decode is broken.  Here's a new version.
-    # This code is in the public domain.  Don Libes <don@libes.com>
-
-    # Step through a field for mime-encoded words, building a new
-    # version with unencoded equivalents.
-
-    # Sorry about the grotesque regexp.  Most of it is sensible.  One
-    # notable fudge: the final $ is needed because of an apparent bug
-    # in the regexp engine where the preceding .* otherwise becomes
-    # non-greedy - perhaps because of the earlier ".*?", sigh.
-
-    while {[regexp {(.*?)(=\?(?:[^?]+)\?(?:.)\?(?:[^?]*)\?=)(.*)$} $field ignore prefix encoded field]} {
-	# don't allow whitespace between encoded words per RFC 2047
-	if {"" != $prefix} {
-	    if {![string is space $prefix]} {
-		append result $prefix
-	    }
-	}
-
-	set decoded [word_decode $encoded]
-        foreach {charset - string} $decoded break
-
-	append result [::encoding convertfrom $charset $string]
-    }
-
-    append result $field
-    return $result
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/mime/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/mime/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded mime 1.5.2 [list source [file join $dir mime.tcl]]
-package ifneeded smtp 1.4.4 [list source [file join $dir smtp.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/mime/smtp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/mime/smtp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1503 +1,0 @@
-# smtp.tcl - SMTP client
-#
-# Copyright (c) 1999-2000 Marshall T. Rose
-# Copyright (c) 2003-2006 Pat Thoyts
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-
-package require Tcl 8.3
-package require mime 1.4.1
-
-catch {
-    package require SASL 1.0;           # tcllib 1.8
-    package require SASL::NTLM 1.0;     # tcllib 1.8
-}
-
-#
-# state variables:
-#
-#    sd: socket to server
-#    afterID: afterID associated with ::smtp::timer
-#    options: array of user-supplied options
-#    readable: semaphore for vwait
-#    addrs: number of recipients negotiated
-#    error: error during read
-#    line: response read from server
-#    crP: just put a \r in the data
-#    nlP: just put a \n in the data
-#    size: number of octets sent in DATA
-#
-
-
-namespace eval ::smtp {
-    variable version 1.4.4
-    variable trf 1
-    variable smtp
-    array set smtp { uid 0 }
-
-    namespace export sendmessage
-}
-
-if {[catch {package require Trf  2.0}]} {
-    # Trf is not available, but we can live without it as long as the
-    # transform and unstack procs are defined.
-
-    # Warning!
-    # This is a fragile emulation of the more general calling sequence
-    # that appears to work with this code here.
-
-    proc transform {args} {
-	upvar state mystate
-	set mystate(size) 1
-    }
-    proc unstack {channel} {
-        # do nothing
-        return
-    }
-    set ::smtp::trf 0
-}
-
-
-# ::smtp::sendmessage --
-#
-#	Sends a mime object (containing a message) to some recipients
-#
-# Arguments:
-#	part  The MIME object containing the message to send
-#       args  A list of arguments specifying various options for sending the
-#             message:
-#             -atleastone  A boolean specifying whether or not to send the
-#                          message at all if any of the recipients are 
-#                          invalid.  A value of false (as defined by 
-#                          ::smtp::boolean) means that ALL recipients must be
-#                          valid in order to send the message.  A value of
-#                          true means that as long as at least one recipient
-#                          is valid, the message will be sent.
-#             -debug       A boolean specifying whether or not debugging is
-#                          on.  If debugging is enabled, status messages are 
-#                          printed to stderr while trying to send mail.
-#             -queue       A boolean specifying whether or not the message
-#                          being sent should be queued for later delivery.
-#             -header      A single RFC 822 header key and value (as a list),
-#                          used to specify to whom to send the message 
-#                          (To, Cc, Bcc), the "From", etc.
-#             -originator  The originator of the message (equivalent to
-#                          specifying a From header).
-#             -recipients  A string containing recipient e-mail addresses.
-#                          NOTE: This option overrides any recipient addresses
-#                          specified with -header.
-#             -servers     A list of mail servers that could process the
-#                          request.
-#             -ports       A list of SMTP ports to use for each SMTP server
-#                          specified
-#             -client      The string to use as our host name for EHLO or HELO
-#                          This defaults to 'localhost' or [info hostname]
-#             -maxsecs     Maximum number of seconds to allow the SMTP server
-#                          to accept the message. If not specified, the default
-#                          is 120 seconds.
-#             -usetls      A boolean flag. If the server supports it and we
-#                          have the package, use TLS to secure the connection.
-#             -tlspolicy   A command to call if the TLS negotiation fails for
-#                          some reason. Return 'insecure' to continue with
-#                          normal SMTP or 'secure' to close the connection and
-#                          try another server.
-#             -username    These are needed if your SMTP server requires
-#             -password    authentication.
-#
-# Results:
-#	Message is sent.  On success, return "".  On failure, throw an
-#       exception with an error code and error message.
-
-proc ::smtp::sendmessage {part args} {
-    global errorCode errorInfo
-
-    # Here are the meanings of the following boolean variables:
-    # aloP -- value of -atleastone option above.
-    # debugP -- value of -debug option above.
-    # origP -- 1 if -originator option was specified, 0 otherwise.
-    # queueP -- value of -queue option above.
-
-    set aloP 0
-    set debugP 0
-    set origP 0
-    set queueP 0
-    set maxsecs 120
-    set originator ""
-    set recipients ""
-    set servers [list localhost]
-    set client "" ;# default is set after options processing
-    set ports [list 25]
-    set tlsP 1
-    set tlspolicy {}
-    set username {}
-    set password {}
-
-    array set header ""
-
-    # lowerL will contain the list of header keys (converted to lower case) 
-    # specified with various -header options.  mixedL is the mixed-case version
-    # of the list.
-    set lowerL ""
-    set mixedL ""
-
-    # Parse options (args).
-
-    if {[expr {[llength $args]%2}]} {
-        # Some option didn't get a value.
-        error "Each option must have a value!  Invalid option list: $args"
-    }
-    
-    foreach {option value} $args {
-        switch -- $option {
-            -atleastone {set aloP   [boolean $value]}
-            -debug      {set debugP [boolean $value]}
-            -queue      {set queueP [boolean $value]}
-            -usetls     {set tlsP   [boolean $value]}
-            -tlspolicy  {set tlspolicy $value}
-	    -maxsecs    {set maxsecs [expr {$value < 0 ? 0 : $value}]}
-            -header {
-                if {[llength $value] != 2} {
-                    error "-header expects a key and a value, not $value"
-                }
-                set mixed [lindex $value 0]
-                set lower [string tolower $mixed]
-                set disallowedHdrList \
-                    [list content-type \
-                          content-transfer-encoding \
-                          content-md5 \
-                          mime-version]
-                if {[lsearch -exact $disallowedHdrList $lower] > -1} {
-                    error "Content-Type, Content-Transfer-Encoding,\
-                        Content-MD5, and MIME-Version cannot be user-specified."
-                }
-                if {[lsearch -exact $lowerL $lower] < 0} {
-                    lappend lowerL $lower
-                    lappend mixedL $mixed
-                }               
-
-                lappend header($lower) [lindex $value 1]
-            }
-
-            -originator {
-                set originator $value
-                if {$originator == ""} {
-                    set origP 1
-                }
-            }
-
-            -recipients {
-                set recipients $value
-            }
-
-            -servers {
-                set servers $value
-            }
-
-            -client {
-                set client $value
-            }
-
-            -ports {
-                set ports $value
-            }
-
-            -username { set username $value }
-            -password { set password $value }
-
-            default {
-                error "unknown option $option"
-            }
-        }
-    }
-
-    if {[lsearch -glob $lowerL resent-*] >= 0} {
-        set prefixL resent-
-        set prefixM Resent-
-    } else {
-        set prefixL ""
-        set prefixM ""
-    }
-
-    # Set a bunch of variables whose value will be the real header to be used
-    # in the outbound message (with proper case and prefix).
-
-    foreach mixed {From Sender To cc Dcc Bcc Date Message-ID} {
-        set lower [string tolower $mixed]
-	# FRINK: nocheck
-        set ${lower}L $prefixL$lower
-	# FRINK: nocheck
-        set ${lower}M $prefixM$mixed
-    }
-
-    if {$origP} {
-        # -originator was specified with "", so SMTP sender should be marked "".
-        set sender ""
-    } else {
-        # -originator was specified with a value, OR -originator wasn't
-        # specified at all.
-        
-        # If no -originator was provided, get the originator from the "From"
-        # header.  If there was no "From" header get it from the username
-        # executing the script.
-
-        set who "-originator"
-        if {$originator == ""} {
-            if {![info exists header($fromL)]} {
-                set originator $::tcl_platform(user)
-            } else {
-                set originator [join $header($fromL) ,]
-
-                # Indicate that we're using the From header for the originator.
-
-                set who $fromM
-            }
-        }
-        
-	# If there's no "From" header, create a From header with the value
-	# of -originator as the value.
-
-        if {[lsearch -exact $lowerL $fromL] < 0} {
-            lappend lowerL $fromL
-            lappend mixedL $fromM
-            lappend header($fromL) $originator
-        }
-
-	# ::mime::parseaddress returns a list whose elements are huge key-value
-	# lists with info about the addresses.  In this case, we only want one
-	# originator, so we want the length of the main list to be 1.
-
-        set addrs [::mime::parseaddress $originator]
-        if {[llength $addrs] > 1} {
-            error "too many mailboxes in $who: $originator"
-        }
-        array set aprops {error "invalid address \"$from\""}
-        array set aprops [lindex $addrs 0]
-        if {$aprops(error) != ""} {
-            error "error in $who: $aprops(error)"
-        }
-
-	# sender = validated originator or the value of the From header.
-
-        set sender $aprops(address)
-
-	# If no Sender header has been specified and From is different from
-	# originator, then set the sender header to the From.  Otherwise, don't
-	# specify a Sender header.
-        set from [join $header($fromL) ,]
-        if {[lsearch -exact $lowerL $senderL] < 0 && \
-                [string compare $originator $from]} {
-            if {[info exists aprops]} {
-                unset aprops
-            }
-            array set aprops {error "invalid address \"$from\""}
-            array set aprops [lindex [::mime::parseaddress $from] 0]
-            if {$aprops(error) != ""} {
-                error "error in $fromM: $aprops(error)"
-            }
-            if {[string compare $aprops(address) $sender]} {
-                lappend lowerL $senderL
-                lappend mixedL $senderM
-                lappend header($senderL) $aprops(address)
-            }
-        }
-    }
-
-    # We're done parsing the arguments.
-
-    if {$recipients != ""} {
-        set who -recipients
-    } elseif {![info exists header($toL)]} {
-        error "need -header \"$toM ...\""
-    } else {
-        set recipients [join $header($toL) ,]
-	# Add Cc values to recipients list
-	set who $toM
-        if {[info exists header($ccL)]} {
-            append recipients ,[join $header($ccL) ,]
-            append who /$ccM
-        }
-
-        set dccInd [lsearch -exact $lowerL $dccL]
-        if {$dccInd >= 0} {
-	    # Add Dcc values to recipients list, and get rid of Dcc header
-	    # since we don't want to output that.
-            append recipients ,[join $header($dccL) ,]
-            append who /$dccM
-
-            unset header($dccL)
-            set lowerL [lreplace $lowerL $dccInd $dccInd]
-            set mixedL [lreplace $mixedL $dccInd $dccInd]
-        }
-    }
-
-    set brecipients ""
-    set bccInd [lsearch -exact $lowerL $bccL]
-    if {$bccInd >= 0} {
-        set bccP 1
-
-	# Build valid bcc list and remove bcc element of header array (so that
-	# bcc info won't be sent with mail).
-        foreach addr [::mime::parseaddress [join $header($bccL) ,]] {
-            if {[info exists aprops]} {
-                unset aprops
-            }
-            array set aprops {error "invalid address \"$from\""}
-            array set aprops $addr
-            if {$aprops(error) != ""} {
-                error "error in $bccM: $aprops(error)"
-            }
-            lappend brecipients $aprops(address)
-        }
-
-        unset header($bccL)
-        set lowerL [lreplace $lowerL $bccInd $bccInd]
-        set mixedL [lreplace $mixedL $bccInd $bccInd]
-    } else {
-        set bccP 0
-    }
-
-    # If there are no To headers, add "" to bcc list.  WHY??
-    if {[lsearch -exact $lowerL $toL] < 0} {
-        lappend lowerL $bccL
-        lappend mixedL $bccM
-        lappend header($bccL) ""
-    }
-
-    # Construct valid recipients list from recipients list.
-
-    set vrecipients ""
-    foreach addr [::mime::parseaddress $recipients] {
-        if {[info exists aprops]} {
-            unset aprops
-        }
-        array set aprops {error "invalid address \"$from\""}
-        array set aprops $addr
-        if {$aprops(error) != ""} {
-            error "error in $who: $aprops(error)"
-        }
-        lappend vrecipients $aprops(address)
-    }
-
-    # If there's no date header, get the date from the mime message.  Same for
-    # the message-id.
-
-    if {([lsearch -exact $lowerL $dateL] < 0) \
-            && ([catch { ::mime::getheader $part $dateL }])} {
-        lappend lowerL $dateL
-        lappend mixedL $dateM
-        lappend header($dateL) [::mime::parsedatetime -now proper]
-    }
-
-    if {([lsearch -exact $lowerL ${message-idL}] < 0) \
-            && ([catch { ::mime::getheader $part ${message-idL} }])} {
-        lappend lowerL ${message-idL}
-        lappend mixedL ${message-idM}
-        lappend header(${message-idL}) [::mime::uniqueID]
-
-    }
-
-    # Get all the headers from the MIME object and save them so that they can
-    # later be restored.
-    set savedH [::mime::getheader $part]
-
-    # Take all the headers defined earlier and add them to the MIME message.
-    foreach lower $lowerL mixed $mixedL {
-        foreach value $header($lower) {
-            ::mime::setheader $part $mixed $value -mode append
-        }
-    }
-
-    if {[string length $client] < 1} {
-        if {![string compare $servers localhost]} {
-            set client localhost
-        } else {
-            set client [info hostname]
-        }
-    }
-
-    # Create smtp token, which essentially means begin talking to the SMTP
-    # server.
-    set token [initialize -debug $debugP -client $client \
-		                -maxsecs $maxsecs -usetls $tlsP \
-                                -multiple $bccP -queue $queueP \
-                                -servers $servers -ports $ports \
-                                -tlspolicy $tlspolicy \
-                                -username $username -password $password]
-
-    if {![string match "::smtp::*" $token]} {
-	# An error occurred and $token contains the error info
-	array set respArr $token
-	return -code error $respArr(diagnostic)
-    }
-
-    set code [catch { sendmessageaux $token $part \
-                                           $sender $vrecipients $aloP } \
-                    result]
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    # Send the message to bcc recipients as a MIME attachment.
-
-    if {($code == 0) && ($bccP)} {
-        set inner [::mime::initialize -canonical message/rfc822 \
-                                    -header [list Content-Description \
-                                                  "Original Message"] \
-                                    -parts [list $part]]
-
-        set subject "\[$bccM\]"
-        if {[info exists header(subject)]} {
-            append subject " " [lindex $header(subject) 0] 
-        }
-
-        set outer [::mime::initialize \
-                         -canonical multipart/digest \
-                         -header [list From $originator] \
-                         -header [list Bcc ""] \
-                         -header [list Date \
-                                       [::mime::parsedatetime -now proper]] \
-                         -header [list Subject $subject] \
-                         -header [list Message-ID [::mime::uniqueID]] \
-                         -header [list Content-Description \
-                                       "Blind Carbon Copy"] \
-                         -parts [list $inner]]
-
-
-        set code [catch { sendmessageaux $token $outer \
-                                               $sender $brecipients \
-                                               $aloP } result2]
-        set ecode $errorCode
-        set einfo $errorInfo
-
-        if {$code == 0} {
-            set result [concat $result $result2]
-        } else {
-            set result $result2
-        }
-
-        catch { ::mime::finalize $inner -subordinates none }
-        catch { ::mime::finalize $outer -subordinates none }
-    }
-
-    # Determine if there was any error in prior operations and set errorcodes
-    # and error messages appropriately.
-    
-    switch -- $code {
-        0 {
-            set status orderly
-        }
-
-        7 {
-            set code 1
-            array set response $result
-            set result "$response(code): $response(diagnostic)"
-            set status abort
-        }
-
-        default {
-            set status abort
-        }
-    }
-
-    # Destroy SMTP token 'cause we're done with it.
-    
-    catch { finalize $token -close $status }
-
-    # Restore provided MIME object to original state (without the SMTP headers).
-    
-    foreach key [::mime::getheader $part -names] {
-        mime::setheader $part $key "" -mode delete
-    }
-    foreach {key values} $savedH {
-        foreach value $values {
-            ::mime::setheader $part $key $value -mode append
-        }
-    }
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::smtp::sendmessageaux --
-#
-#	Sends a mime object (containing a message) to some recipients using an
-#       existing SMTP token.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#	part        The MIME object containing the message to send.
-#       originator  The e-mail address of the entity sending the message,
-#                   usually the From clause.
-#       recipients  List of e-mail addresses to whom message will be sent.
-#       aloP        Boolean "atleastone" setting; see the -atleastone option
-#                   in ::smtp::sendmessage for details.
-#
-# Results:
-#	Message is sent.  On success, return "".  On failure, throw an
-#       exception with an error code and error message.
-
-proc ::smtp::sendmessageaux {token part originator recipients aloP} {
-    global errorCode errorInfo
-
-    winit $token $part $originator
-
-    set goodP 0
-    set badP 0
-    set oops ""
-    foreach recipient $recipients {
-        set code [catch { waddr $token $recipient } result]
-        set ecode $errorCode
-        set einfo $errorInfo
-
-        switch -- $code {
-            0 {
-                incr goodP
-            }
-
-            7 {
-                incr badP
-
-                array set response $result
-                lappend oops [list $recipient $response(code) \
-                                   $response(diagnostic)]
-            }
-
-            default {
-                return -code $code -errorinfo $einfo -errorcode $ecode $result
-            }
-        }
-    }
-
-    if {($goodP) && ((!$badP) || ($aloP))} {
-        wtext $token $part
-    } else {
-        catch { talk $token 300 RSET }
-    }
-
-    return $oops
-}
-
-# ::smtp::initialize --
-#
-#	Create an SMTP token and open a connection to the SMTP server.
-#
-# Arguments:
-#       args  A list of arguments specifying various options for sending the
-#             message:
-#             -debug       A boolean specifying whether or not debugging is
-#                          on.  If debugging is enabled, status messages are 
-#                          printed to stderr while trying to send mail.
-#             -client      Either localhost or the name of the local host.
-#             -multiple    Multiple messages will be sent using this token.
-#             -queue       A boolean specifying whether or not the message
-#                          being sent should be queued for later delivery.
-#             -servers     A list of mail servers that could process the
-#                          request.
-#             -ports       A list of ports on mail servers that could process
-#                          the request (one port per server-- defaults to 25).
-#             -usetls      A boolean to indicate we will use TLS if possible.
-#             -tlspolicy   Command called if TLS setup fails.
-#             -username    These provide the authentication information 
-#             -password    to be used if needed by the SMTP server.
-#
-# Results:
-#	On success, return an smtp token.  On failure, throw
-#       an exception with an error code and error message.
-
-proc ::smtp::initialize {args} {
-    global errorCode errorInfo
-
-    variable smtp
-
-    set token [namespace current]::[incr smtp(uid)]
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set state [list afterID "" options "" readable 0]
-    array set options [list -debug 0 -client localhost -multiple 1 \
-                            -maxsecs 120 -queue 0 -servers localhost \
-                            -ports 25 -usetls 1 -tlspolicy {} \
-                            -username {} -password {}]
-    array set options $args
-    set state(options) [array get options]
-
-    # Iterate through servers until one accepts a connection (and responds
-    # nicely).
-   
-    set index 0 
-    foreach server $options(-servers) {
-	set state(readable) 0
-        if {[llength $options(-ports)] >= $index} {
-            set port [lindex $options(-ports) $index]
-        } else {
-            set port 25
-        }
-        if {$options(-debug)} {
-            puts stderr "Trying $server..."
-            flush stderr
-        }
-
-        if {[info exists state(sd)]} {
-            unset state(sd)
-        }
-
-        if {[set code [catch {
-            set state(sd) [socket -async $server $port]
-            fconfigure $state(sd) -blocking off -translation binary
-            fileevent $state(sd) readable [list ::smtp::readable $token]
-        } result]]} {
-            set ecode $errorCode
-            set einfo $errorInfo
-
-            catch { close $state(sd) }
-            continue
-        }
-
-        if {[set code [catch { hear $token 600 } result]]} {
-            array set response [list code 400 diagnostic $result]
-        } else {
-            array set response $result
-        }
-        set ecode $errorCode
-        set einfo $errorInfo
-        switch -- $response(code) {
-            220 {
-            }
-
-            421 - default {
-                # 421 - Temporary problem on server
-                catch {close $state(sd)}
-                continue
-            }
-        }
-
-        set r [initialize_ehlo $token]
-        if {$r != {}} {
-            return $r
-        }
-        incr index
-    }
-
-    # None of the servers accepted our connection, so close everything up and
-    # return an error.
-    finalize $token -close drop
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-proc ::smtp::initialize_ehlo {token} {
-    global errorCode errorInfo
-    upvar einfo einfo
-    upvar ecode ecode
-    upvar code  code
-    
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    array set options $state(options)
-
-    # Try enhanced SMTP first.
-
-    if {[set code [catch {smtp::talk $token 300 "EHLO $options(-client)"} \
-                       result]]} {
-        array set response [list code 400 diagnostic $result args ""]
-    } else {
-        array set response $result
-    }
-    set ecode $errorCode
-    set einfo $errorInfo
-    if {(500 <= $response(code)) && ($response(code) <= 599)} {
-        if {[set code [catch { talk $token 300 \
-                                   "HELO $options(-client)" } \
-                           result]]} {
-            array set response [list code 400 diagnostic $result args ""]
-        } else {
-            array set response $result
-        }
-        set ecode $errorCode
-        set einfo $errorInfo
-    }
-    
-    if {$response(code) == 250} {
-        # Successful response to HELO or EHLO command, so set up queuing
-        # and whatnot and return the token.
-        
-        set state(esmtp) $response(args)
-
-        if {(!$options(-multiple)) \
-                && ([lsearch $response(args) ONEX] >= 0)} {
-            catch {smtp::talk $token 300 ONEX}
-        }
-        if {($options(-queue)) \
-                && ([lsearch $response(args) XQUE] >= 0)} {
-            catch {smtp::talk $token 300 QUED}
-        }
-        
-        # Support STARTTLS extension.
-        # The state(tls) item is used to see if we have already tried this.
-        if {($options(-usetls)) && ![info exists state(tls)] \
-                && (([lsearch $response(args) STARTTLS] >= 0)
-                    || ([lsearch $response(args) TLS] >= 0))} {
-            if {![catch {package require tls}]} {
-                set state(tls) 0
-                if {![catch {smtp::talk $token 300 STARTTLS} resp]} {
-                    array set starttls $resp
-                    if {$starttls(code) == 220} {
-                        fileevent $state(sd) readable {}
-                        catch {
-                            ::tls::import $state(sd)
-                            catch {::tls::handshake $state(sd)} msg
-                            set state(tls) 1
-                        } 
-                        fileevent $state(sd) readable \
-                            [list ::smtp::readable $token]
-                        return [initialize_ehlo $token]
-                    } else {
-                        # Call a TLS client policy proc here
-                        #  returns secure close and try another server.
-                        #  returns insecure continue on current socket
-                        set policy insecure
-                        if {$options(-tlspolicy) != {}} {
-                            catch {
-                                eval $options(-tlspolicy) \
-                                    [list $starttls(code)] \
-                                    [list $starttls(diagnostic)]
-                            } policy
-                        }
-                        if {$policy != "insecure"} {
-                            set code error
-                            set ecode $starttls(code)
-                            set einfo $starttls(diagnostic)
-                            catch {close $state(sd)}
-                            return {}
-                        }
-                    }
-                }
-            }
-        }
-
-        # If we have not already tried and the server supports it and we 
-        # have a username -- lets try to authenticate.
-        #
-        if {![info exists state(auth)]
-            && [llength [package provide SASL]] != 0
-            && [set andx [lsearch -glob $response(args) "AUTH*"]] >= 0 
-            && [string length $options(-username)] > 0 } {
-            
-            # May be AUTH mech or AUTH=mech
-            # We want to use the strongest mechanism that has been offered
-            # and that we support. If we cannot find a mechanism that 
-            # succeeds, we will go ahead and try to carry on unauthenticated.
-            # This may still work else we'll get an unauthorised error later.
-
-            set mechs [string range [lindex $response(args) $andx] 5 end]
-            foreach mech [SASL::mechanisms] {
-                if {[lsearch -exact $mechs $mech] == -1} { continue }
-                if {[catch {
-                    Authenticate $token $mech
-                } msg]} {
-                    if {$options(-debug)} {
-                        puts stderr "AUTH $mech failed: $msg "
-                        flush stderr
-                    }
-                }
-                if {[info exists state(auth)] && $state(auth)} {
-                    if {$state(auth) == 1} {
-                        break
-                    } else {
-                        # After successful AUTH we are supposed to redo
-                        # our connection for mechanisms that setup a new
-                        # security layer -- these should set state(auth) 
-                        # greater than 1
-                        fileevent $state(sd) readable \
-                            [list ::smtp::readable $token]
-                        return [initialize_ehlo $token]
-                    }
-                }
-            }
-        }
-        
-        return $token
-    } else {
-        # Bad response; close the connection and hope the next server
-        # is happier.
-        catch {close $state(sd)}
-    }
-    return {}
-}
-
-proc ::smtp::SASLCallback {token context command args} {
-    upvar #0 $token state
-    upvar #0 $context ctx
-    array set options $state(options)
-    switch -exact -- $command {
-        login    { return "" }
-        username { return $options(-username) }
-        password { return $options(-password) }
-        hostname { return [info host] }
-        realm    { 
-            if {[string equal $ctx(mech) "NTLM"] \
-                    && [info exists ::env(USERDOMAIN)]} {
-                return $::env(USERDOMAIN)
-            } else {
-                return ""
-            }
-        }
-        default  { 
-            return -code error "error: unsupported SASL information requested"
-        }
-    }
-}
-
-proc ::smtp::Authenticate {token mechanism} {
-    upvar 0 $token state
-    package require base64
-    set ctx [SASL::new -mechanism $mechanism \
-                 -callback [list [namespace origin SASLCallback] $token]]
-
-    set state(auth) 0
-    set result [smtp::talk $token 300 "AUTH $mechanism"]
-    array set response $result
-
-    while {$response(code) == 334} {
-        # The NTLM initial response is not base64 encoded so handle it.
-        if {[catch {base64::decode $response(diagnostic)} challenge]} {
-            set challenge $response(diagnostic)
-        }
-        SASL::step $ctx $challenge
-        set result [smtp::talk $token 300 \
-                        [base64::encode -maxlen 0 [SASL::response $ctx]]]
-        array set response $result
-    }
-    
-    if {$response(code) == 235} {
-        set state(auth) 1
-        return $result
-    } else {
-        return -code 7 $result
-    }
-}
-
-# ::smtp::finalize --
-#
-#	Deletes an SMTP token by closing the connection to the SMTP server,
-#       cleanup up various state.
-#
-# Arguments:
-#       token   SMTP token that has an open connection to the SMTP server.
-#       args    Optional arguments, where the only useful option is -close,
-#               whose valid values are the following:
-#               orderly     Normal successful completion.  Close connection and
-#                           clear state variables.
-#               abort       A connection exists to the SMTP server, but it's in
-#                           a weird state and needs to be reset before being
-#                           closed.  Then clear state variables.
-#               drop        No connection exists, so we just need to clean up
-#                           state variables.
-#
-# Results:
-#	SMTP connection is closed and state variables are cleared.  If there's
-#       an error while attempting to close the connection to the SMTP server,
-#       throw an exception with the error code and error message.
-
-proc ::smtp::finalize {token args} {
-    global errorCode errorInfo
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options [list -close orderly]
-    array set options $args
-
-    switch -- $options(-close) {
-        orderly {
-            set code [catch { talk $token 120 QUIT } result]
-        }
-
-        abort {
-            set code [catch {
-                talk $token 0 RSET
-                talk $token 0 QUIT
-            } result]
-        }
-
-        drop {
-            set code 0
-            set result ""
-        }
-
-        default {
-            error "unknown value for -close $options(-close)"
-        }
-    }
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    catch { close $state(sd) }
-
-    if {$state(afterID) != ""} {
-        catch { after cancel $state(afterID) }
-    }
-
-    foreach name [array names state] {
-        unset state($name)
-    }
-    # FRINK: nocheck
-    unset $token
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::smtp::winit --
-#
-#	Send originator info to SMTP server.  This occurs after HELO/EHLO
-#       command has completed successfully (in ::smtp::initialize).  This function
-#       is called by ::smtp::sendmessageaux.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#       part        MIME token for the message to be sent. May be used for
-#                   handling some SMTP extensions.
-#       originator  The e-mail address of the entity sending the message,
-#                   usually the From clause.
-#       mode        SMTP command specifying the mode of communication.  Default
-#                   value is MAIL.
-#
-# Results:
-#	Originator info is sent and SMTP server's response is returned.  If an
-#       error occurs, throw an exception.
-
-proc ::smtp::winit {token part originator {mode MAIL}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[lsearch -exact [list MAIL SEND SOML SAML] $mode] < 0} {
-        error "unknown origination mode $mode"
-    }
-
-    set from "$mode FROM:<$originator>"
-
-    # RFC 1870 -  SMTP Service Extension for Message Size Declaration
-    if {[info exists state(esmtp)] 
-        && [lsearch -glob $state(esmtp) "SIZE*"] != -1} {
-        catch {
-            set size [string length [mime::buildmessage $part]]
-            append from " SIZE=$size"
-        }
-    }
-
-    array set response [set result [talk $token 600 $from]]
-
-    if {$response(code) == 250} {
-        set state(addrs) 0
-        return $result
-    } else {
-        return -code 7 $result
-    }
-}
-
-# ::smtp::waddr --
-#
-#	Send recipient info to SMTP server.  This occurs after originator info
-#       is sent (in ::smtp::winit).  This function is called by
-#       ::smtp::sendmessageaux. 
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#       recipient   One of the recipients to whom the message should be
-#                   delivered.  
-#
-# Results:
-#	Recipient info is sent and SMTP server's response is returned.  If an
-#       error occurs, throw an exception.
-
-proc ::smtp::waddr {token recipient} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set result [talk $token 3600 "RCPT TO:<$recipient>"]
-    array set response $result
-
-    switch -- $response(code) {
-        250 - 251 {
-            incr state(addrs)
-            return $result
-        }
-
-        default {
-            return -code 7 $result
-        }
-    }
-}
-
-# ::smtp::wtext --
-#
-#	Send message to SMTP server.  This occurs after recipient info
-#       is sent (in ::smtp::winit).  This function is called by
-#       ::smtp::sendmessageaux. 
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#	part        The MIME object containing the message to send.
-#
-# Results:
-#	MIME message is sent and SMTP server's response is returned.  If an
-#       error occurs, throw an exception.
-
-proc ::smtp::wtext {token part} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    array set options $state(options)
-
-    set result [talk $token 300 DATA]
-    array set response $result
-    if {$response(code) != 354} {
-        return -code 7 $result
-    }
-
-    if {[catch { wtextaux $token $part } result]} {
-        catch { puts -nonewline $state(sd) "\r\n.\r\n" ; flush $state(sd) }
-        return -code 7 [list code 400 diagnostic $result]
-    }
-
-    set secs $options(-maxsecs)
-
-    set result [talk $token $secs .]
-    array set response $result
-    switch -- $response(code) {
-        250 - 251 {
-            return $result
-        }
-
-        default {
-            return -code 7 $result
-        }
-    }
-}
-
-# ::smtp::wtextaux --
-#
-#	Helper function that coordinates writing the MIME message to the socket.
-#       In particular, it stacks the channel leading to the SMTP server, sets up
-#       some file events, sends the message, unstacks the channel, resets the
-#       file events to their original state, and returns.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#	part        The MIME object containing the message to send.
-#
-# Results:
-#	Message is sent.  If anything goes wrong, throw an exception.
-
-proc ::smtp::wtextaux {token part} {
-    global errorCode errorInfo
-
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    # Workaround a bug with stacking channels on top of TLS.
-    # FRINK: nocheck
-    set trf [set [namespace current]::trf]
-    if {[info exists state(tls)] && $state(tls)} {
-        set trf 0
-    }
-
-    flush $state(sd)
-    fileevent $state(sd) readable ""
-    if {$trf} {
-        transform -attach $state(sd) -command [list ::smtp::wdata $token]
-    } else {
-        set state(size) 1
-    }
-    fileevent $state(sd) readable [list ::smtp::readable $token]
-
-    # If trf is not available, get the contents of the message,
-    # replace all '.'s that start their own line with '..'s, and
-    # then write the mime body out to the filehandle. Do not forget to
-    # deal with bare LF's here too (SF bug #499242).
-
-    if {$trf} {
-        set code [catch { ::mime::copymessage $part $state(sd) } result]
-    } else {
-        set code [catch { ::mime::buildmessage $part } result]
-        if {$code == 0} {
-	    # Detect and transform bare LF's into proper CR/LF
-	    # sequences.
-
-	    while {[regsub -all -- {([^\r])\n} $result "\\1\r\n" result]} {}
-            regsub -all -- {\n\.}      $result "\n.."   result
-
-            # Fix for bug #827436 - mail data must end with CRLF.CRLF
-            if {[string compare [string index $result end] "\n"] != 0} {
-                append result "\r\n"
-            }
-            set state(size) [string length $result]
-            puts -nonewline $state(sd) $result
-            set result ""
-	}
-    }
-    set ecode $errorCode
-    set einfo $errorInfo
-
-    flush $state(sd)
-    fileevent $state(sd) readable ""
-    if {$trf} {
-        unstack $state(sd)
-    }
-    fileevent $state(sd) readable [list ::smtp::readable $token]
-
-    return -code $code -errorinfo $einfo -errorcode $ecode $result
-}
-
-# ::smtp::wdata --
-#
-#	This is the custom transform using Trf to do CR/LF translation.  If Trf
-#       is not installed on the system, then this function never gets called and
-#       no translation occurs.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#       command     Trf provided command for manipulating socket data.
-#	buffer      Data to be converted.
-#
-# Results:
-#	buffer is translated, and state(size) is set.  If Trf is not installed
-#       on the system, the transform proc defined at the top of this file sets
-#       state(size) to 1.  state(size) is used later to determine a timeout
-#       value.
-
-proc ::smtp::wdata {token command buffer} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    switch -- $command {
-        create/write -
-        clear/write  -
-        delete/write {
-            set state(crP) 0
-            set state(nlP) 1
-            set state(size) 0
-        }
-
-        write {
-            set result ""
-
-            foreach c [split $buffer ""] {
-                switch -- $c {
-                    "." {
-                        if {$state(nlP)} {
-                            append result .
-                        }
-                        set state(crP) 0
-                        set state(nlP) 0
-                    }
-
-                    "\r" {
-                        set state(crP) 1
-                        set state(nlP) 0
-                    }
-
-                    "\n" {
-                        if {!$state(crP)} {
-                            append result "\r"
-                        }
-                        set state(crP) 0
-                        set state(nlP) 1
-                    }
-
-                    default {
-                        set state(crP) 0
-                        set state(nlP) 0
-                    }
-                }
-
-                append result $c
-            }
-
-            incr state(size) [string length $result]
-            return $result
-        }
-
-        flush/write {
-            set result ""
-
-            if {!$state(nlP)} {
-                if {!$state(crP)} {
-                    append result "\r"
-                }
-                append result "\n"
-            }
-
-            incr state(size) [string length $result]
-            return $result
-        }
-
-	create/read -
-        delete/read {
-	    # Bugfix for [#539952]
-        }
-
-	query/ratio {
-	    # Indicator for unseekable channel,
-	    # for versions of Trf which ask for
-	    # this.
-	    return {0 0}
-	}
-	query/maxRead {
-	    # No limits on reading bytes from the channel below, for
-	    # versions of Trf which ask for this information
-	    return -1
-	}
-
-	default {
-	    # Silently pass all unknown commands.
-	    #error "Unknown command \"$command\""
-	}
-    }
-
-    return ""
-}
-
-# ::smtp::talk --
-#
-#	Sends an SMTP command to a server
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#	secs        Timeout after which command should be aborted.
-#       command     Command to send to SMTP server.
-#
-# Results:
-#	command is sent and response is returned.  If anything goes wrong, throw
-#       an exception.
-
-proc ::smtp::talk {token secs command} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options $state(options)
-
-    if {$options(-debug)} {
-        puts stderr "--> $command (wait upto $secs seconds)"
-        flush stderr
-    }
-
-    if {[catch { puts -nonewline $state(sd) "$command\r\n"
-                 flush $state(sd) } result]} {
-        return [list code 400 diagnostic $result]
-    }
-
-    if {$secs == 0} {
-        return ""
-    }
-
-    return [hear $token $secs]
-}
-
-# ::smtp::hear --
-#
-#	Listens for SMTP server's response to some prior command.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#	secs        Timeout after which we should stop waiting for a response.
-#
-# Results:
-#	Response is returned.
-
-proc ::smtp::hear {token secs} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options $state(options)
-
-    array set response [list args ""]
-
-    set firstP 1
-    while {1} {
-        if {$secs >= 0} {
-	    ## SF [ 836442 ] timeout with large data
-	    ## correction, aotto 031105 -
-	    if {$secs > 600} {set secs 600}
-            set state(afterID) [after [expr {$secs*1000}] \
-                                      [list ::smtp::timer $token]]
-        }
-
-        if {!$state(readable)} {
-            vwait ${token}(readable)
-        }
-
-        # Wait until socket is readable.
-        if {$state(readable) !=  -1} {
-            catch { after cancel $state(afterID) }
-            set state(afterID) ""
-        }
-
-        if {$state(readable) < 0} {
-            array set response [list code 400 diagnostic $state(error)]
-            break
-        }
-        set state(readable) 0
-
-        if {$options(-debug)} {
-            puts stderr "<-- $state(line)"
-            flush stderr
-        }
-
-        if {[string length $state(line)] < 3} {
-            array set response \
-                  [list code 500 \
-                        diagnostic "response too short: $state(line)"]
-            break
-        }
-
-        if {$firstP} {
-            set firstP 0
-
-            if {[scan [string range $state(line) 0 2] %d response(code)] \
-                    != 1} {
-                array set response \
-                      [list code 500 \
-                            diagnostic "unrecognizable code: $state(line)"]
-                break
-            }
-
-            set response(diagnostic) \
-                [string trim [string range $state(line) 4 end]]
-        } else {
-            lappend response(args) \
-                    [string trim [string range $state(line) 4 end]]
-        }
-
-        # When status message line ends in -, it means the message is complete.
-        
-        if {[string compare [string index $state(line) 3] -]} {
-            break
-        }
-    }
-
-    return [array get response]
-}
-
-# ::smtp::readable --
-#
-#	Reads a line of data from SMTP server when the socket is readable.  This
-#       is the callback of "fileevent readable".
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#
-# Results:
-#	state(line) contains the line of data and state(readable) is reset.
-#       state(readable) gets the following values:
-#       -3  if there's a premature eof,
-#       -2  if reading from socket fails.
-#       1   if reading from socket was successful
-
-proc ::smtp::readable {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    if {[catch { array set options $state(options) }]} {
-        return
-    }
-
-    set state(line) ""
-    if {[catch { gets $state(sd) state(line) } result]} {
-        set state(readable) -2
-        set state(error) $result
-    } elseif {$result == -1} {
-        if {[eof $state(sd)]} {
-            set state(readable) -3
-            set state(error) "premature end-of-file from server"
-        }
-    } else {
-        # If the line ends in \r, remove the \r.
-        if {![string compare [string index $state(line) end] "\r"]} {
-            set state(line) [string range $state(line) 0 end-1]
-        }
-        set state(readable) 1
-    }
-
-    if {$state(readable) < 0} {
-        if {$options(-debug)} {
-            puts stderr "    ... $state(error) ..."
-            flush stderr
-        }
-
-        catch { fileevent $state(sd) readable "" }
-    }
-}
-
-# ::smtp::timer --
-#
-#	Handles timeout condition on any communication with the SMTP server.
-#
-# Arguments:
-#       token       SMTP token that has an open connection to the SMTP server.
-#
-# Results:
-#	Sets state(readable) to -1 and state(error) to an error message.
-
-proc ::smtp::timer {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    array set options $state(options)
-
-    set state(afterID) ""
-    set state(readable) -1
-    set state(error) "read from server timed out"
-
-    if {$options(-debug)} {
-        puts stderr "    ... $state(error) ..."
-        flush stderr
-    }
-}
-
-# ::smtp::boolean --
-#
-#	Helper function for unifying boolean values to 1 and 0.
-#
-# Arguments:
-#       value   Some kind of value that represents true or false (i.e. 0, 1,
-#               false, true, no, yes, off, on).
-#
-# Results:
-#	Return 1 if the value is true, 0 if false.  If the input value is not
-#       one of the above, throw an exception.
-
-proc ::smtp::boolean {value} {
-    switch -- [string tolower $value] {
-        0 - false - no - off {
-            return 0
-        }
-
-        1 - true - yes - on {
-            return 1
-        }
-
-        default {
-            error "unknown boolean value: $value"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-package provide smtp $::smtp::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-# indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/multiplexer/multiplexer.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/multiplexer/multiplexer.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,291 +1,0 @@
-# multiplexer.tcl -- one-to-many comunication with sockets
-#
-#	Implementation of a one-to-many multiplexer in Tcl utilizing
-#	sockets.
-
-# Copyright (c) 2001-2003 by David N. Welton <davidw@dedasys.com>
-
-# This file may be distributed under the same terms as Tcl.
-
-# $Id: multiplexer.tcl,v 1.4 2004/01/15 06:36:13 andreas_kupries Exp $
-
-package provide multiplexer 0.2
-package require logger
-
-namespace eval ::multiplexer {
-    variable Unique 0
-}
-
-proc ::multiplexer::create {} {
-    variable Unique
-    set ns ::multiplexer::mp$Unique
-
-    namespace eval $ns {
-	# Use the namespace as the logger name.
-	set log [logger::init [string trimleft [namespace current] ::]]
-	# list of connected clients
-	array set clients {}
-
-	# filters to run at access (socket accept) time
-	set accessfilters {}
-
-	# filters to run on data
-	set filters {}
-
-	# hook to run at exit time
-	set exitfilters {}
-
-	# config options
-	array set config {}
-	set config(sendtoorigin) 0
-	set config(debuglevel) warn
-	${log}::disable $config(debuglevel)
-	${log}::enable $config(debuglevel)
-
-	# AddAccessFilter --
-	#
-	# Command to add an access filter that will be called like so:
-	#
-	# AccessFilter chan clientaddress clientport
-	#
-	# Arguments:
-	#
-	# function: proc to filter access to the multiplexer.  Takes chan,
-	# clientaddress and clientport arguments.  Returns 0 on success, -1 on
-	# failure.
-
-	proc AddAccessFilter { function } {
-	    variable accessfilters
-	    lappend accessfilters $function
-	}
-
-	# AddFilter --
-
-	# Command to add a filter for data that passes through the
-	# multiplexer.  The filter proc is called like this:
-
-	# Filter data chan clientaddress clientport
-
-	# Arguments:
-
-	# function: proc to filter data that arrives to the
-	# multiplexer.
-	# Takes data, chan, clientaddress, and clientport arguments.  Returns
-	# filtered version of data.
-
-	proc AddFilter { function } {
-	    variable filters
-	    lappend filters $function
-	}
-
-	# AddExitFilter --
-
-	# Adds filter to be run when client socket generates an EOF condition.
-	# ExitFilter functions look like the following:
-
-	# ExitFilter chan clientaddress clientport
-
-	# Arguments:
-
-	# function: hook to be run when clients exit by generating an EOF.
-	# Takes chan, clientaddress and clientport arguments, and returns
-	# nothing.
-
-	proc AddExitFilter { function } {
-	    variable exitfilters
-	    lappend exitfilters $function
-	}
-
-	# DelClient --
-
-	# Deletes a client from the client list, and runs exit filters.
-
-	# Arguments:
-
-	# chan: channel that is closed.
-
-	# client: address of client
-
-	# clientport: port number of client.
-
-	proc DelClient { chan client clientport } {
-	    variable clients
-	    variable exitfilters
-	    variable config
-	    variable log
-	    foreach ef $exitfilters {
-		catch {
-		    $ef $chan $client $clientport
-		} err
-		${log}::debug "Error in DelClient: $err"
-	    }
-	    unset clients($chan)
-	    close $chan
-	}
-
-
-	# MultiPlex --
-
-	# Multiplex data
-
-	# Arguments:
-
-	# data - data to multiplex
-
-	proc MultiPlex { data {chan ""} } {
-	    variable clients
-	    variable config
-	    variable log
-
-	    foreach c [array names clients] {
-		if { $config(sendtoorigin) } {
-		    puts -nonewline $c "$data"
-		} else {
-		    if { $chan != $c } {
-			${log}::debug "Sending '$data' to $c"
-			puts -nonewline $c "$data"
-		    }
-		}
-	    }
-	}
-
-
-	# GetData --
-
-	# Get data from clients, filter it, redistribute it.
-
-	# Arguments:
-
-	# chan: open channel
-
-	# client: client address
-
-	# clientport: port number of client
-
-	proc GetData { chan client clientport } {
-	    variable filters
-	    variable clients
-	    variable config
-	    variable log
-	    if { ! [eof $chan] } {
-		set data [read $chan]
-	#	gets $chan data
-		${log}::debug "Tcl chan $chan from host $client and port $clientport sends: $data"
-		# do data filters
-		foreach f $filters {
-		    catch {
-			set data [$f $data $chan $client $clientport]
-		    } err
-		    ${log}::debug "GetData filter: $err"
-		}
-		set chans [array names clients]
-		MultiPlex $data $chan
-	    } else {
-		${log}::debug "Deleting client $chan from host $client and port $clientport."
-		DelClient $chan $client $clientport
-	    }
-	}
-
-	# NewClient --
-
-	# Sets up newly created connection after running access filters
-
-	# Arguments:
-
-	# chan: open channel
-
-	# client: client address
-
-	# clientport: port number of client
-
-	proc NewClient { chan client clientport } {
-	    variable clients
-	    variable config
-	    variable accessfilters
-	    variable log
-	    # run through access filters
-	    foreach af $accessfilters {
-		if { [$af $chan $client $clientport] == -1 } {
-		    ${log}::debug "Access denied to $chan $client $clientport"
-		    close $chan
-		    return
-		}
-	    }
-	    set clients($chan) $client
-
-	    # We want to read data and immediately send it out again.
-	    fconfigure $chan -blocking 0
-	    fconfigure $chan -buffering none
-	    fconfigure $chan -translation binary
-	    fileevent $chan readable [list [namespace current]::GetData $chan $client $clientport]
-	    ${log}::debug "Tcl channel $chan is host $client and port $clientport."
-	}
-
-	# Config --
-	#
-	# Configure global options, which currently include the
-	# following:
-	#
-	# sendtoorigin: if 1, resend the data to all clients, including the
-	# sender.  Defaults to 0
-	#
-	# debuglevel: a debug level understood by logger.
-	#
-	# Arguments:
-	#
-	# key: name of option to configure
-	#
-	# value: value for option.
-
-	proc Config { key value } {
-	    variable config
-	    variable log
-	    if { $key == "debuglevel" } {
-		${log}::disable $config(debuglevel)
-		${log}::enable $value
-	    }
-	    set config($key) $value
-	}
-
-	# Init --
-	#
-	# Start the server
-	#
-	# Arguments:
-	#
-	# port: port to listen on.
-
-	proc Init { port } {
-	    variable serversock
-	    set serversock [socket -server [namespace current]::NewClient $port]
-	}
-
-	# destroy --
-	#
-	#	Destroy multiplexer instance.  It is important to do
-	#	this, to free the resources used.
-	#
-	# Side Effects:
-	#	Deletes namespace associated with multiplexer
-	#	instance.
-
-
-	proc destroy { } {
-	    variable serversock
-	    foreach c [array names clients] {
-	        catch { close $c }
-	    }
-	    catch {
-		close $serversock
-	    }
-	    namespace delete [namespace current]
-	}
-
-    }
-    incr Unique
-    return $ns
-}
-
-namespace eval multiplexer {
-    namespace export create destroy
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/multiplexer/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/multiplexer/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if { ![package vsatisfies [package provide Tcl] 8.2] } { return }
-package ifneeded multiplexer 0.2 [list source [file join $dir multiplexer.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ncgi/ncgi.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ncgi/ncgi.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1098 +1,0 @@
-# ncgi.tcl
-#
-# Basic support for CGI programs
-#
-# Copyright (c) 2000 Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-
-
-# Please note that Don Libes' has a "cgi.tcl" that implements version 1.0
-# of the cgi package.  That implementation provides a bunch of cgi_ procedures
-# (it doesn't use the ::cgi:: namespace) and has a wealth of procedures for
-# generating HTML.  In contract, the package provided here is primarly
-# concerned with processing input to CGI programs.  I have tried to mirror his
-# API's where possible.  So, ncgi::input is equivalent to cgi_input, and so
-# on.  There are also some different APIs for accessing values (ncgi::list,
-# ncgi::parse and ncgi::value come to mind)
-
-# Note, I use the term "query data" to refer to the data that is passed in
-# to a CGI program.  Typically this comes from a Form in an HTML browser.
-# The query data is composed of names and values, and the names can be
-# repeated.  The names and values are encoded, and this module takes care
-# of decoding them.
-
-# We use newer string routines
-package require Tcl 8.2
-package require fileutil ; # Required by importFile.
-
-package provide ncgi 1.3.2
-
-namespace eval ::ncgi {
-
-    # "query" holds the raw query (i.e., form) data
-    # This is treated as a cache, too, so you can call ncgi::query more than
-    # once
-
-    variable query
-
-    # This is the content-type which affects how the query is parsed
-
-    variable contenttype
-
-    # value is an array of parsed query data.  Each array element is a list
-    # of values, and the array index is the form element name.
-    # See the differences among ncgi::parse, ncgi::input, ncgi::value
-    # and ncgi::valuelist for the various approaches to handling these values.
-
-    variable value
-
-    # This lists the names that appear in the query data
-
-    variable varlist
-
-    # This holds the URL coresponding to the current request
-    # This does not include the server name.
-
-    variable urlStub
-
-    # This flags compatibility with Don Libes cgi.tcl when dealing with
-    # form values that appear more than once.  This bit gets flipped when
-    # you use the ncgi::input procedure to parse inputs.
-
-    variable listRestrict 0
-
-    # This is the set of cookies that are pending for output
-
-    variable cookieOutput
-
-    # Support for x-www-urlencoded character mapping
-    # The spec says: "non-alphanumeric characters are replaced by '%HH'"
- 
-    variable i
-    variable c
-    variable map
-
-    for {set i 1} {$i <= 256} {incr i} {
-	set c [format %c $i]
-	if {![string match \[a-zA-Z0-9\] $c]} {
-	    set map($c) %[format %.2X $i]
-	}
-    }
-     
-    # These are handled specially
-    array set map {
-	" " +   \n %0D%0A
-    }
-
-    # Map of transient files
-
-    variable  _tmpfiles
-    array set _tmpfiles {}
-
-    # I don't like importing, but this makes everything show up in 
-    # pkgIndex.tcl
-
-    namespace export reset urlStub query type decode encode
-    namespace export nvlist parse input value valueList names
-    namespace export setValue setValueList setDefaultValue setDefaultValueList
-    namespace export empty import importAll importFile redirect header
-    namespace export parseMimeValue multipart cookie setCookie
-}
-
-# ::ncgi::reset
-#
-#	This resets the state of the CGI input processor.  This is primarily
-#	used for tests, although it is also designed so that TclHttpd can
-#	call this with the current query data
-#	so the ncgi package can be shared among TclHttpd and CGI scripts.
-#
-#	DO NOT CALL this in a standard cgi environment if you have not
-#	yet processed the query data, which will not be used after a
-#	call to ncgi::reset is made.  Instead, just call ncgi::parse
-#
-# Arguments:
-#	newquery	The query data to be used instead of external CGI.
-#	newtype		The raw content type.
-#
-# Side Effects:
-#	Resets the cached query data and wipes any environment variables
-#	associated with CGI inputs (like QUERY_STRING)
-
-proc ::ncgi::reset {args} {
-    global env
-    variable _tmpfiles
-    variable query
-    variable contenttype
-    variable cookieOutput
-
-    # array unset _tmpfiles -- Not a Tcl 8.2 idiom
-    unset _tmpfiles ; array set _tmpfiles {}
-
-    set cookieOutput {}
-    if {[llength $args] == 0} {
-
-	# We use and test args here so we can detect the
-	# difference between empty query data and a full reset.
-
-	if {[info exists query]} {
-	    unset query
-	}
-	if {[info exists contenttype]} {
-	    unset contenttype
-	}
-    } else {
-	set query [lindex $args 0]
-	set contenttype [lindex $args 1]
-    }
-}
-
-# ::ncgi::urlStub
-#
-#	Set or return the URL associated with the current page.
-#	This is for use by TclHttpd to override the default value
-#	that otherwise comes from the CGI environment
-#
-# Arguments:
-#	url	(option) The url of the page, not counting the server name.
-#		If not specified, the current urlStub is returned
-#
-# Side Effects:
-#	May affects future calls to ncgi::urlStub
-
-proc ::ncgi::urlStub {{url {}}} {
-    global   env
-    variable urlStub
-    if {[string length $url]} {
-	set urlStub $url
-	return ""
-    } elseif {[info exists urlStub]} {
-	return $urlStub
-    } elseif {[info exists env(SCRIPT_NAME)]} {
-	set urlStub $env(SCRIPT_NAME)
-	return $urlStub
-    } else {
-	return ""
-    }
-}
-
-# ::ncgi::query
-#
-#	This reads the query data from the appropriate location, which depends
-#	on if it is a POST or GET request.
-#
-# Arguments:
-#	none
-#
-# Results:
-#	The raw query data.
-
-proc ::ncgi::query {} {
-    global env
-    variable query
-
-    if {[info exists query]} {
-	# This ensures you can call ncgi::query more than once,
-	# and that you can use it with ncgi::reset
-	return $query
-    }
-
-    set query ""
-    if {[info exists env(REQUEST_METHOD)]} {
-	if {$env(REQUEST_METHOD) == "GET"} {
-	    if {[info exists env(QUERY_STRING)]} {
-		set query $env(QUERY_STRING)
-	    }
-	} elseif {$env(REQUEST_METHOD) == "POST"} {
-	    if {[info exists env(CONTENT_LENGTH)] &&
-		    [string length $env(CONTENT_LENGTH)] != 0} {
- 		## added by Steve Cassidy to try to fix binary file upload
- 		fconfigure stdin -translation binary -encoding binary
-		set query [read stdin $env(CONTENT_LENGTH)]
-	    }
-	}
-    }
-    return $query
-}
-
-# ::ncgi::type
-#
-#	This returns the content type of the query data.
-#
-# Arguments:
-#	none
-#
-# Results:
-#	The content type of the query data.
-
-proc ::ncgi::type {} {
-    global env
-    variable contenttype
-
-    if {![info exists contenttype]} {
-	if {[info exists env(CONTENT_TYPE)]} {
-	    set contenttype $env(CONTENT_TYPE)
-	} else {
-	    return ""
-	}
-    }
-    return $contenttype
-}
-
-# ::ncgi::decode
-#
-#	This decodes data in www-url-encoded format.
-#
-# Arguments:
-#	An encoded value
-#
-# Results:
-#	The decoded value
-
-proc ::ncgi::decode {str} {
-    # rewrite "+" back to space
-    # protect \ from quoting another '\'
-    set str [string map [list + { } "\\" "\\\\"] $str]
-
-    # prepare to process all %-escapes
-    regsub -all -- {%([A-Fa-f0-9][A-Fa-f0-9])} $str {\\u00\1} str
-
-    # process \u unicode mapped chars
-    return [subst -novar -nocommand $str]
-}
-
-# ::ncgi::encode
-#
-#	This encodes data in www-url-encoded format.
-#
-# Arguments:
-#	A string
-#
-# Results:
-#	The encoded value
-
-proc ::ncgi::encode {string} {
-    variable map
-
-    # 1 leave alphanumerics characters alone
-    # 2 Convert every other character to an array lookup
-    # 3 Escape constructs that are "special" to the tcl parser
-    # 4 "subst" the result, doing all the array substitutions
-
-    regsub -all -- \[^a-zA-Z0-9\] $string {$map(&)} string
-    # This quotes cases like $map([) or $map($) => $map(\[) ...
-    regsub -all -- {[][{})\\]\)} $string {\\&} string
-    return [subst -nocommand $string]
-}
-
-# ::ncgi::names
-#
-#	This parses the query data and returns a list of the names found therein.
-#
-# 	Note: If you use ncgi::setValue or ncgi::setDefaultValue, this
-#	names procedure doesn't see the effect of that.
-#
-# Arguments:
-#	none
-#
-# Results:
-#	A list of names
-
-proc ::ncgi::names {} {
-    array set names {}
-    foreach {name val} [nvlist] {
-        if {![string equal $name "anonymous"]} {
-            set names($name) 1
-        }
-    }
-    return [array names names]
-}
-
-# ::ncgi::nvlist
-#
-#	This parses the query data and returns it as a name, value list
-#
-# 	Note: If you use ncgi::setValue or ncgi::setDefaultValue, this
-#	nvlist procedure doesn't see the effect of that.
-#
-# Arguments:
-#	none
-#
-# Results:
-#	An alternating list of names and values
-
-proc ::ncgi::nvlist {} {
-    set query [query]
-    set type  [type]
-    switch -glob -- $type {
-	"" -
-	text/xml* -
-	application/x-www-form-urlencoded* -
-	application/x-www-urlencoded* {
-	    set result {}
-
-	    # Any whitespace at the beginning or end of urlencoded data is not
-	    # considered to be part of that data, so we trim it off.  One special
-	    # case in which post data is preceded by a \n occurs when posting
-	    # with HTTPS in Netscape.
-
-	    foreach {x} [split [string trim $query] &] {
-		# Turns out you might not get an = sign,
-		# especially with <isindex> forms.
-
-		set pos [string first = $x]
-		set len [string length $x]
-
-		if { $pos>=0 } {
-		    if { $pos == 0 } { # if the = is at the beginning ...
-		        if { $len>1 } { 
-                            # ... and there is something to the right ...
-		            set varname anonymous
-		            set val [string range $x 1 end]]
-		        } else { 
-                            # ... otherwise, all we have is an =
-		            set varname anonymous
-		            set val ""
-		        }
-		    } elseif { $pos==[expr {$len-1}] } { 
-                        # if the = is at the end ...
-		        set varname [string range $x 0 [expr {$pos-1}]]
-			set val ""
-		    } else {
-		        set varname [string range $x 0 [expr {$pos-1}]]
-		        set val [string range $x [expr {$pos+1}] end]
-		    }
-		} else { # no = was found ...
-		    set varname anonymous
-		    set val $x
-		}		
-		lappend result [decode $varname] [decode $val]
-	    }
-	    return $result
-	}
-	multipart/* {
-	    return [multipart $type $query]
-	}
-	default {
-	    return -code error "Unknown Content-Type: $type"
-	}
-    }
-}
-
-# ::ncgi::parse
-#
-#	The parses the query data and stores it into an array for later retrieval.
-#	You should use the ncgi::value or ncgi::valueList procedures to get those
-#	values, or you are allowed to access the ncgi::value array directly.
-#
-#	Note - all values have a level of list structure associated with them
-#	to allow for multiple values for a given form element (e.g., a checkbox)
-#
-# Arguments:
-#	none
-#
-# Results:
-#	A list of names of the query values
-
-proc ::ncgi::parse {} {
-    variable value
-    variable listRestrict 0
-    variable varlist {}
-    if {[info exists value]} {
-	unset value
-    }
-    foreach {name val} [nvlist] {
-	if {![info exists value($name)]} {
-	    lappend varlist $name
-	}
-	lappend value($name) $val
-    }
-    return $varlist
-} 
-
-# ::ncgi::input
-#
-#	Like ncgi::parse, but with Don Libes cgi.tcl semantics.
-#	Form elements must have a trailing "List" in their name to be
-#	listified, otherwise this raises errors if an element appears twice.
-#
-# Arguments:
-#	fakeinput	See ncgi::reset
-#	fakecookie	The raw cookie string to use when testing.
-#
-# Results:
-#	The list of element names in the form
-
-proc ::ncgi::input {{fakeinput {}} {fakecookie {}}} {
-    variable value
-    variable varlist {}
-    variable listRestrict 1
-    if {[info exists value]} {
-	unset value
-    }
-    if {[string length $fakeinput]} {
-	ncgi::reset $fakeinput
-    }
-    foreach {name val} [nvlist] {
-	set exists [info exists value($name)]
-	if {!$exists} {
-	    lappend varlist $name
-	}
-	if {[string match "*List" $name]} {
-	    # Accumulate a list of values for this name
-	    lappend value($name) $val
-	} elseif {$exists} {
-	    error "Multiple definitions of $name encountered in input.\
-	    If you're trying to do this intentionally (such as with select),\
-	    the variable must have a \"List\" suffix."
-	} else {
-	    # Capture value with no list structure
-	    set value($name) $val
-	}
-    }
-    return $varlist
-} 
-
-# ::ncgi::value
-#
-#	Return the value of a named query element, or the empty string if
-#	it was not not specified.  This only returns the first value of
-#	associated with the name.  If you want them all (like all values
-#	of a checkbox), use ncgi::valueList
-#
-# Arguments:
-#	key	The name of the query element
-#	default	The value to return if the value is not present
-#
-# Results:
-#	The first value of the named element, or the default
-
-proc ::ncgi::value {key {default {}}} {
-    variable value
-    variable listRestrict
-    variable contenttype
-    if {[info exists value($key)]} {
-	if {$listRestrict} {
-
-	    # ::ncgi::input was called, and it already figured out if the
-	    # user wants list structure or not.
-
-	    set val $value($key)
-	} else {
-
-	    # Undo the level of list structure done by ncgi::parse
-
-	    set val [lindex $value($key) 0]
-	}
-	if {[string match multipart/* [type]]} {
-
-	    # Drop the meta-data information associated with each part
-
-	    set val [lindex $val 1]
-	}
-	return $val
-    } else {
-	return $default
-    }
-}
-
-# ::ncgi::valueList
-#
-#	Return all the values of a named query element as a list, or
-#	the empty list if it was not not specified.  This always returns
-#	lists - if you do not want the extra level of listification, use
-#	ncgi::value instead.
-#
-# Arguments:
-#	key	The name of the query element
-#
-# Results:
-#	The first value of the named element, or ""
-
-proc ::ncgi::valueList {key {default {}}} {
-    variable value
-    if {[info exists value($key)]} {
-	return $value($key)
-    } else {
-	return $default
-    }
-}
-
-# ::ncgi::setValue
-#
-#	Jam a new value into the CGI environment.  This is handy for preliminary
-#	processing that does data validation and cleanup.
-#
-# Arguments:
-#	key	The name of the query element
-#	value	This is a single value, and this procedure wraps it up in a list
-#		for compatibility with the ncgi::value array usage.  If you
-#		want a list of values, use ngci::setValueList
-#		
-#
-# Side Effects:
-#	Alters the ncgi::value and possibly the ncgi::valueList variables
-
-proc ::ncgi::setValue {key value} {
-    variable listRestrict
-    if {$listRestrict} {
-	ncgi::setValueList $key $value
-    } else {
-	ncgi::setValueList $key [list $value]
-    }
-}
-
-# ::ncgi::setValueList
-#
-#	Jam a list of new values into the CGI environment.
-#
-# Arguments:
-#	key		The name of the query element
-#	valuelist	This is a list of values, e.g., for checkbox or multiple
-#			selections sets.
-#		
-# Side Effects:
-#	Alters the ncgi::value and possibly the ncgi::valueList variables
-
-proc ::ncgi::setValueList {key valuelist} {
-    variable value
-    variable varlist
-    if {![info exists value($key)]} {
-	lappend varlist $key
-    }
-
-    # This if statement is a workaround for another hack in
-    # ::ncgi::value that treats multipart form data
-    # differently.
-    if {[string match multipart/* [type]]} {
-	set value($key) [list [list {} [join $valuelist]]]
-    } else {
-	set value($key) $valuelist
-    }
-    return ""
-}
-
-# ::ncgi::setDefaultValue
-#
-#	Set a new value into the CGI environment if there is not already one there.
-#
-# Arguments:
-#	key	The name of the query element
-#	value	This is a single value, and this procedure wraps it up in a list
-#		for compatibility with the ncgi::value array usage.
-#		
-#
-# Side Effects:
-#	Alters the ncgi::value and possibly the ncgi::valueList variables
-
-proc ::ncgi::setDefaultValue {key value} {
-    ncgi::setDefaultValueList $key [list $value]
-}
-
-# ::ncgi::setDefaultValueList
-#
-#	Jam a list of new values into the CGI environment if the CGI value
-#	is not already defined.
-#
-# Arguments:
-#	key		The name of the query element
-#	valuelist	This is a list of values, e.g., for checkbox or multiple
-#			selections sets.
-#		
-# Side Effects:
-#	Alters the ncgi::value and possibly the ncgi::valueList variables
-
-proc ::ncgi::setDefaultValueList {key valuelist} {
-    variable value
-    if {![info exists value($key)]} {
-	ncgi::setValueList $key $valuelist
-	return ""
-    } else {
-	return ""
-    }
-}
-
-# ::ncgi::empty --
-#
-#	Return true if the CGI variable doesn't exist.
-#
-# Arguments:
-#	name	Name of the CGI variable
-#
-# Results:
-#	1 if the variable doesn't exist
-
-proc ::ncgi::exists {var} {
-    variable value
-    return [info exists value($var)]
-}
-
-# ::ncgi::empty --
-#
-#	Return true if the CGI variable doesn't exist or is an empty string
-#
-# Arguments:
-#	name	Name of the CGI variable
-#
-# Results:
-#	1 if the variable doesn't exist or has the empty value
-
-proc ::ncgi::empty {name} {
-    return [expr {[string length [string trim [value $name]]] == 0}]
-}
-
-# ::ncgi::import
-#
-#	Map a CGI input into a Tcl variable.  This creates a Tcl variable in
-#	the callers scope that has the value of the CGI input.  An alternate
-#	name for the Tcl variable can be specified.
-#
-# Arguments:
-#	cginame		The name of the form element
-#	tclname		If present, an alternate name for the Tcl variable,
-#			otherwise it is the same as the form element name
-
-proc ::ncgi::import {cginame {tclname {}}} {
-    if {[string length $tclname]} {
-	upvar 1 $tclname var
-    } else {
-	upvar 1 $cginame var
-    }
-    set var [value $cginame]
-}
-
-# ::ncgi::importAll
-#
-#	Map a CGI input into a Tcl variable.  This creates a Tcl variable in
-#	the callers scope for every CGI value, or just for those named values.
-#
-# Arguments:
-#	args	A list of form element names.  If this is empty,
-#		then all form value are imported.
-
-proc ::ncgi::importAll {args} {
-    variable varlist
-    if {[llength $args] == 0} {
-	set args $varlist
-    }
-    foreach cginame $args {
-	upvar 1 $cginame var
-	set var [value $cginame]
-    }
-}
-
-# ::ncgi::redirect
-#
-#	Generate a redirect by returning a header that has a Location: field.
-#	If the URL is not absolute, this automatically qualifies it to
-#	the current server
-#
-# Arguments:
-#	url		The url to which to redirect
-#
-# Side Effects:
-#	Outputs a redirect header
-
-proc ::ncgi::redirect {url} {
-    global env
-
-    if {![regexp -- {^[^:]+://} $url]} {
-
-	# The url is relative (no protocol/server spec in it), so
-	# here we create a canonical URL.
-
-	# request_uri	The current URL used when dealing with relative URLs.  
-	# proto		http or https
-	# server 	The server, which we are careful to match with the
-	#		current one in base Basic Authentication is being used.
-	# port		This is set if it is not the default port.
-
-	if {[info exists env(REQUEST_URI)]} {
-	    # Not all servers have the leading protocol spec
-	    regsub -- {^https?://[^/]*/} $env(REQUEST_URI) / request_uri
-	} elseif {[info exists env(SCRIPT_NAME)]} {
-	    set request_uri $env(SCRIPT_NAME)
-	} else {
-	    set request_uri /
-	}
-
-	set port ""
-	if {[info exists env(HTTPS)] && $env(HTTPS) == "on"} {
-	    set proto https
-	    if {$env(SERVER_PORT) != 443} {
-		set port :$env(SERVER_PORT)
-	    }
-	} else {
-	    set proto http
-	    if {$env(SERVER_PORT) != 80} {
-		set port :$env(SERVER_PORT)
-	    }
-	}
-	# Pick the server from REQUEST_URI so it matches the current
-	# URL.  Otherwise use SERVER_NAME.  These could be different, e.g.,
-	# "pop.scriptics.com" vs. "pop"
-
-	if {[info exists env(REQUEST_URI)]} {
-	    # Not all servers have the leading protocol spec
-	    if {![regexp -- {^https?://([^/:]*)} $env(REQUEST_URI) x server]} {
-		set server $env(SERVER_NAME)
-	    }
-	} else {
-	    set server $env(SERVER_NAME)
-	}
-	if {[string match /* $url]} {
-	    set url $proto://$server$port$url
-	} else {
-	    regexp -- {^(.*/)[^/]*$} $request_uri match dirname
-	    set url $proto://$server$port$dirname$url
-	}
-    }
-    ncgi::header text/html Location $url
-    puts "Please go to <a href=\"$url\">$url</a>"
-}
-
-# ncgi:header
-#
-#	Output the Content-Type header.
-#
-# Arguments:
-#	type	The MIME content type
-#	args	Additional name, value pairs to specifiy output headers
-#
-# Side Effects:
-#	Outputs a normal header
-
-proc ::ncgi::header {{type text/html} args} {
-    variable cookieOutput
-    puts "Content-Type: $type"
-    foreach {n v} $args {
-	puts "$n: $v"
-    }
-    if {[info exists cookieOutput]} {
-	foreach line $cookieOutput {
-	    puts "Set-Cookie: $line"
-	}
-    }
-    puts ""
-    flush stdout
-}
-
-# ::ncgi::parseMimeValue
-#
-#	Parse a MIME header value, which has the form
-#	value; param=value; param2="value2"; param3='value3'
-#
-# Arguments:
-#	value	The mime header value.  This does not include the mime
-#		header field name, but everything after it.
-#
-# Results:
-#	A two-element list, the first is the primary value,
-#	the second is in turn a name-value list corresponding to the
-#	parameters.  Given the above example, the return value is
-#	{
-#		value
-#		{param value param2 value param3 value3}
-#	}
-
-proc ::ncgi::parseMimeValue {value} {
-    set parts [split $value \;]
-    set results [list [string trim [lindex $parts 0]]]
-    set paramList [list]
-    foreach sub [lrange $parts 1 end] {
-	if {[regexp -- {([^=]+)=(.+)} $sub match key val]} {
-            set key [string trim [string tolower $key]]
-            set val [string trim $val]
-            # Allow single as well as double quotes
-            if {[regexp -- {^["']} $val quote]} { ;# need a " for balance
-                if {[regexp -- ^${quote}(\[^$quote\]*)$quote $val x val2]} {
-                    # Trim quotes and any extra crap after close quote
-                    set val $val2
-                }
-            }
-            lappend paramList $key $val
-	}
-    }
-    if {[llength $paramList]} {
-	lappend results $paramList
-    }
-    return $results
-}
-
-# ::ncgi::multipart
-#
-#	This parses multipart form data.
-#	Based on work by Steve Ball for TclHttpd, but re-written to use
-#	string first with an offset to iterate through the data instead
-#	of using a regsub/subst combo.
-#
-# Arguments:
-#	type	The Content-Type, because we need boundary options
-#	query	The raw multipart query data
-#
-# Results:
-#	An alternating list of names and values
-#	In this case, the value is a two element list:
-#		headers, which in turn is a list names and values
-#		content, which is the main value of the element
-#	The header name/value pairs come primarily from the MIME headers
-#	like Content-Type that appear in each part.  However, the
-#	Content-Disposition header is handled specially.  It has several
-#	parameters like "name" and "filename" that are important, so they
-#	are promoted to to the same level as Content-Type.  Otherwise,
-#	if a header like Content-Type has parameters, they appear as a list
-#	after the primary value of the header.  For example, if the
-#	part has these two headers:
-#
-#	Content-Disposition: form-data; name="Foo"; filename="/a/b/C.txt"
-#	Content-Type: text/html; charset="iso-8859-1"; mumble='extra'
-#	
-#	Then the header list will have this structure:
-#	{
-#		content-disposition form-data
-#		name Foo
-#		filename /a/b/C.txt
-#		content-type {text/html {charset iso-8859-1 mumble extra}}
-#	}
-#	Note that the header names are mapped to all lowercase.  You can
-#	use "array set" on the header list to easily find things like the
-#	filename or content-type.  You should always use [lindex $value 0]
-#	to account for values that have parameters, like the content-type
-#	example above.  Finally, not that if the value has a second element,
-#	which are the parameters, you can "array set" that as well.
-#	
-proc ::ncgi::multipart {type query} {
-
-    set parsedType [parseMimeValue $type]
-    if {![string match multipart/* [lindex $parsedType 0]]} {
-	return -code error "Not a multipart Content-Type: [lindex $parsedType 0]"
-    }
-    array set options [lindex $parsedType 1]
-    if {![info exists options(boundary)]} {
-	return -code error "No boundary given for multipart document"
-    }
-    set boundary $options(boundary)
-
-    # The query data is typically read in binary mode, which preserves
-    # the \r\n sequence from a Windows-based browser.
-    # Also, binary data may contain \r\n sequences.
-
-    if {[string match "*$boundary\r\n*" $query]} {
-        set lineDelim "\r\n"
-	#	puts "DELIM"
-    } else {
-        set lineDelim "\n"
-	#	puts "NO"
-    }
-
-    # Iterate over the boundary string and chop into parts
-
-    set len [string length $query]
-    # [string length $lineDelim]+2 is for "$lineDelim--"
-    set blen [expr {[string length $lineDelim] + 2 + \
-            [string length $boundary]}]
-    set first 1
-    set results [list]
-    set offset 0
-
-    # Ensuring the query data starts
-    # with a newline makes the string first test simpler
-    if {[string first $lineDelim $query 0]!=0} {
-        set query $lineDelim$query
-    }
-    while {[set offset [string first $lineDelim--$boundary $query $offset]] \
-            >= 0} {
-	if {!$first} {
-	    lappend results $formName [list $headers \
-		[string range $query $off2 [expr {$offset -1}]]]
-	} else {
-	    set first 0
-	}
-	incr offset $blen
-
-	# Check for the ending boundary, which is signaled by --$boundary--
-
-	if {[string equal "--" \
-		[string range $query $offset [expr {$offset + 1}]]]} {
-	    break
-	}
-
-	# Split headers out from content
-	# The headers become a nested list structure:
-	#	{header-name {
-	#		value {
-	#			paramname paramvalue ... }
-	#		}
-	#	}
-
-        set off2 [string first "$lineDelim$lineDelim" $query $offset]
-	set headers [list]
-	set formName ""
-        foreach line [split [string range $query $offset $off2] $lineDelim] {
-	    if {[regexp -- {([^:	 ]+):(.*)$} $line x hdrname value]} {
-		set hdrname [string tolower $hdrname]
-		set valueList [parseMimeValue $value]
-		if {[string equal $hdrname "content-disposition"]} {
-
-		    # Promote Conent-Disposition parameters up to headers,
-		    # and look for the "name" that identifies the form element
-
-		    lappend headers $hdrname [lindex $valueList 0]
-		    foreach {n v} [lindex $valueList 1] {
-			lappend headers $n $v
-			if {[string equal $n "name"]} {
-			    set formName $v
-			}
-		    }
-		} else {
-		    lappend headers $hdrname $valueList
-		}
-	    }
-	}
-
-	if {$off2 > 0} {
-            # +[string length "$lineDelim$lineDelim"] for the
-            # $lineDelim$lineDelim
-            incr off2 [string length "$lineDelim$lineDelim"]
-	    set offset $off2
-	} else {
-	    break
-	}
-    }
-    return $results
-}
-
-# ::ncgi::importFile --
-#
-#   get information about a file upload field
-#
-# Arguments:
-#   cmd         one of '-server' '-client' '-type' '-data'
-#   var         cgi variable name for the file field
-#   filename    filename to write to for -server
-# Results:
-#   -server returns the name of the file on the server: side effect
-#      is that the file gets stored on the server and the 
-#      script is responsible for deleting/moving the file
-#   -client returns the name of the file sent from the client 
-#   -type   returns the mime type of the file
-#   -data   returns the contents of the file 
-
-proc ::ncgi::importFile {cmd var {filename {}}} {
-
-    set vlist [valueList $var]
-
-    array set fileinfo [lindex [lindex $vlist 0] 0]
-    set contents [lindex [lindex $vlist 0] 1]
-
-    switch -exact -- $cmd {
-	-server {
-	    ## take care not to write it out more than once
-	    variable _tmpfiles
-	    if {![info exists _tmpfiles($var)]} {
-		if {$filename != {}} {
-		    ## use supplied filename 
-		    set _tmpfiles($var) $filename
-		} else {
-		    ## create a tmp file 
-		    set _tmpfiles($var) [::fileutil::tempfile ncgi]
-		}
-
-		# write out the data only if it's not been done already
-		if {[catch {open $_tmpfiles($var) w} h]} {
-		    error "Can't open temporary file in ncgi::importFile ($h)"
-		} 
-
-		fconfigure $h -translation binary -encoding binary
-		puts -nonewline $h $contents 
-		close $h
-	    }
-	    return $_tmpfiles($var)
-	}
-	-client {
-	    if {![info exists fileinfo(filename)]} {return {}}
-	    return $fileinfo(filename)
-	}
-	-type {
-	    if {![info exists fileinfo(content-type)]} {return {}}
-	    return $fileinfo(content-type)
-	}
-	-data {
-	    return $contents
-	}
-	default {
-	    error "Unknown subcommand to ncgi::import_file: $cmd"
-	}
-    }
-}
-
-
-# ::ncgi::cookie
-#
-#	Return a *list* of cookie values, if present, else ""
-#	It is possible for multiple cookies with the same key
-#	to be present, so we return a list.
-#
-# Arguments:
-#	cookie	The name of the cookie (the key)
-#
-# Results:
-#	A list of values for the cookie
-
-proc ::ncgi::cookie {cookie} {
-    global env
-    set result ""
-    if {[info exists env(HTTP_COOKIE)]} {
-	foreach pair [split $env(HTTP_COOKIE) \;] {
-	    foreach {key value} [split [string trim $pair] =] { break ;# lassign }
-	    if {[string compare $cookie $key] == 0} {
-		lappend result $value
-	    }
-	}
-    }
-    return $result
-}
-
-# ::ncgi::setCookie
-#
-#	Set a return cookie.  You must call this before you call
-#	ncgi::header or ncgi::redirect
-#
-# Arguments:
-#	args	Name value pairs, where the names are:
-#		-name	Cookie name
-#		-value	Cookie value
-#		-path	Path restriction
-#		-domain	domain restriction
-#		-expires	Time restriction
-#
-# Side Effects:
-#	Formats and stores the Set-Cookie header for the reply.
-
-proc ::ncgi::setCookie {args} {
-    variable cookieOutput
-    array set opt $args
-    set line "$opt(-name)=$opt(-value) ;"
-    foreach extra {path domain} {
-	if {[info exists opt(-$extra)]} {
-	    append line " $extra=$opt(-$extra) ;"
-	}
-    }
-    if {[info exists opt(-expires)]} {
-	switch -glob -- $opt(-expires) {
-	    *GMT {
-		set expires $opt(-expires)
-	    }
-	    default {
-		set expires [clock format [clock scan $opt(-expires)] \
-			-format "%A, %d-%b-%Y %H:%M:%S GMT" -gmt 1]
-	    }
-	}
-	append line " expires=$expires ;"
-    }
-    if {[info exists opt(-secure)]} {
-	append line " secure "
-    }
-    lappend cookieOutput $line
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ncgi/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ncgi/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded ncgi 1.3.2 [list source [file join $dir ncgi.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nmea/nmea.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nmea/nmea.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,121 +1,0 @@
-# nmea.tcl --
-#
-# NMEA protocol implementation
-#
-# Copyright (c) 2006-2007 Aaron Faupell
-#
-# RCS: @(#) $Id: nmea.tcl,v 1.3 2007/08/20 21:55:27 andreas_kupries Exp $
-
-package require Tcl 8.2
-package provide nmea 0.1.1
-
-namespace eval ::nmea {
-    set ::nmea::nmea(checksum) 1
-    set ::nmea::nmea(log) ""
-}
-
-proc ::nmea::open_port {port {speed 4800}} {
-    variable nmea
-    set nmea(fh) [open $port]
-    fconfigure $nmea(fh) -mode $speed,n,8,1 -handshake xonxoff -buffering line -translation crlf
-    fileevent $nmea(fh) readable [list ::nmea::read_port $nmea(fh)]
-    return 1
-}
-
-proc ::nmea::open_file {file rate} {
-    variable nmea
-    set nmea(fh) [open $file]
-    set nmea(rate) $rate
-    fconfigure $nmea(fh) -buffering line -blocking 0 -translation auto
-    if {$rate > 0} {
-        after $rate [list ::nmea::read_file $nmea(fh)]
-    }
-}
-
-proc ::nmea::configure_port {settings} {
-    variable nmea
-    fconfigure $nmea(fh) -mode $settings
-}
-
-proc ::nmea::close_port {} {
-    variable nmea
-    catch {close $nmea(fh)}
-}
-
-proc ::nmea::close_file {} {
-    variable nmea
-    catch {close $nmea(fh)}
-}
-
-proc ::nmea::read_port {f} {
-    set line [gets $f]
-    if {$::nmea::nmea(log) != ""} {
-        puts $::nmea::nmea(log) $line
-    }
-    ::nmea::parse_nmea $line
-}
-
-proc ::nmea::read_file {f} {
-    variable nmea
-    if {![eof $f]} {
-        set line [gets $f]
-        if {[string match {$*} $line]} {
-            ::nmea::parse_nmea $line
-        } else {
-            ::nmea::parse_nmea \$$line
-        }
-    }
-    after $nmea(rate) [list ::nmea::read_file $f]
-}
-
-proc ::nmea::do_line {} {
-    variable nmea
-    if {![eof $nmea(fh)]} {
-        set line [gets $nmea(fh)]
-        if {[string match {$*} $line]} {
-            ::nmea::parse_nmea $line
-        } else {
-            ::nmea::parse_nmea \$$line
-        }
-    }
-}
-
-proc ::nmea::log {file} {
-    variable nmea
-    if {$file != ""} {
-        if {$nmea(log) != ""} { error "already logging to a file" }
-        set nmea(log) [open $file a]
-    } else {
-        catch {close $nmea(log)}
-        set nmea(log) ""
-    }
-}
-
-proc ::nmea::parse_nmea {line} {
-    set line [split $line \$*]
-    set cksum [lindex $line 2]
-    set line [lindex $line 1]
-    if {$cksum == "" || !$::nmea::nmea(checksum) || [checksum $line] == $cksum} {
-        set line [split $line ,]
-        set sentence [lindex $line 0]
-        set line [lrange $line 1 end]
-        if {[info commands ::nmea::$sentence] != ""} {
-            $sentence $line
-        }
-    }
-}
-
-proc ::nmea::checksum {line} {
-    set sum 0
-    binary scan $line c* line
-    foreach char $line {
-        set sum [expr {$sum ^ ($char % 128)}]
-    }
-    return [format %02X [expr {$sum % 256}]]
-}
-
-proc ::nmea::write {type args} {
-    variable nmea
-    set data $type,[join $args ,]
-    puts $nmea(fh) \$$data*[checksum $data]
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nmea/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nmea/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded nmea 0.1.1 [list source [file join $dir nmea.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nns/common.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nns/common.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,38 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Name service - Common/shared information.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::nameserv::common {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::nameserv::common::port {} {
-    variable port
-    return  $port
-}
-
-namespace eval ::nameserv::common {
-    # Derivation of the standard port number for this service.
-
-    # nameserv::server
-    # -> nameservserver  / remove ':'
-    # -> 62637378737837  / phonecode
-    # -> 38573           / mod 65536
-
-    variable port 38573
-
-    # The modulo operation is required because IP port numbers are
-    # restricted to unsigned short (16 bit), i.e. 1 ... 65535.
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide nameserv::common 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nns/nns.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nns/nns.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,404 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Name Service - Client side access
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-package require comm             ; # Generic message transport
-package require interp           ; # Interpreter helpers.
-package require logger           ; # Tracing internal activity
-package require nameserv::common ; # Common/shared utilities
-package require snit             ; # OO support, for streaming search class
-package require uevent           ; # Generate events for connection-loss
-
-namespace eval ::nameserv {}
-
-# ### ### ### ######### ######### #########
-## API: Write, Read, Search
-
-proc ::nameserv::bind {name data} {
-    # Registers this application at the configured name service under
-    # the specified name, and provides a value.
-    #
-    # Note: The application is allowed register multiple names.
-    #
-    # Note: A registered name is automatically removed by the server
-    #       when the connection to it collapses.
-
-    DO Bind $name $data
-    return
-}
-
-proc ::nameserv::release {} {
-    # Releases all names the application is registered under
-    # at the configured name service.
-
-    DO Release
-    return
-}
-
-proc ::nameserv::search {args} {
-    # Searches the configured name service for applications whose name
-    # matches the given pattern. Returns a dictionary mapping from the
-    # names to the data they provided at 'bind' time.
-
-    # In continuous and async modes it returns an object whose
-    # contents reflect the current set of matching entries.
-
-    switch -exact [llength $args] {
-	0 {
-	    set continuous 0
-	    set pattern    *
-	}
-	1 {
-	    set opt [lindex $args 0]
-	    if {$opt eq "-continuous"} {
-		set oneshot    0
-		set continuous 1
-		set pattern    *
-	    } elseif {$opt eq "-async"} {
-		set oneshot    1
-		set continuous 1
-		set pattern    *
-	    } else {
-		set continuous 0
-		set pattern    $opt
-	    }
-	}
-	2 {
-	    set opt [lindex $args 0]
-	    if {$opt eq "-continuous"} {
-		set oneshot    0
-		set continuous 1
-		set pattern    [lindex $args 1]
-	    } elseif {$opt eq "-async"} {
-		set oneshot    1
-		set continuous 1
-		set pattern    [lindex $args 1]
-	    } else {
-		return -code error "wrong\#args: Expected ?-continuous|-async? ?pattern?"
-	    }
-	}
-	default {
-	    return -code error "wrong\#args: Expected ?-continuous|-async? ?pattern?"
-	}
-    }
-
-    if {$continuous} {
-	variable search
-	# This client uses the receiver object as tag for the search
-	# in the service. This is easily unique, and makes dispatch of
-	# incoming results later easy too.
-
-	set receiver [receiver %AUTO% $oneshot]
-	ASYNC Search/Continuous/Start $receiver $pattern
-
-	set search($receiver) .
-	return $receiver
-    } else {
-	return [DO Search $pattern]
-    }
-}
-
-proc ::nameserv::protocol {} {
-    return 1
-}
-
-proc ::nameserv::server_protocol {} {
-    return [DO ProtocolVersion]
-}
-
-proc ::nameserv::server_features {} {
-    return [DO ProtocolFeatures]
-}
-
-# ### ### ### ######### ######### #########
-## INT: Communication setup / teardown / use
-
-proc ::nameserv::DO {args} {
-    variable sid
-    log::debug [linsert $args end @ $sid]
-
-    if {[catch {
-	[SERV] send $sid $args
-	#eval [linsert $args 0 [SERV] send $sid] ;# $args
-    } msg]} {
-	if {[string match "*refused*" $msg]} {
-	    return -code error "No name server present @ $sid"
-	} else {
-	    return -code error $msg
-	}
-    }
-    # Result of the call
-    return $msg
-}
-
-proc ::nameserv::ASYNC {args} {
-    variable sid
-    log::debug [linsert $args end @ $sid]
-
-    if {[catch {
-	[SERV] send -async $sid $args
-	#eval [linsert $args 0 [SERV] send $sid] ;# $args
-    } msg]} {
-	if {[string match "*refused*" $msg]} {
-	    return -code error "No name server present @ $sid"
-	} else {
-	    return -code error $msg
-	}
-    }
-    # No result to return
-    return
-}
-
-proc ::nameserv::SERV {} {
-    variable comm
-    variable sid
-    variable host
-    variable port
-    if {$comm ne ""} {return $comm}
-
-    # NOTE
-    # -local 1 means that clients can only talk to a local
-    #          name service. Might make sense to auto-force
-    #          -local 0 for host ne "localhost".
-
-    set     interp [interp::createEmpty]
-    foreach msg {
-	Search/Continuous/Change
-    } {
-	interp alias $interp $msg {} ::nameserv::$msg
-    }
-
-    set sid  [list $port $host]
-    set comm [comm::comm new ::nameserv::CSERV \
-		  -interp $interp \
-		  -local  1 \
-		  -listen 1]
-
-    $comm hook lost ::nameserv::LOST
-
-    log::debug [list SERV @ $sid : $comm]
-    return $comm
-}
-
-proc ::nameserv::LOST {args} {
-    upvar 1 id id chan chan reason reason
-    variable comm
-    variable sid
-    variable search
-
-    log::debug [list LOST @ $sid - $reason]
-
-    $comm destroy
-
-    set comm {}
-    set sid  {}
-
-    # Notify async/cont search of the loss.
-    foreach r [array names search] {
-	$r DATA stop
-	unset search($r)
-    }
-
-    uevent::generate nameserv lost-connection [list reason $reason]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - System state
-
-namespace eval ::nameserv {
-    # Object command of the communication channel to the server.
-    # If present re-configuration is not possible. Also the comm
-    # id of the server.
-
-    variable comm {}
-    variable sid  {}
-
-    # Table of active async/cont searches
-
-    variable search ; array set search {}
-}
-
-# ### ### ### ######### ######### #########
-## API: Configuration management (host, port)
-
-proc ::nameserv::cget {option} {
-    return [configure $option]
-}
-
-proc ::nameserv::configure {args} {
-    variable host
-    variable port
-
-    if {![llength $args]} {
-	return [list -host $host -port $port]
-    }
-    if {[llength $args] == 1} {
-	# cget
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -host { return $host }
-	    -port { return $port }
-	    default {
-		return -code error "bad option \"$opt\", expected -host, or -port"
-	    }
-	}
-    }
-
-    if {$comm ne ""} {
-	return -code error "Unable to configure an active connection"
-    }
-
-    # Note: Should -port/-host be made configurable after
-    # communication has started it will be necessary to provide code
-    # which retracts everything from the old server and re-initializes
-    # the new one.
-
-    while {[llength $args]} {
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -host {
-		if {[llength $args] % 2 == 1} {
-		    return -code error "value for \"$opt\" is missing"
-		}
-		set host [lindex $args 1]
-		set args [lrange $args 2 end]
-	    }
-	    -port {
-		if {[llength $args] % 2 == 1} {
-		    return -code error "value for \"$opt\" is missing"
-		}
-		set port [lindex $args 1]
-		# Todo: Check non-zero unsigned short integer
-		set args [lrange $args 2 end]
-	    }
-	    default {
-		return -code error "bad option \"$opt\", expected -host, or -port"
-	    }
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Receiver for continuous and async searches
-
-proc ::nameserv::Search/Continuous/Change {tag type response} {
-
-    # Ignore messages for searches which were canceled already.
-    #
-    # Due to the async nature of the messages for cont/async search
-    # the client may have canceled the receiver object already, sent
-    # the stop message already, but still has to process search
-    # results which were already in flight. We ignore them.
-
-    if {![llength [info commands $tag]]} return
-
-    # This client uses the receiver object as tag, dispatch the
-    # received notification to it.
-
-    $tag DATA $type $response
-    return
-}
-
-snit::type ::nameserv::receiver {
-
-    option -command -default {}
-
-    constructor {{once 0}} {
-	set singleshot $once
-	return
-    }
-
-    destructor {
-	if {$singleshot} return
-	ASYNC Search/Continuous/Stop $self
-	Callback stop {}
-	return
-    }
-
-    method get {k} {
-	if {![info exists current($k)]} {return -code error "Unknown key \"$k\""}
-	return $current($k)
-    }
-
-    method names {} {
-	return [array names current]
-    }
-
-    method size {} {
-	return [array size current]
-    }
-
-    method getall {{pattern *}} {
-	return [array get current $pattern]
-    }
-
-    method filled {} {
-	return $filled
-    }
-
-    method {DATA stop} {} {
-	if {$filled && $singleshot} return
-	set singleshot 1 ; # Prevent 'stop' again during destruction.
-	Callback stop {}
-	return
-    }
-
-    method {DATA add} {response} {
-	set filled 1
-	if {$singleshot} {
-	    ASYNC Search/Continuous/Stop $self
-	}
-	array set current $response
-	Callback add $response
-	if {$singleshot} {
-	    Callback stop {}
-	}
-	return
-    }
-
-    method {DATA remove} {response} {
-	set filled 1
-	foreach {k v} $response {
-	    unset -nocomplain current($k)
-	}
-	Callback remove $response
-	return
-    }
-
-    proc Callback {type response} {
-	upvar 1 options options
-	if {$options(-command) eq ""} return
-	# Defer execution to event loop
-	after 0 [linsert $options(-command) end $type $response]
-	return
-    }
-
-    variable singleshot 0
-    variable current -array {}
-    variable filled 0
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - Tracing, Configuration
-
-logger::initNamespace ::nameserv
-namespace eval        ::nameserv {
-    # Host and port to connect to, to get access to the nameservice.
-
-    variable host localhost
-    variable port [nameserv::common::port]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide nameserv 0.3
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nns/nns_auto.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nns/nns_auto.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,156 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Name Service - Client side connection monitor
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require nameserv ; # Name service client-side core
-package require uevent   ; # Watch for connection-loss
-
-namespace eval ::nameserv::auto {}
-
-# ### ### ### ######### ######### #########
-## API: Write, Read, Search
-
-## TODO - Keep after handle, ensure that only one poll is running.
-## Factor into smaller commands with descriptive names ... We have
-## several near-replicated pieces of code (error handling).
-
-proc ::nameserv::auto::bind {name data} {
-    # See nameserv::bind. Remembers the information, for re-binding
-    # when the connection was lost, and later restored.
-
-    variable bindings
-    variable delay
-
-    # Watch base client for loss of connection.
-    uevent::bind nameserv lost-connection ::nameserv::auto::Reconnect
-
-    if {[catch {
-	nameserv::bind $name $data
-    } msg]} {
-	if {[string match *No name server*]} {
-	    # No nameserver. Remember, and start reconnect polling.
-	    set bindings($name) $data
-	    after $delay ::nameserv::auto::Reconnect
-	    return
-	}
-	# Name is bound already, lost immediately, generate
-	# standard event.
-
-	uevent::generate nameserv lost-name [list name $name data $data]
-	return
-    }
-
-    # Success. Remember for possible loss of connection.
-    set bindings($name) $data
-    return
-}
-
-proc ::nameserv::auto::Reconnect {args} {
-    # args = <>|<tags event details>
-    # <tag,event> = <'nameserv','lost'>
-    #     details = dict ('reason' -> string)
-
-    if {![catch {
-	::nameserv::server_features
-    }]} {Rebind ; return}
-
-    variable delay
-    after   $delay ::nameserv::auto::Reconnect
-    return
-}
-
-proc ::nameserv::auto::Rebind {} {
-    variable bindings
-
-    foreach {name data} [array get bindings] {
-	if {[catch {
-	    nameserv::bind $name $data
-	} msg]} {
-	    # Lost server while rebinding names. Abort and wait for
-	    # the reconnect to try again.
-	    if {[string match *No name server*]} break
-
-	    # Other error => (name already bound) That means someone
-	    # else took the name while we were not connected to the
-	    # service. Best effort we can do: Deliver total loss of
-	    # this binding to observers via event.
-
-	    uevent::generate nameserv lost-name [list name $name data $data]
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - System state
-
-namespace eval ::nameserv::auto {
-    # In-memory database of bindings to restore after connection was
-    # lost and restored.
-
-    variable bindings ; array set bindings {}
-}
-
-# ### ### ### ######### ######### #########
-## API: Configuration management (host, port)
-
-proc ::nameserv::auto::cget {option} {
-    return [configure $option]
-}
-
-proc ::nameserv::auto::configure {args} {
-    variable delay
-
-    if {![llength $args]} {
-	return [list -delay $delay]
-    }
-    if {[llength $args] == 1} {
-	# cget
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -delay { return $delay }
-	    default {
-		return -code error "bad option \"$opt\", expected -delay"
-	    }
-	}
-    }
-
-    while {[llength $args]} {
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -delay {
-		if {[llength $args] % 2 == 1} {
-		    return -code error "value for \"$opt\" is missing"
-		}
-		# TODO: check integer > 0
-		set delay [lindex $args 1]
-		set args  [lrange $args 2 end]
-	    }
-	    default {
-		return -code error "bad option \"$opt\", expected -delay"
-	    }
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - Tracing, Configuration
-
-logger::initNamespace ::nameserv::auto
-namespace eval        ::nameserv::auto {
-    # Interval between reconnection attempts when connection was lost.
-
-    variable delay 1000 ; # One second
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide nameserv::auto 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nns/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nns/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8]} {return}
-package ifneeded nameserv::common 0.1 [list source [file join $dir common.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded nameserv         0.3 [list source [file join $dir nns.tcl]]
-package ifneeded nameserv::server 0.3 [list source [file join $dir server.tcl]]
-package ifneeded nameserv::auto   0.1 [list source [file join $dir nns_auto.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nns/server.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nns/server.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,376 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Name Service - Server (Singleton)
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-package require comm             ; # Generic message transport
-package require interp           ; # Interpreter helpers.
-package require logger           ; # Tracing internal activity
-package require nameserv::common ; # Common/shared utilities
-
-namespace eval ::nameserv::server {}
-
-# ### ### ### ######### ######### #########
-## API: Start, Stop
-
-proc ::nameserv::server::start {} {
-    variable comm
-    variable port
-    variable localonly
-
-    log::debug "start"
-    if {$comm ne ""} return
-
-    log::debug "start /granted"
-
-    set     interp [interp::createEmpty]
-    foreach msg {
-	Bind
-	Release
-	Search
-	Search/Continuous/Start
-	Search/Continuous/Stop
-	ProtocolVersion
-	ProtocolFeatures
-    } {
-	interp alias $interp $msg {} ::nameserv::server::$msg
-    }
-
-    set comm [comm::comm new ::nameserv::server::COMM \
-		  -interp $interp \
-		  -port   $port \
-		  -listen 1 \
-		  -local  $localonly]
-
-    $comm hook lost ::nameserv::server::LOST
-
-    log::debug "UP @$port local-only $localonly"
-    return
-}
-
-proc ::nameserv::server::stop {} {
-    variable comm
-    variable names
-    variable data
-
-    log::debug "stop"
-    if {$comm eq ""} return
-
-    log::debug "stop /granted"
-
-    # This kills all existing connection and destroys the configured
-    # -interp as well.
-
-    $comm destroy
-    set comm ""
-
-    array unset names *
-    array unset data  *
-
-    log::debug "DOWN"
-    return
-}
-
-proc ::nameserv::server::active? {} {
-    variable comm
-    return [expr {$comm ne ""}]
-}
-
-# ### ### ### ######### ######### #########
-## INT: Protocol operations
-
-proc ::nameserv::server::ProtocolVersion  {} {return 1}
-proc ::nameserv::server::ProtocolFeatures {} {return {Core Search/Continuous}}
-
-proc ::nameserv::server::Bind {name cdata} {
-    variable comm
-    variable names
-    variable data
-
-    set id [$comm remoteid]
-
-    log::debug "bind ([list $name -> $cdata]), for $id"
-
-    if {[info exists data($name)]} {
-	return -code error "Name \"$name\" is already bound"
-    }
-
-    lappend names($id)  $name
-    set     data($name) $cdata
-
-    Search/Continuous/NotifyAdd $name $cdata
-    return
-}
-
-proc ::nameserv::server::Release {} {
-    variable comm
-    ReleaseId [$comm remoteid]
-    return
-}
-
-proc ::nameserv::server::Search {pattern} {
-    variable data
-    return [array get data $pattern]
-}
-
-proc ::nameserv::server::ReleaseId {id} {
-    variable names
-    variable data
-    variable searchi
-
-    log::debug "release id $id"
-
-    # Two steps. Release all searches the client may have open, then
-    # all names it may have bound. That last step may trigger
-    # notifications for searches by other clients. It must not trigger
-    # searches from the client just going away, hence their release
-    # first.
-
-    foreach k [array names searchi [list $id *]] {
-	Search/Release $k
-    }
-
-    if {[info exists names($id)]} {
-	set gone {}
-	foreach n $names($id) {
-	    lappend gone $n $data($n)
-	    catch {unset data($n)}
-
-	    log::debug "release name <$n>"
-	}
-	unset names($id)
-
-	Search/Continuous/NotifyRelease $gone
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Support for continuous and async searches
-
-proc ::nameserv::server::Search/Continuous/Start {tag pattern} {
-    variable data
-    variable searchi
-    variable searchp
-    variable comm
-
-    set id [$comm remoteid]
-
-    # Register the search, then generate the initial response.
-    # Non-unique tags are silently discarded. Clients will wait
-    # forever.
-
-    set k [list $id $tag]
-    if {[info exists searchi($k)]} return
-
-    set searchi($k) $pattern
-    lappend searchp($pattern) $k
-
-    $comm send -async $id [list Search/Continuous/Change \
-			       $tag add [array get data $pattern]]
-    return
-}
-
-proc ::nameserv::server::Search/Continuous/Stop {tag} {
-    Search/Release [list [$comm remoteid] $tag]
-    return
-}
-
-proc ::nameserv::server::Search/Release {k} {
-    variable searchi
-    variable searchp
-
-    # Remove search information from the data store
-
-    if {![info exists searchi($k)]} return
-
-    log::debug "release search <$k>"
-
-    set pattern $searchi($k)
-    unset searchi($k)
-
-    set pos [lsearch -exact $searchp($pattern) $k]
-    if {$pos < 0} return
-    set new [lreplace $searchp($pattern) $pos $pos]
-    if {[llength $new]} {
-	# Shorten the callback list.
-	set searchp($pattern) $new
-    } else {
-	# Nothing monitors that pattern anymore, remove it completely.
-	unset searchp($pattern)
-    }
-    return
-}
-
-proc ::nameserv::server::Search/Continuous/NotifyAdd {name val} {
-    variable searchp
-
-    # Abort quickly if there are no searches waiting.
-    if {![array size searchp]} return
-
-    foreach p [array names searchp] {
-	if {![string match $p $name]} continue
-	Notify $p add [list $name $val]
-    }
-    return
-}
-
-proc ::nameserv::server::Search/Continuous/NotifyRelease {gone} {
-    variable searchp
-
-    # Abort quickly if there are no searches waiting.
-    if {![array size searchp]} return
-
-    array set m $gone
-    foreach p [array names searchp] {
-	set response [array get m $p]
-	if {![llength $response]} continue
-	Notify $p remove $response
-    }
-    return
-}
-
-proc ::nameserv::server::Notify {p type response} {
-    variable searchp
-    variable comm
-
-    foreach item $searchp($p) {
-	foreach {id tag} $item break
-	$comm send -async $id \
-	    [list Search/Continuous/Change $tag $type $response]
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - In-memory database
-
-namespace eval ::nameserv::server {
-    # Database
-    # search = list (id tag) : Searches are identified by client and a tag.
-    #
-    # array (id   -> list (name))      : Names under which a connection is known.
-    # array (name -> data)             : Data associated with a name.
-    #
-    # array (pattern -> list (search)) : Per pattern the list of searches using it.
-    # array (search -> pattern)        : Pattern per active search.
-    #
-    # searchp <~~> names
-    # searchi <~~> data
-
-    variable names   ; array set names {}
-    variable data    ; array set data  {}
-    variable searchp ; array set searchp {}
-    variable searchi ; array set searchi {}
-}
-
-# ### ### ### ######### ######### #########
-## INT: Connection management
-
-proc ::nameserv::server::LOST {args} {
-    # Currently just to see when a client goes away.
-
-    upvar 1 id id chan chan reason reason
-    ReleaseId $id
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - System state
-
-namespace eval ::nameserv::server {
-    # Object command of the communication channel of the server.
-    # If present re-configuration is not possible.
-
-    variable comm {}
-}
-
-# ### ### ### ######### ######### #########
-## API: Configuration management (host, port)
-
-proc ::nameserv::server::cget {option} {
-    return [configure $option]
-}
-
-proc ::nameserv::server::configure {args} {
-    variable localonly
-    variable port
-    variable comm
-
-    if {![llength $args]} {
-	return [list -localonly $localonly -port $port]
-    }
-    if {[llength $args] == 1} {
-	# cget
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -localonly { return $localonly }
-	    -port      { return $port }
-	    default {
-		return -code error "bad option \"$opt\", expected -localonly, or -port"
-	    }
-	}
-    }
-
-    # Note: Should -port be made configurable after communication has
-    # started it might be necessary to provide code to re-initialize
-    # the connections to all known clients using the new
-    # configuration.
-
-    while {[llength $args]} {
-	set opt [lindex $args 0]
-	switch -exact -- $opt {
-	    -localonly {
-		if {[llength $args] % 2 == 1} {
-		    return -code error "value for \"$opt\" is missing"
-		}
-		# Todo: Check boolean 
-		set new  [lindex $args 1]
-		set args [lrange $args 2 end]
-
-		if {$new == $localonly} continue
-		set localonly $new
-		if {$comm eq ""} continue
-		$comm configure -local $localonly
-	    }
-	    -port {
-		if {$comm ne ""} {
-		    return -code error "Unable to configure an active server"
-		}
-		if {[llength $args] % 2 == 1} {
-		    return -code error "value for \"$opt\" is missing"
-		}
-		# Todo: Check non-zero unsigned short integer
-		set port [lindex $args 1]
-		set args [lrange $args 2 end]
-	    }
-	    default {
-		return -code error "bad option \"$opt\", expected -localonly, or -port"
-	    }
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - Tracing, Configuration
-
-logger::initNamespace ::nameserv::server
-namespace eval        ::nameserv::server {
-    # Port the server will listen on, and boolean flag determining
-    # acceptance of non-local connections.
-
-    variable port      [nameserv::common::port]
-    variable localonly 1
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide nameserv::server 0.3
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nntp/nntp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nntp/nntp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,979 +1,0 @@
-# nntp.tcl --
-#
-#       nntp implementation for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# All rights reserved.
-# 
-# RCS: @(#) $Id: nntp.tcl,v 1.13 2004/05/03 22:56:25 andreas_kupries Exp $
-
-package require Tcl 8.2
-package provide nntp 0.2.1
-
-namespace eval ::nntp {
-    # The socks variable holds the handle to the server connections
-    variable socks
-
-    # The counter is used to help create unique connection names
-    variable counter 0
-
-    # commands is the list of subcommands recognized by nntp
-    variable commands [list \
-            "article"     \
-            "authinfo"    \
-            "body"        \
-            "date"        \
-            "group"       \
-            "head"        \
-            "help"        \
-            "last"        \
-            "list"        \
-            "listgroup"   \
-            "mode_reader" \
-            "newgroups"   \
-            "newnews"     \
-            "next"        \
-            "post"        \
-            "stat"        \
-            "quit"        \
-            "xgtitle"     \
-            "xhdr"        \
-            "xover"       \
-            "xpat"        \
-            ]
-
-    set ::nntp::eol "\n"
-
-    # only export one command, the one used to instantiate a new
-    # nntp connection 
-    namespace export nntp
-
-}
-
-# ::nntp::nntp --
-#
-#       Create a new nntp connection.
-#
-# Arguments:
-#        server -   The name of the nntp server to connect to (optional).
-#        port -     The port number to connect to (optional).
-#        name -     The name of the nntp connection to create (optional).
-#
-# Results:
-#    Creates a connection to the a nntp server.  By default the
-#    connection is established with the machine 'news' at port '119'
-#    These defaults can be overridden with the environment variables
-#    NNTPPORT and NNTPHOST, or can be passed as optional arguments
-
-proc ::nntp::nntp {{server ""} {port ""} {name ""}} {
-    global env
-    variable connections
-    variable counter
-    variable socks
-
-    # If a name wasn't specified for the connection, create a new 'unique'
-    # name for the connection 
-
-    if { [llength [info level 0]] < 4 } {
-        set counter 0
-        set name "nntp${counter}"
-        while {[lsearch -exact [info commands] $name] >= 0} {
-            incr counter
-            set name "nntp${counter}"
-        }
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-        error "command \"$name\" already exists, unable to create nntp connection"
-    }
-
-    upvar 0 ::nntp::${name}data data
-
-    set socks($name) [list ]
-
-    # Initialize instance specific variables
-
-    set data(debug) 0
-    set data(eol) "\n"
-
-    # Logic to determine whether to use the specified nntp server, or to use
-    # the default
-
-    if {$server == ""} {
-        if {[info exists env(NNTPSERVER)]} {
-            set data(host) "$env(NNTPSERVER)"
-        } else {
-            set data(host) "news"
-        }
-    } else {
-        set data(host) $server
-    }
-
-    # Logic to determine whether to use the specified nntp port, or to use the
-    # default.
-
-    if {$port == ""} {
-        if {[info exists env(NNTPPORT)]} {
-            set data(port) $env(NNTPPORT)
-        } else {    
-            set data(port) 119
-        }
-    } else {
-        set data(port) $port
-    }
- 
-    set data(code) 0
-    set data(mesg) ""
-    set data(addr) ""
-    set data(binary) 0
-
-    set sock [socket $data(host) $data(port)]
-
-    set data(sock) $sock
-
-    # Create the command to manipulate the nntp connection
-
-    interp alias {} ::$name {} ::nntp::NntpProc $name
-    
-    ::nntp::response $name
-
-    return $name
-}
-
-# ::nntp::NntpProc --
-#
-#       Command that processes all nntp object commands.
-#
-# Arguments:
-#       name    name of the nntp object to manipulate.
-#       args    command name and args for the command.
-#
-# Results:
-#       Calls the appropriate nntp procedure for the command specified in
-#       'args' and passes 'args' to the command/procedure.
-
-proc ::nntp::NntpProc {name {cmd ""} args} {
-
-    # Do minimal args checks here
-
-    if { [llength [info level 0]] < 3 } {
-        error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-
-    # Split the args into command and args components
-
-    if { [llength [info commands ::nntp::_$cmd]] == 0 } {
-        variable commands
-        set optlist [join $commands ", "]
-        set optlist [linsert $optlist "end-1" "or"]
-        error "bad option \"$cmd\": must be $optlist"
-    }
-
-    # Call the appropriate command with its arguments
-
-    return [eval [linsert $args 0 ::nntp::_$cmd $name]]
-}
-
-# ::nntp::okprint --
-#
-#       Used to test the return code stored in data(code) to
-#       make sure that it is alright to right to the socket.
-#
-# Arguments:
-#       name    name of the nntp object.
-#
-# Results:
-#       Either throws an error describing the failure, or
-#       'args' and passes 'args' to the command/procedure or
-#       returns 1 for 'OK' and 0 for error states.   
-
-proc ::nntp::okprint {name} {
-    upvar 0 ::nntp::${name}data data
-
-    if {$data(code) >=400} {
-        set val [expr {(0 < $data(code)) && ($data(code) < 400)}]
-        error "NNTPERROR: $data(code) $data(mesg)"
-    }
-
-    # Codes less than 400 are good
-
-    return [expr {(0 < $data(code)) && ($data(code) < 400)}]
-}
-
-# ::nntp::message --
-#
-#       Used to format data(mesg) for printing to the socket
-#       by appending the appropriate end of line character which
-#       is stored in data(eol).
-#
-# Arguments:
-#       name    name of the nntp object.
-#
-# Results:
-#       Returns a string containing the message from data(mesg) followed
-#       by the eol character(s) stored in data(eol)
-
-proc ::nntp::message {name} {
-    upvar 0 ::nntp::${name}data data
-
-    return "$data(mesg)$data(eol)"
-}
-
-#################################################
-#
-# NNTP Methods
-#
-
-proc ::nntp::_cget {name option} {
-    upvar 0 ::nntp::${name}data data
-
-    if {[string equal $option -binary]} {
-	return $data(binary)
-    } else {
-	return -code error \
-		"Illegal option \"$option\", expected \"-binary\""
-    }
-}
-
-proc ::nntp::_configure {name args} {
-    upvar 0 ::nntp::${name}data data
-
-    if {[llength $args] == 0} {
-	return [list -binary $data(binary)]
-    }
-    if {[llength $args] == 1} {
-	return [_cget $name [lindex $args 0]]
-    }
-    if {([llength $args] % 2) == 1} {
-	return -code error \
-		"wrong#args: expected even number of elements"
-    }
-    foreach {o v} $args {
-	if {[string equal $o -binary]} {
-	    if {![string is boolean -strict $v]} {
-		return -code error \
-			"Expected boolean, got \"$v\""
-	    }
-	    set data(binary) $v
-	} else {
-	    return -code error \
-		    "Illegal option \"$o\", expected \"-binary\""
-	}
-    }
-    return {}
-}
-
-
-# ::nntp::_article --
-#
-#       Internal article proc.  Called by the 'nntpName article' command.
-#       Retrieves the article specified by msgid, in the group specified by
-#       the 'nntpName group' command.  If no msgid is specified the current 
-#       (or first) article in the group is retrieved
-#
-# Arguments:
-#       name    name of the nntp object.
-#       msgid   The article number to retrieve
-#
-# Results:
-#       Returns the message (if there is one) from the specified group as
-#       a valid tcl list where each element is a line of the message.
-#       If no article is found, the "" string is returned.
-#
-# According to RFC 977 the responses are:
-#
-#   220 n  article retrieved - head and body follow
-#           (n = article number,  = message-id)
-#   221 n  article retrieved - head follows
-#   222 n  article retrieved - body follows
-#   223 n  article retrieved - request text separately
-#   412 no newsgroup has been selected
-#   420 no current article has been selected
-#   423 no such article number in this group
-#   430 no such article found
-#
- 
-proc ::nntp::_article {name {msgid ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "ARTICLE $msgid"]
-}
-
-# ::nntp::_authinfo --
-#
-#       Internal authinfo proc.  Called by the 'nntpName authinfo' command.
-#       Passes the username and password for a nntp server to the nntp server. 
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       user    The username for the nntp server.
-#       pass    The password for 'username' on the nntp server.
-#
-# Results:
-#       Returns the result of the attempts to set the username and password
-#       on the nntp server ( 1 if successful, 0 if failed).
-
-proc ::nntp::_authinfo {name {user "guest"} {pass "foobar"}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) ""
-    set res [::nntp::command $name "AUTHINFO USER $user"]
-    if {$res} {
-        set res [expr {$res && [::nntp::command $name "AUTHINFO PASS $pass"]}]
-    }
-    return $res
-}
-
-# ::nntp::_body --
-#
-#       Internal body proc.  Called by the 'nntpName body' command.
-#       Retrieves the body of the article specified by msgid from the group
-#       specified by the 'nntpName group' command. If no msgid is specified
-#       the current (or first) message body is returned  
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       msgid   The number of the body of the article to retrieve
-#
-# Results:
-#       Returns the body of article 'msgid' from the group specified through
-#       'nntpName group'. If msgid is not specified or is "" then the body of
-#       the current (or the first) article in the newsgroup will be returned 
-#       as a valid tcl list.  The "" string will be returned if there is no
-#       article 'msgid' or if no group has been specified.
-
-proc ::nntp::_body {name {msgid ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "BODY $msgid"]
-}
-
-# ::nntp::_group --
-#
-#       Internal group proc.  Called by the 'nntpName group' command.
-#       Sets the current group on the nntp server to the group passed in.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       group   The name of the group to set as the default group.
-#
-# Results:
-#    Sets the default group to the group specified. If no group is specified
-#    or if an invalid group is specified an error is thrown.
-#
-# According to RFC 977 the responses are:
-#
-#  211 n f l s group selected
-#           (n = estimated number of articles in group,
-#           f = first article number in the group,
-#           l = last article number in the group,
-#           s = name of the group.)
-#  411 no such news group
-
-proc ::nntp::_group {name {group ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "groupinfo"
-    if {$group == ""} {
-        set group $data(group)
-    }
-    return [::nntp::command $name "GROUP $group"]
-}
-
-# ::nntp::_head --
-#
-#       Internal head proc.  Called by the 'nntpName head' command.
-#       Retrieves the header of the article specified by msgid from the group
-#       specified by the 'nntpName group' command. If no msgid is specified
-#       the current (or first) message header is returned  
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       msgid   The number of the header of the article to retrieve
-#
-# Results:
-#       Returns the header of article 'msgid' from the group specified through
-#       'nntpName group'. If msgid is not specified or is "" then the header of
-#       the current (or the first) article in the newsgroup will be returned 
-#       as a valid tcl list.  The "" string will be returned if there is no
-#       article 'msgid' or if no group has been specified.
-
-proc ::nntp::_head {name {msgid ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "HEAD $msgid"]
-}
-
-# ::nntp::_help --
-#
-#       Internal help proc.  Called by the 'nntpName help' command.
-#       Retrieves a list of the valid nntp commands accepted by the server.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#
-# Results:
-#       Returns the NNTP commands expected by the NNTP server.
-
-proc ::nntp::_help {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "HELP"]
-}
-
-proc ::nntp::_ihave {name {msgid ""} args} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    if {![::nntp::command $name "IHAVE $msgid"]} {
-        return ""
-    }
-    return [::nntp::squirt $name "$args"]    
-}
-
-# ::nntp::_last --
-#
-#       Internal last proc.  Called by the 'nntpName last' command.
-#       Sets the current message to the message before the current message.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#
-# Results:
-#       None.
-
-proc ::nntp::_last {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "msgid"
-    return [::nntp::command $name "LAST"]
-}
-
-# ::nntp::_list --
-#
-#       Internal list proc.  Called by the 'nntpName list' command.
-#       Lists all groups or (optionally) all groups of a specified type.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       Type    The type of groups to return (active active.times newsgroups
-#               distributions distrib.pats moderators overview.fmt
-#               subscriptions) - optional.
-#
-# Results:
-#       Returns a tcl list of all groups or the groups that match 'type' if
-#       a type is specified.
-
-proc ::nntp::_list {name {type ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "LIST $type"]
-}
-
-# ::nntp::_newgroups --
-#
-#       Internal newgroups proc.  Called by the 'nntpName newgroups' command.
-#       Lists all new groups since a specified time.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       since   The time to find new groups since.  The time can be in any
-#               format that is accepted by 'clock scan' in tcl.
-#
-# Results:
-#       Returns a tcl list of all new groups added since the time specified. 
-
-proc ::nntp::_newgroups {name since args} {
-    upvar 0 ::nntp::${name}data data
-
-    set since [clock format [clock scan "$since"] -format "%y%m%d %H%M%S"]
-    set dist ""
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "NEWGROUPS $since $dist"]
-}
-
-# ::nntp::_newnews --
-#
-#       Internal newnews proc.  Called by the 'nntpName newnews' command.
-#       Lists all new news in the specified group since a specified time.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       group   Name of the newsgroup to query.
-#       since   The time to find new groups since.  The time can be in any
-#               format that is accepted by 'clock scan' in tcl. Defaults to
-#               "1 day ago"
-#
-# Results:
-#       Returns a tcl list of all new messages since the time specified. 
-
-proc ::nntp::_newnews {name {group ""} {since ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    if {$group != ""} {
-        if {[regexp -- {^[\w\.\-]+$} $group] == 0} {
-            set since $group
-            set group ""
-        }
-    }
-    if {![info exists group] || ($group == "")} {
-        if {[info exists data(group)] && ($data(group) != "")} {
-            set group $data(group)
-        } else {
-            set group "*"
-        }
-    }
-    if {"$since" == ""} {
-        set since [clock format [clock scan "now - 1 day"]]
-    }
-    set since [clock format [clock scan $since] -format "%y%m%d %H%M%S"]
-    set dist "" 
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "NEWNEWS $group $since $dist"]
-}
-
-# ::nntp::_next --
-#
-#       Internal next proc.  Called by the 'nntpName next' command.
-#       Sets the current message to the next message after the current message.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#
-# Results:
-#       None.
-
-proc ::nntp::_next {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "msgid"
-    return [::nntp::command $name "NEXT"]
-}
-
-# ::nntp::_post --
-#
-#       Internal post proc.  Called by the 'nntpName post' command.
-#       Posts a message to a newsgroup.
-#
-# Responses (according to RFC 977) to a post request:
-#  240 article posted ok
-#  340 send article to be posted. End with .
-#  440 posting not allowed
-#  441 posting failed
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       article A message of the form specified in RFC 850
-#
-# Results:
-#       None.
-
-proc ::nntp::_post {name article} {
-    
-    if {![::nntp::command $name "POST"]} {
-        return ""
-    }
-    return [::nntp::squirt $name "$article"]
-}
-
-# ::nntp::_slave --
-#
-#       Internal slave proc.  Called by the 'nntpName slave' command.
-#       Identifies a connection as being made from a slave nntp server.
-#       This might be used to indicate that the connection is serving
-#       multiple people and should be given priority.  Actual use is 
-#       entirely implementation dependant and may vary from server to
-#       server.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#
-# Results:
-#       None.
-#
-# According to RFC 977 the only response is:
-#
-#    202 slave status noted
-
-proc ::nntp::_slave {name} {
-    return [::nntp::command $name "SLAVE"]
-}
-
-# ::nntp::_stat --
-#
-#       Internal stat proc.  Called by the 'nntpName stat' command.
-#       The stat command is similar to the article command except that no
-#       text is returned.  When selecting by message number within a group,
-#       the stat command serves to set the current article pointer without
-#       sending text. The returned acknowledgement response will contain the
-#       message-id, which may be of some value.  Using the stat command to
-#       select by message-id is valid but of questionable value, since a
-#       selection by message-id does NOT alter the "current article pointer"
-#
-# Arguments:
-#       name    Name of the nntp object.
-#       msgid   The number of the message to stat (optional) default is to
-#               stat the current article
-#
-# Results:
-#       Returns the statistics for the article.
-
-proc ::nntp::_stat {name {msgid ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "status"
-    return [::nntp::command $name "STAT $msgid"]
-}
-
-# ::nntp::_quit --
-#
-#       Internal quit proc.  Called by the 'nntpName quit' command.
-#       Quits the nntp session and closes the socket.  Deletes the command
-#       that was created for the connection.
-#
-# Arguments:
-#       name    Name of the nntp object.
-#
-# Results:
-#       Returns the return value from the quit command.
-
-proc ::nntp::_quit {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set ret [::nntp::command $name "QUIT"]
-    close $data(sock)
-    rename ${name} {}
-    return $ret
-}
-
-#############################################################
-#
-# Extended methods (not available on all NNTP servers
-#
-
-proc ::nntp::_date {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "msg"
-    return [::nntp::command $name "DATE"]
-}
-
-proc ::nntp::_listgroup {name {group ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "LISTGROUP $group"]
-}
-
-proc ::nntp::_mode_reader {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "msg"
-    return [::nntp::command $name "MODE READER"]
-}
-
-proc ::nntp::_xgtitle {name {group_pattern ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XGTITLE $group_pattern"]
-}
-
-proc ::nntp::_xhdr {name {header "message-id"} {list ""} {last ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    if {![regexp -- {\d+-\d+} $list]} {
-        if {"$last" != ""} {
-            set list "$list-$last"
-        } else {
-            set list ""
-	}
-    }
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XHDR $header $list"]    
-}
-
-proc ::nntp::_xindex {name {group ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    if {("$group" == "") && [info exists data(group)]} {
-        set group $data(group)
-    }
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XINDEX $group"]    
-}
-
-proc ::nntp::_xmotd {name {since ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    if {"$since" != ""} {
-        set since [clock seconds]
-    }
-    set since [clock format [clock scan $since] -format "%y%m%d %H%M%S"]
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XMOTD $since"]    
-}
-
-proc ::nntp::_xover {name {list ""} {last ""}} {
-    upvar 0 ::nntp::${name}data data
-    if {![regexp -- {\d+-\d+} $list]} {
-        if {"$last" != ""} {
-            set list "$list-$last"
-        } else {
-            set list ""
-	}
-    }
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XOVER $list"]
-}
-
-proc ::nntp::_xpat {name {header "subject"} {list 1} {last ""} args} {
-    upvar 0 ::nntp::${name}data data
-
-    set patterns ""
-
-    if {![regexp -- {\d+-\d+} $list]} {
-        if {("$last" != "") && ([string is digit $last])} {
-            set list "$list-$last"
-        }
-    } elseif {"$last" != ""} {
-        set patterns "$last"
-    }
-    
-    if {[llength $args] > 0} {
-        set patterns "$patterns $args"
-    }
-
-    if {"$patterns" == ""} {
-        set patterns "*"
-    }
-    
-    set data(cmnd) "fetch"
-    return [::nntp::command $name "XPAT $header $list $patterns"]
-}
-
-proc ::nntp::_xpath {name {msgid ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(cmnd) "msg"
-    return [::nntp::command $name "XPATH $msgid"]
-}
-
-proc ::nntp::_xsearch {name args} {
-    set res [::nntp::command $name "XSEARCH"]
-    if {!$res} {
-        return ""
-    }
-    return [::nntp::squirt $name "$args"]    
-}
-
-proc ::nntp::_xthread {name args} {
-    upvar 0 ::nntp::${name}data data
-
-    if {[llength $args] > 0} {
-        set filename "dbinit"
-    } else {
-        set filename "thread"
-    }
-    set data(cmnd) "fetchbinary"
-    return [::nntp::command $name "XTHREAD $filename"]
-}
-
-######################################################
-#
-# Helper methods
-#
-
-proc ::nntp::cmd {name cmd} {
-    upvar 0 ::nntp::${name}data data
-
-    set eol "\015\012"
-    set sock $data(sock)
-    if {$data(debug)} {
-        puts stderr "$sock command $cmd"
-    }
-    puts $sock "$cmd"
-    flush $sock
-    return
-}
-
-proc ::nntp::command {name args} {
-    set res [eval [linsert $args 0 ::nntp::cmd $name]]
-    
-    return [::nntp::response $name]
-}
-
-proc ::nntp::msg {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set res [::nntp::okprint $name]
-    if {!$res} {
-        return ""
-    }
-    return $data(mesg)
-}
-
-proc ::nntp::groupinfo {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set data(group) ""
-
-    if {[::nntp::okprint $name] && [regexp -- {(\d+)\s+(\d+)\s+(\d+)\s+([\w\.]+)} \
-            $data(mesg) match count first last data(group)]} {
-        return [list $count $first $last $data(group)]
-    }
-    return ""
-}
-
-proc ::nntp::msgid {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set result ""
-    if {[::nntp::okprint $name] && \
-            [regsub -- {\s+<[^>]+>} $data(mesg) {} result]} {
-        return $result
-    } else {
-        return ""
-    }
-}
-
-proc ::nntp::status {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set result ""
-    if {[::nntp::okprint $name] && \
-            [regexp -- {\d+\s+<[^>]+>} $data(mesg) result]} {
-        return $result
-    } else {
-        return ""
-    }
-}
-
-proc ::nntp::fetch {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set eol "\012"
-
-    if {![::nntp::okprint $name]} {
-        return ""
-    }
-    set sock $data(sock)
-
-    if {$data(binary)} {
-	set oldenc [fconfigure $sock -encoding]
-	fconfigure $sock -encoding binary
-    }
-
-    set result [list ]
-    while {![eof $sock]} {
-        gets $sock line
-        regsub -- {\015?\012$} $line $data(eol) line
-
-        if {[string match "." $line]} {
-            break
-        }
-	if { [string match "..*" $line] } {
-	    lappend result [string range $line 1 end]
-	} else {
-	    lappend result $line
-	}
-    }
-
-    if {$data(binary)} {
-	fconfigure $sock -encoding $oldenc
-    }
-
-    return $result
-}
-
-proc ::nntp::response {name} {
-    upvar 0 ::nntp::${name}data data
-
-    set eol "\012"
-
-    set sock $data(sock)
-
-    gets $sock line
-    set data(code) 0
-    set data(mesg) ""
-
-    if {$line == ""} {
-        error "nntp: unexpected EOF on $sock\n"
-    }
-
-    regsub -- {\015?\012$} $line "" line
-
-    set result [regexp -- {^((\d\d)(\d))\s*(.*)} $line match \
-            data(code) val1 val2 data(mesg)]
-    
-    if {$result == 0} {
-        puts stderr "nntp garbled response: $line\n";
-        return ""
-    }
-
-    if {$val1 == 20} {
-        set data(post) [expr {!$val2}]
-    }
-
-    if {$data(debug)} {
-        puts stderr "val1 $val1 val2 $val2"
-        puts stderr "code '$data(code)'"
-        puts stderr "mesg '$data(mesg)'"
-        if {[info exists data(post)]} {
-            puts stderr "post '$data(post)'"
-        }
-    } 
-
-    return [::nntp::returnval $name]
-}
-
-proc ::nntp::returnval {name} {
-    upvar 0 ::nntp::${name}data data
-
-    if {([info exists data(cmnd)]) \
-            && ($data(cmnd) != "")} {
-        set command $data(cmnd)
-    } else {
-        set command okprint
-    }
-    
-    if {$data(debug)} {
-        puts stderr "returnval command '$command'"
-    }
-
-    set data(cmnd) ""
-    return [::nntp::$command $name]
-}
-
-proc ::nntp::squirt {name {body ""}} {
-    upvar 0 ::nntp::${name}data data
-
-    set body [split $body \n]
-
-    if {$data(debug)} {
-        puts stderr "$data(sock) sending [llength $body] lines\n";
-    }
-
-    foreach line $body {
-        # Print each line, possibly prepending a dot for lines
-        # starting with a dot and trimming any trailing \n.
-	if { [string match ".*" $line] } {
-	    set line ".$line"
-	}
-        puts $data(sock) $line
-    }
-    puts $data(sock) "."
-    flush $data(sock)
-
-    if {$data(debug)} {
-        puts stderr "$data(sock) is finished sending"
-    }
-    return [::nntp::response $name]
-}
-#eof
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/nntp/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/nntp/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded nntp 0.2.1 [list source [file join $dir nntp.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ntp/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ntp/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded time 1.2.1 [list source [file join $dir time.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ntp/time.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ntp/time.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,387 +1,0 @@
-# time.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Client for the Time protocol. See RFC 868
-# Client for Simple Network Time Protocol - RFC 2030
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: time.tcl,v 1.19 2006/09/19 23:36:17 andreas_kupries Exp $
-
-package require Tcl 8.0;                # tcl minimum version
-package require log;                    # tcllib 1.3
-
-namespace eval ::time {
-    variable version 1.2.1
-    variable rcsid {$Id: time.tcl,v 1.19 2006/09/19 23:36:17 andreas_kupries Exp $}
-
-    namespace export configure gettime server cleanup
-
-    variable options
-    if {![info exists options]} {
-        array set options {
-            -timeserver {}
-            -port       37
-            -protocol   tcp
-            -timeout    10000
-            -command    {}
-            -loglevel   warning
-        }
-        if {![catch {package require udp}]} {
-            set options(-protocol) udp
-        } else {
-            if {![catch {package require ceptcl}]} {
-                set options(-protocol) udp
-            }
-        }
-        log::lvSuppressLE emergency 0
-        log::lvSuppressLE $options(-loglevel) 1
-        log::lvSuppress $options(-loglevel) 0
-    }
-
-    # Store conversions for other epochs. Currently only unix - but maybe
-    # there are some others out there.
-    variable epoch
-    if {![info exists epoch]} {
-        array set epoch {
-            unix 2208988800
-        }
-    }
-
-    # The id for the next token.
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Retrieve configuration settings for the time package.
-#
-proc ::time::cget {optionname} {
-    return [configure $optionname]
-}
-
-# Description:
-#  Configure the package.
-#  With no options, returns a list of all current settings.
-#
-proc ::time::configure {args} {
-    variable options
-    set r {}
-    set cget 0
-
-    if {[llength $args] < 1} {
-        foreach opt [lsort [array names options]] {
-            lappend r $opt $options($opt)
-        }
-        return $r
-    }
-
-    if {[llength $args] == 1} {
-        set cget 1
-    }
-
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -port     { set r [SetOrGet -port $cget] }
-            -timeout  { set r [SetOrGet -timeout $cget] }
-            -protocol { set r [SetOrGet -protocol $cget] }
-            -command  { set r [SetOrGet -command $cget] }
-            -loglevel {
-                if {$cget} {
-                    return $options(-loglevel)
-                } else {
-                    set options(-loglevel) [Pop args 1]
-                    log::lvSuppressLE emergency 0
-                    log::lvSuppressLE $options(-loglevel) 1
-                    log::lvSuppress $options(-loglevel) 0
-                }
-            }
-            --        { Pop args ; break }
-            default {
-                set err [join [lsort [array names options -*]] ", "]
-                return -code error "bad option \"$option\": must be $err"
-            }
-        }
-        Pop args
-    }
-    
-    return $r
-}
-
-# Set/get package options.
-proc ::time::SetOrGet {option {cget 0}} {
-    upvar options options
-    upvar args args
-    if {$cget} {
-        return $options($option)
-    } else {
-        set options($option) [Pop args 1]
-    }
-    return {}
-}
-
-# -------------------------------------------------------------------------
-
-proc ::time::getsntp {args} {
-    set token [eval [linsert $args 0 CommonSetup -port 123]]
-    upvar #0 $token State
-    set State(rfc) 2030
-    return [QueryTime $token]
-}
-
-proc ::time::gettime {args} {
-    set token [eval [linsert $args 0 CommonSetup -port 37]]
-    upvar #0 $token State
-    set State(rfc) 868
-    return [QueryTime $token]
-}
-
-proc ::time::CommonSetup {args} {
-    variable options
-    variable uid
-    set token [namespace current]::[incr uid]
-    variable $token
-    upvar 0 $token State
-
-    array set State [array get options]
-    set State(status) unconnected
-    set State(data) {}
-    
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -port     { set State(-port) [Pop args 1] }
-            -timeout  { set State(-timeout) [Pop args 1] }
-            -proto*   { set State(-protocol) [Pop args 1] }
-            -command  { set State(-command) [Pop args 1] }
-            --        { Pop args ; break }
-            default {
-                set err [join [lsort [array names State -*]] ", "]
-                return -code error "bad option \"$option\":\
-                    must be $err."
-            }
-        }
-        Pop args
-    }
-
-    set len [llength $args]
-    if {$len < 1 || $len > 2} {
-        if {[catch {info level -1} arg0]} {
-            set arg0 [info level 0]
-        }
-        return -code error "wrong # args: should be\
-              \"[lindex $arg0 0] ?options? timeserver ?port?\""
-    }
-
-    set State(-timeserver) [lindex $args 0]
-    if {$len == 2} {
-        set State(-port) [lindex $args 1]
-    }
-
-    return $token
-}
-
-proc ::time::QueryTime {token} {
-    variable $token
-    upvar 0 $token State
-
-    if {[string equal $State(-protocol) "udp"]} {
-        if {[llength [package provide ceptcl]] == 0 \
-                && [llength [package provide udp]] == 0} {
-            set State(status) error
-            set State(error) "udp support is not available, \
-                either ceptcl or tcludp required"
-            return $token
-        }
-    }
-
-    if {[catch {
-        if {[string equal $State(-protocol) "udp"]} {
-            if {[llength [package provide ceptcl]] > 0} {
-                # using ceptcl
-                set State(sock) [cep -type datagram \
-                                     $State(-timeserver) $State(-port)]
-                fconfigure $State(sock) -blocking 0
-            } else {
-                # using tcludp
-                set State(sock) [udp_open]
-                udp_conf $State(sock) $State(-timeserver) $State(-port)
-            }
-        } else {
-            set State(sock) [socket $State(-timeserver) $State(-port)]
-        }
-    } sockerr]} {
-        set State(status) error
-        set State(error) $sockerr
-        return $token
-    }
-
-    # setup the timeout
-    if {$State(-timeout) > 0} {
-        set State(after) [after $State(-timeout) \
-                              [list [namespace origin reset] $token timeout]]
-    }
-
-    set State(status) connect
-    fconfigure $State(sock) -translation binary -buffering none
-
-    # SNTP wants a 48 byte request while TIME doesn't care and is happy
-    # to accept any old rubbish. If protocol is TCP then merely connecting
-    # is sufficient to elicit a response.
-    if {[string equal $State(-protocol) "udp"]} {
-        set len [expr {($State(rfc) == 2030) ? 47 : 3}]
-        puts -nonewline $State(sock) \x0b[string repeat \0 $len]
-    }
-
-    fileevent $State(sock) readable \
-        [list [namespace origin ClientReadEvent] $token]
-
-    if {$State(-command) == {}} {
-        wait $token
-    }
-
-    return $token
-}
-
-proc ::time::unixtime {{token {}}} {
-    variable $token
-    variable epoch
-    upvar 0 $token State
-    if {$State(status) != "ok"} {
-        return -code error $State(error)
-    }
-    
-    # SNTP returns 48+ bytes while TIME always returns 4.
-    if {[string length $State(data)] == 4} {
-        # RFC848 TIME
-        if {[binary scan $State(data) I r] < 1} {
-            return -code error "Unable to scan data"
-        }
-        return [expr {int($r - $epoch(unix))&0xffffffff}]
-    } elseif {[string length $State(data)] > 47} {
-        # SNTP TIME
-        if {[binary scan $State(data) c40II -> sec frac] < 1} {
-            return -code error "Failed to decode result"
-        }
-        return [expr {int($sec - $epoch(unix))&0xffffffff}]
-    } else {
-        return -code error "error: data format not recognised"
-    }
-}
-
-proc ::time::status {token} {
-    variable $token
-    upvar 0 $token State
-    return $State(status)
-}
-
-proc ::time::error {token} {
-    variable $token
-    upvar 0 $token State
-    set r {}
-    if {[info exists State(error)]} {
-        set r $State(error)
-    }
-    return $r
-}
-
-proc ::time::wait {token} {
-    variable $token
-    upvar 0 $token State
-
-    if {$State(status) == "connect"} {
-        vwait [subst $token](status)
-    }
-
-    return $State(status)
-}
-
-proc ::time::reset {token {why reset}} {
-    variable $token
-    upvar 0 $token State
-    set reason {}
-    set State(status) $why
-    catch {fileevent $State(sock) readable {}}
-    if {$why == "timeout"} {
-        set reason "timeout ocurred"
-    }
-    Finish $token $reason
-}
-
-# Description:
-#  Remove any state associated with this token.
-#
-proc ::time::cleanup {token} {
-    variable $token
-    upvar 0 $token State
-    if {[info exists State]} {
-        unset State
-    }
-}
-
-# -------------------------------------------------------------------------
-
-proc ::time::ClientReadEvent {token} {
-    variable $token
-    upvar 0 $token State
-
-    append State(data) [read $State(sock)]
-    set expected [expr {($State(rfc) == 868) ? 4 : 48}]
-    if {[string length $State(data)] < $expected} { return }
-
-    #FIX ME: acquire peer data?
-
-    set State(status) ok
-    Finish $token
-    return
-}
-
-proc ::time::Finish {token {errormsg {}}} {
-    variable $token
-    upvar 0 $token State
-    global errorInfo errorCode
-
-    if {[string length $errormsg] > 0} {
-	set State(error) $errormsg
-	set State(status) error
-    }
-    catch {close $State(sock)}
-    catch {after cancel $State(after)}
-    if {[info exists State(-command)] && $State(-command) != {}} {
-        if {[catch {eval $State(-command) {$token}} err]} {
-            if {[string length $errormsg] == 0} {
-                set State(error) [list $err $errorInfo $errorCode]
-                set State(status) error
-            }
-        }
-        if {[info exists State(-command)]} {
-            unset State(-command)
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::time::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-package provide time $::time::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/otp/otp.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/otp/otp.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,433 +1,0 @@
-# otp.tcl - Copyright (C) 2006 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Tcl implementation of RFC 2289: A One-Time Password System
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::otp {
-    variable version 1.0.0
-    variable rcsid {$Id: otp.tcl,v 1.2 2006/09/02 22:30:17 patthoyts Exp $}
-
-    namespace export otp-md4 otp-md5 otp-sha1 otp-rmd160
-
-    variable Words {
-        "A"     "ABE"   "ACE"   "ACT"   "AD"    "ADA"   "ADD"
-        "AGO"   "AID"   "AIM"   "AIR"   "ALL"   "ALP"   "AM"    "AMY"
-        "AN"    "ANA"   "AND"   "ANN"   "ANT"   "ANY"   "APE"   "APS"
-        "APT"   "ARC"   "ARE"   "ARK"   "ARM"   "ART"   "AS"    "ASH"
-        "ASK"   "AT"    "ATE"   "AUG"   "AUK"   "AVE"   "AWE"   "AWK"
-        "AWL"   "AWN"   "AX"    "AYE"   "BAD"   "BAG"   "BAH"   "BAM"
-        "BAN"   "BAR"   "BAT"   "BAY"   "BE"    "BED"   "BEE"   "BEG"
-        "BEN"   "BET"   "BEY"   "BIB"   "BID"   "BIG"   "BIN"   "BIT"
-        "BOB"   "BOG"   "BON"   "BOO"   "BOP"   "BOW"   "BOY"   "BUB"
-        "BUD"   "BUG"   "BUM"   "BUN"   "BUS"   "BUT"   "BUY"   "BY"
-        "BYE"   "CAB"   "CAL"   "CAM"   "CAN"   "CAP"   "CAR"   "CAT"
-        "CAW"   "COD"   "COG"   "COL"   "CON"   "COO"   "COP"   "COT"
-        "COW"   "COY"   "CRY"   "CUB"   "CUE"   "CUP"   "CUR"   "CUT"
-        "DAB"   "DAD"   "DAM"   "DAN"   "DAR"   "DAY"   "DEE"   "DEL"
-        "DEN"   "DES"   "DEW"   "DID"   "DIE"   "DIG"   "DIN"   "DIP"
-        "DO"    "DOE"   "DOG"   "DON"   "DOT"   "DOW"   "DRY"   "DUB"
-        "DUD"   "DUE"   "DUG"   "DUN"   "EAR"   "EAT"   "ED"    "EEL"
-        "EGG"   "EGO"   "ELI"   "ELK"   "ELM"   "ELY"   "EM"    "END"
-        "EST"   "ETC"   "EVA"   "EVE"   "EWE"   "EYE"   "FAD"   "FAN"
-        "FAR"   "FAT"   "FAY"   "FED"   "FEE"   "FEW"   "FIB"   "FIG"
-        "FIN"   "FIR"   "FIT"   "FLO"   "FLY"   "FOE"   "FOG"   "FOR"
-        "FRY"   "FUM"   "FUN"   "FUR"   "GAB"   "GAD"   "GAG"   "GAL"
-        "GAM"   "GAP"   "GAS"   "GAY"   "GEE"   "GEL"   "GEM"   "GET"
-        "GIG"   "GIL"   "GIN"   "GO"    "GOT"   "GUM"   "GUN"   "GUS"
-        "GUT"   "GUY"   "GYM"   "GYP"   "HA"    "HAD"   "HAL"   "HAM"
-        "HAN"   "HAP"   "HAS"   "HAT"   "HAW"   "HAY"   "HE"    "HEM"
-        "HEN"   "HER"   "HEW"   "HEY"   "HI"    "HID"   "HIM"   "HIP"
-        "HIS"   "HIT"   "HO"   "HOB"   "HOC"   "HOE"   "HOG"   "HOP"
-        "HOT"   "HOW"   "HUB"   "HUE"   "HUG"   "HUH"   "HUM"   "HUT"
-        "I"     "ICY"   "IDA"   "IF"    "IKE"   "ILL"   "INK"   "INN"
-        "IO"    "ION"   "IQ"   "IRA"   "IRE"   "IRK"   "IS"    "IT"
-        "ITS"   "IVY"   "JAB"   "JAG"   "JAM"   "JAN"   "JAR"   "JAW"
-        "JAY"   "JET"   "JIG"   "JIM"   "JO"    "JOB"   "JOE"   "JOG"
-        "JOT"   "JOY"   "JUG"   "JUT"   "KAY"   "KEG"   "KEN"   "KEY"
-        "KID"   "KIM"   "KIN"   "KIT"   "LA"    "LAB"   "LAC"   "LAD"
-        "LAG"   "LAM"   "LAP"   "LAW"   "LAY"   "LEA"   "LED"   "LEE"
-        "LEG"   "LEN"   "LEO"   "LET"   "LEW"   "LID"   "LIE"   "LIN"
-        "LIP"   "LIT"   "LO"   "LOB"   "LOG"   "LOP"   "LOS"   "LOT"
-        "LOU"   "LOW"   "LOY"   "LUG"   "LYE"   "MA"    "MAC"   "MAD"
-        "MAE"   "MAN"   "MAO"   "MAP"   "MAT"   "MAW"   "MAY"   "ME"
-        "MEG"   "MEL"   "MEN"   "MET"   "MEW"   "MID"   "MIN"   "MIT"
-        "MOB"   "MOD"   "MOE"   "MOO"   "MOP"   "MOS"   "MOT"   "MOW"
-        "MUD"   "MUG"   "MUM"   "MY"    "NAB"   "NAG"   "NAN"   "NAP"
-        "NAT"   "NAY"   "NE"   "NED"   "NEE"   "NET"   "NEW"   "NIB"
-        "NIL"   "NIP"   "NIT"   "NO"    "NOB"   "NOD"   "NON"   "NOR"
-        "NOT"   "NOV"   "NOW"   "NU"    "NUN"   "NUT"   "O"     "OAF"
-        "OAK"   "OAR"   "OAT"   "ODD"   "ODE"   "OF"    "OFF"   "OFT"
-        "OH"    "OIL"   "OK"   "OLD"   "ON"    "ONE"   "OR"    "ORB"
-        "ORE"   "ORR"   "OS"   "OTT"   "OUR"   "OUT"   "OVA"   "OW"
-        "OWE"   "OWL"   "OWN"   "OX"    "PA"    "PAD"   "PAL"   "PAM"
-        "PAN"   "PAP"   "PAR"   "PAT"   "PAW"   "PAY"   "PEA"   "PEG"
-        "PEN"   "PEP"   "PER"   "PET"   "PEW"   "PHI"   "PI"    "PIE"
-        "PIN"   "PIT"   "PLY"   "PO"    "POD"   "POE"   "POP"   "POT"
-        "POW"   "PRO"   "PRY"   "PUB"   "PUG"   "PUN"   "PUP"   "PUT"
-        "QUO"   "RAG"   "RAM"   "RAN"   "RAP"   "RAT"   "RAW"   "RAY"
-        "REB"   "RED"   "REP"   "RET"   "RIB"   "RID"   "RIG"   "RIM"
-        "RIO"   "RIP"   "ROB"   "ROD"   "ROE"   "RON"   "ROT"   "ROW"
-        "ROY"   "RUB"   "RUE"   "RUG"   "RUM"   "RUN"   "RYE"   "SAC"
-        "SAD"   "SAG"   "SAL"   "SAM"   "SAN"   "SAP"   "SAT"   "SAW"
-        "SAY"   "SEA"   "SEC"   "SEE"   "SEN"   "SET"   "SEW"   "SHE"
-        "SHY"   "SIN"   "SIP"   "SIR"   "SIS"   "SIT"   "SKI"   "SKY"
-        "SLY"   "SO"    "SOB"   "SOD"   "SON"   "SOP"   "SOW"   "SOY"
-        "SPA"   "SPY"   "SUB"   "SUD"   "SUE"   "SUM"   "SUN"   "SUP"
-        "TAB"   "TAD"   "TAG"   "TAN"   "TAP"   "TAR"   "TEA"   "TED"
-        "TEE"   "TEN"   "THE"   "THY"   "TIC"   "TIE"   "TIM"   "TIN"
-        "TIP"   "TO"    "TOE"   "TOG"   "TOM"   "TON"   "TOO"   "TOP"
-        "TOW"   "TOY"   "TRY"   "TUB"   "TUG"   "TUM"   "TUN"   "TWO"
-        "UN"    "UP"    "US"   "USE"   "VAN"   "VAT"   "VET"   "VIE"
-        "WAD"   "WAG"   "WAR"   "WAS"   "WAY"   "WE"    "WEB"   "WED"
-        "WEE"   "WET"   "WHO"   "WHY"   "WIN"   "WIT"   "WOK"   "WON"
-        "WOO"   "WOW"   "WRY"   "WU"    "YAM"   "YAP"   "YAW"   "YE"
-        "YEA"   "YES"   "YET"   "YOU"   "ABED"  "ABEL"  "ABET"  "ABLE"
-        "ABUT"  "ACHE"  "ACID"  "ACME"  "ACRE"  "ACTA"  "ACTS"  "ADAM"
-        "ADDS"  "ADEN"  "AFAR"  "AFRO"  "AGEE"  "AHEM"  "AHOY"  "AIDA"
-        "AIDE"  "AIDS"  "AIRY"  "AJAR"  "AKIN"  "ALAN"  "ALEC"  "ALGA"
-        "ALIA"  "ALLY"  "ALMA"  "ALOE"  "ALSO"  "ALTO"  "ALUM"  "ALVA"
-        "AMEN"  "AMES"  "AMID"  "AMMO"  "AMOK"  "AMOS"  "AMRA"  "ANDY"
-        "ANEW"  "ANNA"  "ANNE"  "ANTE"  "ANTI"  "AQUA"  "ARAB"  "ARCH"
-        "AREA"  "ARGO"  "ARID"  "ARMY"  "ARTS"  "ARTY"  "ASIA"  "ASKS"
-        "ATOM"  "AUNT"  "AURA"  "AUTO"  "AVER"  "AVID"  "AVIS"  "AVON"
-        "AVOW"  "AWAY"  "AWRY"  "BABE"  "BABY"  "BACH"  "BACK"  "BADE"
-        "BAIL"  "BAIT"  "BAKE"  "BALD"  "BALE"  "BALI"  "BALK"  "BALL"
-        "BALM"  "BAND"  "BANE"  "BANG"  "BANK"  "BARB"  "BARD"  "BARE"
-        "BARK"  "BARN"  "BARR"  "BASE"  "BASH"  "BASK"  "BASS"  "BATE"
-        "BATH"  "BAWD"  "BAWL"  "BEAD"  "BEAK"  "BEAM"  "BEAN"  "BEAR"
-        "BEAT"  "BEAU"  "BECK"  "BEEF"  "BEEN"  "BEER"  "BEET"  "BELA"
-        "BELL"  "BELT"  "BEND"  "BENT"  "BERG"  "BERN"  "BERT"  "BESS"
-        "BEST"  "BETA"  "BETH"  "BHOY"  "BIAS"  "BIDE"  "BIEN"  "BILE"
-        "BILK"  "BILL"  "BIND"  "BING"  "BIRD"  "BITE"  "BITS"  "BLAB"
-        "BLAT"  "BLED"  "BLEW"  "BLOB"  "BLOC"  "BLOT"  "BLOW"  "BLUE"
-        "BLUM"  "BLUR"  "BOAR"  "BOAT"  "BOCA"  "BOCK"  "BODE"  "BODY"
-        "BOGY"  "BOHR"  "BOIL"  "BOLD"  "BOLO"  "BOLT"  "BOMB"  "BONA"
-        "BOND"  "BONE"  "BONG"  "BONN"  "BONY"  "BOOK"  "BOOM"  "BOON"
-        "BOOT"  "BORE"  "BORG"  "BORN"  "BOSE"  "BOSS"  "BOTH"  "BOUT"
-        "BOWL"  "BOYD"  "BRAD"  "BRAE"  "BRAG"  "BRAN"  "BRAY"  "BRED"
-        "BREW"  "BRIG"  "BRIM"  "BROW"  "BUCK"  "BUDD"  "BUFF"  "BULB"
-        "BULK"  "BULL"  "BUNK"  "BUNT"  "BUOY"  "BURG"  "BURL"  "BURN"
-        "BURR"  "BURT"  "BURY"  "BUSH"  "BUSS"  "BUST"  "BUSY"  "BYTE"
-        "CADY"  "CAFE"  "CAGE"  "CAIN"  "CAKE"  "CALF"  "CALL"  "CALM"
-        "CAME"  "CANE"  "CANT"  "CARD"  "CARE"  "CARL"  "CARR"  "CART"
-        "CASE"  "CASH"  "CASK"  "CAST"  "CAVE"  "CEIL"  "CELL"  "CENT"
-        "CERN"  "CHAD"  "CHAR"  "CHAT"  "CHAW"  "CHEF"  "CHEN"  "CHEW"
-        "CHIC"  "CHIN"  "CHOU"  "CHOW"  "CHUB"  "CHUG"  "CHUM"  "CITE"
-        "CITY"  "CLAD"  "CLAM"  "CLAN"  "CLAW"  "CLAY"  "CLOD"  "CLOG"
-        "CLOT"  "CLUB"  "CLUE"  "COAL"  "COAT"  "COCA"  "COCK"  "COCO"
-        "CODA"  "CODE"  "CODY"  "COED"  "COIL"  "COIN"  "COKE"  "COLA"
-        "COLD"  "COLT"  "COMA"  "COMB"  "COME"  "COOK"  "COOL"  "COON"
-        "COOT"  "CORD"  "CORE"  "CORK"  "CORN"  "COST"  "COVE"  "COWL"
-        "CRAB"  "CRAG"  "CRAM"  "CRAY"  "CREW"  "CRIB"  "CROW"  "CRUD"
-        "CUBA"  "CUBE"  "CUFF"  "CULL"  "CULT"  "CUNY"  "CURB"  "CURD"
-        "CURE"  "CURL"  "CURT"  "CUTS"  "DADE"  "DALE"  "DAME"  "DANA"
-        "DANE"  "DANG"  "DANK"  "DARE"  "DARK"  "DARN"  "DART"  "DASH"
-        "DATA"  "DATE"  "DAVE"  "DAVY"  "DAWN"  "DAYS"  "DEAD"  "DEAF"
-        "DEAL"  "DEAN"  "DEAR"  "DEBT"  "DECK"  "DEED"  "DEEM"  "DEER"
-        "DEFT"  "DEFY"  "DELL"  "DENT"  "DENY"  "DESK"  "DIAL"  "DICE"
-        "DIED"  "DIET"  "DIME"  "DINE"  "DING"  "DINT"  "DIRE"  "DIRT"
-        "DISC"  "DISH"  "DISK"  "DIVE"  "DOCK"  "DOES"  "DOLE"  "DOLL"
-        "DOLT"  "DOME"  "DONE"  "DOOM"  "DOOR"  "DORA"  "DOSE"  "DOTE"
-        "DOUG"  "DOUR"  "DOVE"  "DOWN"  "DRAB"  "DRAG"  "DRAM"  "DRAW"
-        "DREW"  "DRUB"  "DRUG"  "DRUM"  "DUAL"  "DUCK"  "DUCT"  "DUEL"
-        "DUET"  "DUKE"  "DULL"  "DUMB"  "DUNE"  "DUNK"  "DUSK"  "DUST"
-        "DUTY"  "EACH"  "EARL"  "EARN"  "EASE"  "EAST"  "EASY"  "EBEN"
-        "ECHO"  "EDDY"  "EDEN"  "EDGE"  "EDGY"  "EDIT"  "EDNA"  "EGAN"
-        "ELAN"  "ELBA"  "ELLA"  "ELSE"  "EMIL"  "EMIT"  "EMMA"  "ENDS"
-        "ERIC"  "EROS"  "EVEN"  "EVER"  "EVIL"  "EYED"  "FACE"  "FACT"
-        "FADE"  "FAIL"  "FAIN"  "FAIR"  "FAKE"  "FALL"  "FAME"  "FANG"
-        "FARM"  "FAST"  "FATE"  "FAWN"  "FEAR"  "FEAT"  "FEED"  "FEEL"
-        "FEET"  "FELL"  "FELT"  "FEND"  "FERN"  "FEST"  "FEUD"  "FIEF"
-        "FIGS"  "FILE"  "FILL"  "FILM"  "FIND"  "FINE"  "FINK"  "FIRE"
-        "FIRM"  "FISH"  "FISK"  "FIST"  "FITS"  "FIVE"  "FLAG"  "FLAK"
-        "FLAM"  "FLAT"  "FLAW"  "FLEA"  "FLED"  "FLEW"  "FLIT"  "FLOC"
-        "FLOG"  "FLOW"  "FLUB"  "FLUE"  "FOAL"  "FOAM"  "FOGY"  "FOIL"
-        "FOLD"  "FOLK"  "FOND"  "FONT"  "FOOD"  "FOOL"  "FOOT"  "FORD"
-        "FORE"  "FORK"  "FORM"  "FORT"  "FOSS"  "FOUL"  "FOUR"  "FOWL"
-        "FRAU"  "FRAY"  "FRED"  "FREE"  "FRET"  "FREY"  "FROG"  "FROM"
-        "FUEL"  "FULL"  "FUME"  "FUND"  "FUNK"  "FURY"  "FUSE"  "FUSS"
-        "GAFF"  "GAGE"  "GAIL"  "GAIN"  "GAIT"  "GALA"  "GALE"  "GALL"
-        "GALT"  "GAME"  "GANG"  "GARB"  "GARY"  "GASH"  "GATE"  "GAUL"
-        "GAUR"  "GAVE"  "GAWK"  "GEAR"  "GELD"  "GENE"  "GENT"  "GERM"
-        "GETS"  "GIBE"  "GIFT"  "GILD"  "GILL"  "GILT"  "GINA"  "GIRD"
-        "GIRL"  "GIST"  "GIVE"  "GLAD"  "GLEE"  "GLEN"  "GLIB"  "GLOB"
-        "GLOM"  "GLOW"  "GLUE"  "GLUM"  "GLUT"  "GOAD"  "GOAL"  "GOAT"
-        "GOER"  "GOES"  "GOLD"  "GOLF"  "GONE"  "GONG"  "GOOD"  "GOOF"
-        "GORE"  "GORY"  "GOSH"  "GOUT"  "GOWN"  "GRAB"  "GRAD"  "GRAY"
-        "GREG"  "GREW"  "GREY"  "GRID"  "GRIM"  "GRIN"  "GRIT"  "GROW"
-        "GRUB"  "GULF"  "GULL"  "GUNK"  "GURU"  "GUSH"  "GUST"  "GWEN"
-        "GWYN"  "HAAG"  "HAAS"  "HACK"  "HAIL"  "HAIR"  "HALE"  "HALF"
-        "HALL"  "HALO"  "HALT"  "HAND"  "HANG"  "HANK"  "HANS"  "HARD"
-        "HARK"  "HARM"  "HART"  "HASH"  "HAST"  "HATE"  "HATH"  "HAUL"
-        "HAVE"  "HAWK"  "HAYS"  "HEAD"  "HEAL"  "HEAR"  "HEAT"  "HEBE"
-        "HECK"  "HEED"  "HEEL"  "HEFT"  "HELD"  "HELL"  "HELM"  "HERB"
-        "HERD"  "HERE"  "HERO"  "HERS"  "HESS"  "HEWN"  "HICK"  "HIDE"
-        "HIGH"  "HIKE"  "HILL"  "HILT"  "HIND"  "HINT"  "HIRE"  "HISS"
-        "HIVE"  "HOBO"  "HOCK"  "HOFF"  "HOLD"  "HOLE"  "HOLM"  "HOLT"
-        "HOME"  "HONE"  "HONK"  "HOOD"  "HOOF"  "HOOK"  "HOOT"  "HORN"
-        "HOSE"  "HOST"  "HOUR"  "HOVE"  "HOWE"  "HOWL"  "HOYT"  "HUCK"
-        "HUED"  "HUFF"  "HUGE"  "HUGH"  "HUGO"  "HULK"  "HULL"  "HUNK"
-        "HUNT"  "HURD"  "HURL"  "HURT"  "HUSH"  "HYDE"  "HYMN"  "IBIS"
-        "ICON"  "IDEA"  "IDLE"  "IFFY"  "INCA"  "INCH"  "INTO"  "IONS"
-        "IOTA"  "IOWA"  "IRIS"  "IRMA"  "IRON"  "ISLE"  "ITCH"  "ITEM"
-        "IVAN"  "JACK"  "JADE"  "JAIL"  "JAKE"  "JANE"  "JAVA"  "JEAN"
-        "JEFF"  "JERK"  "JESS"  "JEST"  "JIBE"  "JILL"  "JILT"  "JIVE"
-        "JOAN"  "JOBS"  "JOCK"  "JOEL"  "JOEY"  "JOHN"  "JOIN"  "JOKE"
-        "JOLT"  "JOVE"  "JUDD"  "JUDE"  "JUDO"  "JUDY"  "JUJU"  "JUKE"
-        "JULY"  "JUNE"  "JUNK"  "JUNO"  "JURY"  "JUST"  "JUTE"  "KAHN"
-        "KALE"  "KANE"  "KANT"  "KARL"  "KATE"  "KEEL"  "KEEN"  "KENO"
-        "KENT"  "KERN"  "KERR"  "KEYS"  "KICK"  "KILL"  "KIND"  "KING"
-        "KIRK"  "KISS"  "KITE"  "KLAN"  "KNEE"  "KNEW"  "KNIT"  "KNOB"
-        "KNOT"  "KNOW"  "KOCH"  "KONG"  "KUDO"  "KURD"  "KURT"  "KYLE"
-        "LACE"  "LACK"  "LACY"  "LADY"  "LAID"  "LAIN"  "LAIR"  "LAKE"
-        "LAMB"  "LAME"  "LAND"  "LANE"  "LANG"  "LARD"  "LARK"  "LASS"
-        "LAST"  "LATE"  "LAUD"  "LAVA"  "LAWN"  "LAWS"  "LAYS"  "LEAD"
-        "LEAF"  "LEAK"  "LEAN"  "LEAR"  "LEEK"  "LEER"  "LEFT"  "LEND"
-        "LENS"  "LENT"  "LEON"  "LESK"  "LESS"  "LEST"  "LETS"  "LIAR"
-        "LICE"  "LICK"  "LIED"  "LIEN"  "LIES"  "LIEU"  "LIFE"  "LIFT"
-        "LIKE"  "LILA"  "LILT"  "LILY"  "LIMA"  "LIMB"  "LIME"  "LIND"
-        "LINE"  "LINK"  "LINT"  "LION"  "LISA"  "LIST"  "LIVE"  "LOAD"
-        "LOAF"  "LOAM"  "LOAN"  "LOCK"  "LOFT"  "LOGE"  "LOIS"  "LOLA"
-        "LONE"  "LONG"  "LOOK"  "LOON"  "LOOT"  "LORD"  "LORE"  "LOSE"
-        "LOSS"  "LOST"  "LOUD"  "LOVE"  "LOWE"  "LUCK"  "LUCY"  "LUGE"
-        "LUKE"  "LULU"  "LUND"  "LUNG"  "LURA"  "LURE"  "LURK"  "LUSH"
-        "LUST"  "LYLE"  "LYNN"  "LYON"  "LYRA"  "MACE"  "MADE"  "MAGI"
-        "MAID"  "MAIL"  "MAIN"  "MAKE"  "MALE"  "MALI"  "MALL"  "MALT"
-        "MANA"  "MANN"  "MANY"  "MARC"  "MARE"  "MARK"  "MARS"  "MART"
-        "MARY"  "MASH"  "MASK"  "MASS"  "MAST"  "MATE"  "MATH"  "MAUL"
-        "MAYO"  "MEAD"  "MEAL"  "MEAN"  "MEAT"  "MEEK"  "MEET"  "MELD"
-        "MELT"  "MEMO"  "MEND"  "MENU"  "MERT"  "MESH"  "MESS"  "MICE"
-        "MIKE"  "MILD"  "MILE"  "MILK"  "MILL"  "MILT"  "MIMI"  "MIND"
-        "MINE"  "MINI"  "MINK"  "MINT"  "MIRE"  "MISS"  "MIST"  "MITE"
-        "MITT"  "MOAN"  "MOAT"  "MOCK"  "MODE"  "MOLD"  "MOLE"  "MOLL"
-        "MOLT"  "MONA"  "MONK"  "MONT"  "MOOD"  "MOON"  "MOOR"  "MOOT"
-        "MORE"  "MORN"  "MORT"  "MOSS"  "MOST"  "MOTH"  "MOVE"  "MUCH"
-        "MUCK"  "MUDD"  "MUFF"  "MULE"  "MULL"  "MURK"  "MUSH"  "MUST"
-        "MUTE"  "MUTT"  "MYRA"  "MYTH"  "NAGY"  "NAIL"  "NAIR"  "NAME"
-        "NARY"  "NASH"  "NAVE"  "NAVY"  "NEAL"  "NEAR"  "NEAT"  "NECK"
-        "NEED"  "NEIL"  "NELL"  "NEON"  "NERO"  "NESS"  "NEST"  "NEWS"
-        "NEWT"  "NIBS"  "NICE"  "NICK"  "NILE"  "NINA"  "NINE"  "NOAH"
-        "NODE"  "NOEL"  "NOLL"  "NONE"  "NOOK"  "NOON"  "NORM"  "NOSE"
-        "NOTE"  "NOUN"  "NOVA"  "NUDE"  "NULL"  "NUMB"  "OATH"  "OBEY"
-        "OBOE"  "ODIN"  "OHIO"  "OILY"  "OINT"  "OKAY"  "OLAF"  "OLDY"
-        "OLGA"  "OLIN"  "OMAN"  "OMEN"  "OMIT"  "ONCE"  "ONES"  "ONLY"
-        "ONTO"  "ONUS"  "ORAL"  "ORGY"  "OSLO"  "OTIS"  "OTTO"  "OUCH"
-        "OUST"  "OUTS"  "OVAL"  "OVEN"  "OVER"  "OWLY"  "OWNS"  "QUAD"
-        "QUIT"  "QUOD"  "RACE"  "RACK"  "RACY"  "RAFT"  "RAGE"  "RAID"
-        "RAIL"  "RAIN"  "RAKE"  "RANK"  "RANT"  "RARE"  "RASH"  "RATE"
-        "RAVE"  "RAYS"  "READ"  "REAL"  "REAM"  "REAR"  "RECK"  "REED"
-        "REEF"  "REEK"  "REEL"  "REID"  "REIN"  "RENA"  "REND"  "RENT"
-        "REST"  "RICE"  "RICH"  "RICK"  "RIDE"  "RIFT"  "RILL"  "RIME"
-        "RING"  "RINK"  "RISE"  "RISK"  "RITE"  "ROAD"  "ROAM"  "ROAR"
-        "ROBE"  "ROCK"  "RODE"  "ROIL"  "ROLL"  "ROME"  "ROOD"  "ROOF"
-        "ROOK"  "ROOM"  "ROOT"  "ROSA"  "ROSE"  "ROSS"  "ROSY"  "ROTH"
-        "ROUT"  "ROVE"  "ROWE"  "ROWS"  "RUBE"  "RUBY"  "RUDE"  "RUDY"
-        "RUIN"  "RULE"  "RUNG"  "RUNS"  "RUNT"  "RUSE"  "RUSH"  "RUSK"
-        "RUSS"  "RUST"  "RUTH"  "SACK"  "SAFE"  "SAGE"  "SAID"  "SAIL"
-        "SALE"  "SALK"  "SALT"  "SAME"  "SAND"  "SANE"  "SANG"  "SANK"
-        "SARA"  "SAUL"  "SAVE"  "SAYS"  "SCAN"  "SCAR"  "SCAT"  "SCOT"
-        "SEAL"  "SEAM"  "SEAR"  "SEAT"  "SEED"  "SEEK"  "SEEM"  "SEEN"
-        "SEES"  "SELF"  "SELL"  "SEND"  "SENT"  "SETS"  "SEWN"  "SHAG"
-        "SHAM"  "SHAW"  "SHAY"  "SHED"  "SHIM"  "SHIN"  "SHOD"  "SHOE"
-        "SHOT"  "SHOW"  "SHUN"  "SHUT"  "SICK"  "SIDE"  "SIFT"  "SIGH"
-        "SIGN"  "SILK"  "SILL"  "SILO"  "SILT"  "SINE"  "SING"  "SINK"
-        "SIRE"  "SITE"  "SITS"  "SITU"  "SKAT"  "SKEW"  "SKID"  "SKIM"
-        "SKIN"  "SKIT"  "SLAB"  "SLAM"  "SLAT"  "SLAY"  "SLED"  "SLEW"
-        "SLID"  "SLIM"  "SLIT"  "SLOB"  "SLOG"  "SLOT"  "SLOW"  "SLUG"
-        "SLUM"  "SLUR"  "SMOG"  "SMUG"  "SNAG"  "SNOB"  "SNOW"  "SNUB"
-        "SNUG"  "SOAK"  "SOAR"  "SOCK"  "SODA"  "SOFA"  "SOFT"  "SOIL"
-        "SOLD"  "SOME"  "SONG"  "SOON"  "SOOT"  "SORE"  "SORT"  "SOUL"
-        "SOUR"  "SOWN"  "STAB"  "STAG"  "STAN"  "STAR"  "STAY"  "STEM"
-        "STEW"  "STIR"  "STOW"  "STUB"  "STUN"  "SUCH"  "SUDS"  "SUIT"
-        "SULK"  "SUMS"  "SUNG"  "SUNK"  "SURE"  "SURF"  "SWAB"  "SWAG"
-        "SWAM"  "SWAN"  "SWAT"  "SWAY"  "SWIM"  "SWUM"  "TACK"  "TACT"
-        "TAIL"  "TAKE"  "TALE"  "TALK"  "TALL"  "TANK"  "TASK"  "TATE"
-        "TAUT"  "TEAL"  "TEAM"  "TEAR"  "TECH"  "TEEM"  "TEEN"  "TEET"
-        "TELL"  "TEND"  "TENT"  "TERM"  "TERN"  "TESS"  "TEST"  "THAN"
-        "THAT"  "THEE"  "THEM"  "THEN"  "THEY"  "THIN"  "THIS"  "THUD"
-        "THUG"  "TICK"  "TIDE"  "TIDY"  "TIED"  "TIER"  "TILE"  "TILL"
-        "TILT"  "TIME"  "TINA"  "TINE"  "TINT"  "TINY"  "TIRE"  "TOAD"
-        "TOGO"  "TOIL"  "TOLD"  "TOLL"  "TONE"  "TONG"  "TONY"  "TOOK"
-        "TOOL"  "TOOT"  "TORE"  "TORN"  "TOTE"  "TOUR"  "TOUT"  "TOWN"
-        "TRAG"  "TRAM"  "TRAY"  "TREE"  "TREK"  "TRIG"  "TRIM"  "TRIO"
-        "TROD"  "TROT"  "TROY"  "TRUE"  "TUBA"  "TUBE"  "TUCK"  "TUFT"
-        "TUNA"  "TUNE"  "TUNG"  "TURF"  "TURN"  "TUSK"  "TWIG"  "TWIN"
-        "TWIT"  "ULAN"  "UNIT"  "URGE"  "USED"  "USER"  "USES"  "UTAH"
-        "VAIL"  "VAIN"  "VALE"  "VARY"  "VASE"  "VAST"  "VEAL"  "VEDA"
-        "VEIL"  "VEIN"  "VEND"  "VENT"  "VERB"  "VERY"  "VETO"  "VICE"
-        "VIEW"  "VINE"  "VISE"  "VOID"  "VOLT"  "VOTE"  "WACK"  "WADE"
-        "WAGE"  "WAIL"  "WAIT"  "WAKE"  "WALE"  "WALK"  "WALL"  "WALT"
-        "WAND"  "WANE"  "WANG"  "WANT"  "WARD"  "WARM"  "WARN"  "WART"
-        "WASH"  "WAST"  "WATS"  "WATT"  "WAVE"  "WAVY"  "WAYS"  "WEAK"
-        "WEAL"  "WEAN"  "WEAR"  "WEED"  "WEEK"  "WEIR"  "WELD"  "WELL"
-        "WELT"  "WENT"  "WERE"  "WERT"  "WEST"  "WHAM"  "WHAT"  "WHEE"
-        "WHEN"  "WHET"  "WHOA"  "WHOM"  "WICK"  "WIFE"  "WILD"  "WILL"
-        "WIND"  "WINE"  "WING"  "WINK"  "WINO"  "WIRE"  "WISE"  "WISH"
-        "WITH"  "WOLF"  "WONT"  "WOOD"  "WOOL"  "WORD"  "WORE"  "WORK"
-        "WORM"  "WORN"  "WOVE"  "WRIT"  "WYNN"  "YALE"  "YANG"  "YANK"
-        "YARD"  "YARN"  "YAWL"  "YAWN"  "YEAH"  "YEAR"  "YELL"  "YOGA"
-        "YOKE"   
-    }
-}
-
-# Encode 64 bits as words selected from the RFC 2289 dictionary.
-# See the RFC for details. Briefly the input is broken into 11 bit
-# chunks + 2bits of checksum and each chunk selects a word from the 
-# 2048 word table.
-#
-proc ::otp::otp_encode {data} {
-    variable Words
-    if {[string length $data] != 8} {
-        set bc [expr {[string length $data] * 8}]
-        return -code error "invalid input: 64 bits of data\
-            required and $bc  bits provided"
-    }
-    binary scan $data II A B
-
-    set cksum 0
-    foreach w [list $A $B] {
-        for {set n 0} {$n < 32} {incr n 2} {
-            incr cksum [expr {($w >> $n) & 3}]
-        }
-    }
-
-    set W0 [expr { (($A & 0xFFE00000) >> 21) & 0x07ff}]
-    set W1 [expr { (($A & 0x001FFC00) >> 10)}]
-    set W2 [expr { (($A & 0x000003FF) << 1)  | (($B >> 31) & 0x1)}]
-    set W3 [expr {  ($B & 0x7FF00000) >> 20}]
-    set W4 [expr {  ($B & 0x000FFE00) >> 9}]
-    set W5 [expr { (($B & 0x000001FF) << 2) | ($cksum & 3)}]
-    
-    foreach w [list $W0 $W1 $W2 $W3 $W4 $W5] {
-        lappend words [lindex $Words $w]
-    }
-
-    return $words
-}
-
-# Fold a 128 bit digest in little-endian format into a 64 bit
-# little-endian output
-proc ::otp::Fold64LE {digest} {
-    binary scan $digest iiii A B C D
-    set w0 [expr {($A ^ $C) & 0xffffffff}]
-    set w1 [expr {($B ^ $D) & 0xffffffff}]
-    binary format ii $w0 $w1
-}
-
-# Fold a160 bit big-endian digest (SHA-1) into a 64 bit 
-# little-endian output
-proc ::otp::Fold160BE {digest} {
-    binary scan $digest IIIII A B C D E
-    set w0 [expr {(($A ^ $C) ^ $E) & 0xffffffff}]
-    set w1 [expr { ($B ^ $D)       & 0xffffffff}]
-    binary format ii $w0 $w1
-}
-
-# Fold a 160 bit little-endian digest into a 64 bit 
-# little-endian output.
-proc ::otp::Fold160LE {digest} {
-    binary scan $digest iiiii A B C D E
-    set w0 [expr {(($A ^ $C) ^ $E) & 0xffffffff}]
-    set w1 [expr { ($B ^ $D)       & 0xffffffff}]
-    binary format ii $w0 $w1
-}
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::otp::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-proc ::otp::otp {args} {
-    array set opts {-hash md5 -seed {} -count 0 -hex 0 -words 0}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -hex   { set opts(-hex) 1}
-            -word - 
-            -words { set opts(-words) 1 }
-            -hash  { set opts(-hash) [Pop args 1] }
-            -seed  { set opts(-seed) [Pop args 1] }
-            -count { set opts(-count) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option \"$option\":\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-    
-    set data [lindex $args 0]
-
-    if {[string length $opts(-seed)] < 1 || [string length $opts(-seed)] > 16} {
-        return -code error "seed must be between 1 and 16 characters in length"
-    }
-    switch -exact -- $opts(-hash) {
-        md4  { set func ::md4::md4  ; set fold ::otp::Fold64LE }
-        md5  { set func ::md5::md5  ; set fold ::otp::Fold64LE }
-        sha1 { set func ::otp::sha1 ; set fold ::otp::Fold160BE }
-        rmd160 { set func ::ripemd::ripemd160 ; set fold ::otp::Fold160LE }
-        default {
-            return -code error "invalid hash type \"$opts(-hash)\":\
-                must be one of md4, md5, rmd160 or sha1"
-        }
-    }
-    # RFC 2289: Initial step
-    set S [$fold [$func [string tolower $opts(-seed)]$data]]
-    
-    # RFC2289:6 Computation step
-    for {set n 0} {$n < $opts(-count)} {incr n} {
-        set S [$fold [$func $S]]
-    }
-
-    if {$opts(-hex)} {
-        binary scan $S H* S 
-    } elseif {$opts(-words)} {
-        set S [otp_encode $S] 
-    }
-    return $S
-}
-
-proc ::otp::otp-md4 {args} {
-    package require md4
-    return [eval [linsert $args 0 [namespace current]::otp -hash md4]]
-}
-
-proc ::otp::otp-md5 {args} {
-    package require md5
-    return [eval [linsert $args 0 [namespace current]::otp -hash md5]]
-}
-
-proc ::otp::otp-sha1 {args} {
-    package require sha1
-    interp alias {} ::otp::sha1 {} ::sha1::sha1 -bin
-    return [eval [linsert $args 0 [namespace current]::otp -hash sha1]]
-}
-
-proc ::otp::otp-rmd160 {args} {
-    package require ripemd160
-    return [eval [linsert $args 0 [namespace current]::otp -hash rmd160]]
-}
-
-# -------------------------------------------------------------------------
-
-package provide otp $::otp::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/otp/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/otp/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-# pkgIndex.tcl -*- tcl -*-
-if {![package vsatisfies [package provide Tcl] 8.2]} { return }
-package ifneeded otp 1.0.0 [list source [file join $dir otp.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_emodes.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_emodes.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,458 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-
-# Perform mode analysis (x) on the PE grammar delivered by the
-# frontend. The grammar is in normalized form (*).
-#
-# (x) = See "doc_emodes.txt".
-#       and "doc_emodes_alg.txt".
-# (*) = See "doc_normalize.txt".
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin     ; # S.a. pseudo-package.
-package require page::util::flow ; # Dataflow walking.
-package require page::util::peg  ; # General utilities.
-package require treeql
-
-namespace eval ::page::analysis::peg::emodes {
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::analysis::peg::emodes::compute {t} {
-
-    # Ignore call if already done before
-    if {[$t keyexists root page::analysis::peg::emodes]} {return 1}
-
-    # We do not actually compute per node a mode, but rather their
-    # gen'erate and acc'eptance properties, as described in
-    # "doc_emodes.txt".
-
-    # Note: This implementation will not compute acc/gen information
-    # for unreachable nodes.
-
-    # --- --- --- --------- --------- ---------
-
-    array set acc  {} ; # Per node X, acc(X), undefined if no element
-    array set call {} ; # Per definition node, number of users
-    array set cala {} ; # Per definition node, number of (non-)accepting users
-
-    foreach {sym def} [$t get root definitions] {
-	set call($def)   [llength [$t get $def users]]
-	set cala(0,$def) 0
-	set cala(1,$def) 0
-    }
-
-    set acc(root) 1 ; # Sentinel for root of start expression.
-
-    # --- --- --- --------- --------- ---------
-
-    #puts stderr ~~~~\t~~~\t~~~\t~~~\t~~~
-    #puts stderr Node\tAcc\tNew\tWhat\tOp
-    #puts stderr ~~~~\t~~~\t~~~\t~~~\t~~~
-
-    # A node is visited if its value for acc() is either undefined or
-    # may have changed. Basic flow is top down, from the start
-    # expression and a definition a child of its invokers.
-
-    set gstart [$t get root start]
-    if {$gstart eq ""} {
-	page_error "  No start expression, unable to compute accept/generate properties"
-	return 0
-    }
-
-    page::util::flow [list $gstart] flow n {
-	# Determine first or new value.
-
-	#puts -nonewline stderr [string replace $n 1 3]
-
-	if {![info exists acc($n)]} {
-	    set a [Accepting $t $n acc call cala]
-	    set acc($n) $a
-	    set change 0
-
-	    #puts -nonewline stderr \t-\t$a\t^
-	} else {
-	    set a   [Accepting $t $n acc call cala]
-	    set old $acc($n)
-	    if {$a == $old} {
-		#puts stderr \t$old\t$a\t\ =
-		continue
-	    }
-	    set change 1
-	    set acc($n) $a
-
-	    #puts -nonewline stderr \t$old\t$a\t\ \ *
-	}
-
-	# Update counters in definitions, if the node invokes them.
-	# Also, schedule the children for their (re)definition.
-
-	if {[$t keyexists $n symbol]} {
-	    #puts -nonewline stderr \t\ DEF\t[$t get $n symbol]\t[$t get $n mode]
-	} else {
-	    #puts -nonewline stderr \t[$t get $n op]\t\t
-	}
-
-	if {[$t keyexists $n op] && ([$t get $n op] eq "n")} {
-	    #puts -nonewline stderr ->\ [$t get $n sym]
-	    set def [$t get $n def]
-	    if {$def eq ""} continue
-
-	    if {$change} {
-		incr cala($old,$def) -1
-	    }
-	    incr cala($a,$def)
-	    $flow visit $def
-
-	    #puts -nonewline stderr @$def\t(0a$cala(0,$def),\ 1a$cala(1,$def),\ #$call($def))\tv($def)
-	    #puts stderr ""
-	    continue
-	}
-
-	#puts stderr \t\t\t\tv([$t children $n])
-	$flow visitl [$t children $n]
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    array set gen {} ; # Per node X, gen(X), undefined if no element
-    array set nc  {} ; # Per node, number of children
-    array set ng  {} ; # Per node, number of (non-)generating children
-
-    foreach n [$t nodes] {
-	set nc($n)       [$t numchildren $n]
-	set ng(0,$n)     0
-	set ng(1,$n)     0
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    #puts stderr ~~~~\t~~~\t~~~\t~~~\t~~~
-    #puts stderr Node\tGen\tNew\tWhat\tOp
-    #puts stderr ~~~~\t~~~\t~~~\t~~~\t~~~
-
-    # A node is visited if its value for gen() is either undefined or
-    # may have changed. Basic flow is bottom up, from the all
-    # leaves (and lookahead operators). Users of a definition are
-    # considered as its parents.
-
-    set start [$t leaves]
-    set q [treeql q -tree $t]
-    q query tree withatt op ! over n {lappend start $n}
-    q query tree withatt op & over n {lappend start $n}
-    q destroy
-
-    page::util::flow $start flow n {
-	# Ignore root.
-
-	if {$n eq "root"} continue
-
-	#puts -nonewline stderr [string replace $n 1 3]
-
-	# Determine first or new value.
-
-	if {![info exists gen($n)]} {
-	    set g [Generating $t $n gen nc ng acc call cala]
-	    set gen($n) $g
-
-	    #puts -nonewline stderr \t-\t$g\t^
-
-	} else {
-	    set g   [Generating $t $n gen nc ng acc call cala]
-	    set old $gen($n)
-	    if {$g eq $old} {
-		#puts stderr \t$old\t$g\t\ =
-		continue
-	    }
-	    set gen($n) $g
-
-	    #puts -nonewline stderr \t$old\t$g\t\ \ *
-	}
-
-	if {($g ne "maybe") && !$g && $acc($n)} {
-	    # No generate here implies that none of our children will
-	    # generate anything either. So the current acceptance of
-	    # these non-existing values can be safely forced to
-	    # non-acceptance.
-
-	    set acc($n) 0
-	    #puts -nonewline stderr "-a"
-	}
-
-	if {0} {
-	    if {[$t keyexists $n symbol]} {
-		#puts -nonewline stderr \t\ DEF\t[$t get $n symbol]\t[$t get $n mode]
-	    } else {
-		#puts -nonewline stderr \t[$t get $n op]\t\t
-	    }
-	}
-
-	#puts -nonewline stderr \t(0g$ng(0,$n),1g$ng(1,$n),\ #$nc($n))
-
-	# Update counters in the (virtual) parents, and schedule them
-	# for a visit.
-
-	if {[$t keyexists $n symbol]} {
-	    # Users are virtual parents.
-
-	    set users  [$t get $n users]
-	    $flow visitl $users
-
-	    if {$g ne "maybe"} {
-		foreach u $users {incr ng($g,$u)}
-	    }
-	    #puts stderr \tv($users)
-	    continue
-	}
-
-	set p [$t parent $n]
-	$flow visit $p
-	if {$g ne "maybe"} {
-	    incr ng($g,$p)
-	}
-
-	#puts stderr \tv($p)
-    }
-
-    # --- --- --- --------- --------- ---------
-
-    # Copy the calculated data over into the tree.
-    # Note: There will be no data for unreachable nodes.
-
-    foreach n [$t nodes] {
-	if {$n eq "root"}           continue
-	if {![info exists acc($n)]} continue
-	$t set $n acc $acc($n)
-	$t set $n gen $gen($n)
-    }
-
-    # Recompute the modes based on the current
-    # acc/gen status of the definitions.
-
-    #puts stderr ~~~~\t~~~\t~~~~\t~~~\t~~~\t~~~
-    #puts stderr Node\tSym\tMode\tNew\tGen\tAcc
-    #puts stderr ~~~~\t~~~\t~~~~\t~~~\t~~~\t~~~
-
-    foreach {sym def} [$t get root definitions] {
-	set m {}
-
-	set old [$t get $def mode]
-
-	if {[info exists acc($def)]} {
-	    switch -exact -- $gen($def)/$acc($def) {
-		0/0     {set m discard}
-		0/1     {error "Bad gen/acc for $sym"}
-		1/0     {# don't touch (match, leaf)}
-		1/1     {set m value}
-		maybe/0 {error "Bad gen/acc for $sym"}
-		maybe/1 {set m value}
-	    }
-	    if {$m ne ""} {
-		# Should check correctness of change, if any (We can drop
-		# to discard, nothing else).
-		$t set $def mode $m
-	    }
-	    #puts stderr [string replace $def 1 3]\t$sym\t$old\t[$t get $def mode]\t[$t get $def gen]\t[$t get $def acc]
-	} else {
-	    #puts stderr [string replace $def 1 3]\t$sym\t$old\t\t\t\tNOT_REACHED
-	}
-    }
-
-    #puts stderr ~~~~\t~~~\t~~~~\t~~~\t~~~\t~~~
-
-    # Wrap up the whole state and save it in the tree. No need to
-    # throw this away, useful for other mode based transforms and
-    # easier to get in this way than walking the tree again.
-
-    $t set root page::analysis::peg::emodes [list \
-	    [array get acc] \
-	    [array get call] \
-	    [array get cala] \
-	    [array get gen] \
-	    [array get nc] \
-	    [array get ng]]
-    return 1
-}
-
-proc ::page::analysis::peg::emodes::reset {t} {
-    # Remove marker, allow recalculation of emodesness after changes.
-
-    $t unset root page::analysis::peg::emodes
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal
-
-proc ::page::analysis::peg::emodes::Accepting {t n av cv cav} {
-    upvar 1 $av acc $cv call $cav cala
-
-    # Definitions accept based on how they are called first, and on
-    # their mode if that is not possible.
-
-    if {[$t keyexists $n symbol]} {
-	# Call based acceptance.
-	# !acc if all callers do not accept.
-
-	if {$cala(0,$n) >= $call($n)} {
-	    return 0
-	}
-
-	# Falling back to mode specific accptance
-	return [expr {([$t get $n mode] eq "value") ? 1 : 0}]
-    }
-
-    set op [$t get $n op]
-
-    # Lookahead operators will never accept.
-
-    if {($op eq "!") || ($op eq "&")} {
-	return 0
-    }
-
-    # All other operators inherit the acceptance
-    # of their parent.
-
-    return $acc([$t parent $n])
-}
-
-proc ::page::analysis::peg::emodes::Generating {t n gv ncv ngv av cv cav} {
-    upvar 1 $gv gen $ncv nc $ngv ng $av acc $cv call $cav cala
-    #           ~~~      ~~      ~~     ~~~     ~~~~      ~~~~
-
-    # Definitions generate based on their mode, their defining
-    # expression, and the acceptance of their callers.
-
-    if {[$t keyexists $n symbol]} {
-
-	# If no caller accepts a value, then this definition will not
-	# generate one, even if its own mode asked it to do so.
-
-	if {$cala(0,$n) >= $call($n)} {
-	    return 0
-	}
-
-	# The definition has callers accepting values and callres not
-	# doing so. It will generate as per its own mode and defining
-	# expression.
-
-	# The special modes know if they generate a value or not.
-	# The pass through mode looks at the expression for the
-	# information.
-
-	switch -exact -- [$t get $n mode] {
-	    value   {return $gen([lindex [$t children $n] 0])}
-	    match   {return 1}
-	    leaf    {return 1}
-	    discard {return 0}
-	}
-	error PANIC
-    }
-
-    set op [$t get $n op]
-
-    # Inner nodes generate based on operator and children.
-
-    if {$nc($n)} {
-	switch -exact -- $op {
-	    ! - & {return 0}
-	    ? - * {
-		# No for all children --> no
-		# Otherwise           --> maybe
-
-		if {$ng(0,$n) >= $nc($n)} {
-		    return 0
-		} else {
-		    return maybe
-		}
-	    }
-	    + - / - | {
-		# Yes for all children --> yes
-		# No for all children  --> no
-		# Otherwise            --> maybe
-
-		if {$ng(1,$n) >= $nc($n)} {
-		    return 1
-		} elseif {$ng(0,$n) >= $nc($n)} {
-		    return 0
-		} else {
-		    return maybe
-		}
-	    }
-	    x {
-		# Yes for some children --> yes
-		# No for all children   --> no
-		# Otherwise             --> maybe
-
-		if {$ng(1,$n) > 0} {
-		    return 1
-		} elseif {$ng(0,$n) >= $nc($n)} {
-		    return 0
-		} else {
-		    return maybe
-		}
-	    }
-	}
-	error PANIC
-    }
-
-    # Nonterminal leaves generate based on acceptance from their
-    # parent and the referenced definition.
-
-    # As acc(X) == acc(parent(X)) the test doesn't have to go to the
-    # parent itself.
-
-    if {$op eq "n"} {
-	if {[info exists acc($n)] && !$acc($n)} {return 0}
-
-	set def [$t get $n def]
-
-	# Undefine symbols do not generate anything.
-	if {$def eq ""} {return 0}
-
-	# Inherit directly from the definition, if existing.
-	if {![info exists gen($def)]} {
-	    return maybe
-	}
-
-	return $gen($def)
-    }
-
-    # Terminal leaves generate values if and only if such values are
-    # accepted by their parent. As acc(X) == acc(parent(X) the test
-    # doesn't have to go to the parent itself.
-
-
-    return $acc($n)
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::analysis::peg::emodes 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_minimize.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_minimize.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# -*- tcl -*-
-# Transform - Minimize the grammar, through the removal of the
-# unreachable and not useful nonterminals (and expressions).
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-package require page::analysis::peg::reachable
-package require page::analysis::peg::realizable
-
-namespace eval ::page::analysis::peg {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::analysis::peg::minimize {t} {
-    page_info {[PEG Minimization]}
-    page_log_info ..Reachability  ; ::page::analysis::peg::reachable::remove!
-    page_log_info ..Realizability ; ::page::analysis::peg::realizable::remove!
-
-    page_log_info Ok
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::analysis::peg::minimize 0.1
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_reachable.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_reachable.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,150 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-
-# Perform reachability analysis on the PE grammar delivered by the
-# frontend. The grammar is in normalized form (reduced to essentials,
-# graph like node-x-references, expression trees).
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin     ; # S.a. pseudo-package.
-package require page::util::flow ; # Dataflow walking.
-package require page::util::peg  ; # General utilities.
-
-namespace eval ::page::analysis::peg::reachable {
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::analysis::peg::reachable::compute {t} {
-
-    # Ignore call if already done before
-    if {[$t keyexists root page::analysis::peg::reachable]} return
-
-    # We compute the set of all nodes which are reachable from the
-    # root node of the start expression. This is a simple topdown walk
-    # where the children of all reachable nodes are mode reachable as
-    # well, and invokations of nonterminals symbols are treated as
-    # children as well. At the end of the flow all reachable non-
-    # terminal symbols and their expressions are marked, and none
-    # other.
-
-    # Initialize walking state: 2 arrays, all nodes (except root) are
-    # in or the other array, and their location tells if they are
-    # reachable or not. In the beginning no node is reachable. The
-    # goal array (reach) also serves as minder of which nodes have
-    # been seen, to cut multiple visits short.
-
-    array set unreach {} ; foreach n [$t nodes] {set unreach($n) .}
-    unset     unreach(root)
-    array set reach   {}
-
-    # A node is visited if it has been determined that it is indeed
-    # reachable.
-
-    page::util::flow [list [$t get root start]] flow n {
-	# Ignore nodes already reached.
-	if {[info exists reach($n)]} continue
-
-	# Reclassify node, has been reached now.
-	unset unreach($n)
-	set   reach($n) .
-
-	# Schedule children for visit --> topdown flow.
-	$flow visitl [$t children $n]
-
-	# Treat n-Nodes as special, their definition as indirect
-	# child. But ignore invokations of undefined nonterminal
-	# symbols, or those already marked as reachable.
-
-	if {![$t keyexists $n op]} continue
-	if {[$t get $n op] ne "n"} continue
-
-	set def [$t get $n def]
-	if {$def eq ""}                continue
-	if {[info exists reach($def)]} continue
-	$flow visit $def
-    }
-
-    # Store results. This also serves as marker.
-
-    $t set root page::analysis::peg::reachable   [array names reach]
-    $t set root page::analysis::peg::unreachable [array names unreach]
-    return
-}
-
-proc ::page::analysis::peg::reachable::remove! {t} {
-
-    # Determine which nonterminal symbols are reachable from the root
-    # of the start expression.
-
-    compute $t
-
-    # Remove all nodes which are not reachable.
-
-    set unreach [$t get root page::analysis::peg::unreachable]
-    foreach n [lsort $unreach] {
-	if {[$t exists $n]} {
-	    $t delete $n
-	}
-    }
-
-    # Notify the user of the definitions which were among the removed
-    # nodes. Keep only the still-existing definitions.
-
-    set res {}
-    foreach {sym def} [$t get root definitions] {
-	if {![$t exists $def]} {
-	    page_warning "  $sym: Unreachable nonterminal symbol, deleting"
-	} else {
-	    lappend res $sym $def
-	}
-    }
-
-    # Clear computation results.
-
-    $t unset root page::analysis::peg::reachable
-    $t unset root page::analysis::peg::unreachable
-
-    $t set root definitions $res
-    updateUndefinedDueRemoval $t
-    return
-}
-
-proc ::page::analysis::peg::reachable::reset {t} {
-    # Remove marker, allow recalculation of reachability after
-    # changes.
-
-    $t unset root page::analysis::peg::reachable
-    $t unset root page::analysis::peg::unreachable
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::analysis::peg::reachable 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_realizable.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/analysis_peg_realizable.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,257 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-
-# Perform realizability analysis (x) on the PE grammar delivered by
-# the frontend. The grammar is in normalized form (reduced to
-# essentials, graph like node-x-references, expression trees).
-#
-# (x) = See "doc_realizable.txt".
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin     ; # S.a. pseudo-package.
-package require page::util::flow ; # Dataflow walking.
-package require page::util::peg  ; # General utilities.
-package require treeql
-
-namespace eval ::page::analysis::peg::realizable {
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::analysis::peg::realizable::compute {t} {
-
-    # Ignore call if already done before
-
-    if {[$t keyexists root page::analysis::peg::realizable]} return
-
-    # We compute the set of realizable nonterminal symbols by doing the
-    # computation for all partial PE's in the grammar. We start at the
-    # leaves and then iteratively propagate the property as far as
-    # possible using the rules defining it, see the specification.
-
-    # --- --- --- --------- --------- ---------
-
-    # Initialize all nodes and the local arrays. Everything is not
-    # realizable, except for the terminal leafs of the tree. Their parents
-    # are scheduled to be visited as well.
-
-    array set realizable   {} ; # Place where realizable nodes are held
-    array set unrealizable {} ; # Place where unrealizable nodes are held
-    array set nc           {} ; # Per node, number of children.
-    array set uc           {} ; # Per node, number of realizable children.
-
-    set nodeset [$t leaves]
-
-    set q [treeql q -tree $t]
-    $q query tree withatt op * over n {lappend nodeset $n}
-    $q query tree withatt op ? over n {lappend nodeset $n}
-    q destroy
-
-    foreach n [$t nodes] {
-	set unrealizable($n) .
-	set nc($n)       [$t numchildren $n]
-	set uc($n)       0
-    }
-
-    # A node is visited if it _may_ have changed its status (to
-    # realizability).
-
-    page::util::flow $nodeset flow n {
-	# Realizable nodes cannot change, ignore them.
-
-	if {[info exists realizable($n)]} continue
-
-	# Determine new state of realizability, ignore a node if it is
-	# unchanged.
-
-	if {![Realizable $t $n nc uc realizable]} continue
-
-	# Reclassify changed node, it is now realizable.
-	unset unrealizable($n)
-	set   realizable($n) .
-
-	# Schedule visits to nodes which may have been affected by
-	# this change. Update the relevant counters as well.
-
-	# @ root       - none
-	# @ definition - users of the definition
-	# otherwise    - parent of operator.
-
-	if {$n eq "root"} continue
-
-	if {[$t keyexists $n symbol]} {
-	    set users [$t get $n users]
-	    $flow visitl $users
-	    foreach u $users {
-		incr uc($u)
-	    }
-	    continue
-	}
-
-	set p [$t parent $n]
-	incr uc($p)
-	$flow visit $p
-    }
-
-    # Set marker preventing future calls.
-    $t set root page::analysis::peg::realizable   [array names realizable]
-    $t set root page::analysis::peg::unrealizable [array names unrealizable]
-    return
-}
-
-proc ::page::analysis::peg::realizable::remove! {t} {
-    # Determine which parts of the grammar are realizable
-
-    compute $t
-
-    # Remove anything which is not realizable (and all their children),
-    # except for the root itself, should it be unrealizablel.
-
-    set unreal [$t get root page::analysis::peg::unrealizable]
-    foreach n [lsort $unreal] {
-	if {$n eq "root"} continue
-	if {[$t exists $n]} {
-	    $t delete $n
-	}
-    }
-
-    # Notify the user of the definitions which were among the removed
-    # nodes. Keep only the still-existing definitions.
-
-    set res {}
-    foreach {sym def} [$t get root definitions] {
-	if {![$t exists $def]} {
-	    page_warning "  $sym: Nonterminal symbol is not realizable, removed."
-	} else {
-	    lappend res $sym $def
-	}
-    }
-    $t set root definitions $res
-
-    if {![$t exists [$t get root start]]} {
-	page_warning "  <Start expression>: Is not realizable, removed."
-	$t set root start {}
-    }
-
-    # Find and cut operator chains, very restricted. Cut only chains
-    # of x- and /-operators. The other operators have only one child
-    # by definition and are thus not chains.
-
-    set q [treeql q -tree $t]
-    # q query tree over n
-    foreach n [$t children -all root] {
-	if {[$t keyexists $n symbol]}        continue
-	if {[llength [$t children $n]] != 1} continue
-	set op [$t get $n op]
-	if {($op ne "/") && ($op ne "x")} continue
-	$t cut $n
-    }
-
-    flatten $q $t
-    q destroy
-
-    # Clear computation results.
-
-    $t unset root page::analysis::peg::realizable
-    $t unset root page::analysis::peg::unrealizable
-
-    updateUndefinedDueRemoval $t
-    return
-}
-
-proc ::page::analysis::peg::realizable::reset {t} {
-    # Remove marker, allow recalculation of realizability after changes.
-
-    $t unset root page::analysis::peg::realizable
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal
-
-proc ::page::analysis::peg::realizable::First {v} {
-    upvar 1 $v visit
-
-    set id    [array startsearch visit]
-    set first [array nextelement visit $id]
-    array donesearch visit $id
-
-    unset visit($first)
-    return $first
-}
-
-proc ::page::analysis::peg::realizable::Realizable {t node ncv ucv uv} {
-    upvar 1 $ncv nc $ucv uc $uv realizable
-
-    if {$node eq "root"} {
-	# Root inherits realizability of the start expression.
-
-	return [info exists realizable([$t get root start])]
-    }
-
-    if {[$t keyexists $node symbol]} {
-	# Symbol definitions inherit the realizability of their
-	# expression.
-
-	return [expr {$uc($node) >= $nc($node)}]
-    }
-
-    switch -exact -- [$t get $node op] {
-	t - .. - epsilon - alpha - alnum - dot - * - ? {
-	    # The terminal symbols are all realizable.
-	    return 1
-	}
-	n {
-	    # Symbol invokation inherits realizability of its definition.
-	    # Calls to undefined symbols are not realizable.
-
-	    set def [$t get $node def]
-	    if {$def eq ""} {return 0}
-	    return [info exists realizable($def)]
-	}
-	/ - | {
-	    # Choice, ordered and unordered. Realizable if we have at
-	    # least one realizable branch. A quick test based on the count
-	    # of realizable children is used.
-
-	    return [expr {$uc($node) > 0}]
-	}
-	default {
-	    # Sequence, and all other operators, are realizable if and
-	    # only if all its children are realizable. A quick test based
-	    # on the count of realizable children is used.
-
-	    return [expr {$uc($node) >= $nc($node)}]
-	}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::analysis::peg::realizable 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/compiler_peg_mecpu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/compiler_peg_mecpu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1642 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Transformation - Compile grammar to ME cpu instructions.
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Dumping the input grammar. But not as Tcl or other code. In PEG
-## format again, pretty printing.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-
-package require grammar::me::cpu::gasm
-package require textutil
-package require struct::graph
-
-package require page::analysis::peg::emodes
-package require page::util::quote
-package require page::util::peg
-
-namespace eval ::page::compiler::peg::mecpu {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl)
-
-    namespace import ::page::util::quote::*
-    namespace import ::page::util::peg::*
-
-
-    namespace eval gas {
-	namespace import ::grammar::me::cpu::gas::begin
-	namespace import ::grammar::me::cpu::gas::done
-	namespace import ::grammar::me::cpu::gas::lift
-	namespace import ::grammar::me::cpu::gas::state
-	namespace import ::grammar::me::cpu::gas::state!
-    }
-    namespace import ::grammar::me::cpu::gas::*
-    rename begin  {}
-    rename done   {}
-    rename lift   {}
-    rename state  {}
-    rename state! {}
-}
-
-# ### ### ### ######### ######### #########
-## Data structures for the generated code.
-
-## All data is held in node attributes of the tree. Per node:
-##
-## asm - List of instructions implementing the node.
-
-
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::compiler::peg::mecpu {t} {
-    # Resolve the mode hints. Every gen(X) having a value of 'maybe'
-    # (or missing) is for the purposes of this code a 'yes'.
-
-    if {![page::analysis::peg::emodes::compute $t]} {
-	page_error "  Unable to generate a ME parser without accept/generate properties"
-	return
-    }
-
-    foreach n [$t nodes] {
-	if {![$t keyexists $n gen] || ([$t get $n gen] eq "maybe")} {
-	    $t set $n gen 1
-	}
-	if {![$t keyexists $n acc]} {$t set $n acc 1}
-    }
-
-    # Synthesize a program, then the assembly code.
-
-    mecpu::Synth $t
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::compiler::peg::mecpu::Synth {t} {
-    # Phase 2: Bottom-up, synthesized attributes
-
-    # We use a global graph to capture instructions and their
-    # relations. The graph is then converted into a linear list of
-    # instructions, with proper labeling and jump instructions to
-    # handle all non-linear control-flow.
-
-    set g [struct::graph g]
-    $t set root gas::called {}
-
-    page_info "* Synthesize graph code"
-
-    $t walk root -order post -type dfs n {
-	SynthNode $n
-    }
-
-    status             $g  ;  gdump $g synth
-    remove_unconnected $g  ;  gdump $g nounconnected
-    remove_dead        $g  ;  gdump $g nodead
-    denop              $g  ;  gdump $g nonops
-    parcmerge          $g  ;  gdump $g parcmerge
-    forwmerge          $g  ;  gdump $g fmerge
-    backmerge          $g  ;  gdump $g bmerge
-    status             $g  
-    pathlengths        $g  ;  gdump $g pathlen
-    jumps              $g  ;  gdump $g jumps
-    status             $g
-    symbols            $g $t
-
-    set cc [2code $t $g]
-    #write asm/mecode [join $cc \n]
-
-    statistics $cc
-
-    $t set root asm $cc
-    $g destroy
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode {n} {
-    upvar 1 t t g g
-    if {$n eq "root"} {
-	set code Root
-    } elseif {[$t keyexists $n symbol]} {
-	set code Nonterminal
-    } elseif {[$t keyexists $n op]} {
-	set code [$t get $n op]
-    } else {
-	return -code error "PANIC. Bad node $n, cannot classify"
-    }
-
-    page_log_info "  [np $n] := ([linsert [$t children $n] 0 $code])"
-
-    SynthNode/$code $n
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/Root {n} {
-    upvar 1 t t g g
-
-    # Root is the grammar itself.
-
-    set gstart [$t get root start]
-    set gname  [$t get root name]
-
-    if {$gstart eq ""} {
-	page_error "  No start expression."
-	return
-    }
-
-    gas::begin $g $n halt "<Start Expression> '$gname'"
-    $g node set [Who entry] instruction .C
-    $g node set [Who entry] START .
-
-    Inline $t $gstart sexpr
-    /At sexpr/exit/ok   ; /Ok   ; Jmp exit/return
-    /At sexpr/exit/fail ; /Fail ; Jmp exit/return
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/Nonterminal {n} {
-    upvar 1 t t g g
-
-    # This is the root of a definition.
-    #
-    # The text is a procedure wrapping the match code of its
-    # expression into the required the nonterminal handling (caching
-    # and such), plus the support code for the expression matcher.
-
-    set sym      [$t get $n symbol]
-    set label    [$t get $n label]
-    set gen      [$t get $n gen]
-    set mode     [$t get $n mode]
-
-    set pe       [lindex [$t children $n] 0]
-    set egen     [$t get $pe gen]
-
-    # -> inc_restore -found-> NOP  gen:  -> ok -> ias_push -> RETURN
-    #               /!found             \                  /
-    #              /                     \-fail --------->/
-    #             /               !gen: -> RETURN
-    #            /
-    #            \-> icl_push (-> ias_mark) -> (*) -> SV -> inc_save (-> ias_mrewind) -X
-    #
-    # X -ok----> ias_push -> ier_nonterminal
-    #  \                  /
-    #   \-fail ----------/
-
-    # Poking into the generated instructions, converting the initial
-    # .NOP into a .C'omment.
-
-    set first [gas::begin $g $n !okfail "Nonterminal '$sym'"]
-    $g node set [Who entry] instruction .C
-    $g node set [Who entry] START .
-
-    Cmd inc_restore $label ; /Label restore ; /Ok
-
-    if {$gen} {
-	Bra ; /Label @
-	/Fail ; Nop          ; Exit
-	/At @
-	/Ok   ; Cmd ias_push ; Exit
-    } else {
-	Nop ; Exit
-    }
-
-    /At restore ; /Fail
-    Cmd icl_push ; # Balanced by inc_save (XX)
-    Cmd icl_push ; # Balanced by pop after ier_terminal
-
-    if {$egen} {
-	# [*] Needed for removal of SV's from stack after handling by
-	# this symbol, only if expression actually generates an SV.
-
-	Cmd ias_mark
-    }
-
-    Inline $t $pe subexpr ; /Ok   ; Nop ; /Label unified
-    /At subexpr/exit/fail ; /Fail ; Jmp unified
-    /At unified
-
-    switch -exact -- $mode {
-	value   {Cmd isv_nonterminal_reduce $label}
-	match   {Cmd isv_nonterminal_range  $label}
-	leaf    {Cmd isv_nonterminal_leaf   $label}
-	discard {Cmd isv_clear}
-	default {return -code error "Bad nonterminal mode \"$mode\""}
-    }
-
-    Cmd inc_save $label ; # Implied icl_pop (XX)
-
-    if {$egen} {
-	# See [*], this is the removal spoken about before.
-	Cmd ias_mrewind
-    }
-
-    /Label hold
-
-    if {$gen} {
-	/Ok
-	Cmd ias_push
-	Nop           ; /Label merge
-	/At hold ; /Fail ; Jmp merge
-	/At merge
-    }
-
-    Cmd ier_nonterminal "Expected $label"
-    Cmd icl_pop
-    Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/? {n} {
-    upvar 1 t t g g
-
-    # The expression e? is equivalent to e/epsilon.
-    # And like this it is compiled.
-
-    set pe       [lindex [$t children $n] 0]
-
-    gas::begin $g $n okfail ?
-
-    # -> icl_push -> ier_push -> (*) -ok--> ier_merge/ok --> icl_pop -ok----------------> OK
-    #                             \                                                    /
-    #                              \-fail-> ier_merge/f ---> icl_rewind -> iok_ok -ok-/
-
-    Cmd icl_push
-    Cmd ier_push
-
-    Inline $t $pe subexpr
-
-    /Ok
-    Cmd ier_merge
-    Cmd icl_pop
-    /Ok ; Exit
-
-    /At subexpr/exit/fail ; /Fail
-    Cmd ier_merge
-    Cmd icl_rewind
-    Cmd iok_ok
-    /Ok ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/* {n} {
-    upvar 1 t t g g
-
-    # Kleene star is like a repeated ?
-
-    # Note: Compilation as while loop, as done now
-    # means that the parser has no information about
-    # the intermediate structure of the input in his
-    # cache.
-
-    # Future: Create a helper symbol X and compile
-    # the expression e = e'* as:
-    #     e = X; X <- (e' X)?
-    # with match data for X put into the cache. This
-    # is not exactly equivalent, the structure of the
-    # AST is different (right-nested tree instead of
-    # a list). This however can be handled with a
-    # special nonterminal mode to expand the current
-    # SV on the stack.
-
-    # Note 2: This is a transformation which can be
-    # done on the grammar itself, before the actual
-    # backend is let loose. This "strength reduction"
-    # allows us to keep this code here.
-
-    set pe       [lindex [$t children $n] 0]
-    set egen     [$t get $pe gen]
-
-    # Build instruction graph.
-
-    #  /<---------------------------------------------------------------\
-    #  \_                                                                \_
-    # ---> icl_push -> ier_push -> (*) -ok--> ier_merge/ok --> icl_pop ->/
-    #                               \
-    #                                \-fail-> ier_merge/f ---> icl_rewind -> iok_ok -> OK
-
-    gas::begin $g $n okfail *
-
-    Cmd icl_push ; /Label header
-    Cmd ier_push
-
-    Inline $t $pe loop
-
-    /Ok
-    Cmd ier_merge
-    Cmd icl_pop
-    Jmp header ; /CloseLoop
-
-    /At loop/exit/fail ; /Fail
-    Cmd ier_merge
-    Cmd icl_rewind
-    Cmd iok_ok
-    /Ok ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/+ {n} {
-    upvar 1 t t g g
-
-    # Positive Kleene star x+ is equivalent to x x*
-    # This is how it is compiled. See also the notes
-    # at the * above, they apply in essence here as
-    # well, except that the transformat scheme is
-    # slighty different:
-    #
-    # e = e'*  ==> e = X; X <- e' X?
-
-    set pe [lindex [$t children $n] 0]
-
-    # Build instruction graph.
-
-    # icl_push -> ier_push -> (*) -fail-> ier_merge/fl -> icl_rewind -> FAIL
-    #                          \
-    #                           \--ok---> ier_merge/ok -> icl_pop ->\_
-    #                                                               /
-    #    /<--------------------------------------------------------/
-    #   /
-    #  /<---------------------------------------------------------------\
-    #  \_                                                                \_
-    #   -> icl_push -> ier_push -> (*) -ok--> ier_merge/ok --> icl_pop ->/
-    #                               \
-    #                                \-fail-> ier_merge/f ---> icl_rewind -> iok_ok -> OK
-
-    gas::begin $g $n okfail +
-
-    Cmd icl_push
-    Cmd ier_push
-
-    Inline $t $pe first
-    /At first/exit/fail ; /Fail
-    Cmd ier_merge
-    Cmd icl_rewind
-    /Fail ; Exit
-
-    /At first/exit/ok ; /Ok
-    Cmd ier_merge
-    Cmd icl_pop
-
-    # Loop copied from Kleene *, it is *
-
-    Cmd icl_push ; /Label header
-    Cmd ier_push
-
-    # For the loop we create the sub-expression instruction graph a
-    # second time. This is done by walking the subtree a second time
-    # and constructing a completely new node set. The result is
-    # imported under a new name.
-
-    set save [gas::state]
-    $t walk $pe -order post -type dfs n {SynthNode $n}
-    gas::state! $save
-    Inline $t $pe loop
-
-    /Ok
-    Cmd ier_merge
-    Cmd icl_pop
-    Jmp header ; /CloseLoop
-
-    /At loop/exit/fail ; /Fail
-    Cmd ier_merge
-    Cmd icl_rewind
-    Cmd iok_ok
-    /Ok ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode// {n} {
-    upvar 1 t t g g
-
-    set args [$t children $n]
-
-    if {![llength $args]} {
-	error "PANIC. Empty choice."
-
-    } elseif {[llength $args] == 1} {
-	# A choice over one branch is no real choice. The code
-	# generated for the child applies here as well.
-
-	gas::lift $t $n <-- [lindex $args 0]
-	return
-    }
-
-    # Choice over at least two branches.
-    # Build instruction graph.
-
-    # -> BRA
-    #
-    # BRA -> icl_push (-> ias_mark) -> ier_push -> (*) -ok -> ier_merge -> BRA'OK
-    #                                              \-fail -> ier_merge (-> ias_mrewind) -> icl_rewind -> BRA'FAIL
-    #
-    # BRA'FAIL -> BRA
-    # BRA'FAIL -> FAIL (last branch)
-    #
-    # BRA'OK -> icl_pop -> OK
-
-    gas::begin $g $n okfail /
-
-    /Clear
-    Cmd icl_pop ; /Label BRA'OK ; /Ok ; Exit
-    /At entry
-
-    foreach pe $args {
-	set egen [$t get $pe gen]
-
-	# Note: We do not check for static match results. Doing so is
-	# an optimization we can do earlier, directly on the tree.
-
-	Cmd icl_push
-	if {$egen} {Cmd ias_mark}
-
-	Cmd ier_push
-	Inline $t $pe subexpr
-
-	/Ok
-	Cmd ier_merge
-	Jmp BRA'OK
-
-	/At subexpr/exit/fail ; /Fail
-	Cmd ier_merge
-	if {$egen} {Cmd ias_mrewind}
-	Cmd icl_rewind
-
-	# Branch failed. Go to the next branch. Fail completely at
-	# last branch.
-    }
-
-    /Fail ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/x {n} {
-    upvar 1 t t g g
-
-    set args [$t children $n]
-
-    if {![llength $args]} {
-	error "PANIC. Empty sequence."
-
-    } elseif {[llength $args] == 1} {
-	# A sequence of one element is no real sequence. The code
-	# generated for the child applies here as well.
-
-	gas::lift $t $n <-- [lindex $args 0]
-	return
-    }
-
-    # Sequence of at least two elements.
-    # Build instruction graph.
-
-    # -> icl_push -> SEG
-    #
-    # SEG (-> ias_mark) -> ier_push -> (*) -ok -> ier_merge -> SEG'OK
-    #                                  \-fail -> ier_merge -> SEG'FAIL
-    #
-    # SEG'OK -> SEG
-    # SEG'OK -> icl_pop -> OK (last segment)
-    #
-    # SEG'FAIL (-> ias_mrewind) -> icl_rewind -> FAIL
-
-    gas::begin $g $n okfail x
-
-    /Clear
-    Cmd icl_rewind ; /Label SEG'FAIL ; /Fail ; Exit
-
-    /At entry
-    Cmd icl_push
-
-    set gen 0
-    foreach pe $args {
-	set egen [$t get $pe gen]
-	if {$egen && !$gen} {
-	    set gen 1
-
-	    # From here on out is the sequence able to generate
-	    # semantic values which have to be canceled when
-	    # backtracking.
-
-	    Cmd ias_mark ; /Label @mark
-
-	    /Clear
-	    Cmd ias_mrewind ; Jmp SEG'FAIL ; /Label SEG'FAIL
-
-	    /At @mark
-	}
-
-	Cmd ier_push
-	Inline $t $pe subexpr
-
-	/At subexpr/exit/fail ; /Fail
-	Cmd ier_merge
-	Jmp SEG'FAIL
-
-	/At subexpr/exit/ok ; /Ok
-	Cmd ier_merge 
-    }
-
-    Cmd icl_pop
-    /Ok ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/& {n} {
-    upvar 1 t t g g
-    SynthLookahead $n no
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/! {n} {
-    upvar 1 t t g g
-    SynthLookahead $n yes
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/dot {n} {
-    upvar 1 t t g g
-    SynthTerminal $n {} "any character"
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/epsilon {n} {
-    upvar 1 t t g g
-
-    gas::begin $g $n okfail epsilon
-
-    Cmd iok_ok ; /Ok ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/alnum {n} {
-    upvar 1 t t g g
-    SynthClass $n alnum
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/alpha {n} {
-    upvar 1 t t g g
-    SynthClass $n alpha
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/digit {n} {
-    upvar 1 t t g g
-    SynthClass $n digit
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/xdigit {n} {
-    upvar 1 t t g g
-    SynthClass $n xdigit
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/punct {n} {
-    upvar 1 t t g g
-    SynthClass $n punct
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/space {n} {
-    upvar 1 t t g g
-    SynthClass $n space
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/.. {n} {
-    upvar 1 t t g g
-    # Range is [x-y]
-
-    set b [$t get $n begin]
-    set e [$t get $n end]
-
-    set tb [quote'tcl $b]
-    set te [quote'tcl $e]
-
-    set pb [quote'tclstr $b]
-    set pe [quote'tclstr $e]
-
-    SynthTerminal $n [list ict_match_tokrange $tb $te] "\\\[${pb}..${pe}\\\]"
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/t {n} {
-    upvar 1 t t g g
-
-    # Terminal node. Primitive matching.
-    # Code is parameterized by gen(X) of this node X.
-
-    set ch  [$t get $n char]
-    set tch [quote'tcl    $ch]
-    set pch [quote'tclstr $ch]
-
-    SynthTerminal $n [list ict_match_token $tch] $pch
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthNode/n {n} {
-    upvar 1 t t g g
-
-    # Nonterminal node. Primitive matching.
-    # The code is parameterized by acc(X) of this node X, and gen(D)
-    # of the invoked nonterminal D.
-
-    set sym   [$t get $n sym]
-    set def   [$t get $n def]
-
-    gas::begin $g $n okfail call'$sym'
-
-    if {$def eq ""} {
-	# Invokation of an undefined nonterminal. This will always fail.
-
-	Note "Match for undefined symbol '$sym'"
-	Cmdd iok_fail ; /Fail ; Exit
-	gas::done --> $t
-
-    } else {
-	# Combinations
-	# Acc Gen Action
-	# --- --- ------
-	#   0   0 Plain match
-	#   0   1 Match with canceling of the semantic value.
-	#   1   0 Plain match
-	#   1   1 Plain match
-	# --- --- ------
-
-	if {[$t get $n acc] || ![$t get $def gen]} {
-	    Cmd icf_ntcall sym_$sym ; /Label CALL
-	    /Ok   ; Exit
-	    /Fail ; Exit
-
-	} else {
-	    Cmd ias_mark
-	    Cmd icf_ntcall sym_$sym ; /Label CALL
-	    Cmd ias_mrewind
-	    /Ok   ; Exit
-	    /Fail ; Exit
-	}
-
-	set caller [Who CALL]
-	gas::done --> $t
-
-	$t lappend $def gas::callers $caller
-	$t lappend root gas::called  $def
-    }
-
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthLookahead {n negated} {
-    upvar 1 g g t t
-
-    # Note: Per the rules about expression modes (! is a lookahead
-    # ____| operator) this node has a mode of 'discard', and its child
-    # ____| has so as well.
-
-    # assert t get n  mode == discard
-    # assert t get pe mode == discard
-
-    set op       [$t get $n op]
-    set pe       [lindex [$t children $n] 0]
-    set eop      [$t get $pe op]
-
-    # -> icl_push -> (*) -ok--> icl_rewind -> OK
-    #                 \--fail-> icl_rewind -> FAIL
-
-    # -> icl_push -> (*) -ok--> icl_rewind -> iok_negate -> FAIL
-    #                 \--fail-> icl_rewind -> iok_negate -> OK
-
-    gas::begin $g $n okfail [expr {$negated ? "!" : "&"}]
-
-    Cmd icl_push
-    Inline $t $pe subexpr
-
-    /Ok
-    Cmd icl_rewind
-    if {$negated} { Cmd iok_negate ; /Fail } else /Ok ; Exit
-
-    /At subexpr/exit/fail ; /Fail
-    Cmd icl_rewind
-    if {$negated} { Cmd iok_negate ; /Ok } else /Fail ; Exit
-
-    gas::done --> $t
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthClass {n op} {
-    upvar 1 t t g g
-    SynthTerminal $n [list ict_match_tokclass $op] <$op>
-    return
-}
-
-proc ::page::compiler::peg::mecpu::SynthTerminal {n cmd msg} {
-    upvar 1 t t g g
-
-    # 4 cases (+/- cmd, +/- sv).
-    #
-    # (A) +cmd+sv
-    #     entry -> advance -ok-> match -ok-> sv -> OK
-    #              \             \
-    #               \             \-fail----------> FAIL
-    #                \-fail----------------------/
-    #
-    # (B) -cmd+sv
-    #     entry -> advance -ok-> sv -> OK
-    #              \
-    #               \-fail-----------> FAIL
-    #
-    # (C) +cmd-sv
-    #     entry -> advance -ok-> match -ok-> OK
-    #              \             \
-    #               \             \-fail---> FAIL
-    #                \-fail---------------/
-    #
-    # (D) -cmd-sv
-    #     entry -> advance -ok-> OK
-    #              \
-    #               \-fail-----> FAIL
-
-    gas::begin $g $n okfail M'[lindex $cmd 0]
-
-    Cmd ict_advance "Expected $msg (got EOF)"
-    /Fail ; Exit
-    /Ok
-
-    if {[llength $cmd]} {
-	lappend cmd "Expected $msg"
-	eval [linsert $cmd 0 Cmd]
-	/Fail ; Exit
-	/Ok
-    }
-
-    if {[$t get $n gen]} {
-	Cmd isv_terminal
-	/Ok
-    }
-
-    Exit
-
-    gas::done --> $t
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Extending the graph of instructions (expression
-## framework, new instructions, (un)conditional sequencing).
-
-# ### ### ### ######### ######### #########
-## Internal. Working on the graph of instructions.
-
-proc ::page::compiler::peg::mecpu::2code {t g} {
-    page_info "* Generating ME assembler code"
-
-    set insn  {}
-    set start [$t get root gas::entry]
-    set cat 0
-    set calls [list $start]
-
-    while {$cat < [llength $calls]} {
-	set  now [lindex $calls $cat]
-	incr cat
-
-	set at 0
-	set pending [list $now]
-
-	while {$at < [llength $pending]} {
-	    set  current [lindex $pending $at]
-	    incr at
-
-	    while {$current ne ""} {
-		if {[$g node keyexists $current WRITTEN]} break
-
-		insn $g $current insn
-		$g node set $current WRITTEN .
-
-		if {[$g node keyexists $current SAVE]} {
-		    lappend pending [$g node get $current SAVE]
-		}
-		if {[$g node keyexists $current CALL]} {
-		    lappend calls [$g node get $current CALL]
-		}
-
-		set  current [$g node get $current NEXT]
-		if {$current eq ""} break
-		if {[$g node keyexists $current WRITTEN]} {
-		    lappend insn [list {} icf_jalways \
-			    [$g node get $current LABEL]]
-		    break
-		}
-
-		# Process the following instruction,
-		# if there is any.
-	    }
-	}
-    }
-
-    return $insn
-}
-
-proc ::page::compiler::peg::mecpu::insn {g current iv} {
-    upvar 1 $iv insn
-
-    set code [$g node get $current instruction]
-    set args [$g node get $current arguments]
-
-    set label {}
-    if {[$g node keyexists $current LABEL]} {
-	set label [$g node get $current LABEL]
-    }
-
-    lappend insn [linsert $args 0 $label $code]
-    return
-}
-
-if 0 {
-    if {[lindex $ins 0] eq "icf_ntcall"} {
-	set tmp {}
-	foreach b $branches {
-	    if {[$g node keyexists $b START]} {
-		set sym [$g node get $b symbol]
-		lappend ins     sym_$sym
-	    } else {
-		lappend tmp $b
-	    }
-	}
-	set branches $tmp
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Optimizations.
-#
-## I. Remove all nodes which are not connected to anything.
-##    There should be none.
-
-proc ::page::compiler::peg::mecpu::remove_unconnected {g} {
-    page_info "* Remove unconnected instructions"
-
-    foreach n [$g nodes] {
-	if {[$g node degree $n] == 0} {
-	    page_error "$n ([printinsn $g $n])"
-	    page_error "Found unconnected node. This should not have happened."
-	    page_error "Removing the bad node."
-
-	    $g node delete $n
-	}
-    }
-}
-
-proc ::page::compiler::peg::mecpu::remove_dead {g} {
-    page_info "* Remove dead instructions"
-
-    set count 0
-    set runs 0
-    set hasdead 1
-    while {$hasdead} {
-	set hasdead 0
-	foreach n [$g nodes] {
-	    if {[$g node keyexists $n START]} continue
-	    if {[$g node degree -in $n] > 0}  continue
-
-	    page_log_info "    [np $n] removed, dead ([printinsn $g $n])"
-
-	    $g node delete $n
-
-	    set hasdead 1
-	    incr count
-	}
-	incr runs
-    }
-
-    page_info "  Removed [plural $count instruction] in [plural $runs run]"
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Optimizations.
-#
-## II. We have lots of .NOP instructions in the control flow, as part
-##     of the framework. They made the handling of expressions easier,
-##     providing clear and fixed anchor nodes to connect to from
-##     inside and outside, but are rather like the epsilon-transitions
-##     in a (D,N)FA. Now is the time to get rid of them.
-#
-##     We keep the .C'omments, and explicit .BRA'nches.
-##     We should not have any .NOP which is a dead-end (without
-##     successor), nor should we find .NOPs with more than one
-##     successor. The latter should have been .BRA'nches. Both
-##     situations are reported on. Dead-ends we
-##     remove. Multi-destination NOPs we keep.
-#
-##     Without the nops in place to confus the flow we can perform a
-##     series peep-hole optimizations to merge/split branches.
-
-proc ::page::compiler::peg::mecpu::denop {g} {
-    # Remove the .NOPs and reroute control flow. We keep the pseudo
-    # instructions for comments (.C) and the explicit branch points
-    # (.BRA).
-
-    page_info "* Removing the helper .NOP instructions."
-
-    set count 0
-    foreach n [$g nodes] {
-	# Skip over nodes already deleted by a previous iteration.
-	if {[$g node get $n instruction] ne ".NOP"} continue
-
-	# We keep branching .NOPs, and warn user. There shouldn't be
-	# any. such should explicit bnrachpoints.
-
-	set destinations [$g arcs -out $n]
-
-	if {[llength $destinations] > 1} {
-	    page_error "$n ([printinsn $g $n])"
-	    page_error "Found a .NOP with more than one destination."
-	    page_error "This should have been a .BRA instruction."
-	    page_error "Not removed. Internal error. Fix the transformation."
-	    continue
-	}
-
-	# Nops without a destination, dead-end's are not wanted. They
-	# should not exist either too. We will do a general dead-end
-	# and dead-start removal as well.
-
-	if {[llength $destinations] < 1} {
-	    page_error "$n ([printinsn $g $n])"
-	    page_error "Found a .NOP without any destination, i.e. a dead end."
-	    page_error "This should not have happened. Removed the node."
-
-	    $g node delete $n
-	    continue
-	}
-
-	page_log_info "    [np $n] removed, updated cflow ([printinsn $g $n])"
-
-	# As there is exactly one destination we can now reroute all
-	# incoming arcs around the nop to the new destination.
-
-	set target [$g arc target [lindex $destinations 0]]
-	foreach a [$g arcs -in $n] {
-	    $g arc move-target $a $target
-	}
-
-	$g node delete $n
-	incr count
-    }
-
-    page_info "  Removed [plural $count instruction]"
-    return
-}
-
-
-# ### ### ### ######### ######### #########
-## Optimizations.
-#
-
-# Merge parallel arcs (remove one, make the other unconditional).
-
-proc ::page::compiler::peg::mecpu::parcmerge {g} {
-    page_info "* Search for identical parallel arcs and merge them"
-
-    #puts [join  [info loaded] \n] /seg.fault induced with tcllibc! - tree!
-
-    set count 0
-    foreach n [$g nodes] {
-	set arcs [$g arcs -out $n]
-
-	if {[llength $arcs] < 2} continue
-	if {[llength $arcs] > 2} {
-	    page_error "  $n ([printinsn $g $n])"
-	    page_error "  Instruction has more than two destinations."
-	    page_error "  That is not possible. Internal error."
-	    continue
-	}
-	# Two way branch. Both targets the same ?
-
-	foreach {a b} $arcs break
-
-	if {[$g arc target $a] ne [$g arc target $b]} continue
-
-	page_log_info "    [np $n] outbound arcs merged ([printinsn $g $n])"
-
-	$g arc set $a condition always
-	$g arc delete $b
-
-	incr count 2
-    }
-
-    page_info "  Merged [plural $count arc]"
-    return
-}
-
-# Use knowledge of the match status before and after an instruction to
-# label the arcs a bit better (This may guide the forward and backward
-# merging.).
-
-# Forward merging of instructions.
-# An ok/fail decision is done as late as possible.
-#
-#  /- ok ---> Y -> U               /- ok ---> U
-# X                    ==>   X -> Y
-#  \- fail -> Y -> V               \- fail -> V
-
-# The Y must not have additional inputs. This more complex case we
-# will look at later.
-
-proc ::page::compiler::peg::mecpu::forwmerge {g} {
-    page_info "* Forward merging of identical instructions"
-    page_info "  Delaying decisions"
-    set count 0
-    set runs 0
-
-    set merged 1
-    while {$merged} {
-	set merged 0
-	foreach n [$g nodes] {
-	    # Skip nodes already killed in previous rounds.
-	    if {![$g node exists $n]} continue
-
-	    set outbound [$g arcs -out $n]
-	    if {[llength $outbound] != 2} continue
-
-	    foreach {aa ab} $outbound break
-	    set na [$g arc target $aa]
-	    set nb [$g arc target $ab]
-
-	    set ia [$g node get $na instruction][$g node get $na arguments]
-	    set ib [$g node get $nb instruction][$g node get $nb arguments]
-	    if {$ia ne $ib} continue
-
-	    # Additional condition: Inbounds in the targets not > 1
-
-	    if {([$g node degree -in $na] > 1) ||
-		([$g node degree -in $nb] > 1)} continue
-
-	    page_log_info "    /Merge [np $n] : [np $na] <- [np $nb] ([printinsn $g $na])"
-
-	    # Label all arcs out of na with the condition of the arc
-	    # into it.  Ditto for the arcs out of nb. The latter also
-	    # get na as their new origin. The arcs out of n relabeled
-	    # to always. The nb is deleted. This creates the desired
-	    # control structure without having to create a new node
-	    # and filling it. We simply use na, discard nb, and
-	    # properly rewrite the arcs to have the correct
-	    # conditions.
-
-	    foreach a [$g arcs -out $na] {
-		$g arc set $a condition [$g arc get $aa condition]
-	    }
-	    foreach a [$g arcs -out $nb] {
-		$g arc set $a condition [$g arc get $ab condition]
-		$g arc move-source $a $na
-	    }
-	    $g arc set     $aa condition always
-	    $g node delete $nb
-	    set merged 1
-	    incr count
-	}
-	incr runs
-    }
-
-    # NOTE: This may require a parallel arc merge, with identification
-    #       of merge-able arcs based on the arc condition, i.e. labeling.
-
-    page_info "  Merged [plural $count instruction] in [plural $runs run]"
-    return
-}
-
-# Backward merging of instructions.
-# Common backends are put together.
-#
-# U -> Y ->\             U ->\
-#           -> X   ==>        -> Y -> X
-# V -> Y ->/             V ->/
-
-# Note. It is possible for an instruction to be amenable to both for-
-# and backward merging. No heuristics are known to decide which is
-# better.
-
-proc ::page::compiler::peg::mecpu::backmerge {g} {
-    page_info "* Backward merging of identical instructions"
-    page_info "  Unifying paths"
-    set count 0
-    set runs 0
-
-    set merged 1
-    while {$merged} {
-	set merged 0
-	foreach n [$g nodes] {
-	    # Skip nodes already killed in previous rounds.
-	    if {![$g node exists $n]} continue
-
-	    set inbound [$g arcs -in $n]
-	    if {[llength $inbound] < 2} continue
-
-	    # We have more than 1 inbound arcs on this node. Check all
-	    # pairs of pre-decessors for possible unification.
-
-	    # Additional condition: Outbounds in the targets not > 1
-	    # We check in different levels, to avoid redundant calls.
-
-	    while {[llength $inbound] > 2} {
-		set aa   [lindex $inbound 0]
-		set tail [lrange $inbound 1 end]
-
-		set na [$g arc source $aa]
-		if {[$g node degree -out $na] > 1} {
-		    set inbound $tail
-		    continue
-		}
-
-		set inbound {}
-		foreach ab $tail {
-		    set nb [$g arc source $ab]
-		    if {[$g node degree -out $nb] > 1} continue
-
-		    set ia [$g node get $na instruction][$g node get $na arguments]
-		    set ib [$g node get $nb instruction][$g node get $nb arguments]
-
-		    if {$ia ne $ib} {
-			lappend inbound $ab
-			continue
-		    }
-
-		    page_log_info "    \\Merge [np $n] : [np $na] <- [np $nb] ([printinsn $g $na])"
-
-		    # Discard the second node in the pair. Move all
-		    # arcs inbound into it so that they reach the
-		    # first node instead.
-
-		    foreach a [$g arcs -in $nb] {$g arc move-target $a $na}
-		    $g node delete $nb
-		    set merged 1
-		    incr count
-		}
-	    }
-	}
-	incr runs
-    }
-
-    page_info "  Merged [plural $count instruction] in [plural $runs run]"
-    return
-}
-
-# ### ### ### ######### ######### #########
-
-proc ::page::compiler::peg::mecpu::pathlengths {g} {
-    page_info "* Find maximum length paths"
-
-    set pending [llength [$g nodes]]
-
-    set nodes {}
-    set loops {}
-    foreach n [$g nodes] {
-	$g node set $n WAIT [$g node degree -out $n]
-	set insn [$g node get $n instruction]
-	if {($insn eq "icf_halt") || ($insn eq "icf_ntreturn")} {
-	    lappend nodes $n
-	}
-	if {[$g node keyexists $n LOOP]} {
-	    lappend loops $n
-	}
-    }
-
-    set level 0
-    while {[llength $nodes]} {
-	incr pending -[llength $nodes]
-	set nodes [closure $g $nodes $level]
-	incr level
-    }
-
-    if {[llength $loops]} {
-	page_info "  Loop levels"
-
-	set nodes $loops
-	while {[llength $nodes]} {
-	    incr pending -[llength $nodes]
-	    set nodes [closure $g $nodes $level]
-	    incr level
-	}
-    }
-
-    if {$pending} {
-	page_info  "  Remainder"
-
-	while {$pending} {
-	    set nodes {}
-	    foreach n [$g nodes] {
-		if {[$g node keyexists $n LEVEL]} continue
-		if {[$g node get $n WAIT] < [$g node degree -out $n]} {
-		    lappend nodes $n
-		}
-	    }
-	    while {[llength $nodes]} {
-		incr pending -[llength $nodes]
-		set nodes [closure $g $nodes $level]
-		incr level
-	    }
-	}
-    }
-    return
-}
-
-proc ::page::compiler::peg::mecpu::closure {g nodes level} {
-    page_log_info "  \[[format %6d $level]\] : $nodes"
-
-    foreach n $nodes {$g node set $n LEVEL $level}
-
-    set tmp {}
-    foreach n $nodes {
-	foreach pre [$g nodes -in $n] {
-	    # Ignore instructions already given a level.
-	    if {[$g node keyexists $pre LEVEL]} continue
-	    $g node set $pre WAIT [expr {[$g node get $pre WAIT] - 1}]
-	    if {[$g node get $pre WAIT] > 0} continue
-	    lappend tmp $pre
-	}
-    }
-    return [lsort -uniq -dict $tmp]
-}
-
-proc ::page::compiler::peg::mecpu::jumps {g} {
-    page_info "* Insert explicit jumps and branches"
-
-    foreach n [$g nodes] {
-	# Inbound > 1, at least one is from a jump, so a label is
-	# needed.
-
-	if {[llength [$g arcs -in $n]] > 1} {
-	    set go bra[string range $n 4 end]
-	    $g node set $n LABEL $go
-	}
-
-	set darcs [$g arcs -out $n]
-
-	if {[llength $darcs] == 0} {
-	    $g node set $n NEXT ""
-	    continue
-	}
-
-	if {[llength $darcs] == 1} {
-	    set da [lindex $darcs 0]
-	    set dn [$g arc target $da]
-
-	    if {[$g node get $dn LEVEL] > [$g node get $n LEVEL]} {
-		# Flow is backward, an uncond. jump
-		# is needed here.
-
-		set go bra[string range $dn 4 end]
-		$g node set $dn LABEL $go
-		set j [$g node insert]
-		$g arc move-target $da $j
-		$g node set $j instruction icf_jalways
-		$g node set $j arguments   $go
-
-		$g arc insert $j $dn
-
-		$g node set $n NEXT $j
-		$g node set $j NEXT ""
-	    } else {
-		$g node set $n NEXT $dn
-	    }
-	    continue
-	}
-
-	set aok {}
-	set afl {}
-	foreach a $darcs {
-	    if {[$g arc get $a condition] eq "ok"} {
-		set aok $a
-	    } else {
-		set afl $a
-	    }
-	}
-	set nok [$g arc target $aok]
-	set nfl [$g arc target $afl]
-
-	if {[$g node get $n instruction] eq "inc_restore"} {
-	    set go bra[string range $nok 4 end]
-	    $g node set $nok LABEL $go
-
-	    $g node set $n NEXT $nfl
-	    $g node set $n SAVE $nok
-
-	    $g node set $n arguments [linsert [$g node get $n arguments] 0 $go]
-	    continue
-	}
-
-	if {[$g node get $n instruction] ne ".BRA"} {
-	    set bra [$g node insert]
-	    $g arc move-source $aok $bra
-	    $g arc move-source $afl $bra
-	    $g arc insert $n $bra
-	    $g node set $n NEXT $bra
-	    set n $bra
-	}
-
-	if {[$g node get $nok LEVEL] > [$g node get $nfl LEVEL]} {
-	    # Ok branch is direct, Fail is jump.
-
-	    $g node set $n NEXT $nok
-	    $g node set $n SAVE $nfl
-
-	    set go bra[string range $nfl 4 end]
-	    $g node set $nfl LABEL $go
-	    $g node set $n instruction icf_jfail
-	    $g node set $n arguments   $go
-	} else {
-
-	    # Fail branch is direct, Ok is jump.
-
-	    $g node set $n NEXT $nfl
-	    $g node set $n SAVE $nok
-
-	    set go bra[string range $nok 4 end]
-	    $g node set $nok LABEL $go
-	    $g node set $n instruction icf_jok
-	    $g node set $n arguments   $go
-	}
-    }
-}
-
-proc ::page::compiler::peg::mecpu::symbols {g t} {
-    page_info "* Label subroutine heads"
-
-    # Label and mark the instructions where subroutines begin.
-    # These markers are used by 2code to locate all actually
-    # used subroutines.
-
-    foreach def [lsort -uniq [$t get root gas::called]] {
-	set gdef [$t get $def gas::entry]
-	foreach caller [$t get $def gas::callers] {
-
-	    # Skip callers which are gone because of optimizations.
-	    if {![$g node exists $caller]} continue
-
-	    $g node set $caller CALL $gdef
-	    $g node set $gdef LABEL \
-		    [lindex [$g node set $caller arguments] 0]
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-
-proc ::page::compiler::peg::mecpu::statistics {code} {
-    return
-    # disabled
-    page_info "* Statistics"
-    statistics_si $code
-
-    # All higher order statistics are done only on the instructions in
-    # a basic block, i.e. a linear sequence. We are looking for
-    # high-probability blocks in itself, and then also for
-    # high-probability partials.
-
-    set blocks [basicblocks $code]
-
-    # Basic basic block statistics (full blocks)
-
-    Init bl
-    foreach b $blocks {Incr bl($b)}
-    wrstat  bl asm/statistics_bb.txt
-    wrstatk bl asm/statistics_bbk.txt
-
-    # Statistics of all partial blocks, i.e. all possible
-    # sub-sequences with length > 1.
-
-    Init ps
-    foreach b $blocks {
-	for {set s 0} {$s < [llength $b]} {incr s} {
-	    for {set e [expr {$s + 1}]} {$e < [llength $b]} {incr e} {
-		Incr ps([lrange $b $s $e]) $bl($b)
-	    }
-	}
-    }
-
-    wrstat  ps asm/statistics_ps.txt
-    wrstatk ps asm/statistics_psk.txt
-    return
-}
-
-proc ::page::compiler::peg::mecpu::statistics_si {code} {
-    page_info "  Single instruction probabilities."
-
-    # What are the most used instructions, statically speaking,
-    # without considering context ?
-
-    Init si
-    foreach i $code {
-	foreach {label name} $i break
-	if {$name eq ".C"} continue
-	Incr si($name)
-    }
-
-    wrstat si asm/statistics_si.txt
-    return
-}
-
-proc ::page::compiler::peg::mecpu::Init {v} {
-    upvar 1 $v var total total
-    array set var {}
-    set total 0
-    return
-}
-
-proc ::page::compiler::peg::mecpu::Incr {v {n 1}} {
-    upvar 1 $v var total total
-    if {![info exists var]} {set var $n ; incr total ; return}
-    incr var $n
-    incr total $n
-    return
-}
-
-proc ::page::compiler::peg::mecpu::wrstat {bv file} {
-    upvar 1 $bv buckets total total
-
-    set tmp  {}
-    foreach {name count} [array get buckets] {
-	lappend tmp [list $name $count]
-    }
-
-    set     lines {}
-    lappend lines "Total: $total"
-
-    set half [expr {$total / 2}]
-    set down $total
-
-    foreach item [lsort -index 1 -decreasing -integer [lsort -index 0 $tmp]] {
-	foreach {key count} $item break
-
-	set percent [format %6.2f [expr {$count*100.0/$total}]]%
-	set fcount  [format %8d $count]
-
-	lappend lines "  $fcount $percent $key"
-	incr down -$count
-	if {$half && ($down < $half)} {
-	    lappend lines **
-	    set half 0
-	}
-    }
-
-    write $file [join $lines \n]\n
-    return
-}
-
-proc ::page::compiler::peg::mecpu::wrstatk {bv file} {
-    upvar 1 $bv buckets total total
-
-    set tmp  {}
-    foreach {name count} [array get buckets] {
-	lappend tmp [list $name $count]
-    }
-
-    set     lines {}
-    lappend lines "Total: $total"
-
-    set half [expr {$total / 2}]
-    set down $total
-
-    foreach item  [lsort -index 0 [lsort -index 1 -decreasing -integer $tmp]] {
-	foreach {key count} $item break
-
-	set percent [format %6.2f [expr {$count*100.0/$total}]]%
-	set fcount  [format %8d $count]
-
-	lappend lines "  $fcount $percent $key"
-	incr down -$count
-	if {$down < $half} {
-	    lappend lines **
-	    set half -1
-	}
-    }
-
-    write $file [join $lines \n]\n
-    return
-}
-
-proc ::page::compiler::peg::mecpu::basicblocks {code} {
-    set blocks {}
-    set block {}
-
-    foreach i $code {
-	foreach {label name} $i break
-	if {
-	    ($name eq ".C")          ||
-	    ($name eq "icf_jok")     ||
-	    ($name eq "icf_jfail")   ||
-	    ($name eq "icf_jalways") ||
-	    ($name eq "icf_ntreturn")
-	} {
-	    # Jumps stop a block, and are not put into the block
-	    # Except if the block is of length 1. Then it is of
-	    # interest to see if certain combinations are used
-	    # often.
-
-	    if {[llength $block]} {
-		if {[llength $block] == 1} {lappend block $name}
-		lappend blocks $block
-	    }
-	    set block {}
-	    continue
-	} elseif {$label ne ""} {
-	    # A labeled instruction starts a new block and belongs to
-	    # it. Note that the previous block is saved only if it is
-	    # of length > 1. A single instruction block is not
-	    # something we can optimize.
-
-	    if {[llength $block] > 1} {lappend blocks $block}
-	    set block [list $name]
-	    continue
-	}
-	# Extend current block
-	lappend block $name
-    }
-
-    if {[llength $block]} {lappend blocks $block}
-    return $blocks
-}
-
-# ### ### ### ######### ######### #########
-
-proc ::page::compiler::peg::mecpu::printinsn {g n} {
-    return "[$g node get $n instruction] <[$g node get $n arguments]>"
-}
-
-proc ::page::compiler::peg::mecpu::plural {n prefix} {
-    return "$n ${prefix}[expr {$n == 1 ? "" : "s"}]"
-}
-
-proc ::page::compiler::peg::mecpu::np {n} {
-    format %-*s 8 $n
-}
-
-proc ::page::compiler::peg::mecpu::status {g} {
-    page_info "[plural [llength [$g nodes]] instruction]"
-    return
-}
-
-proc ::page::compiler::peg::mecpu::gdump {g file} {
-    return
-    # disabled
-    variable gnext
-    page_info "  %% Saving graph to \"$file\" %%"
-    write asm/[format %02d $gnext]_${file}.sgr [$g serialize]
-    incr gnext
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::compiler::peg::mecpu {
-    variable gnext 0
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::compiler::peg::mecpu 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_canon.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_canon.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,481 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - PEG as ... PEG
-
-# ### ### ### ######### ######### #########
-## Dumping the input grammar. But not as Tcl or other code. In PEG
-## format again, pretty printing.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require textutil
-
-namespace eval ::page::gen::peg::canon {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::canon {t chan} {
-
-    # Generate data for inherited attributes
-    # used during synthesis.
-    canon::Setup $t
-
-    # Synthesize all text fragments we need.
-    canon::Synth $t
-
-    # And write the grammar text.
-    puts $chan [$t get root TEXT]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::peg::canon::Setup {t} {
-    # Phase 1: Top-down, inherited attributes:
-    #
-    # - Max length of nonterminal symbols defined by the grammar.
-    #
-    # - Indentation put on all rules to get enough space for
-    #   definition attributes.
-
-    set       max   -1
-    array set modes {}
-
-    foreach {sym def} [$t get root definitions] {
-	set l [string length $sym]
-	if {$l > $max} {set max $l}
-
-	set mode [string index [$t get $def mode] 0]
-	set modes($mode) .
-    }
-    set modeset [join [lsort [array names modes]] ""]
-    set mlen    [AttrFieldLength $modeset]
-    set heading [expr {$max + $mlen + 4}]
-    # The constant 4 is for ' <- ', see
-    # SynthNode/Nonterminal
-
-    # Save the computed information for access by the definitions and
-    # other operators.
-
-    $t set root SYM_FIELDLEN $max
-    $t set root ATT_FIELDLEN $mlen
-    $t set root ATT_BASE     $modeset
-    $t set root HEADLEN      $heading
-    return
-}
-
-proc ::page::gen::peg::canon::Synth {t} {
-    # Phase 2: Bottom-up, synthesized attributes
-    #
-    # - Text block per node, length and height.
-
-    $t walk root -order post -type dfs n {
-	SynthNode $t $n
-    }
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode {t n} {
-    if {$n eq "root"} {
-	set code Root
-    } elseif {[$t keyexists $n symbol]} {
-	set code Nonterminal
-    } elseif {[$t keyexists $n op]} {
-	set code [$t get $n op]
-    } else {
-	return -code error "PANIC. Bad node $n, cannot classify"
-    }
-
-    #puts stderr "SynthNode/$code $t $n"
-
-    SynthNode/$code $t $n
-
-    #SHOW [$t get $n TEXT] 1 0
-    #catch {puts stderr "\t.[$t get $n W]x[$t get $n H]"}
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/Root {t n} {
-    # Root is the grammar itself.
-
-    # Get the data we need from our children, which are start
-    # expression and nonterminal definitions.
-
-    set gname  [$t get root name]
-    set gstart [$t get root start]
-    if {$gstart ne ""} {
-	set stext  [$t get $gstart TEXT]
-    } else {
-	puts stderr "No start expression."
-	set stext ""
-    }
-    set rules  {}
-    foreach {sym def} [$t get root definitions] {
-	lappend rules [list $sym [$t get $def TEXT]]
-    }
-
-    # Combine them into a text for the whole grammar.
-
-    set intro  "PEG $gname \("
-    set ispace [::textutil::blank [string length $intro]]
-
-    set    out ""
-    append out "# -*- text -*-" \n
-    append out "## Parsing Expression Grammar '$gname'." \n
-    append out "## Layouted by the PG backend 'PEGwriter'." \n
-    append out \n
-    append out $intro[::textutil::indent $stext $ispace 1]\)
-    append out \n
-    append out \n
-
-    foreach e [lsort -dict -index 0 $rules] {
-	foreach {sym text} $e break
-	append out $text \n
-	append out \n
-    }
-
-    append out "END\;" \n
-
-    $t set root TEXT $out
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/Nonterminal {t n} {
-    # This is the root of a definition. We now
-    # have to combine the text block for the
-    # expression with nonterminal and attribute
-    # data.
-
-    variable ms
-
-    set abase [$t get root ATT_BASE]
-    set sfl   [$t get root SYM_FIELDLEN]
-    set mode  [$t get $n mode]
-    set sym   [$t get $n symbol]
-    set etext [$t get [lindex [$t children $n] 0] TEXT]
-
-    set    out ""
-    append out $ms($abase,$mode)
-    append out $sym
-    append out [::textutil::blank [expr {$sfl - [string length $sym]}]]
-    append out " <- "
-
-    set ispace [::textutil::blank [string length $out]]
-
-    append out [::textutil::indent $etext $ispace 1]
-    append out " ;"
-
-    $t set $n TEXT $out
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/t {t n} {
-    # Terminal node. Primitive layout.
-    # Put the char into single or double quotes.
-
-    set ch [$t get $n char]
-    if {$ch eq "'"} {set q "\""} else {set q '}
-
-    set text $q$ch$q
-
-    SetBlock $t $n $text
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/n {t n} {
-    # Nonterminal node. Primitive layout. Text is the name of smybol
-    # itself.
-
-    SetBlock $t $n [$t get $n sym]
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/.. {t n} {
-    # Range is [x-y]
-    set b [$t get $n begin]
-    set e [$t get $n end]
-    SetBlock $t $n "\[${b}-${e}\]"
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/alnum   {t n} {SetBlock $t $n <alnum>}
-proc ::page::gen::peg::canon::SynthNode/alpha   {t n} {SetBlock $t $n <alpha>}
-proc ::page::gen::peg::canon::SynthNode/dot     {t n} {SetBlock $t $n .}
-proc ::page::gen::peg::canon::SynthNode/epsilon {t n} {SetBlock $t $n ""}
-
-proc ::page::gen::peg::canon::SynthNode/? {t n} {SynthSuffix $t $n ?}
-proc ::page::gen::peg::canon::SynthNode/* {t n} {SynthSuffix $t $n *}
-proc ::page::gen::peg::canon::SynthNode/+ {t n} {SynthSuffix $t $n +}
-
-proc ::page::gen::peg::canon::SynthNode/! {t n} {SynthPrefix $t $n !}
-proc ::page::gen::peg::canon::SynthNode/& {t n} {SynthPrefix $t $n &}
-
-proc ::page::gen::peg::canon::SynthSuffix {t n op} {
-
-    set sub   [lindex [$t children $n] 0]
-    set sop   [$t get $sub op]
-    set etext [$t get $sub TEXT]
-
-    WrapParens $op $sop etext
-    SetBlock $t $n $etext$op
-    return
-}
-
-proc ::page::gen::peg::canon::SynthPrefix {t n op} {
-
-    set sub   [lindex [$t children $n] 0]
-    set sop   [$t get $sub op]
-    set etext [$t get $sub TEXT]
-
-    WrapParens $op $sop etext
-    SetBlock $t $n $op$etext
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode/x {t n} {
-    variable llen
-
-    # Space given to us for an expression.
-    set lend [expr {$llen - [$t get root HEADLEN]}]
-
-    set clist [$t children $n]
-    if {[llength $clist] == 1} {
-	# Implicit cutting out of chains.
-
-	CopyBlock $t $n [lindex $clist 0]
-
-	#puts stderr <<implicit>>
-	return
-    }
-
-    set out ""
-
-    # We are not tracking the total width of the block, but only the
-    # width of the current line, as that is where we may have to
-    # wrap. The height however is the total height.
-
-    #puts stderr <<$clist>>
-    #puts stderr \t___________________________________
-
-    set w 0
-    set h 0
-    foreach c $clist {
-	set sop   [$t get $c op]
-	set sub   [$t get $c TEXT]
-	set sw    [$t get $c W]
-	set slw   [$t get $c Wlast]
-	set sh    [$t get $c H]
-
-	#puts stderr \t<$sop/$sw/$slw/$sh>___________________________________
-	#SHOW $sub $slw $sh
-
-	if {[Paren x $sop]} {
-	    set sub "([::textutil::indent $sub " " 1])"
-	    incr slw 2
-	    incr sw  2
-
-	    #puts stderr /paren/
-	    #SHOW $sub $slw $sh
-	}
-
-	# Empty buffer ... Put element, and extend dimensions
-
-	#puts stderr \t.=============================
-	#SHOW $out $w $h
-
-	if {$w == 0} {
-	    #puts stderr /init
-	    append out $sub
-	    set w $slw
-	    set h $sh
-	} elseif {($w + $sw + 1) > $lend} {
-	    #puts stderr /wrap/[expr {($w + $sw + 1)}]/$lend
-	    # To large, wrap into next line.
-	    append out \n $sub
-	    incr h $sh
-	    set  w $slw
-	} else {
-	    # We have still space to put the block in. Either by
-	    # simply appending, or by indenting a multiline block
-	    # properly so that its parts stay aligned with each other.
-	    if {$sh == 1} {
-		#puts stderr /add/line
-		append out " " $sub
-		incr w ; incr w $slw
-	    } else {
-		append out " "  ; incr w
-		#puts stderr /add/block/$w
-		append out [::textutil::indent $sub [::textutil::blank $w] 1]
-		incr w $slw
-		incr h $sh ; incr h -1
-	    }
-	}
-
-	#puts stderr \t.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	#SHOW $out $w $h
-    }
-
-    SetBlock $t $n $out
-    return
-}
-
-proc ::page::gen::peg::canon::SynthNode// {t n} {
-    # We take all branches and put them together, nicely aligned under
-    # each other.
-
-    set clist [$t children $n]
-    if {[llength $clist] == 1} {
-	# Implicit cutting out of chains.
-
-	CopyBlock $t $n [lindex $clist 0]
-	return
-    }
-
-    set out ""
-    foreach c $clist {
-	set sop   [$t get $c op]
-	set sub   [$t get $c TEXT]
-	WrapParens / $sop sub
-	append out "/ [::textutil::indent $sub "  " 1]" \n
-    }
-
-    SetBlock $t $n " [string range $out 1 end]"
-    return
-}
-
-proc ::page::gen::peg::canon::WrapParens {op sop tvar} {
-    if {[Paren $op $sop]} {
-	upvar 1 $tvar text
-	set text "([::textutil::indent $text " " 1])"
-    }
-}
-
-proc ::page::gen::peg::canon::Paren {op sop} {
-    # sop is nested under op.
-    # Parens are required if sop has a lower priority than op.
-
-    return [expr {[Priority $sop] < [Priority $op]}]
-}
-
-proc ::page::gen::peg::canon::Priority {op} {
-    switch -exact -- $op {
-	t        -
-	n        -
-	..       -
-	alnum    -
-	alpha    -
-	dot      -
-	epsilon  {return 4}
-	? -
-	* -
-	+        {return 3}
-	! -
-	&        {return 2}
-	x        {return 1}
-	/        {return 0}
-    }
-    return -code error "Internal error, bad operator \"$op\""
-}
-
-proc ::page::gen::peg::canon::CopyBlock {t n src} {
-    $t set $n TEXT  [$t get $src TEXT]
-    $t set $n W     [$t get $src W]
-    $t set $n Wlast [$t get $src Wlast]
-    $t set $n H     [$t get $src H]
-    return
-}
-
-proc ::page::gen::peg::canon::SetBlock {t n text} {
-    set text   [string trimright $text]
-    set lines  [split $text \n]
-    set height [llength $lines]
-
-    if {$height > 1} {
-	set max -1
-	set ntext {}
-
-	foreach line $lines {
-	    set line [string trimright $line]
-	    set l [string length $line]
-	    if {$l > $max} {set max $l}
-	    lappend ntext $line
-	    set wlast $l
-	}
-	set text  [join $ntext \n]
-	set width $max
-    } else {
-	set width [string length $text]
-	set wlast $width
-    }
-
-    $t set $n TEXT $text
-    $t set $n W     $width
-    $t set $n Wlast $wlast
-    $t set $n H     $height
-    return
-}
-
-proc ::page::gen::peg::canon::AttrFieldLength {modeset} {
-    variable ms
-    return  $ms($modeset,*)
-}
-
-if {0} {
-    proc ::page::gen::peg::canon::SHOW {text w h} {
-	set wl $w ; incr wl -1
-	puts stderr "\t/$h"
-	puts stderr "[textutil::indent $text \t|]"
-	puts stderr "\t\\[string repeat "-" $wl]^ ($w)"
-	return
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::canon {
-    variable llen 80
-    variable ms ; array set ms {
-	dlmv,discard {void:  }
-	dlmv,leaf    {leaf:  }
-	dlmv,match   {match: }
-	dlmv,value   {       }
-	dlmv,*       7
-
-	dlm,discard  {void:  }		dlv,discard  {void: }
-	dlm,leaf     {leaf:  }		dlv,leaf     {leaf: }
-	dlm,match    {match: }		dlv,value    {      }
-	dlm,*        7			dlv,*        6
-
-	dmv,discard  {void:  }		lmv,leaf     {leaf:  }
-	dmv,match    {match: }		lmv,match    {match: }
-	dmv,value    {       }		lmv,value    {       }
-	dmv,*        7			lmv,*        7
-
-	dl,discard   {void: }		dm,discard   {void:  }
-	dl,leaf      {leaf: }		dm,match     {match: }
-	dl,*         6			dm,*         7
-
-	lm,leaf      {leaf:  }		dv,discard   {void: }
-	lm,match     {match: }		dv,value     {      }
-	lm,*         7			dv,*         6
-
-	lv,leaf      {leaf: }		mv,match     {match: }
-	lv,value     {      }		mv,value     {       }
-	lv,*         6			mv,*         7
-
-	d,discard    {void: }		d,*       6
-	l,leaf       {leaf: }		l,*       6
-	m,match      {match: }		m,*       7
-	v,value      {}			v,*       0
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::canon 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_cpkg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_cpkg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,171 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - PEG as Tcl script.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::peg
-
-namespace eval ::page::gen::peg::cpkg {
-    # Get various utilities.
-
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::cpkg {t chan} {
-    cpkg::printWarnings [cpkg::getWarnings $t]
-
-    set grname [$t get root name]
-
-    cpkg::Header  $chan $grname
-
-    set gstart [$t get root start]
-    if {$gstart ne ""} {
-	set gstart [cpkg::peOf $t $gstart]
-    } else {
-	puts stderr "No start expression."
-    }
-
-    cpkg::Start   $chan $gstart
-
-    set temp {}
-    set max -1
-
-    foreach {sym def} [$t get root definitions] {
-	set eroot [lindex [$t children $def] 0]
-	set l [string length [list $sym]]
-	if {$l > $max} {set max $l}
-	lappend temp \
-	    [list $sym [$t get $def mode] [cpkg::peOf $t $eroot] $l]
-    }
-
-    foreach e [lsort -dict -index 0 $temp] {
-	foreach {sym mode rule l} $e break
-	cpkg::Rule $chan $sym $mode $rule [expr {$max - $l}]
-    }
-
-    cpkg::Trailer $chan $grname
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::peg::cpkg::Header {chan grname} {
-    variable header
-    variable headerb
-
-    set stem [namespace tail $grname]
-    puts $chan [string map \
-		    [list \
-			 @@ [list $grname] \
-			 @stem@ [list $stem] \
-			 "\n\t" "\n"
-			] \
-		    $header\n$headerb]
-}
-
-proc ::page::gen::peg::cpkg::Start {chan pe} {
-    puts $chan "    Start  [printTclExpr $pe]\n"
-    return
-}
-
-proc ::page::gen::peg::cpkg::Rule {chan sym mode pe off} {
-    variable ms
-    set off [string repeat " " $off]
-    puts $chan "    Define $ms($mode) $sym$off [printTclExpr $pe]"
-    return
-}
-
-proc ::page::gen::peg::cpkg::Trailer {chan grname} {
-    variable trailer
-    variable trailerb
-    puts $chan [string map \
-		    [list \
-			 @@ [list $grname] \
-			 "\n\t" "\n"
-			] \
-		    $trailer\n$trailerb]
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::cpkg {
-    variable ms ; array set ms {
-	value   {value  }
-	discard {discard}
-	match   {match  }
-	leaf    {leaf   }
-    }
-    variable header {# -*- tcl -*-
-	## Parsing Expression Grammar '@@'.
-
-	# ### ### ### ######### ######### #########
-	## Package description
-
-	## It provides a single command returning the handle of a
-	## grammar container in which the grammar '@@'
-	## is stored. The container is usable by a PEG interpreter
-	## or other packages taking PE grammars.
-
-	# ### ### ### ######### ######### #########
-	## Requisites.
-	## - PEG container type
-
-	package require grammar::peg
-
-	namespace eval ::@@ {}
-
-	# ### ### ### ######### ######### #########
-	## API
-
-	proc ::@@ {} {
-	    return $@stem@::gr
-	}
-
-	# ### ### ### ######### ######### #########
-	# ### ### ### ######### ######### #########
-	## Data and helpers.
-
-	namespace eval ::@@ {
-	    # Grammar container
-	    variable gr [::grammar::peg gr]
-	}
-
-	proc ::@@::Start {pe} {
-	    variable gr
-	    $gr start $pe
-	    return
-	}
-
-	proc ::@@::Define {mode sym pe} {
-	    variable gr
-	    $gr nonterminal add  $sym $pe
-	    $gr nonterminal mode $sym $mode
-	    return
-	}
-
-	# ### ### ### ######### ######### #########
-	## Initialization = Grammar definition
-    }
-    variable headerb	"namespace eval ::@@ \{"
-
-    variable trailer "\}"
-    variable trailerb {
-	# ### ### ### ######### ######### #########
-	## Package Management - Ready
-
-	package provide @@ 0.1
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::cpkg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_hb.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_hb.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,79 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - PEG in half baked form for PEG container.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::peg
-
-namespace eval ::page::gen::peg::hb {
-    # Get various utilities.
-
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::hb {t chan} {
-    hb::printWarnings [hb::getWarnings $t]
-
-    set gstart [$t get root start]
-    if {$gstart ne ""} {
-	set gstart [hb::peOf $t $gstart]
-    } else {
-	puts stderr "No start expression."
-    }
-
-    hb::Start $chan $gstart
-
-    set temp {}
-    set max -1
-    foreach {sym def} [$t get root definitions] {
-	set eroot [lindex [$t children $def] 0]
-	set l [string length [list $sym]]
-	if {$l > $max} {set max $l}
-	lappend temp \
-	    [list $sym [$t get $def mode] [hb::peOf $t $eroot] $l]
-    }
-
-    foreach e [lsort -dict -index 0 $temp] {
-	foreach {sym mode rule l} $e break
-	hb::Rule $chan $sym $mode $rule [expr {$max - $l}]
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::peg::hb::Start {chan pe} {
-    puts $chan "Start  [printTclExpr $pe]\n"
-    return
-}
-
-proc ::page::gen::peg::hb::Rule {chan sym mode pe off} {
-    variable ms
-    set off [string repeat " " $off]
-    puts $chan "Define $ms($mode) $sym$off [printTclExpr $pe]"
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::hb {
-    variable ms ; array set ms {
-	value   {value  }
-	discard {discard}
-	match   {match  }
-	leaf    {leaf   }
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::hb 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_me.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_me.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,888 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - Generate a grammar::mengine based parser.
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Dumping the input grammar. But not as Tcl or other code. In PEG
-## format again, pretty printing.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-
-package require textutil
-package require page::analysis::peg::emodes
-package require page::util::quote
-package require page::util::peg
-
-namespace eval ::page::gen::peg::me {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl)
-
-    namespace import ::page::util::quote::*
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::me::package {text} {
-    variable package $text
-    return
-}
-
-proc ::page::gen::peg::me::copyright {text} {
-    variable copyright $text
-    return
-}
-
-proc ::page::gen::peg::me {t chan} {
-    variable me::package
-    variable me::copyright
-
-    # Resolve the mode hints. Every gen(X) having a value of 'maybe'
-    # (or missing) is for the purposes of this code a 'yes'.
-
-    if {![page::analysis::peg::emodes::compute $t]} {
-	page_error "  Unable to generate a ME parser without accept/generate properties"
-	return
-    }
-
-    foreach n [$t nodes] {
-	if {![$t keyexists $n gen] || ([$t get $n gen] eq "maybe")} {
-	    $t set $n gen 1
-	}
-	if {![$t keyexists $n acc]} {$t set $n acc 1}
-    }
-
-    $t set root Pcount 0
-
-    $t set root package   $package
-    $t set root copyright $copyright
-
-    # Synthesize all text fragments we need.
-    me::Synth $t
-
-    # And write the grammar text.
-    puts $chan [$t get root TEXT]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::peg::me::Synth {t} {
-    # Phase 2: Bottom-up, synthesized attributes
-    #
-    # - Text blocks per node.
-
-    $t walk root -order post -type dfs n {
-	SynthNode $t $n
-    }
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode {t n} {
-    if {$n eq "root"} {
-	set code Root
-    } elseif {[$t keyexists $n symbol]} {
-	set code Nonterminal
-    } elseif {[$t keyexists $n op]} {
-	set code [$t get $n op]
-    } else {
-	return -code error "PANIC. Bad node $n, cannot classify"
-    }
-
-    #puts stderr "SynthNode/$code $t $n"
-
-    SynthNode/$code $t $n
-
-    #SHOW [$t get $n TEXT] 1 0
-    #catch {puts stderr "\t.[$t get $n W]x[$t get $n H]"}
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/Root {t n} {
-    variable template
-
-    # Root is the grammar itself.
-
-    # Text blocks we have to combine:
-    # - Code for matching the start expression
-    # - Supporting code for the above.
-    # - Code per Nonterminal definition.
-
-    set gname    [$t get root name]
-    set gstart   [$t get root start]
-    set gpackage [$t get root package]
-    set gcopy    [$t get root copyright]
-
-    if {$gcopy ne ""} {
-	set gcopyright "## (C) $gcopy\n"
-    } else {
-	set gcopyright ""
-    }
-    if {$gpackage eq ""} {
-	set gpackage $gname
-    }
-
-    page_info "  Grammar:   $gname"
-    page_info "  Package:   $gpackage"
-    if {$gcopy ne ""} {
-	page_info "  Copyright: $gcopy"
-    }
-
-    if {$gstart ne ""} {
-	set match   [textutil::indent \
-		[$t get $gstart MATCH] \
-		"    "]
-    } else {
-	page_error "  No start expression."
-	set match ""
-    }
-
-    set crules {}
-    set rules  {}
-    set support [$t get [$t get root start] SUPPORT]
-    if {[string length $support]} {
-	lappend rules $support
-	lappend rules {}
-    }
-
-    lappend crules "# Grammar '$gname'"
-    lappend crules {#}
-
-    array set def [$t get root definitions]
-    foreach sym [lsort -dict [array names def]]  {
-	lappend crules [Pfx "# " [$t get $def($sym) EXPR]]
-	lappend crules {#}
-
-	lappend rules  [$t get $def($sym) TEXT]
-	lappend rules {}
-    }
-    set rules [join [lrange $rules 0 end-1] \n]
-
-    lappend crules {}
-    lappend crules $rules
-
-    set crules [join $crules \n]
-
-    # @PKG@ and @NAME@ are handled after the other expansions as their
-    # contents may insert additional instances of these placeholders.
-
-    $t set root TEXT \
-	[string map \
-	    [list \
-	        @NAME@ $gname \
-	        @PKG@  $gpackage \
-	        @COPY@ $gcopyright] \
-	    [string map \
-	        [list \
-		    @MATCH@ $match \
-		    @RULES@ $crules \
-		    ] $template]]
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/Nonterminal {t n} {
-    # This is the root of a definition.
-    #
-    # The text is a procedure wrapping the match code of its
-    # expression into the required the nonterminal handling (caching
-    # and such), plus the support code for the expression matcher.
-
-    set sym      [$t get $n symbol]
-    set label    [$t get $n label]
-    set gen      [$t get $n gen]
-    set mode     [$t get $n mode]
-
-    set pe       [lindex [$t children $n] 0]
-    set egen     [$t get $pe gen]
-    set esupport [$t get $pe SUPPORT]
-    set ematch   [$t get $pe MATCH]
-    set eexpr    [$t get $pe EXPR]
-
-    # Combine the information.
-
-    set sexpr    [Cat "$sym = " $eexpr]
-
-    set match {}
-    #lappend match "puts stderr \"$label << \[icl_get\]\""
-    #lappend match {}
-    lappend match [Pfx "# " $sexpr]
-    lappend match {}
-    if {$gen} {
-	lappend match {variable ok}
-	lappend match "if \{\[inc_restore $label\]\} \{"
-	lappend match "    if \{\$ok\} ias_push"
-	#lappend match "    puts stderr \">> $label = \$ok (c) \[icl_get\]\""
-	lappend match "    return"
-	lappend match "\}"
-    } else {
-	set eop [$t get $pe op]
-	if {
-	    ($eop eq "t")     || ($eop eq "..") ||
-	    ($eop eq "alpha") || ($eop eq "alnum")
-	} {
-	    # Required iff !dot
-	    # Support for terminal expression 
-	    lappend match {variable ok}
-	}
-
-	#lappend match "variable ok"
-	lappend match "if \{\[inc_restore $label\]\} return"
-	#lappend match "if \{\[inc_restore $label\]\} \{"
-	#lappend match "    puts stderr \">> $label = \$ok (c) \[icl_get\]\""
-	#lappend match "    return"
-	#lappend match "\}"
-    }
-    lappend match {}
-    lappend match {set pos [icl_get]}
-    if {$egen} {
-	# [*] Needed for removal of SV's from stack after handling by
-	# this symbol, only if expression actually generates an SV.
-	lappend match {set mrk [ias_mark]}
-    }
-    lappend match {}
-    lappend match $ematch
-    lappend match {}
-
-    switch -exact -- $mode {
-	value   {lappend match "isv_nonterminal_reduce $label \$pos \$mrk"}
-	match   {lappend match "isv_nonterminal_range  $label \$pos"}
-	leaf    {lappend match "isv_nonterminal_leaf   $label \$pos"}
-	discard {lappend match "isv_clear"}
-	default {return -code error "Bad nonterminal mode \"$mode\""}
-    }
-
-    lappend match "inc_save               $label \$pos"
-    if {$egen} {
-	# See [*], this is the removal spoken about before.
-	lappend match {ias_pop2mark             $mrk}
-    }
-    if {$gen} {
-	lappend match {if {$ok} ias_push}
-    }
-    lappend match "ier_nonterminal        \"Expected $label\" \$pos"
-    #lappend match "puts stderr \">> $label = \$ok \[icl_get\]\""
-    lappend match return
-
-    # Final assembly
-
-    set pname [Call $sym]
-    set match [list [Proc $pname [join $match \n]]]
-
-    if {[string length $esupport]} {
-	lappend match {}
-	lappend match $esupport
-    }
-
-    $t set $n TEXT [join $match \n]
-    $t set $n EXPR $sexpr
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/? {t n} {
-    # The expression e? is equivalent to e/epsilon.
-    # And like this it is compiled.
-
-    set pe       [lindex [$t children $n] 0]
-    set ematch   [$t get $pe MATCH]
-    set esupport [$t get $pe SUPPORT]
-    set eexpr    [$t get $pe EXPR]
-    set egen     [$t get $pe gen]
-    set sexpr    "[Cat "(? " $eexpr])"
-
-    set     match {}
-    lappend match {}
-    lappend match [Pfx "# " $sexpr]
-    lappend match {}
-    lappend match {variable ok}
-    lappend match {}
-    lappend match {set pos [icl_get]}
-    lappend match {}
-    lappend match {set old [ier_get]}
-    lappend match $ematch
-    lappend match {ier_merge $old}
-    lappend match {}
-    lappend match {if {$ok} return}
-    lappend match {icl_rewind $pos}
-    lappend match {iok_ok}
-    lappend match {return}
-
-    # Final assembly
-
-    set pname [NextProc $t opt]
-    set match [list [Proc $pname [join $match \n]]]
-    if {[string length $esupport]} {
-	lappend match {}
-	lappend match $esupport
-    }
-
-    $t set $n EXPR    $sexpr
-    $t set $n MATCH   [Cat "$pname                ; " [Pfx "# " $sexpr]]
-    $t set $n SUPPORT [join $match \n]
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/* {t n} {
-    # Kleene star is like a repeated ?
-
-    # Note: Compilation as while loop, as done now
-    # means that the parser has no information about
-    # the intermediate structure of the input in his
-    # cache.
-
-    # Future: Create a helper symbol X and compile
-    # the expression e = e'* as:
-    #     e = X; X <- (e' X)?
-    # with match data for X put into the cache. This
-    # is not exactly equivalent, the structure of the
-    # AST is different (right-nested tree instead of
-    # a list). This however can be handled with a
-    # special nonterminal mode to expand the current
-    # SV on the stack.
-
-    # Note 2: This is a transformation which can be
-    # done on the grammar itself, before the actual
-    # backend is let loose. This "strength reduction"
-    # allows us to keep this code here.
-
-    set pe       [lindex [$t children $n] 0]
-    set ematch   [$t get $pe MATCH]
-    set esupport [$t get $pe SUPPORT]
-    set eexpr    [$t get $pe EXPR]
-    set egen     [$t get $pe gen]
-    set sexpr    "[Cat "(* " $eexpr])"
-
-    set     match {}
-    lappend match {}
-    lappend match [Pfx "# " $sexpr]
-    lappend match {}
-    lappend match {variable ok}
-    lappend match {}
-    lappend match "while \{1\} \{"
-    lappend match {    set pos [icl_get]}
-    lappend match {}
-    lappend match {    set old [ier_get]}
-    lappend match [textutil::indent $ematch "    "]
-    lappend match {    ier_merge $old}
-    lappend match {}
-    lappend match {    if {$ok} continue}
-    lappend match {    break}
-    lappend match "\}"
-    lappend match {}
-    lappend match {icl_rewind $pos}
-    lappend match {iok_ok}
-    lappend match {return}
-
-    # Final assembly
-
-    set pname [NextProc $t kleene]
-    set match [list [Proc $pname [join $match \n]]]
-    if {[string length $esupport]} {
-	lappend match {}
-	lappend match $esupport
-    }
-
-    $t set $n MATCH   [Cat "$pname                ; " [Pfx "# " $sexpr]]
-    $t set $n SUPPORT [join $match \n]
-    $t set $n EXPR    $sexpr
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/+ {t n} {
-    # Positive Kleene star x+ is equivalent to x x*
-    # This is how it is compiled. See also the notes
-    # at the * above, they apply in essence here as
-    # well, except that the transformat scheme is
-    # slighty different:
-    #
-    # e = e'*  ==> e = X; X <- e' X?
-
-    set pe       [lindex [$t children $n] 0]
-    set ematch   [$t get $pe MATCH]
-    set esupport [$t get $pe SUPPORT]
-    set eexpr    [$t get $pe EXPR]
-    set egen     [$t get $pe gen]
-    set sexpr    "[Cat "(+ " $eexpr])"
-
-    set     match {}
-    lappend match {}
-    lappend match [Pfx "# " $sexpr]
-    lappend match {}
-    lappend match {variable ok}
-    lappend match {}
-    lappend match {set pos [icl_get]}
-    lappend match {}
-    lappend match {set old [ier_get]}
-    lappend match $ematch
-    lappend match {ier_merge $old}
-    lappend match {}
-    lappend match "if \{!\$ok\} \{"
-    lappend match {    icl_rewind $pos}
-    lappend match {    return}
-    lappend match "\}"
-    lappend match {}
-    lappend match "while \{1\} \{"
-    lappend match {    set pos [icl_get]}
-    lappend match {}
-    lappend match {    set old [ier_get]}
-    lappend match [textutil::indent $ematch "    "]
-    lappend match {    ier_merge $old}
-    lappend match {}
-    lappend match {    if {$ok} continue}
-    lappend match {    break}
-    lappend match "\}"
-    lappend match {}
-    lappend match {icl_rewind $pos}
-    lappend match {iok_ok}
-    lappend match {return}
-
-    # Final assembly
-
-    set pname [NextProc $t pkleene]
-    set match [list [Proc $pname [join $match \n]]]
-    if {[string length $esupport]} {
-	lappend match {}
-	lappend match $esupport
-    }
-
-    $t set $n MATCH   [Cat "$pname                ; " [Pfx "# " $sexpr]]
-    $t set $n SUPPORT [join $match \n]
-    $t set $n EXPR    $sexpr
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode// {t n} {
-    set args [$t children $n]
-
-    if {![llength $args]} {
-	error "PANIC. Empty choice."
-
-    } elseif {[llength $args] == 1} {
-	# A choice over one branch is no real choice. The code
-	# generated for the child applies here as well.
-
-	set pe [lindex $args 0]
-	$t set $n MATCH   [$t get $pe MATCH]
-	$t set $n SUPPORT [$t get $pe SUPPORT]
-	return
-    }
-
-    # Choice over at least two branches.
-
-    set match   {}
-    set support {}
-    set sexpr   {}
-
-    lappend match {}
-    lappend match {}
-    lappend match {variable ok}
-    lappend match {}
-    lappend match {set pos [icl_get]}
-    foreach pe $args {
-	lappend match {}
-
-	set ematch   [$t get $pe MATCH]
-	set esupport [$t get $pe SUPPORT]
-	set eexpr    [$t get $pe EXPR]
-	set egen     [$t get $pe gen]
-
-	# Note: We do not check for static match results. Doing so is
-	# an optimization we can do earlier, directly on the tree.
-
-	lappend sexpr $eexpr
-
-	if {[string length $esupport]} {
-	    lappend support {}
-	    lappend support $esupport
-	}
-
-	if {$egen} {
-	    lappend match "set mrk \[ias_mark\]"
-	}
-
-	lappend match "set old \[ier_get\]"
-	lappend match $ematch
-	lappend match "ier_merge \$old"
-	lappend match {}
-	lappend match "if \{\$ok\} return"
-
-	if {$egen} {
-	    lappend match "ias_pop2mark \$mrk"
-	}
-	lappend match "icl_rewind   \$pos"
-    }
-    lappend match {}
-    lappend match return
-
-    # Final assembly
-
-    set sexpr "[Cat "(/ " [join $sexpr \n]])"
-    set match [linsert $match 1 [Pfx "# " $sexpr]]
-
-    set pname [NextProc $t bra]
-    set match [list [Proc $pname [join $match \n]]]
-    if {[llength $support]} {
-	lappend match {}
-	lappend match [join [lrange $support 1 end] \n]
-    }
-
-    $t set $n MATCH   [Cat "$pname                ; " [Pfx "# " $sexpr]]
-    $t set $n SUPPORT [join $match \n]
-    $t set $n EXPR    $sexpr
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/x {t n} {
-    set args [$t children $n]
-
-    if {![llength $args]} {
-	error "PANIC. Empty sequence."
-
-    } elseif {[llength $args] == 1} {
-	# A sequence of one element is no real sequence. The code
-	# generated for the child applies here as well.
-
-	set pe [lindex $args 0]
-	$t set $n MATCH   [$t get $pe MATCH]
-	$t set $n SUPPORT [$t get $pe SUPPORT]
-	$t set $n EXPR    [$t get $pe EXPRE]
-	return
-    }
-
-    # Sequence of at least two elements.
-
-    set match   {}
-    set support {}
-    set sexpr   {}
-    set gen     0
-
-    lappend match {}
-    lappend match {}
-    lappend match {variable ok}
-    lappend match {}
-    lappend match {set pos [icl_get]}
-
-    foreach pe $args {
-	lappend match {}
-
-	set ematch   [$t get $pe MATCH]
-	set esupport [$t get $pe SUPPORT]
-	set eexpr    [$t get $pe EXPR]
-	set egen     [$t get $pe gen]
-
-	lappend sexpr $eexpr
-
-	if {[string length $esupport]} {
-	    lappend support {}
-	    lappend support $esupport
-	}
-
-	if {$egen && !$gen} {
-	    # From here on out is the sequence
-	    # able to generate semantic values
-	    # which have to be canceled when
-	    # backtracking.
-
-	    lappend match "set mrk \[ias_mark\]"
-	    lappend match {}
-	    set gen 1
-	}
-
-	lappend match "set old \[ier_get\]"
-	lappend match $ematch
-	lappend match "ier_merge \$old"
-	lappend match {}
-
-	if {$gen} {
-	    lappend match "if \{!\$ok\} \{"
-	    lappend match "    ias_pop2mark \$mrk"
-	    lappend match "    icl_rewind   \$pos"
-	    lappend match "    return"
-	    lappend match "\}"
-	} else {
-	    lappend match "if \{!\$ok\} \{icl_rewind \$pos \; return\}"
-	}
-    }
-    lappend match {}
-    lappend match return
-
-    # Final assembly
-
-    set sexpr "[Cat "(x " [join $sexpr \n]])"
-    set match [linsert $match 1 [Pfx "# " $sexpr]]
-
-    set pname [NextProc $t seq]
-    set match [list [Proc $pname [join $match \n]]]
-    if {[llength $support]} {
-	lappend match {}
-	lappend match [join [lrange $support 1 end] \n]
-    }
-
-    $t set $n MATCH   [Cat "$pname                ; " [Pfx "# " $sexpr]]
-    $t set $n SUPPORT [join $match \n]
-    $t set $n EXPR    $sexpr
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/& {t n} {
-    SynthLookahead $t $n no
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/! {t n} {
-    SynthLookahead $t $n yes
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/dot {t n} {
-    SynthTerminal $t $n \
-	    "any character" {}
-    $t set $n EXPR "(dot)"
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/epsilon {t n} {
-    $t set $n MATCH   iok_ok
-    $t set $n SUPPORT {}
-    $t set $n EXPR "(epsilon)"
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/alnum {t n} {
-    SynthClass $t $n alnum
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/alpha {t n} {
-    SynthClass $t $n alpha
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/.. {t n} {
-    # Range is [x-y]
-
-    set b [$t get $n begin]
-    set e [$t get $n end]
-
-    set tb [quote'tcl $b]
-    set te [quote'tcl $e]
-
-    set pb [quote'tclstr $b]
-    set pe [quote'tclstr $e]
-
-    set cb [quote'tclcom $b]
-    set ce [quote'tclcom $e]
-
-    SynthTerminal $t $n \
-	    "\\\[${pb}..${pe}\\\]" \
-	    "ict_match_tokrange $tb $te"
-    $t set $n EXPR "(.. $cb $ce)"
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/t {t n} {
-    # Terminal node. Primitive matching.
-    # Code is parameterized by gen(X) of this node X.
-
-    set ch  [$t get $n char]
-    set tch [quote'tcl    $ch]
-    set pch [quote'tclstr $ch]
-    set cch [quote'tclcom $ch]
-
-    SynthTerminal $t $n \
-	    $pch \
-	    "ict_match_token $tch"
-    $t set $n EXPR    "(t $cch)"
-    return
-}
-
-proc ::page::gen::peg::me::SynthNode/n {t n} {
-    # Nonterminal node. Primitive matching.
-    # The code is parameterized by acc(X) of this node X, and gen(D)
-    # of the invoked nonterminal D.
-
-    set sym   [$t get $n sym]
-    set def   [$t get $n def]
-
-    if {$def eq ""} {
-	# Invokation of an undefined nonterminal. This will always fail.
-	set match "iok_fail ; # Match for undefined symbol '$sym'."
-    } else {
-	# Combinations
-	# Acc Gen Action
-	# --- --- ------
-	#   0   0 Plain match
-	#   0   1 Match with canceling of the semantic value.
-	#   1   0 Plain match
-	#   1   1 Plain match
-	# --- --- ------
-
-	if {[$t get $n acc] || ![$t get $def gen]} {
-	    set match [Call $sym]
-	} else {
-	    set     match {}
-	    lappend match "set p$sym \[ias_mark\]"
-	    lappend match [Call $sym]
-	    lappend match "ias_pop2mark \$p$sym"
-	    set match [join $match \n]
-	}
-    }
-
-    set sexpr "(n $sym)"
-    $t set $n EXPR    $sexpr
-    $t set $n MATCH   "$match    ; # $sexpr"
-    $t set $n SUPPORT {}
-    return
-}
-
-proc ::page::gen::peg::me::SynthLookahead {t n negated} {
-    # Note: Per the rules about expression modes (! is a lookahead
-    # ____| operator) this node has a mode of 'discard', and its child
-    # ____| has so as well.
-
-    # assert t get n  mode == discard
-    # assert t get pe mode == discard
-
-    set op       [$t get $n op]
-    set pe       [lindex [$t children $n] 0]
-    set eop      [$t get $pe op]
-    set ematch   [$t get $pe MATCH]
-    set esupport [$t get $pe SUPPORT]
-    set eexpr    [$t get $pe EXPR]
-    set pname    [NextProc $t bang]
-
-    set     match {}
-
-    if {
-	($eop eq "t")     || ($eop eq "..") ||
-	($eop eq "alpha") || ($eop eq "alnum")
-    } {
-	# Required iff !dot
-	# Support for terminal expression 
-	lappend match {variable ok}
-	lappend match {}
-    }
-
-    lappend match {set pos [icl_get]}
-    lappend match {}
-    lappend match $ematch
-    lappend match {}
-    lappend match {icl_rewind $pos}
-
-    if {$negated} {
-	lappend match {iok_negate}
-    }
-
-    lappend match return
-
-    set match [list [Proc $pname [join $match \n]]]
-    if {[string length $esupport]} {
-	lappend match {}
-	lappend match $esupport
-    }
-
-    $t set $n MATCH   $pname
-    $t set $n SUPPORT [join $match \n]
-    $t set $n EXPR    "($op $eexpr)"
-    return
-}
-
-proc ::page::gen::peg::me::SynthClass {t n op} {
-    SynthTerminal $t $n \
-	    <$op> \
-	    "ict_match_tokclass $op"
-    $t set $n EXPR ($op)
-    return
-}
-
-proc ::page::gen::peg::me::SynthTerminal {t n msg cmd} {
-    set     match {}
-    lappend match "ict_advance \"Expected $msg (got EOF)\""
-
-    if {$cmd ne ""} {
-	lappend match "if \{\$ok\} \{$cmd \"Expected $msg\"\}"
-    }
-    if {[$t get $n gen]} {
-	lappend match "if \{\$ok\} isv_terminal"
-    }
-
-    $t set $n MATCH   [join $match \n]
-    $t set $n SUPPORT {}
-    return
-}
-
-proc ::page::gen::peg::me::Call {sym} {
-    # Generator for proc names (nonterminal symbols).
-    return matchSymbol_$sym
-}
-
-proc ::page::gen::peg::me::NextProc {t {mark {}}} {
-    set  count [$t get root Pcount]
-    incr count
-    $t set root Pcount $count
-    return e$mark$count
-}
-
-proc ::page::gen::peg::me::Proc {name body} {
-    set     script {}
-    lappend script "proc ::@PKG@::$name \{\} \{"
-    lappend script [::textutil::indent $body "    "]
-    lappend script "\}"
-    return [join $script \n]
-}
-
-proc ::page::gen::peg::me::Cat {prefix suffix} {
-    return "$prefix[textutil::indent $suffix [textutil::blank [string length $prefix]] 1]"
-}
-
-proc ::page::gen::peg::me::Pfx {prefix suffix} {
-    return [textutil::indent $suffix $prefix]
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::me {
-
-    variable here          [file dirname [info script]]
-    variable template_file [file join $here gen_peg_me.template]
-
-    variable ch
-    variable template \
-	[string trimright [read [set ch [open $template_file r]]][close $ch]]
-    unset ch
-
-    variable package   ""
-    variable copyright ""
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::me 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_mecpu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_mecpu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,289 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - Generate a grammar::me::cpu based parser.
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-
-## The input is a grammar, not as tree, but as a list of instructions
-## (symbolic form). This backend converts that into machinecode for
-## grammar::m::cpu::core and inserts the result into a template file.
-
-## The translation from grammar tree to assembler code was done in a
-## preceding transformation.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-
-package require grammar::me::cpu::core
-package require textutil
-
-#package require page::analysis::peg::emodes
-#package require page::util::quote
-#package require page::util::peg
-
-namespace eval ::page::gen::peg::mecpu {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::mecpu::package {text} {
-    variable package $text
-    return
-}
-
-proc ::page::gen::peg::mecpu::copyright {text} {
-    variable copyright $text
-    return
-}
-
-proc ::page::gen::peg::mecpu::template {path} {
-    variable template $path
-    return
-}
-
-proc ::page::gen::peg::mecpu::cmarker {list} {
-    variable cmarker $list
-    return
-}
-
-proc ::page::gen::peg::mecpu {asmcode chan} {
-
-    # asmcode     = list (name code)
-    # code        = list (instruction)
-    # instruction = list (label name arg...)
-
-    variable mecpu::package
-    variable mecpu::copyright
-    variable mecpu::cmarker
-    variable mecpu::template
-    variable mecpu::template_file
-
-    # Import the config options, provide fallback to defaults for the
-    # unspecified parts.
-
-    set gname [lindex $asmcode 0]
-    set gcode [lindex $asmcode 1]
-
-    if {$package eq ""} {set package $gname}
-
-    page_info "  Grammar:   $gname"
-    page_info "  Package:   $package"
-
-    if {$copyright ne ""} {
-	page_info "  Copyright: $copyright"
-	set copyright "\#\# (C) $copyright\n"
-    }
-
-    if {$template eq ""} {
-	set template $template_file
-    }
-
-    page_info "  Template:  $template"
-
-    # Translate the incoming assembler to machine code.
-
-    set mcode [grammar::me::cpu::core::asm $gcode]
-
-    # We know that the machine code has three parts (instructions,
-    # string pool, token map). We take the data apart to allow separate
-    # insertion if the template so chooses (like for readability).
-
-    foreach {minsn mpool mtmap} $mcode break
-
-    set fminsn {} ; set i 0 ; set j 19
-    while {$i < [llength $minsn]} {
-	append fminsn "         [lrange $minsn $i $j]\n"
-	incr i 20 ; incr j 20
-    }
-
-    set fmpool {} ; set i 0 ; set j 4
-    while {$i < [llength $mpool]} {
-	append fmpool "         [lrange $mpool $i $j]\n"
-	incr i 5 ; incr j 5
-    }
-
-    # ------------------------------------
-    # We also generate a readable representation of the assembler
-    # instructions for insertion into a comment area.
-
-    set asmp [mecpu::2readable $gcode $minsn]
-
-    # ------------------------------------
-
-    # And write the modified template
-    puts $chan [string map [list  \
-		@NAME@ $gname     \
-	        @PKG@  $package   \
-	        @COPY@ $copyright \
-		@CODE@ $mcode     \
-		@INSN@ $minsn     \
-		@FNSN@ $fminsn    \
-		@POOL@ $mpool     \
-		@FPOL@ $fmpool    \
-		@TMAP@ $mtmap     \
-		@ASMP@ $asmp      \
-	       ] [mecpu::Template]]
-    return
-}
-
-proc ::page::gen::peg::mecpu::Template {} {
-    variable template
-    return [string trimright [read [set ch [open $template r]]][close $ch]]
-}
-
-proc ::page::gen::peg::mecpu::2readable {asmcode mecode} {
-    return [2print $asmcode $mecode max [widths $asmcode max]]
-}
-
-proc ::page::gen::peg::mecpu::widths {asmcode mv} {
-    upvar 1 $mv max
-
-    # First iteration, column widths (instructions, and arguments).
-    # Ignore comments, they go across all columns.
-    # Also ignore labels (lrange 1 ..).
-
-    set mc 0
-    foreach insn $asmcode {
-	set i [lindex $insn 1]
-	if {$i eq ".C"} continue
-	set col 0
-
-	foreach x [lrange $insn 1 end] {
-	    set xlen [string length $x]
-	    if {![info exists max($col)] || ($xlen > $max($col))} {set max($col) $xlen}
-	    incr col
-
-	    # Shift the strings of various commands into the third
-	    # column, if they are not already there.
-
-	    if {$i eq "ier_nonterminal"}        {incr col ; set i ""}
-	    if {$i eq "isv_nonterminal_leaf"}   {incr col ; set i ""}
-	    if {$i eq "isv_nonterminal_range"}  {incr col ; set i ""}
-	    if {$i eq "isv_nonterminal_reduce"} {incr col ; set i ""}
-	    if {$i eq "inc_save"}               {incr col ; set i ""}
-	    if {$i eq "ict_advance"}            {incr col ; set i ""}
-	}
-	if {$col > $mc} {set mc $col}
-    }
-
-    set max($mc) 0
-    return $mc
-}
-
-proc ::page::gen::peg::mecpu::2print {asmcode mecode mv mc} {
-    variable cmarker
-    upvar 1 $mv max
-
-    set lines {}
-    set pc    0
-
-    foreach insn $asmcode {
-	foreach {label name} $insn break
-	if {$name  eq ".C"} {lappend lines "" "--  [join [lrange $insn 2 end] " "]" ""}
-	if {$label ne ""}   {lappend lines "       ${label}:" }
-	if {$name  eq ".C"} continue
-
-	set line  " [format %05d $pc]      "
-
-	set  pcs $pc
-	incr pc [llength $insn] ; incr pc -1
-	set  pce $pc ; incr pce -1
-	set  imecode [lrange $mecode $pcs $pce]
-
-	if {
-	    ($name eq "ier_nonterminal") ||
-	    ($name eq "isv_nonterminal_leaf") ||
-	    ($name eq "isv_nonterminal_range") ||
-	    ($name eq "isv_nonterminal_reduce") ||
-	    ($name eq "inc_save") ||
-	    ($name eq "ict_advance")
-	} {
-	    # Shift first argument into 2nd column, and quote it as well.
-	    set insn [lreplace $insn 2 2 "" '[lindex $insn 2]']
-	} elseif {
-	    ($name eq "inc_restore") ||
-	    ($name eq "ict_match_token") ||
-	    ($name eq "ict_match_tokclass")
-	} {
-	    # Command with quoted arguments, no shifting.
-	    set insn [lreplace $insn 3 3 '[lindex $insn 3]']
-	} elseif {
-	    ($name eq "ict_match_tokrange")
-	} {
-	    # Command with quoted arguments, no shifting.
-	    set insn [lreplace $insn 4 4 '[lindex $insn 4]']
-	}
-
-	while {[llength $insn] <= $mc} {lappend insn ""}
-	lappend insn "-- $imecode"
-
-	set col 0
-	foreach x [lrange $insn 1 end] {
-	    set xlen [string length $x]
-	    append line " "
-	    append line $x
-	    append line [string repeat " " [expr {$max($col) - $xlen}]]
-	    incr col
-	}
-
-	lappend lines $line
-    }
-
-    # Wrap the lines into a comment.
-
-    if {$cmarker eq ""} {set cmarker "\#"}
-
-    if {[llength $cmarker] > 1} {
-	# Comments are explictly closed as well.
-
-	foreach {cs ce} $cmarker break
-	return "$cs [join $lines " $ce\n$cs "] $ce"
-    } else {
-	# Comments are not explicitly closed. Implicit by end-of-line
-
-	return "$cmarker [join $lines "\n$cmarker "]"
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::mecpu {
-
-    variable here          [file dirname [info script]]
-    variable template_file [file join $here gen_peg_mecpu.template]
-
-    variable package   ""
-    variable copyright ""
-    variable template  ""
-    variable cmarker   ""
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::mecpu 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_ser.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_peg_ser.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,63 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - PEG as serialized PEG container.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::peg
-package require page::util::quote
-package require page::util::peg
-
-namespace eval ::page::gen::peg::ser {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl), and other utilities.
-
-    namespace import ::page::util::quote::*
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::peg::ser {t chan} {
-    ser::printWarnings [ser::getWarnings $t]
-
-    ::grammar::peg gr
-
-    set gstart [$t get root start]
-    if {$gstart ne ""} {
-	gr start [ser::peOf $t $gstart]
-    } else {
-	page_info "No start expression."
-    }
-
-    foreach {sym def} [$t get root definitions] {
-	set eroot [lindex [$t children $def] 0]
-
-	gr nonterminal add  $sym [ser::peOf $t $eroot]
-	gr nonterminal mode $sym [$t get $def mode]
-    }
-
-    puts $chan [gr serialize]
-    gr destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::peg::ser::GetRules {t} {
-    return $res
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::gen::peg::ser {}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::peg::ser 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_tree_text.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/gen_tree_text.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,94 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Backend - Dump (A)ST for inspection.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::quote
-
-namespace eval ::page::gen::tree::text {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl)
-
-    namespace import ::page::util::quote::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::gen::tree::text {t chan} {
-    set indent ""
-    set bystr  "  "
-    set bysiz  [string length $bystr]
-    set byoff  end-$bysiz
-
-    $t walk root -order both -type dfs {a n} {
-	if {$a eq "enter"} {
-	    text::WriteNode $indent $chan $t $n
-	    append indent $bystr
-	} else {
-	    set indent [string range $indent 0 $byoff]
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::gen::tree::text::WriteNode {indent chan t n} {
-    array set attr [$t getall $n]
-
-    if {[array size attr] == 0} {
-	puts $chan "$indent$n <>"
-    } else {
-	puts -nonewline $chan "$indent$n < "
-
-	set max -1
-	set d {}
-	foreach k [array names attr] {
-	    set l [string length $k]
-	    if {$l > $max} {set max $l}
-	    lappend d [list $k [Quote $attr($k)] $l]
-	}
-
-	if {[llength $d] == 1} {
-	    puts $chan "$k = $attr($k) >"
-	    return
-	}
-
-	set first 1
-	set space $indent[string repeat " " [string length "$n < "]]
-
-	foreach e [lsort -dict -index 0 $d] {
-	    foreach {k v l} $e break
-	    set off [string repeat " " [expr {$max-$l}]]
-
-	    if {$first} {
-		puts -nonewline $chan "$k$off = $v"
-		set first 0
-	    } else {
-		puts -nonewline $chan "\n$space$k$off = $v"
-	    }
-	}
-
-	puts $chan " >"
-    }
-}
-
-proc ::page::gen::tree::text::Quote {str} {
-    return $str
-
-    set res ""
-    foreach c [split $str {}] {
-	append res [quote'tcl $c]
-    }
-    return $res
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::gen::tree::text 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_lemon.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_lemon.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,7420 +1,0 @@
-# -*- tcl -*-
-## Parsing Expression Grammar 'page::parse::lemon'.
-## RD parser by the PG backend 'MEwriter'.
-
-# ### ### ### ######### ######### #########
-## Package description
-
-# The commands provided here match an input provided through a buffer
-# command to the PE grammar 'page::parse::lemon'. The parser is based on the package
-# 'grammar::mengine' (recursive-descent, packrat, pulling chars,
-# pushing the generated AST).
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::me::tcl
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::page::parse::lemon {
-    # Import the virtual machine for matching.
-
-    namespace import ::grammar::me::tcl::*
-    upvar #0 ::grammar::me::tcl::ok ok
-}
-
-# ### ### ### ######### ######### #########
-## API Implementation.
-
-proc ::page::parse::lemon::parse {nxcmd emvar astvar} {
-    variable ok
-    variable se
-
-    upvar 1 $emvar emsg $astvar ast
-
-    init $nxcmd
-
-    matchSymbol_LemonGrammar    ; # (n LemonGrammar)
-
-    isv_nonterminal_reduce ALL -1
-    set ast [sv]
-    if {!$ok} {
-        foreach {l m} [ier_get] break
-        lappend l [lc $l]
-	set mx {}
-	foreach x $m {lappend mx "Expected $x"}
-        set emsg [list $l $mx]
-    }
-
-    return $ok
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper methods
-
-# Grammar 'page::parse::lemon'
-#
-# ASSIGN = (x (t :)
-#             (t :)
-#             (t =)
-#             (n SPACE))
-#
-# C_COMMENT = (x (n CCOM_OPEN)
-#                (* (x (! (n CCOM_CLOSE))
-#                      (dot)))
-#                (n CCOM_CLOSE))
-#
-# CCOM_CLOSE = (x (t *)
-#                 (t /))
-#
-# CCOM_OPEN = (x (t /)
-#                (t *))
-#
-# Code = (x (n DCODE)
-#           (n Codeblock))
-#
-# Codeblock = (x (n LBRACE)
-#                (* (/ (n Codeblock)
-#                      (n C_COMMENT)
-#                      (n Cplusplus_COMMENT)
-#                      (x (! (n RBRACE))
-#                         (dot))))
-#                (n RBRACE))
-#
-# Cplusplus_COMMENT = (x (t /)
-#                        (t /)
-#                        (* (x (! (n EOL))
-#                              (dot)))
-#                        (n EOL))
-#
-# DCODE = (x (t c)
-#            (t o)
-#            (t d)
-#            (t e)
-#            (n SPACE))
-#
-# DDEFDEST = (x (t d)
-#               (t e)
-#               (t f)
-#               (t a)
-#               (t u)
-#               (t l)
-#               (t t)
-#               (t _)
-#               (t d)
-#               (t e)
-#               (t s)
-#               (t t)
-#               (t r)
-#               (t u)
-#               (t c)
-#               (t t)
-#               (t o)
-#               (t r)
-#               (n SPACE))
-#
-# DDEFTYPE = (x (t d)
-#               (t e)
-#               (t f)
-#               (t a)
-#               (t u)
-#               (t l)
-#               (t t)
-#               (t _)
-#               (t t)
-#               (t y)
-#               (t p)
-#               (t e)
-#               (n SPACE))
-#
-# DDEST = (x (t d)
-#            (t e)
-#            (t s)
-#            (t t)
-#            (t r)
-#            (t u)
-#            (t c)
-#            (t t)
-#            (t o)
-#            (t r)
-#            (n SPACE))
-#
-# DefaultDestructor = (x (n DDEFDEST)
-#                        (n Identifier)
-#                        (n Codeblock))
-#
-# DefaultType = (x (n DDEFTYPE)
-#                  (n Codeblock))
-#
-# Definition = (* (x (n Identifier)
-#                    (? (n Label))))
-#
-# DENDIF = (x (t %)
-#             (t e)
-#             (t n)
-#             (t d)
-#             (t i)
-#             (t f)
-#             (n SPACE))
-#
-# Destructor = (x (n DDEST)
-#                 (n Identifier)
-#                 (n Codeblock))
-#
-# DEXTRA = (x (t e)
-#             (t x)
-#             (t t)
-#             (t r)
-#             (t a)
-#             (t _)
-#             (t a)
-#             (t r)
-#             (t g)
-#             (t u)
-#             (t m)
-#             (t e)
-#             (t n)
-#             (t t)
-#             (n SPACE))
-#
-# DFALLBK = (x (t f)
-#              (t a)
-#              (t l)
-#              (t l)
-#              (t b)
-#              (t a)
-#              (t c)
-#              (t k)
-#              (n SPACE))
-#
-# DIFDEF = (x (t %)
-#             (t i)
-#             (t f)
-#             (t d)
-#             (t e)
-#             (t f)
-#             (n SPACE))
-#
-# DIFNDEF = (x (t %)
-#              (t i)
-#              (t f)
-#              (t n)
-#              (t d)
-#              (t e)
-#              (t f)
-#              (n SPACE))
-#
-# DINCL = (x (t i)
-#            (t n)
-#            (t c)
-#            (t l)
-#            (t u)
-#            (t d)
-#            (t e)
-#            (n SPACE))
-#
-# DINTRO = (t %)
-#
-# Directive = (x (n DINTRO)
-#                (/ (n Code)
-#                   (n DefaultDestructor)
-#                   (n DefaultType)
-#                   (n Destructor)
-#                   (n ExtraArgument)
-#                   (n Include)
-#                   (n Left)
-#                   (n Name)
-#                   (n Nonassoc)
-#                   (n ParseAccept)
-#                   (n ParseFailure)
-#                   (n Right)
-#                   (n StackOverflow)
-#                   (n Stacksize)
-#                   (n StartSymbol)
-#                   (n SyntaxError)
-#                   (n TokenDestructor)
-#                   (n TokenPrefix)
-#                   (n TokenType)
-#                   (n Type)
-#                   (n Fallback)))
-#
-# DLEFT = (x (t l)
-#            (t e)
-#            (t f)
-#            (t t)
-#            (n SPACE))
-#
-# DNAME = (x (t n)
-#            (t a)
-#            (t m)
-#            (t e)
-#            (n SPACE))
-#
-# DNON = (x (t n)
-#           (t o)
-#           (t n)
-#           (t a)
-#           (t s)
-#           (t s)
-#           (t o)
-#           (t c)
-#           (n SPACE))
-#
-# DOT = (x (t .)
-#          (n SPACE))
-#
-# DPACC = (x (t p)
-#            (t a)
-#            (t r)
-#            (t s)
-#            (t e)
-#            (t _)
-#            (t a)
-#            (t c)
-#            (t c)
-#            (t e)
-#            (t p)
-#            (t t)
-#            (n SPACE))
-#
-# DPFAIL = (x (t p)
-#             (t a)
-#             (t r)
-#             (t s)
-#             (t e)
-#             (t _)
-#             (t f)
-#             (t a)
-#             (t i)
-#             (t l)
-#             (t u)
-#             (t r)
-#             (t e)
-#             (n SPACE))
-#
-# DRIGHT = (x (t r)
-#             (t i)
-#             (t g)
-#             (t h)
-#             (t t)
-#             (n SPACE))
-#
-# DSTART = (x (t s)
-#             (t t)
-#             (t a)
-#             (t r)
-#             (t t)
-#             (t _)
-#             (t s)
-#             (t y)
-#             (t m)
-#             (t b)
-#             (t o)
-#             (t l)
-#             (n SPACE))
-#
-# DSTKOVER = (x (t s)
-#               (t t)
-#               (t a)
-#               (t c)
-#               (t k)
-#               (t _)
-#               (t o)
-#               (t v)
-#               (t e)
-#               (t r)
-#               (t f)
-#               (t l)
-#               (t o)
-#               (t w)
-#               (n SPACE))
-#
-# DSTKSZ = (x (t s)
-#             (t t)
-#             (t a)
-#             (t c)
-#             (t k)
-#             (t _)
-#             (t s)
-#             (t i)
-#             (t z)
-#             (t e)
-#             (n SPACE))
-#
-# DSYNERR = (x (t s)
-#              (t y)
-#              (t n)
-#              (t t)
-#              (t a)
-#              (t x)
-#              (t _)
-#              (t e)
-#              (t r)
-#              (t r)
-#              (t o)
-#              (t r)
-#              (n SPACE))
-#
-# DTOKDEST = (x (t t)
-#               (t o)
-#               (t k)
-#               (t e)
-#               (t n)
-#               (t _)
-#               (t d)
-#               (t e)
-#               (t s)
-#               (t t)
-#               (t r)
-#               (t u)
-#               (t c)
-#               (t t)
-#               (t o)
-#               (t r)
-#               (n SPACE))
-#
-# DTOKPFX = (x (t t)
-#              (t o)
-#              (t k)
-#              (t e)
-#              (t n)
-#              (t _)
-#              (t p)
-#              (t r)
-#              (t e)
-#              (t f)
-#              (t i)
-#              (t x)
-#              (n SPACE))
-#
-# DTOKTYPE = (x (t t)
-#               (t o)
-#               (t k)
-#               (t e)
-#               (t n)
-#               (t _)
-#               (t t)
-#               (t y)
-#               (t p)
-#               (t e)
-#               (n SPACE))
-#
-# DTYPE = (x (t t)
-#            (t y)
-#            (t p)
-#            (t e)
-#            (n SPACE))
-#
-# Endif = (n DENDIF)
-#
-# EOF = (! (dot))
-#
-# EOL = (/ (x (t \r)
-#             (t \n))
-#          (t \r)
-#          (t \n))
-#
-# ExtraArgument = (x (n DEXTRA)
-#                    (n Codeblock))
-#
-# Fallback = (x (n DFALLBK)
-#               (+ (n Identifier))
-#               (n DOT))
-#
-# Ident = (x (/ (alpha)
-#               (t _))
-#            (* (/ (alnum)
-#                  (t _))))
-#
-# Identifier = (x (n Ident)
-#                 (n SPACE))
-#
-# Ifdef = (x (n DIFDEF)
-#            (n Identifier))
-#
-# Ifndef = (x (n DIFNDEF)
-#             (n Identifier))
-#
-# Include = (x (n DINCL)
-#              (n Codeblock))
-#
-# Label = (x (n LPAREN)
-#            (n Identifier)
-#            (n RPAREN))
-#
-# LBRACE = (t \{)
-#
-# LBRACKET = (x (t [)
-#               (n SPACE))
-#
-# Left = (x (n DLEFT)
-#           (+ (n Identifier))
-#           (n DOT))
-#
-# LemonGrammar = (x (n SPACE)
-#                   (+ (n Statement))
-#                   (n EOF))
-#
-# LPAREN = (x (t \()
-#             (n SPACE))
-#
-# Name = (x (n DNAME)
-#           (n Identifier))
-#
-# NatNum = (+ (.. 0 9))
-#
-# NaturalNumber = (x (n NatNum)
-#                    (n SPACE))
-#
-# Nonassoc = (x (n DNON)
-#               (+ (n Identifier))
-#               (n DOT))
-#
-# ParseAccept = (x (n DPACC)
-#                  (n Codeblock))
-#
-# ParseFailure = (x (n DPFAIL)
-#                   (n Codeblock))
-#
-# Precedence = (x (n LBRACKET)
-#                 (n Identifier)
-#                 (n RBRACKET))
-#
-# RBRACE = (t \})
-#
-# RBRACKET = (x (t ])
-#               (n SPACE))
-#
-# Right = (x (n DRIGHT)
-#            (+ (n Identifier))
-#            (n DOT))
-#
-# RPAREN = (x (t \))
-#             (n SPACE))
-#
-# Rule = (x (n Identifier)
-#           (? (n Label))
-#           (n ASSIGN)
-#           (n Definition)
-#           (n DOT)
-#           (? (n Precedence))
-#           (? (n Codeblock)))
-#
-# SPACE = (* (/ (t <blank>)
-#               (t \t)
-#               (t \n)
-#               (t \r)
-#               (n C_COMMENT)
-#               (n Cplusplus_COMMENT)
-#               (n Ifndef)
-#               (n Ifdef)
-#               (n Endif)))
-#
-# StackOverflow = (x (n DSTKOVER)
-#                    (n Codeblock))
-#
-# Stacksize = (x (n DSTKSZ)
-#                (n NaturalNumber))
-#
-# StartSymbol = (x (n DSTART)
-#                  (n Identifier))
-#
-# Statement = (x (/ (n Directive)
-#                   (n Rule))
-#                (n SPACE))
-#
-# SyntaxError = (x (n DSYNERR)
-#                  (n Codeblock))
-#
-# TokenDestructor = (x (n DTOKDEST)
-#                      (n Identifier)
-#                      (n Codeblock))
-#
-# TokenPrefix = (x (n DTOKPFX)
-#                  (n Identifier))
-#
-# TokenType = (x (n DTOKTYPE)
-#                (n Codeblock))
-#
-# Type = (x (n DTYPE)
-#           (n Identifier)
-#           (n Codeblock))
-#
-
-proc ::page::parse::lemon::matchSymbol_ASSIGN {} {
-    # ASSIGN = (x (t :)
-    #             (t :)
-    #             (t =)
-    #             (n SPACE))
-
-    if {[inc_restore ASSIGN]} return
-
-    set pos [icl_get]
-
-    eseq53                ; # (x (t :)
-                            #    (t :)
-                            #    (t =)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               ASSIGN $pos
-    ier_nonterminal        ASSIGN $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq53 {} {
-
-    # (x (t :)
-    #    (t :)
-    #    (t =)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance :
-    if {$ok} {ict_match_token :}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance :
-    if {$ok} {ict_match_token :}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance =
-    if {$ok} {ict_match_token =}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_C_COMMENT {} {
-    # C_COMMENT = (x (n CCOM_OPEN)
-    #                (* (x (! (n CCOM_CLOSE))
-    #                      (dot)))
-    #                (n CCOM_CLOSE))
-
-    if {[inc_restore C_COMMENT]} return
-
-    set pos [icl_get]
-
-    eseq90                ; # (x (n CCOM_OPEN)
-                            #    (* (x (! (n CCOM_CLOSE))
-                            #          (dot)))
-                            #    (n CCOM_CLOSE))
-
-    isv_clear
-    inc_save               C_COMMENT $pos
-    ier_nonterminal        C_COMMENT $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq90 {} {
-
-    # (x (n CCOM_OPEN)
-    #    (* (x (! (n CCOM_CLOSE))
-    #          (dot)))
-    #    (n CCOM_CLOSE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_CCOM_OPEN    ; # (n CCOM_OPEN)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene89                ; # (* (x (! (n CCOM_CLOSE))
-                               #       (dot)))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_CCOM_CLOSE    ; # (n CCOM_CLOSE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ekleene89 {} {
-
-    # (* (x (! (n CCOM_CLOSE))
-    #       (dot)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq88                ; # (x (! (n CCOM_CLOSE))
-                                #    (dot))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::eseq88 {} {
-
-    # (x (! (n CCOM_CLOSE))
-    #    (dot))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang87
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "any character"
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ebang87 {} {
-    set pos [icl_get]
-
-    matchSymbol_CCOM_CLOSE    ; # (n CCOM_CLOSE)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_CCOM_CLOSE {} {
-    # CCOM_CLOSE = (x (t *)
-    #                 (t /))
-
-    if {[inc_restore CCOM_CLOSE]} return
-
-    set pos [icl_get]
-
-    eseq92                ; # (x (t *)
-                            #    (t /))
-
-    isv_clear
-    inc_save               CCOM_CLOSE $pos
-    ier_nonterminal        CCOM_CLOSE $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq92 {} {
-
-    # (x (t *)
-    #    (t /))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance *
-    if {$ok} {ict_match_token *}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance /
-    if {$ok} {ict_match_token /}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_CCOM_OPEN {} {
-    # CCOM_OPEN = (x (t /)
-    #                (t *))
-
-    if {[inc_restore CCOM_OPEN]} return
-
-    set pos [icl_get]
-
-    eseq91                ; # (x (t /)
-                            #    (t *))
-
-    isv_clear
-    inc_save               CCOM_OPEN $pos
-    ier_nonterminal        CCOM_OPEN $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq91 {} {
-
-    # (x (t /)
-    #    (t *))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance /
-    if {$ok} {ict_match_token /}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance *
-    if {$ok} {ict_match_token *}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Code {} {
-    # Code = (x (n DCODE)
-    #           (n Codeblock))
-
-    variable ok
-    if {[inc_restore Code]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq16                ; # (x (n DCODE)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce Code $pos $mrk
-    inc_save               Code $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Code $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq16 {} {
-
-    # (x (n DCODE)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DCODE    ; # (n DCODE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Codeblock {} {
-    # Codeblock = (x (n LBRACE)
-    #                (* (/ (n Codeblock)
-    #                      (n C_COMMENT)
-    #                      (n Cplusplus_COMMENT)
-    #                      (x (! (n RBRACE))
-    #                         (dot))))
-    #                (n RBRACE))
-
-    variable ok
-    if {[inc_restore Codeblock]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq45                ; # (x (n LBRACE)
-                            #    (* (/ (n Codeblock)
-                            #          (n C_COMMENT)
-                            #          (n Cplusplus_COMMENT)
-                            #          (x (! (n RBRACE))
-                            #             (dot))))
-                            #    (n RBRACE))
-
-    isv_nonterminal_range  Codeblock $pos
-    inc_save               Codeblock $pos
-    if {$ok} ias_push
-    ier_nonterminal        Codeblock $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq45 {} {
-
-    # (x (n LBRACE)
-    #    (* (/ (n Codeblock)
-    #          (n C_COMMENT)
-    #          (n Cplusplus_COMMENT)
-    #          (x (! (n RBRACE))
-    #             (dot))))
-    #    (n RBRACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_LBRACE    ; # (n LBRACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene44                ; # (* (/ (n Codeblock)
-                               #       (n C_COMMENT)
-                               #       (n Cplusplus_COMMENT)
-                               #       (x (! (n RBRACE))
-                               #          (dot))))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_RBRACE    ; # (n RBRACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ekleene44 {} {
-
-    # (* (/ (n Codeblock)
-    #       (n C_COMMENT)
-    #       (n Cplusplus_COMMENT)
-    #       (x (! (n RBRACE))
-    #          (dot))))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ebra43                ; # (/ (n Codeblock)
-                                #    (n C_COMMENT)
-                                #    (n Cplusplus_COMMENT)
-                                #    (x (! (n RBRACE))
-                                #       (dot)))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::ebra43 {} {
-
-    # (/ (n Codeblock)
-    #    (n C_COMMENT)
-    #    (n Cplusplus_COMMENT)
-    #    (x (! (n RBRACE))
-    #       (dot)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    set pCodeblock [ias_mark]
-    matchSymbol_Codeblock
-    ias_pop2mark $pCodeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_C_COMMENT    ; # (n C_COMMENT)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_Cplusplus_COMMENT    ; # (n Cplusplus_COMMENT)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    eseq42                ; # (x (! (n RBRACE))
-                            #    (dot))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::eseq42 {} {
-
-    # (x (! (n RBRACE))
-    #    (dot))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang41
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "any character"
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ebang41 {} {
-    set pos [icl_get]
-
-    matchSymbol_RBRACE    ; # (n RBRACE)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Cplusplus_COMMENT {} {
-    # Cplusplus_COMMENT = (x (t /)
-    #                        (t /)
-    #                        (* (x (! (n EOL))
-    #                              (dot)))
-    #                        (n EOL))
-
-    if {[inc_restore Cplusplus_COMMENT]} return
-
-    set pos [icl_get]
-
-    eseq96                ; # (x (t /)
-                            #    (t /)
-                            #    (* (x (! (n EOL))
-                            #          (dot)))
-                            #    (n EOL))
-
-    isv_clear
-    inc_save               Cplusplus_COMMENT $pos
-    ier_nonterminal        Cplusplus_COMMENT $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq96 {} {
-
-    # (x (t /)
-    #    (t /)
-    #    (* (x (! (n EOL))
-    #          (dot)))
-    #    (n EOL))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance /
-    if {$ok} {ict_match_token /}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance /
-    if {$ok} {ict_match_token /}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene95                ; # (* (x (! (n EOL))
-                               #       (dot)))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_EOL    ; # (n EOL)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ekleene95 {} {
-
-    # (* (x (! (n EOL))
-    #       (dot)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq94                ; # (x (! (n EOL))
-                                #    (dot))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::eseq94 {} {
-
-    # (x (! (n EOL))
-    #    (dot))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang93
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "any character"
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ebang93 {} {
-    set pos [icl_get]
-
-    matchSymbol_EOL    ; # (n EOL)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DCODE {} {
-    # DCODE = (x (t c)
-    #            (t o)
-    #            (t d)
-    #            (t e)
-    #            (n SPACE))
-
-    if {[inc_restore DCODE]} return
-
-    set pos [icl_get]
-
-    eseq59                ; # (x (t c)
-                            #    (t o)
-                            #    (t d)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DCODE $pos
-    ier_nonterminal        DCODE $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq59 {} {
-
-    # (x (t c)
-    #    (t o)
-    #    (t d)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DDEFDEST {} {
-    # DDEFDEST = (x (t d)
-    #               (t e)
-    #               (t f)
-    #               (t a)
-    #               (t u)
-    #               (t l)
-    #               (t t)
-    #               (t _)
-    #               (t d)
-    #               (t e)
-    #               (t s)
-    #               (t t)
-    #               (t r)
-    #               (t u)
-    #               (t c)
-    #               (t t)
-    #               (t o)
-    #               (t r)
-    #               (n SPACE))
-
-    if {[inc_restore DDEFDEST]} return
-
-    set pos [icl_get]
-
-    eseq60                ; # (x (t d)
-                            #    (t e)
-                            #    (t f)
-                            #    (t a)
-                            #    (t u)
-                            #    (t l)
-                            #    (t t)
-                            #    (t _)
-                            #    (t d)
-                            #    (t e)
-                            #    (t s)
-                            #    (t t)
-                            #    (t r)
-                            #    (t u)
-                            #    (t c)
-                            #    (t t)
-                            #    (t o)
-                            #    (t r)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DDEFDEST $pos
-    ier_nonterminal        DDEFDEST $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq60 {} {
-
-    # (x (t d)
-    #    (t e)
-    #    (t f)
-    #    (t a)
-    #    (t u)
-    #    (t l)
-    #    (t t)
-    #    (t _)
-    #    (t d)
-    #    (t e)
-    #    (t s)
-    #    (t t)
-    #    (t r)
-    #    (t u)
-    #    (t c)
-    #    (t t)
-    #    (t o)
-    #    (t r)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DDEFTYPE {} {
-    # DDEFTYPE = (x (t d)
-    #               (t e)
-    #               (t f)
-    #               (t a)
-    #               (t u)
-    #               (t l)
-    #               (t t)
-    #               (t _)
-    #               (t t)
-    #               (t y)
-    #               (t p)
-    #               (t e)
-    #               (n SPACE))
-
-    if {[inc_restore DDEFTYPE]} return
-
-    set pos [icl_get]
-
-    eseq61                ; # (x (t d)
-                            #    (t e)
-                            #    (t f)
-                            #    (t a)
-                            #    (t u)
-                            #    (t l)
-                            #    (t t)
-                            #    (t _)
-                            #    (t t)
-                            #    (t y)
-                            #    (t p)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DDEFTYPE $pos
-    ier_nonterminal        DDEFTYPE $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq61 {} {
-
-    # (x (t d)
-    #    (t e)
-    #    (t f)
-    #    (t a)
-    #    (t u)
-    #    (t l)
-    #    (t t)
-    #    (t _)
-    #    (t t)
-    #    (t y)
-    #    (t p)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance y
-    if {$ok} {ict_match_token y}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DDEST {} {
-    # DDEST = (x (t d)
-    #            (t e)
-    #            (t s)
-    #            (t t)
-    #            (t r)
-    #            (t u)
-    #            (t c)
-    #            (t t)
-    #            (t o)
-    #            (t r)
-    #            (n SPACE))
-
-    if {[inc_restore DDEST]} return
-
-    set pos [icl_get]
-
-    eseq62                ; # (x (t d)
-                            #    (t e)
-                            #    (t s)
-                            #    (t t)
-                            #    (t r)
-                            #    (t u)
-                            #    (t c)
-                            #    (t t)
-                            #    (t o)
-                            #    (t r)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DDEST $pos
-    ier_nonterminal        DDEST $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq62 {} {
-
-    # (x (t d)
-    #    (t e)
-    #    (t s)
-    #    (t t)
-    #    (t r)
-    #    (t u)
-    #    (t c)
-    #    (t t)
-    #    (t o)
-    #    (t r)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DefaultDestructor {} {
-    # DefaultDestructor = (x (n DDEFDEST)
-    #                        (n Identifier)
-    #                        (n Codeblock))
-
-    variable ok
-    if {[inc_restore DefaultDestructor]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq17                ; # (x (n DDEFDEST)
-                            #    (n Identifier)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce DefaultDestructor $pos $mrk
-    inc_save               DefaultDestructor $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        DefaultDestructor $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq17 {} {
-
-    # (x (n DDEFDEST)
-    #    (n Identifier)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DDEFDEST    ; # (n DDEFDEST)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DefaultType {} {
-    # DefaultType = (x (n DDEFTYPE)
-    #                  (n Codeblock))
-
-    variable ok
-    if {[inc_restore DefaultType]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq18                ; # (x (n DDEFTYPE)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce DefaultType $pos $mrk
-    inc_save               DefaultType $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        DefaultType $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq18 {} {
-
-    # (x (n DDEFTYPE)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DDEFTYPE    ; # (n DDEFTYPE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Definition {} {
-    # Definition = (* (x (n Identifier)
-    #                    (? (n Label))))
-
-    variable ok
-    if {[inc_restore Definition]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    ekleene11                ; # (* (x (n Identifier)
-                               #       (? (n Label))))
-
-    isv_nonterminal_reduce Definition $pos $mrk
-    inc_save               Definition $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Definition $pos
-    return
-}
-
-proc ::page::parse::lemon::ekleene11 {} {
-
-    # (* (x (n Identifier)
-    #       (? (n Label))))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq10                ; # (x (n Identifier)
-                                #    (? (n Label)))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::eseq10 {} {
-
-    # (x (n Identifier)
-    #    (? (n Label)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    eopt9                ; # (? (n Label))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::eopt9 {} {
-
-    # (? (n Label))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Label    ; # (n Label)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DENDIF {} {
-    # DENDIF = (x (t %)
-    #             (t e)
-    #             (t n)
-    #             (t d)
-    #             (t i)
-    #             (t f)
-    #             (n SPACE))
-
-    if {[inc_restore DENDIF]} return
-
-    set pos [icl_get]
-
-    eseq82                ; # (x (t %)
-                            #    (t e)
-                            #    (t n)
-                            #    (t d)
-                            #    (t i)
-                            #    (t f)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DENDIF $pos
-    ier_nonterminal        DENDIF $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq82 {} {
-
-    # (x (t %)
-    #    (t e)
-    #    (t n)
-    #    (t d)
-    #    (t i)
-    #    (t f)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance %
-    if {$ok} {ict_match_token %}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Destructor {} {
-    # Destructor = (x (n DDEST)
-    #                 (n Identifier)
-    #                 (n Codeblock))
-
-    variable ok
-    if {[inc_restore Destructor]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq19                ; # (x (n DDEST)
-                            #    (n Identifier)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce Destructor $pos $mrk
-    inc_save               Destructor $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Destructor $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq19 {} {
-
-    # (x (n DDEST)
-    #    (n Identifier)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DDEST    ; # (n DDEST)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DEXTRA {} {
-    # DEXTRA = (x (t e)
-    #             (t x)
-    #             (t t)
-    #             (t r)
-    #             (t a)
-    #             (t _)
-    #             (t a)
-    #             (t r)
-    #             (t g)
-    #             (t u)
-    #             (t m)
-    #             (t e)
-    #             (t n)
-    #             (t t)
-    #             (n SPACE))
-
-    if {[inc_restore DEXTRA]} return
-
-    set pos [icl_get]
-
-    eseq63                ; # (x (t e)
-                            #    (t x)
-                            #    (t t)
-                            #    (t r)
-                            #    (t a)
-                            #    (t _)
-                            #    (t a)
-                            #    (t r)
-                            #    (t g)
-                            #    (t u)
-                            #    (t m)
-                            #    (t e)
-                            #    (t n)
-                            #    (t t)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DEXTRA $pos
-    ier_nonterminal        DEXTRA $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq63 {} {
-
-    # (x (t e)
-    #    (t x)
-    #    (t t)
-    #    (t r)
-    #    (t a)
-    #    (t _)
-    #    (t a)
-    #    (t r)
-    #    (t g)
-    #    (t u)
-    #    (t m)
-    #    (t e)
-    #    (t n)
-    #    (t t)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance x
-    if {$ok} {ict_match_token x}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance g
-    if {$ok} {ict_match_token g}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance m
-    if {$ok} {ict_match_token m}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DFALLBK {} {
-    # DFALLBK = (x (t f)
-    #              (t a)
-    #              (t l)
-    #              (t l)
-    #              (t b)
-    #              (t a)
-    #              (t c)
-    #              (t k)
-    #              (n SPACE))
-
-    if {[inc_restore DFALLBK]} return
-
-    set pos [icl_get]
-
-    eseq79                ; # (x (t f)
-                            #    (t a)
-                            #    (t l)
-                            #    (t l)
-                            #    (t b)
-                            #    (t a)
-                            #    (t c)
-                            #    (t k)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DFALLBK $pos
-    ier_nonterminal        DFALLBK $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq79 {} {
-
-    # (x (t f)
-    #    (t a)
-    #    (t l)
-    #    (t l)
-    #    (t b)
-    #    (t a)
-    #    (t c)
-    #    (t k)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance b
-    if {$ok} {ict_match_token b}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DIFDEF {} {
-    # DIFDEF = (x (t %)
-    #             (t i)
-    #             (t f)
-    #             (t d)
-    #             (t e)
-    #             (t f)
-    #             (n SPACE))
-
-    if {[inc_restore DIFDEF]} return
-
-    set pos [icl_get]
-
-    eseq80                ; # (x (t %)
-                            #    (t i)
-                            #    (t f)
-                            #    (t d)
-                            #    (t e)
-                            #    (t f)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DIFDEF $pos
-    ier_nonterminal        DIFDEF $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq80 {} {
-
-    # (x (t %)
-    #    (t i)
-    #    (t f)
-    #    (t d)
-    #    (t e)
-    #    (t f)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance %
-    if {$ok} {ict_match_token %}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DIFNDEF {} {
-    # DIFNDEF = (x (t %)
-    #              (t i)
-    #              (t f)
-    #              (t n)
-    #              (t d)
-    #              (t e)
-    #              (t f)
-    #              (n SPACE))
-
-    if {[inc_restore DIFNDEF]} return
-
-    set pos [icl_get]
-
-    eseq81                ; # (x (t %)
-                            #    (t i)
-                            #    (t f)
-                            #    (t n)
-                            #    (t d)
-                            #    (t e)
-                            #    (t f)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DIFNDEF $pos
-    ier_nonterminal        DIFNDEF $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq81 {} {
-
-    # (x (t %)
-    #    (t i)
-    #    (t f)
-    #    (t n)
-    #    (t d)
-    #    (t e)
-    #    (t f)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance %
-    if {$ok} {ict_match_token %}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DINCL {} {
-    # DINCL = (x (t i)
-    #            (t n)
-    #            (t c)
-    #            (t l)
-    #            (t u)
-    #            (t d)
-    #            (t e)
-    #            (n SPACE))
-
-    if {[inc_restore DINCL]} return
-
-    set pos [icl_get]
-
-    eseq64                ; # (x (t i)
-                            #    (t n)
-                            #    (t c)
-                            #    (t l)
-                            #    (t u)
-                            #    (t d)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DINCL $pos
-    ier_nonterminal        DINCL $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq64 {} {
-
-    # (x (t i)
-    #    (t n)
-    #    (t c)
-    #    (t l)
-    #    (t u)
-    #    (t d)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DINTRO {} {
-    # DINTRO = (t %)
-
-    variable ok
-    if {[inc_restore DINTRO]} return
-
-    set pos [icl_get]
-
-    ict_advance %
-    if {$ok} {ict_match_token %}
-
-    isv_clear
-    inc_save               DINTRO $pos
-    ier_nonterminal        DINTRO $pos
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Directive {} {
-    # Directive = (x (n DINTRO)
-    #                (/ (n Code)
-    #                   (n DefaultDestructor)
-    #                   (n DefaultType)
-    #                   (n Destructor)
-    #                   (n ExtraArgument)
-    #                   (n Include)
-    #                   (n Left)
-    #                   (n Name)
-    #                   (n Nonassoc)
-    #                   (n ParseAccept)
-    #                   (n ParseFailure)
-    #                   (n Right)
-    #                   (n StackOverflow)
-    #                   (n Stacksize)
-    #                   (n StartSymbol)
-    #                   (n SyntaxError)
-    #                   (n TokenDestructor)
-    #                   (n TokenPrefix)
-    #                   (n TokenType)
-    #                   (n Type)
-    #                   (n Fallback)))
-
-    variable ok
-    if {[inc_restore Directive]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq15                ; # (x (n DINTRO)
-                            #    (/ (n Code)
-                            #       (n DefaultDestructor)
-                            #       (n DefaultType)
-                            #       (n Destructor)
-                            #       (n ExtraArgument)
-                            #       (n Include)
-                            #       (n Left)
-                            #       (n Name)
-                            #       (n Nonassoc)
-                            #       (n ParseAccept)
-                            #       (n ParseFailure)
-                            #       (n Right)
-                            #       (n StackOverflow)
-                            #       (n Stacksize)
-                            #       (n StartSymbol)
-                            #       (n SyntaxError)
-                            #       (n TokenDestructor)
-                            #       (n TokenPrefix)
-                            #       (n TokenType)
-                            #       (n Type)
-                            #       (n Fallback)))
-
-    isv_nonterminal_reduce Directive $pos $mrk
-    inc_save               Directive $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Directive $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq15 {} {
-
-    # (x (n DINTRO)
-    #    (/ (n Code)
-    #       (n DefaultDestructor)
-    #       (n DefaultType)
-    #       (n Destructor)
-    #       (n ExtraArgument)
-    #       (n Include)
-    #       (n Left)
-    #       (n Name)
-    #       (n Nonassoc)
-    #       (n ParseAccept)
-    #       (n ParseFailure)
-    #       (n Right)
-    #       (n StackOverflow)
-    #       (n Stacksize)
-    #       (n StartSymbol)
-    #       (n SyntaxError)
-    #       (n TokenDestructor)
-    #       (n TokenPrefix)
-    #       (n TokenType)
-    #       (n Type)
-    #       (n Fallback)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DINTRO    ; # (n DINTRO)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ebra14                ; # (/ (n Code)
-                            #    (n DefaultDestructor)
-                            #    (n DefaultType)
-                            #    (n Destructor)
-                            #    (n ExtraArgument)
-                            #    (n Include)
-                            #    (n Left)
-                            #    (n Name)
-                            #    (n Nonassoc)
-                            #    (n ParseAccept)
-                            #    (n ParseFailure)
-                            #    (n Right)
-                            #    (n StackOverflow)
-                            #    (n Stacksize)
-                            #    (n StartSymbol)
-                            #    (n SyntaxError)
-                            #    (n TokenDestructor)
-                            #    (n TokenPrefix)
-                            #    (n TokenType)
-                            #    (n Type)
-                            #    (n Fallback))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::ebra14 {} {
-
-    # (/ (n Code)
-    #    (n DefaultDestructor)
-    #    (n DefaultType)
-    #    (n Destructor)
-    #    (n ExtraArgument)
-    #    (n Include)
-    #    (n Left)
-    #    (n Name)
-    #    (n Nonassoc)
-    #    (n ParseAccept)
-    #    (n ParseFailure)
-    #    (n Right)
-    #    (n StackOverflow)
-    #    (n Stacksize)
-    #    (n StartSymbol)
-    #    (n SyntaxError)
-    #    (n TokenDestructor)
-    #    (n TokenPrefix)
-    #    (n TokenType)
-    #    (n Type)
-    #    (n Fallback))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Code    ; # (n Code)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_DefaultDestructor    ; # (n DefaultDestructor)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_DefaultType    ; # (n DefaultType)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Destructor    ; # (n Destructor)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_ExtraArgument    ; # (n ExtraArgument)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Include    ; # (n Include)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Left    ; # (n Left)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Name    ; # (n Name)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Nonassoc    ; # (n Nonassoc)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_ParseAccept    ; # (n ParseAccept)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_ParseFailure    ; # (n ParseFailure)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Right    ; # (n Right)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_StackOverflow    ; # (n StackOverflow)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Stacksize    ; # (n Stacksize)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_StartSymbol    ; # (n StartSymbol)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_SyntaxError    ; # (n SyntaxError)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_TokenDestructor    ; # (n TokenDestructor)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_TokenPrefix    ; # (n TokenPrefix)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_TokenType    ; # (n TokenType)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Type    ; # (n Type)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Fallback    ; # (n Fallback)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DLEFT {} {
-    # DLEFT = (x (t l)
-    #            (t e)
-    #            (t f)
-    #            (t t)
-    #            (n SPACE))
-
-    if {[inc_restore DLEFT]} return
-
-    set pos [icl_get]
-
-    eseq65                ; # (x (t l)
-                            #    (t e)
-                            #    (t f)
-                            #    (t t)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DLEFT $pos
-    ier_nonterminal        DLEFT $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq65 {} {
-
-    # (x (t l)
-    #    (t e)
-    #    (t f)
-    #    (t t)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DNAME {} {
-    # DNAME = (x (t n)
-    #            (t a)
-    #            (t m)
-    #            (t e)
-    #            (n SPACE))
-
-    if {[inc_restore DNAME]} return
-
-    set pos [icl_get]
-
-    eseq66                ; # (x (t n)
-                            #    (t a)
-                            #    (t m)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DNAME $pos
-    ier_nonterminal        DNAME $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq66 {} {
-
-    # (x (t n)
-    #    (t a)
-    #    (t m)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance m
-    if {$ok} {ict_match_token m}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DNON {} {
-    # DNON = (x (t n)
-    #           (t o)
-    #           (t n)
-    #           (t a)
-    #           (t s)
-    #           (t s)
-    #           (t o)
-    #           (t c)
-    #           (n SPACE))
-
-    if {[inc_restore DNON]} return
-
-    set pos [icl_get]
-
-    eseq67                ; # (x (t n)
-                            #    (t o)
-                            #    (t n)
-                            #    (t a)
-                            #    (t s)
-                            #    (t s)
-                            #    (t o)
-                            #    (t c)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DNON $pos
-    ier_nonterminal        DNON $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq67 {} {
-
-    # (x (t n)
-    #    (t o)
-    #    (t n)
-    #    (t a)
-    #    (t s)
-    #    (t s)
-    #    (t o)
-    #    (t c)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DOT {} {
-    # DOT = (x (t .)
-    #          (n SPACE))
-
-    if {[inc_restore DOT]} return
-
-    set pos [icl_get]
-
-    eseq54                ; # (x (t .)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DOT $pos
-    ier_nonterminal        DOT $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq54 {} {
-
-    # (x (t .)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance .
-    if {$ok} {ict_match_token .}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DPACC {} {
-    # DPACC = (x (t p)
-    #            (t a)
-    #            (t r)
-    #            (t s)
-    #            (t e)
-    #            (t _)
-    #            (t a)
-    #            (t c)
-    #            (t c)
-    #            (t e)
-    #            (t p)
-    #            (t t)
-    #            (n SPACE))
-
-    if {[inc_restore DPACC]} return
-
-    set pos [icl_get]
-
-    eseq68                ; # (x (t p)
-                            #    (t a)
-                            #    (t r)
-                            #    (t s)
-                            #    (t e)
-                            #    (t _)
-                            #    (t a)
-                            #    (t c)
-                            #    (t c)
-                            #    (t e)
-                            #    (t p)
-                            #    (t t)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DPACC $pos
-    ier_nonterminal        DPACC $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq68 {} {
-
-    # (x (t p)
-    #    (t a)
-    #    (t r)
-    #    (t s)
-    #    (t e)
-    #    (t _)
-    #    (t a)
-    #    (t c)
-    #    (t c)
-    #    (t e)
-    #    (t p)
-    #    (t t)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DPFAIL {} {
-    # DPFAIL = (x (t p)
-    #             (t a)
-    #             (t r)
-    #             (t s)
-    #             (t e)
-    #             (t _)
-    #             (t f)
-    #             (t a)
-    #             (t i)
-    #             (t l)
-    #             (t u)
-    #             (t r)
-    #             (t e)
-    #             (n SPACE))
-
-    if {[inc_restore DPFAIL]} return
-
-    set pos [icl_get]
-
-    eseq69                ; # (x (t p)
-                            #    (t a)
-                            #    (t r)
-                            #    (t s)
-                            #    (t e)
-                            #    (t _)
-                            #    (t f)
-                            #    (t a)
-                            #    (t i)
-                            #    (t l)
-                            #    (t u)
-                            #    (t r)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DPFAIL $pos
-    ier_nonterminal        DPFAIL $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq69 {} {
-
-    # (x (t p)
-    #    (t a)
-    #    (t r)
-    #    (t s)
-    #    (t e)
-    #    (t _)
-    #    (t f)
-    #    (t a)
-    #    (t i)
-    #    (t l)
-    #    (t u)
-    #    (t r)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DRIGHT {} {
-    # DRIGHT = (x (t r)
-    #             (t i)
-    #             (t g)
-    #             (t h)
-    #             (t t)
-    #             (n SPACE))
-
-    if {[inc_restore DRIGHT]} return
-
-    set pos [icl_get]
-
-    eseq70                ; # (x (t r)
-                            #    (t i)
-                            #    (t g)
-                            #    (t h)
-                            #    (t t)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DRIGHT $pos
-    ier_nonterminal        DRIGHT $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq70 {} {
-
-    # (x (t r)
-    #    (t i)
-    #    (t g)
-    #    (t h)
-    #    (t t)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance g
-    if {$ok} {ict_match_token g}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance h
-    if {$ok} {ict_match_token h}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DSTART {} {
-    # DSTART = (x (t s)
-    #             (t t)
-    #             (t a)
-    #             (t r)
-    #             (t t)
-    #             (t _)
-    #             (t s)
-    #             (t y)
-    #             (t m)
-    #             (t b)
-    #             (t o)
-    #             (t l)
-    #             (n SPACE))
-
-    if {[inc_restore DSTART]} return
-
-    set pos [icl_get]
-
-    eseq73                ; # (x (t s)
-                            #    (t t)
-                            #    (t a)
-                            #    (t r)
-                            #    (t t)
-                            #    (t _)
-                            #    (t s)
-                            #    (t y)
-                            #    (t m)
-                            #    (t b)
-                            #    (t o)
-                            #    (t l)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DSTART $pos
-    ier_nonterminal        DSTART $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq73 {} {
-
-    # (x (t s)
-    #    (t t)
-    #    (t a)
-    #    (t r)
-    #    (t t)
-    #    (t _)
-    #    (t s)
-    #    (t y)
-    #    (t m)
-    #    (t b)
-    #    (t o)
-    #    (t l)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance y
-    if {$ok} {ict_match_token y}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance m
-    if {$ok} {ict_match_token m}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance b
-    if {$ok} {ict_match_token b}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DSTKOVER {} {
-    # DSTKOVER = (x (t s)
-    #               (t t)
-    #               (t a)
-    #               (t c)
-    #               (t k)
-    #               (t _)
-    #               (t o)
-    #               (t v)
-    #               (t e)
-    #               (t r)
-    #               (t f)
-    #               (t l)
-    #               (t o)
-    #               (t w)
-    #               (n SPACE))
-
-    if {[inc_restore DSTKOVER]} return
-
-    set pos [icl_get]
-
-    eseq71                ; # (x (t s)
-                            #    (t t)
-                            #    (t a)
-                            #    (t c)
-                            #    (t k)
-                            #    (t _)
-                            #    (t o)
-                            #    (t v)
-                            #    (t e)
-                            #    (t r)
-                            #    (t f)
-                            #    (t l)
-                            #    (t o)
-                            #    (t w)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DSTKOVER $pos
-    ier_nonterminal        DSTKOVER $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq71 {} {
-
-    # (x (t s)
-    #    (t t)
-    #    (t a)
-    #    (t c)
-    #    (t k)
-    #    (t _)
-    #    (t o)
-    #    (t v)
-    #    (t e)
-    #    (t r)
-    #    (t f)
-    #    (t l)
-    #    (t o)
-    #    (t w)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance v
-    if {$ok} {ict_match_token v}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance l
-    if {$ok} {ict_match_token l}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance w
-    if {$ok} {ict_match_token w}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DSTKSZ {} {
-    # DSTKSZ = (x (t s)
-    #             (t t)
-    #             (t a)
-    #             (t c)
-    #             (t k)
-    #             (t _)
-    #             (t s)
-    #             (t i)
-    #             (t z)
-    #             (t e)
-    #             (n SPACE))
-
-    if {[inc_restore DSTKSZ]} return
-
-    set pos [icl_get]
-
-    eseq72                ; # (x (t s)
-                            #    (t t)
-                            #    (t a)
-                            #    (t c)
-                            #    (t k)
-                            #    (t _)
-                            #    (t s)
-                            #    (t i)
-                            #    (t z)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DSTKSZ $pos
-    ier_nonterminal        DSTKSZ $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq72 {} {
-
-    # (x (t s)
-    #    (t t)
-    #    (t a)
-    #    (t c)
-    #    (t k)
-    #    (t _)
-    #    (t s)
-    #    (t i)
-    #    (t z)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance z
-    if {$ok} {ict_match_token z}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DSYNERR {} {
-    # DSYNERR = (x (t s)
-    #              (t y)
-    #              (t n)
-    #              (t t)
-    #              (t a)
-    #              (t x)
-    #              (t _)
-    #              (t e)
-    #              (t r)
-    #              (t r)
-    #              (t o)
-    #              (t r)
-    #              (n SPACE))
-
-    if {[inc_restore DSYNERR]} return
-
-    set pos [icl_get]
-
-    eseq74                ; # (x (t s)
-                            #    (t y)
-                            #    (t n)
-                            #    (t t)
-                            #    (t a)
-                            #    (t x)
-                            #    (t _)
-                            #    (t e)
-                            #    (t r)
-                            #    (t r)
-                            #    (t o)
-                            #    (t r)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DSYNERR $pos
-    ier_nonterminal        DSYNERR $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq74 {} {
-
-    # (x (t s)
-    #    (t y)
-    #    (t n)
-    #    (t t)
-    #    (t a)
-    #    (t x)
-    #    (t _)
-    #    (t e)
-    #    (t r)
-    #    (t r)
-    #    (t o)
-    #    (t r)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance y
-    if {$ok} {ict_match_token y}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance a
-    if {$ok} {ict_match_token a}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance x
-    if {$ok} {ict_match_token x}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DTOKDEST {} {
-    # DTOKDEST = (x (t t)
-    #               (t o)
-    #               (t k)
-    #               (t e)
-    #               (t n)
-    #               (t _)
-    #               (t d)
-    #               (t e)
-    #               (t s)
-    #               (t t)
-    #               (t r)
-    #               (t u)
-    #               (t c)
-    #               (t t)
-    #               (t o)
-    #               (t r)
-    #               (n SPACE))
-
-    if {[inc_restore DTOKDEST]} return
-
-    set pos [icl_get]
-
-    eseq75                ; # (x (t t)
-                            #    (t o)
-                            #    (t k)
-                            #    (t e)
-                            #    (t n)
-                            #    (t _)
-                            #    (t d)
-                            #    (t e)
-                            #    (t s)
-                            #    (t t)
-                            #    (t r)
-                            #    (t u)
-                            #    (t c)
-                            #    (t t)
-                            #    (t o)
-                            #    (t r)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DTOKDEST $pos
-    ier_nonterminal        DTOKDEST $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq75 {} {
-
-    # (x (t t)
-    #    (t o)
-    #    (t k)
-    #    (t e)
-    #    (t n)
-    #    (t _)
-    #    (t d)
-    #    (t e)
-    #    (t s)
-    #    (t t)
-    #    (t r)
-    #    (t u)
-    #    (t c)
-    #    (t t)
-    #    (t o)
-    #    (t r)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance d
-    if {$ok} {ict_match_token d}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance s
-    if {$ok} {ict_match_token s}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance u
-    if {$ok} {ict_match_token u}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance c
-    if {$ok} {ict_match_token c}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DTOKPFX {} {
-    # DTOKPFX = (x (t t)
-    #              (t o)
-    #              (t k)
-    #              (t e)
-    #              (t n)
-    #              (t _)
-    #              (t p)
-    #              (t r)
-    #              (t e)
-    #              (t f)
-    #              (t i)
-    #              (t x)
-    #              (n SPACE))
-
-    if {[inc_restore DTOKPFX]} return
-
-    set pos [icl_get]
-
-    eseq76                ; # (x (t t)
-                            #    (t o)
-                            #    (t k)
-                            #    (t e)
-                            #    (t n)
-                            #    (t _)
-                            #    (t p)
-                            #    (t r)
-                            #    (t e)
-                            #    (t f)
-                            #    (t i)
-                            #    (t x)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DTOKPFX $pos
-    ier_nonterminal        DTOKPFX $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq76 {} {
-
-    # (x (t t)
-    #    (t o)
-    #    (t k)
-    #    (t e)
-    #    (t n)
-    #    (t _)
-    #    (t p)
-    #    (t r)
-    #    (t e)
-    #    (t f)
-    #    (t i)
-    #    (t x)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance r
-    if {$ok} {ict_match_token r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance f
-    if {$ok} {ict_match_token f}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance i
-    if {$ok} {ict_match_token i}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance x
-    if {$ok} {ict_match_token x}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DTOKTYPE {} {
-    # DTOKTYPE = (x (t t)
-    #               (t o)
-    #               (t k)
-    #               (t e)
-    #               (t n)
-    #               (t _)
-    #               (t t)
-    #               (t y)
-    #               (t p)
-    #               (t e)
-    #               (n SPACE))
-
-    if {[inc_restore DTOKTYPE]} return
-
-    set pos [icl_get]
-
-    eseq77                ; # (x (t t)
-                            #    (t o)
-                            #    (t k)
-                            #    (t e)
-                            #    (t n)
-                            #    (t _)
-                            #    (t t)
-                            #    (t y)
-                            #    (t p)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DTOKTYPE $pos
-    ier_nonterminal        DTOKTYPE $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq77 {} {
-
-    # (x (t t)
-    #    (t o)
-    #    (t k)
-    #    (t e)
-    #    (t n)
-    #    (t _)
-    #    (t t)
-    #    (t y)
-    #    (t p)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance o
-    if {$ok} {ict_match_token o}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance k
-    if {$ok} {ict_match_token k}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance n
-    if {$ok} {ict_match_token n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance y
-    if {$ok} {ict_match_token y}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_DTYPE {} {
-    # DTYPE = (x (t t)
-    #            (t y)
-    #            (t p)
-    #            (t e)
-    #            (n SPACE))
-
-    if {[inc_restore DTYPE]} return
-
-    set pos [icl_get]
-
-    eseq78                ; # (x (t t)
-                            #    (t y)
-                            #    (t p)
-                            #    (t e)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               DTYPE $pos
-    ier_nonterminal        DTYPE $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq78 {} {
-
-    # (x (t t)
-    #    (t y)
-    #    (t p)
-    #    (t e)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance t
-    if {$ok} {ict_match_token t}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance y
-    if {$ok} {ict_match_token y}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance p
-    if {$ok} {ict_match_token p}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance e
-    if {$ok} {ict_match_token e}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Endif {} {
-    # Endif = (n DENDIF)
-
-    if {[inc_restore Endif]} return
-
-    set pos [icl_get]
-
-    matchSymbol_DENDIF    ; # (n DENDIF)
-
-    isv_clear
-    inc_save               Endif $pos
-    ier_nonterminal        Endif $pos
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_EOF {} {
-    # EOF = (! (dot))
-
-    if {[inc_restore EOF]} return
-
-    set pos [icl_get]
-
-    ebang99
-
-    isv_clear
-    inc_save               EOF $pos
-    ier_nonterminal        EOF $pos
-    return
-}
-
-proc ::page::parse::lemon::ebang99 {} {
-    set pos [icl_get]
-
-    ict_advance "any character"
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_EOL {} {
-    # EOL = (/ (x (t \r)
-    #             (t \n))
-    #          (t \r)
-    #          (t \n))
-
-    if {[inc_restore EOL]} return
-
-    set pos [icl_get]
-
-    ebra98                ; # (/ (x (t \r)
-                            #       (t \n))
-                            #    (t \r)
-                            #    (t \n))
-
-    isv_clear
-    inc_save               EOL $pos
-    ier_nonterminal        EOL $pos
-    return
-}
-
-proc ::page::parse::lemon::ebra98 {} {
-
-    # (/ (x (t \r)
-    #       (t \n))
-    #    (t \r)
-    #    (t \n))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    eseq97                ; # (x (t \r)
-                            #    (t \n))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance \\r
-    if {$ok} {ict_match_token \r}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance \\n
-    if {$ok} {ict_match_token \n}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::eseq97 {} {
-
-    # (x (t \r)
-    #    (t \n))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance \\r
-    if {$ok} {ict_match_token \r}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance \\n
-    if {$ok} {ict_match_token \n}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_ExtraArgument {} {
-    # ExtraArgument = (x (n DEXTRA)
-    #                    (n Codeblock))
-
-    variable ok
-    if {[inc_restore ExtraArgument]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq20                ; # (x (n DEXTRA)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce ExtraArgument $pos $mrk
-    inc_save               ExtraArgument $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        ExtraArgument $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq20 {} {
-
-    # (x (n DEXTRA)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DEXTRA    ; # (n DEXTRA)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Fallback {} {
-    # Fallback = (x (n DFALLBK)
-    #               (+ (n Identifier))
-    #               (n DOT))
-
-    variable ok
-    if {[inc_restore Fallback]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq40                ; # (x (n DFALLBK)
-                            #    (+ (n Identifier))
-                            #    (n DOT))
-
-    isv_nonterminal_reduce Fallback $pos $mrk
-    inc_save               Fallback $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Fallback $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq40 {} {
-
-    # (x (n DFALLBK)
-    #    (+ (n Identifier))
-    #    (n DOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DFALLBK    ; # (n DFALLBK)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    epkleene39                ; # (+ (n Identifier))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::epkleene39 {} {
-
-    # (+ (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Identifier    ; # (n Identifier)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Ident {} {
-    # Ident = (x (/ (alpha)
-    #               (t _))
-    #            (* (/ (alnum)
-    #                  (t _))))
-
-    variable ok
-    if {[inc_restore Ident]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq50                ; # (x (/ (alpha)
-                            #       (t _))
-                            #    (* (/ (alnum)
-                            #          (t _))))
-
-    isv_nonterminal_range  Ident $pos
-    inc_save               Ident $pos
-    if {$ok} ias_push
-    ier_nonterminal        Ident $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq50 {} {
-
-    # (x (/ (alpha)
-    #       (t _))
-    #    (* (/ (alnum)
-    #          (t _))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebra47                ; # (/ (alpha)
-                            #    (t _))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene49                ; # (* (/ (alnum)
-                               #       (t _)))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::ebra47 {} {
-
-    # (/ (alpha)
-    #    (t _))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance alpha
-    if {$ok} {ict_match_tokclass alpha}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::ekleene49 {} {
-
-    # (* (/ (alnum)
-    #       (t _)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ebra48                ; # (/ (alnum)
-                                #    (t _))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::ebra48 {} {
-
-    # (/ (alnum)
-    #    (t _))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance alnum
-    if {$ok} {ict_match_tokclass alnum}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance _
-    if {$ok} {ict_match_token _}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Identifier {} {
-    # Identifier = (x (n Ident)
-    #                 (n SPACE))
-
-    variable ok
-    if {[inc_restore Identifier]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq46                ; # (x (n Ident)
-                            #    (n SPACE))
-
-    isv_nonterminal_reduce Identifier $pos $mrk
-    inc_save               Identifier $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Identifier $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq46 {} {
-
-    # (x (n Ident)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Ident    ; # (n Ident)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Ifdef {} {
-    # Ifdef = (x (n DIFDEF)
-    #            (n Identifier))
-
-    if {[inc_restore Ifdef]} return
-
-    set pos [icl_get]
-
-    eseq83                ; # (x (n DIFDEF)
-                            #    (n Identifier))
-
-    isv_clear
-    inc_save               Ifdef $pos
-    ier_nonterminal        Ifdef $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq83 {} {
-
-    # (x (n DIFDEF)
-    #    (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DIFDEF    ; # (n DIFDEF)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    set pIdentifier [ias_mark]
-    matchSymbol_Identifier
-    ias_pop2mark $pIdentifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Ifndef {} {
-    # Ifndef = (x (n DIFNDEF)
-    #             (n Identifier))
-
-    if {[inc_restore Ifndef]} return
-
-    set pos [icl_get]
-
-    eseq84                ; # (x (n DIFNDEF)
-                            #    (n Identifier))
-
-    isv_clear
-    inc_save               Ifndef $pos
-    ier_nonterminal        Ifndef $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq84 {} {
-
-    # (x (n DIFNDEF)
-    #    (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DIFNDEF    ; # (n DIFNDEF)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    set pIdentifier [ias_mark]
-    matchSymbol_Identifier
-    ias_pop2mark $pIdentifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Include {} {
-    # Include = (x (n DINCL)
-    #              (n Codeblock))
-
-    variable ok
-    if {[inc_restore Include]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq21                ; # (x (n DINCL)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce Include $pos $mrk
-    inc_save               Include $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Include $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq21 {} {
-
-    # (x (n DINCL)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DINCL    ; # (n DINCL)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Label {} {
-    # Label = (x (n LPAREN)
-    #            (n Identifier)
-    #            (n RPAREN))
-
-    variable ok
-    if {[inc_restore Label]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq12                ; # (x (n LPAREN)
-                            #    (n Identifier)
-                            #    (n RPAREN))
-
-    isv_nonterminal_reduce Label $pos $mrk
-    inc_save               Label $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Label $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq12 {} {
-
-    # (x (n LPAREN)
-    #    (n Identifier)
-    #    (n RPAREN))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_LPAREN    ; # (n LPAREN)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_RPAREN    ; # (n RPAREN)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_LBRACE {} {
-    # LBRACE = (t \{)
-
-    variable ok
-    if {[inc_restore LBRACE]} return
-
-    set pos [icl_get]
-
-    ict_advance \{
-    if {$ok} {ict_match_token \173}
-
-    isv_clear
-    inc_save               LBRACE $pos
-    ier_nonterminal        LBRACE $pos
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_LBRACKET {} {
-    # LBRACKET = (x (t [)
-    #               (n SPACE))
-
-    if {[inc_restore LBRACKET]} return
-
-    set pos [icl_get]
-
-    eseq57                ; # (x (t [)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               LBRACKET $pos
-    ier_nonterminal        LBRACKET $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq57 {} {
-
-    # (x (t [)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance \[
-    if {$ok} {ict_match_token \133}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Left {} {
-    # Left = (x (n DLEFT)
-    #           (+ (n Identifier))
-    #           (n DOT))
-
-    variable ok
-    if {[inc_restore Left]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq23                ; # (x (n DLEFT)
-                            #    (+ (n Identifier))
-                            #    (n DOT))
-
-    isv_nonterminal_reduce Left $pos $mrk
-    inc_save               Left $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Left $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq23 {} {
-
-    # (x (n DLEFT)
-    #    (+ (n Identifier))
-    #    (n DOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DLEFT    ; # (n DLEFT)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    epkleene22                ; # (+ (n Identifier))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::epkleene22 {} {
-
-    # (+ (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Identifier    ; # (n Identifier)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_LemonGrammar {} {
-    # LemonGrammar = (x (n SPACE)
-    #                   (+ (n Statement))
-    #                   (n EOF))
-
-    variable ok
-    if {[inc_restore LemonGrammar]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq2                ; # (x (n SPACE)
-                           #    (+ (n Statement))
-                           #    (n EOF))
-
-    isv_nonterminal_reduce LemonGrammar $pos $mrk
-    inc_save               LemonGrammar $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        LemonGrammar $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq2 {} {
-
-    # (x (n SPACE)
-    #    (+ (n Statement))
-    #    (n EOF))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    epkleene1                ; # (+ (n Statement))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_EOF    ; # (n EOF)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::epkleene1 {} {
-
-    # (+ (n Statement))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Statement    ; # (n Statement)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Statement    ; # (n Statement)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_LPAREN {} {
-    # LPAREN = (x (t \()
-    #             (n SPACE))
-
-    if {[inc_restore LPAREN]} return
-
-    set pos [icl_get]
-
-    eseq55                ; # (x (t \()
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               LPAREN $pos
-    ier_nonterminal        LPAREN $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq55 {} {
-
-    # (x (t \()
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance \(
-    if {$ok} {ict_match_token \50}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Name {} {
-    # Name = (x (n DNAME)
-    #           (n Identifier))
-
-    variable ok
-    if {[inc_restore Name]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq24                ; # (x (n DNAME)
-                            #    (n Identifier))
-
-    isv_nonterminal_reduce Name $pos $mrk
-    inc_save               Name $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Name $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq24 {} {
-
-    # (x (n DNAME)
-    #    (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DNAME    ; # (n DNAME)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_NatNum {} {
-    # NatNum = (+ (.. 0 9))
-
-    variable ok
-    if {[inc_restore NatNum]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    epkleene52                ; # (+ (.. 0 9))
-
-    isv_nonterminal_range  NatNum $pos
-    inc_save               NatNum $pos
-    if {$ok} ias_push
-    ier_nonterminal        NatNum $pos
-    return
-}
-
-proc ::page::parse::lemon::epkleene52 {} {
-
-    # (+ (.. 0 9))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "any in 0..9"
-    if {$ok} {ict_match_tokrange 0 9}
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ict_advance "any in 0..9"
-        if {$ok} {ict_match_tokrange 0 9}
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_NaturalNumber {} {
-    # NaturalNumber = (x (n NatNum)
-    #                    (n SPACE))
-
-    variable ok
-    if {[inc_restore NaturalNumber]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq51                ; # (x (n NatNum)
-                            #    (n SPACE))
-
-    isv_nonterminal_reduce NaturalNumber $pos $mrk
-    inc_save               NaturalNumber $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        NaturalNumber $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq51 {} {
-
-    # (x (n NatNum)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_NatNum    ; # (n NatNum)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Nonassoc {} {
-    # Nonassoc = (x (n DNON)
-    #               (+ (n Identifier))
-    #               (n DOT))
-
-    variable ok
-    if {[inc_restore Nonassoc]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq26                ; # (x (n DNON)
-                            #    (+ (n Identifier))
-                            #    (n DOT))
-
-    isv_nonterminal_reduce Nonassoc $pos $mrk
-    inc_save               Nonassoc $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Nonassoc $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq26 {} {
-
-    # (x (n DNON)
-    #    (+ (n Identifier))
-    #    (n DOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DNON    ; # (n DNON)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    epkleene25                ; # (+ (n Identifier))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::epkleene25 {} {
-
-    # (+ (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Identifier    ; # (n Identifier)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_ParseAccept {} {
-    # ParseAccept = (x (n DPACC)
-    #                  (n Codeblock))
-
-    variable ok
-    if {[inc_restore ParseAccept]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq27                ; # (x (n DPACC)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce ParseAccept $pos $mrk
-    inc_save               ParseAccept $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        ParseAccept $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq27 {} {
-
-    # (x (n DPACC)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DPACC    ; # (n DPACC)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_ParseFailure {} {
-    # ParseFailure = (x (n DPFAIL)
-    #                   (n Codeblock))
-
-    variable ok
-    if {[inc_restore ParseFailure]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq28                ; # (x (n DPFAIL)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce ParseFailure $pos $mrk
-    inc_save               ParseFailure $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        ParseFailure $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq28 {} {
-
-    # (x (n DPFAIL)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DPFAIL    ; # (n DPFAIL)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Precedence {} {
-    # Precedence = (x (n LBRACKET)
-    #                 (n Identifier)
-    #                 (n RBRACKET))
-
-    variable ok
-    if {[inc_restore Precedence]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq13                ; # (x (n LBRACKET)
-                            #    (n Identifier)
-                            #    (n RBRACKET))
-
-    isv_nonterminal_reduce Precedence $pos $mrk
-    inc_save               Precedence $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Precedence $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq13 {} {
-
-    # (x (n LBRACKET)
-    #    (n Identifier)
-    #    (n RBRACKET))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_LBRACKET    ; # (n LBRACKET)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_RBRACKET    ; # (n RBRACKET)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_RBRACE {} {
-    # RBRACE = (t \})
-
-    variable ok
-    if {[inc_restore RBRACE]} return
-
-    set pos [icl_get]
-
-    ict_advance \}
-    if {$ok} {ict_match_token \175}
-
-    isv_clear
-    inc_save               RBRACE $pos
-    ier_nonterminal        RBRACE $pos
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_RBRACKET {} {
-    # RBRACKET = (x (t ])
-    #               (n SPACE))
-
-    if {[inc_restore RBRACKET]} return
-
-    set pos [icl_get]
-
-    eseq58                ; # (x (t ])
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               RBRACKET $pos
-    ier_nonterminal        RBRACKET $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq58 {} {
-
-    # (x (t ])
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance \]
-    if {$ok} {ict_match_token \135}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Right {} {
-    # Right = (x (n DRIGHT)
-    #            (+ (n Identifier))
-    #            (n DOT))
-
-    variable ok
-    if {[inc_restore Right]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq30                ; # (x (n DRIGHT)
-                            #    (+ (n Identifier))
-                            #    (n DOT))
-
-    isv_nonterminal_reduce Right $pos $mrk
-    inc_save               Right $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Right $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq30 {} {
-
-    # (x (n DRIGHT)
-    #    (+ (n Identifier))
-    #    (n DOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DRIGHT    ; # (n DRIGHT)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    epkleene29                ; # (+ (n Identifier))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::epkleene29 {} {
-
-    # (+ (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Identifier    ; # (n Identifier)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_RPAREN {} {
-    # RPAREN = (x (t \))
-    #             (n SPACE))
-
-    if {[inc_restore RPAREN]} return
-
-    set pos [icl_get]
-
-    eseq56                ; # (x (t \))
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               RPAREN $pos
-    ier_nonterminal        RPAREN $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq56 {} {
-
-    # (x (t \))
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance \)
-    if {$ok} {ict_match_token \51}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Rule {} {
-    # Rule = (x (n Identifier)
-    #           (? (n Label))
-    #           (n ASSIGN)
-    #           (n Definition)
-    #           (n DOT)
-    #           (? (n Precedence))
-    #           (? (n Codeblock)))
-
-    variable ok
-    if {[inc_restore Rule]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq8                ; # (x (n Identifier)
-                           #    (? (n Label))
-                           #    (n ASSIGN)
-                           #    (n Definition)
-                           #    (n DOT)
-                           #    (? (n Precedence))
-                           #    (? (n Codeblock)))
-
-    isv_nonterminal_reduce Rule $pos $mrk
-    inc_save               Rule $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Rule $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq8 {} {
-
-    # (x (n Identifier)
-    #    (? (n Label))
-    #    (n ASSIGN)
-    #    (n Definition)
-    #    (n DOT)
-    #    (? (n Precedence))
-    #    (? (n Codeblock)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    eopt5                ; # (? (n Label))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_ASSIGN    ; # (n ASSIGN)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Definition    ; # (n Definition)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    eopt6                ; # (? (n Precedence))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    eopt7                ; # (? (n Codeblock))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::eopt5 {} {
-
-    # (? (n Label))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Label    ; # (n Label)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::eopt6 {} {
-
-    # (? (n Precedence))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Precedence    ; # (n Precedence)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::eopt7 {} {
-
-    # (? (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_SPACE {} {
-    # SPACE = (* (/ (t <blank>)
-    #               (t \t)
-    #               (t \n)
-    #               (t \r)
-    #               (n C_COMMENT)
-    #               (n Cplusplus_COMMENT)
-    #               (n Ifndef)
-    #               (n Ifdef)
-    #               (n Endif)))
-
-    if {[inc_restore SPACE]} return
-
-    set pos [icl_get]
-
-    ekleene86                ; # (* (/ (t <blank>)
-                               #       (t \t)
-                               #       (t \n)
-                               #       (t \r)
-                               #       (n C_COMMENT)
-                               #       (n Cplusplus_COMMENT)
-                               #       (n Ifndef)
-                               #       (n Ifdef)
-                               #       (n Endif)))
-
-    isv_clear
-    inc_save               SPACE $pos
-    ier_nonterminal        SPACE $pos
-    return
-}
-
-proc ::page::parse::lemon::ekleene86 {} {
-
-    # (* (/ (t <blank>)
-    #       (t \t)
-    #       (t \n)
-    #       (t \r)
-    #       (n C_COMMENT)
-    #       (n Cplusplus_COMMENT)
-    #       (n Ifndef)
-    #       (n Ifdef)
-    #       (n Endif)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ebra85                ; # (/ (t <blank>)
-                                #    (t \t)
-                                #    (t \n)
-                                #    (t \r)
-                                #    (n C_COMMENT)
-                                #    (n Cplusplus_COMMENT)
-                                #    (n Ifndef)
-                                #    (n Ifdef)
-                                #    (n Endif))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::lemon::ebra85 {} {
-
-    # (/ (t <blank>)
-    #    (t \t)
-    #    (t \n)
-    #    (t \r)
-    #    (n C_COMMENT)
-    #    (n Cplusplus_COMMENT)
-    #    (n Ifndef)
-    #    (n Ifdef)
-    #    (n Endif))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance <blank>
-    if {$ok} {ict_match_token \40}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance \\t
-    if {$ok} {ict_match_token \t}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance \\n
-    if {$ok} {ict_match_token \n}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance \\r
-    if {$ok} {ict_match_token \r}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_C_COMMENT    ; # (n C_COMMENT)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_Cplusplus_COMMENT    ; # (n Cplusplus_COMMENT)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_Ifndef    ; # (n Ifndef)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_Ifdef    ; # (n Ifdef)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_Endif    ; # (n Endif)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_StackOverflow {} {
-    # StackOverflow = (x (n DSTKOVER)
-    #                    (n Codeblock))
-
-    variable ok
-    if {[inc_restore StackOverflow]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq31                ; # (x (n DSTKOVER)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce StackOverflow $pos $mrk
-    inc_save               StackOverflow $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        StackOverflow $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq31 {} {
-
-    # (x (n DSTKOVER)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DSTKOVER    ; # (n DSTKOVER)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Stacksize {} {
-    # Stacksize = (x (n DSTKSZ)
-    #                (n NaturalNumber))
-
-    variable ok
-    if {[inc_restore Stacksize]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq32                ; # (x (n DSTKSZ)
-                            #    (n NaturalNumber))
-
-    isv_nonterminal_reduce Stacksize $pos $mrk
-    inc_save               Stacksize $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Stacksize $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq32 {} {
-
-    # (x (n DSTKSZ)
-    #    (n NaturalNumber))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DSTKSZ    ; # (n DSTKSZ)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_NaturalNumber    ; # (n NaturalNumber)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_StartSymbol {} {
-    # StartSymbol = (x (n DSTART)
-    #                  (n Identifier))
-
-    variable ok
-    if {[inc_restore StartSymbol]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq33                ; # (x (n DSTART)
-                            #    (n Identifier))
-
-    isv_nonterminal_reduce StartSymbol $pos $mrk
-    inc_save               StartSymbol $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        StartSymbol $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq33 {} {
-
-    # (x (n DSTART)
-    #    (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DSTART    ; # (n DSTART)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Statement {} {
-    # Statement = (x (/ (n Directive)
-    #                   (n Rule))
-    #                (n SPACE))
-
-    variable ok
-    if {[inc_restore Statement]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq4                ; # (x (/ (n Directive)
-                           #       (n Rule))
-                           #    (n SPACE))
-
-    isv_nonterminal_reduce Statement $pos $mrk
-    inc_save               Statement $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Statement $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq4 {} {
-
-    # (x (/ (n Directive)
-    #       (n Rule))
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ebra3                ; # (/ (n Directive)
-                           #    (n Rule))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::ebra3 {} {
-
-    # (/ (n Directive)
-    #    (n Rule))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Directive    ; # (n Directive)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Rule    ; # (n Rule)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_SyntaxError {} {
-    # SyntaxError = (x (n DSYNERR)
-    #                  (n Codeblock))
-
-    variable ok
-    if {[inc_restore SyntaxError]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq34                ; # (x (n DSYNERR)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce SyntaxError $pos $mrk
-    inc_save               SyntaxError $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        SyntaxError $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq34 {} {
-
-    # (x (n DSYNERR)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DSYNERR    ; # (n DSYNERR)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_TokenDestructor {} {
-    # TokenDestructor = (x (n DTOKDEST)
-    #                      (n Identifier)
-    #                      (n Codeblock))
-
-    variable ok
-    if {[inc_restore TokenDestructor]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq35                ; # (x (n DTOKDEST)
-                            #    (n Identifier)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce TokenDestructor $pos $mrk
-    inc_save               TokenDestructor $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        TokenDestructor $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq35 {} {
-
-    # (x (n DTOKDEST)
-    #    (n Identifier)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DTOKDEST    ; # (n DTOKDEST)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_TokenPrefix {} {
-    # TokenPrefix = (x (n DTOKPFX)
-    #                  (n Identifier))
-
-    variable ok
-    if {[inc_restore TokenPrefix]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq36                ; # (x (n DTOKPFX)
-                            #    (n Identifier))
-
-    isv_nonterminal_reduce TokenPrefix $pos $mrk
-    inc_save               TokenPrefix $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        TokenPrefix $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq36 {} {
-
-    # (x (n DTOKPFX)
-    #    (n Identifier))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DTOKPFX    ; # (n DTOKPFX)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_TokenType {} {
-    # TokenType = (x (n DTOKTYPE)
-    #                (n Codeblock))
-
-    variable ok
-    if {[inc_restore TokenType]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq37                ; # (x (n DTOKTYPE)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce TokenType $pos $mrk
-    inc_save               TokenType $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        TokenType $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq37 {} {
-
-    # (x (n DTOKTYPE)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DTOKTYPE    ; # (n DTOKTYPE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::lemon::matchSymbol_Type {} {
-    # Type = (x (n DTYPE)
-    #           (n Identifier)
-    #           (n Codeblock))
-
-    variable ok
-    if {[inc_restore Type]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq38                ; # (x (n DTYPE)
-                            #    (n Identifier)
-                            #    (n Codeblock))
-
-    isv_nonterminal_reduce Type $pos $mrk
-    inc_save               Type $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        Type $pos
-    return
-}
-
-proc ::page::parse::lemon::eseq38 {} {
-
-    # (x (n DTYPE)
-    #    (n Identifier)
-    #    (n Codeblock))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DTYPE    ; # (n DTYPE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Codeblock    ; # (n Codeblock)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide page::parse::lemon 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4415 +1,0 @@
-# -*- tcl -*-
-## Parsing Expression Grammar 'pg::peg::grammar'.
-## Recursive Descent Packrat parser generated
-## by the PAGE writer plugin 'me'.
-## (C) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-
-# ### ### ### ######### ######### #########
-## Package description
-
-# The commands provided here match an input provided through a buffer
-# command to the PE grammar 'pg::peg::grammar'. The parser is based on the package
-# 'grammar::me::tcl' (recursive-descent, packrat, pulling chars,
-# pushing the generated AST).
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::me::tcl
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-namespace eval ::page::parse::peg {
-    # Import the virtual machine for matching.
-
-    namespace import ::grammar::me::tcl::*
-    upvar #0 ::grammar::me::tcl::ok ok
-}
-
-# ### ### ### ######### ######### #########
-## API Implementation.
-
-proc ::page::parse::peg::parse {nxcmd emvar astvar} {
-    variable ok
-    variable se
-
-    upvar 1 $emvar emsg $astvar ast
-
-    init $nxcmd
-
-    matchSymbol_Grammar    ; # (n Grammar)
-
-    isv_nonterminal_reduce ALL -1
-    set ast [sv]
-    if {!$ok} {
-        foreach {l m} [ier_get] break
-        lappend l [lc $l]
-        set emsg [list $l $m]
-    }
-
-    return $ok
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper methods
-
-# Grammar 'pg::peg::grammar'
-#
-# ALNUM = (x (t <)
-#            (t a)
-#            (t l)
-#            (t n)
-#            (t u)
-#            (t m)
-#            (t >)
-#            (n SPACE))
-#
-# ALPHA = (x (t <)
-#            (t a)
-#            (t l)
-#            (t p)
-#            (t h)
-#            (t a)
-#            (t >)
-#            (n SPACE))
-#
-# AND = (x (t &)
-#          (n SPACE))
-#
-# APOSTROPH = (t ')
-#
-# Attribute = (x (/ (n VOID)
-#                   (n LEAF)
-#                   (n MATCH))
-#                (n COLON))
-#
-# Char = (/ (n CharSpecial)
-#           (n CharOctalFull)
-#           (n CharOctalPart)
-#           (n CharUnicode)
-#           (n CharUnescaped))
-#
-# CharOctalFull = (x (t \)
-#                    (.. 0 2)
-#                    (.. 0 7)
-#                    (.. 0 7))
-#
-# CharOctalPart = (x (t \)
-#                    (.. 0 7)
-#                    (? (.. 0 7)))
-#
-# CharSpecial = (x (t \)
-#                  (/ (t n)
-#                     (t r)
-#                     (t t)
-#                     (t ')
-#                     (t \")
-#                     (t [)
-#                     (t ])
-#                     (t \)))
-#
-# CharUnescaped = (x (! (t \))
-#                    (dot))
-#
-# CharUnicode = (x (t \)
-#                  (t u)
-#                  (n HexDigit)
-#                  (? (x (n HexDigit)
-#                        (? (x (n HexDigit)
-#                              (? (n HexDigit)))))))
-#
-# Class = (x (n OPENB)
-#            (* (x (! (n CLOSEB))
-#                  (n Range)))
-#            (n CLOSEB)
-#            (n SPACE))
-#
-# CLOSE = (x (t \))
-#            (n SPACE))
-#
-# CLOSEB = (t ])
-#
-# COLON = (x (t :)
-#            (n SPACE))
-#
-# COMMENT = (x (t #)
-#              (* (x (! (n EOL))
-#                    (dot)))
-#              (n EOL))
-#
-# DAPOSTROPH = (t \")
-#
-# Definition = (x (? (n Attribute))
-#                 (n Identifier)
-#                 (n IS)
-#                 (n Expression)
-#                 (n SEMICOLON))
-#
-# DOT = (x (t .)
-#          (n SPACE))
-#
-# END = (x (t E)
-#          (t N)
-#          (t D)
-#          (n SPACE))
-#
-# EOF = (! (dot))
-#
-# EOL = (/ (x (t \n)
-#             (t \r))
-#          (t \n)
-#          (t \r))
-#
-# Expression = (x (n Sequence)
-#                 (* (x (n SLASH)
-#                       (n Sequence))))
-#
-# Final = (x (n END)
-#            (n SEMICOLON)
-#            (n SPACE))
-#
-# Grammar = (x (n SPACE)
-#              (n Header)
-#              (+ (n Definition))
-#              (n Final)
-#              (n EOF))
-#
-# Header = (x (n PEG)
-#             (n Identifier)
-#             (n StartExpr))
-#
-# HexDigit = (/ (.. 0 9)
-#               (.. a f)
-#               (.. A F))
-#
-# Ident = (x (/ (t _)
-#               (t :)
-#               (alpha))
-#            (* (/ (t _)
-#                  (t :)
-#                  (alnum))))
-#
-# Identifier = (x (n Ident)
-#                 (n SPACE))
-#
-# IS = (x (t <)
-#         (t -)
-#         (n SPACE))
-#
-# LEAF = (x (t l)
-#           (t e)
-#           (t a)
-#           (t f)
-#           (n SPACE))
-#
-# Literal = (/ (x (n APOSTROPH)
-#                 (* (x (! (n APOSTROPH))
-#                       (n Char)))
-#                 (n APOSTROPH)
-#                 (n SPACE))
-#              (x (n DAPOSTROPH)
-#                 (* (x (! (n DAPOSTROPH))
-#                       (n Char)))
-#                 (n DAPOSTROPH)
-#                 (n SPACE)))
-#
-# MATCH = (x (t m)
-#            (t a)
-#            (t t)
-#            (t c)
-#            (t h)
-#            (n SPACE))
-#
-# NOT = (x (t !)
-#          (n SPACE))
-#
-# OPEN = (x (t \()
-#           (n SPACE))
-#
-# OPENB = (t [)
-#
-# PEG = (x (t P)
-#          (t E)
-#          (t G)
-#          (n SPACE))
-#
-# PLUS = (x (t +)
-#           (n SPACE))
-#
-# Prefix = (x (? (/ (n AND)
-#                   (n NOT)))
-#             (n Suffix))
-#
-# Primary = (/ (n ALNUM)
-#              (n ALPHA)
-#              (n Identifier)
-#              (x (n OPEN)
-#                 (n Expression)
-#                 (n CLOSE))
-#              (n Literal)
-#              (n Class)
-#              (n DOT))
-#
-# QUESTION = (x (t ?)
-#               (n SPACE))
-#
-# Range = (/ (x (n Char)
-#               (n TO)
-#               (n Char))
-#            (n Char))
-#
-# SEMICOLON = (x (t ;)
-#                (n SPACE))
-#
-# Sequence = (+ (n Prefix))
-#
-# SLASH = (x (t /)
-#            (n SPACE))
-#
-# SPACE = (* (/ (t <blank>)
-#               (t \t)
-#               (n EOL)
-#               (n COMMENT)))
-#
-# STAR = (x (t *)
-#           (n SPACE))
-#
-# StartExpr = (x (n OPEN)
-#                (n Expression)
-#                (n CLOSE))
-#
-# Suffix = (x (n Primary)
-#             (? (/ (n QUESTION)
-#                   (n STAR)
-#                   (n PLUS))))
-#
-# TO = (t -)
-#
-# VOID = (x (t v)
-#           (t o)
-#           (t i)
-#           (t d)
-#           (n SPACE))
-#
-
-proc ::page::parse::peg::matchSymbol_ALNUM {} {
-    # ALNUM = (x (t <)
-    #            (t a)
-    #            (t l)
-    #            (t n)
-    #            (t u)
-    #            (t m)
-    #            (t >)
-    #            (n SPACE))
-
-    variable ok
-    if {[inc_restore ALNUM]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq75                ; # (x (t <)
-                            #    (t a)
-                            #    (t l)
-                            #    (t n)
-                            #    (t u)
-                            #    (t m)
-                            #    (t >)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   ALNUM $pos
-    inc_save               ALNUM $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected ALNUM" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq75 {} {
-
-    # (x (t <)
-    #    (t a)
-    #    (t l)
-    #    (t n)
-    #    (t u)
-    #    (t m)
-    #    (t >)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected < (got EOF)"
-    if {$ok} {ict_match_token < "Expected <"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected a (got EOF)"
-    if {$ok} {ict_match_token a "Expected a"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected l (got EOF)"
-    if {$ok} {ict_match_token l "Expected l"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected n (got EOF)"
-    if {$ok} {ict_match_token n "Expected n"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected u (got EOF)"
-    if {$ok} {ict_match_token u "Expected u"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected m (got EOF)"
-    if {$ok} {ict_match_token m "Expected m"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected > (got EOF)"
-    if {$ok} {ict_match_token > "Expected >"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_ALPHA {} {
-    # ALPHA = (x (t <)
-    #            (t a)
-    #            (t l)
-    #            (t p)
-    #            (t h)
-    #            (t a)
-    #            (t >)
-    #            (n SPACE))
-
-    variable ok
-    if {[inc_restore ALPHA]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq74                ; # (x (t <)
-                            #    (t a)
-                            #    (t l)
-                            #    (t p)
-                            #    (t h)
-                            #    (t a)
-                            #    (t >)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   ALPHA $pos
-    inc_save               ALPHA $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected ALPHA" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq74 {} {
-
-    # (x (t <)
-    #    (t a)
-    #    (t l)
-    #    (t p)
-    #    (t h)
-    #    (t a)
-    #    (t >)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected < (got EOF)"
-    if {$ok} {ict_match_token < "Expected <"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected a (got EOF)"
-    if {$ok} {ict_match_token a "Expected a"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected l (got EOF)"
-    if {$ok} {ict_match_token l "Expected l"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected p (got EOF)"
-    if {$ok} {ict_match_token p "Expected p"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected h (got EOF)"
-    if {$ok} {ict_match_token h "Expected h"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected a (got EOF)"
-    if {$ok} {ict_match_token a "Expected a"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected > (got EOF)"
-    if {$ok} {ict_match_token > "Expected >"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_AND {} {
-    # AND = (x (t &)
-    #          (n SPACE))
-
-    variable ok
-    if {[inc_restore AND]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq66                ; # (x (t &)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   AND $pos
-    inc_save               AND $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected AND" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq66 {} {
-
-    # (x (t &)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected & (got EOF)"
-    if {$ok} {ict_match_token & "Expected &"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_APOSTROPH {} {
-    # APOSTROPH = (t ')
-
-    variable ok
-    if {[inc_restore APOSTROPH]} return
-
-    set pos [icl_get]
-
-    ict_advance "Expected ' (got EOF)"
-    if {$ok} {ict_match_token ' "Expected '"}
-
-    isv_clear
-    inc_save               APOSTROPH $pos
-    ier_nonterminal        "Expected APOSTROPH" $pos
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Attribute {} {
-    # Attribute = (x (/ (n VOID)
-    #                   (n LEAF)
-    #                   (n MATCH))
-    #                (n COLON))
-
-    variable ok
-    if {[inc_restore Attribute]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq7                ; # (x (/ (n VOID)
-                           #       (n LEAF)
-                           #       (n MATCH))
-                           #    (n COLON))
-
-    isv_nonterminal_reduce Attribute $pos $mrk
-    inc_save               Attribute $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Attribute" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq7 {} {
-
-    # (x (/ (n VOID)
-    #       (n LEAF)
-    #       (n MATCH))
-    #    (n COLON))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ebra6                ; # (/ (n VOID)
-                           #    (n LEAF)
-                           #    (n MATCH))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_COLON    ; # (n COLON)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ebra6 {} {
-
-    # (/ (n VOID)
-    #    (n LEAF)
-    #    (n MATCH))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_VOID    ; # (n VOID)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_LEAF    ; # (n LEAF)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_MATCH    ; # (n MATCH)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Char {} {
-    # Char = (/ (n CharSpecial)
-    #           (n CharOctalFull)
-    #           (n CharOctalPart)
-    #           (n CharUnicode)
-    #           (n CharUnescaped))
-
-    variable ok
-    if {[inc_restore Char]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    ebra42                ; # (/ (n CharSpecial)
-                            #    (n CharOctalFull)
-                            #    (n CharOctalPart)
-                            #    (n CharUnicode)
-                            #    (n CharUnescaped))
-
-    isv_nonterminal_reduce Char $pos $mrk
-    inc_save               Char $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Char" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra42 {} {
-
-    # (/ (n CharSpecial)
-    #    (n CharOctalFull)
-    #    (n CharOctalPart)
-    #    (n CharUnicode)
-    #    (n CharUnescaped))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_CharSpecial    ; # (n CharSpecial)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_CharOctalFull    ; # (n CharOctalFull)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_CharOctalPart    ; # (n CharOctalPart)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_CharUnicode    ; # (n CharUnicode)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_CharUnescaped    ; # (n CharUnescaped)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CharOctalFull {} {
-    # CharOctalFull = (x (t \)
-    #                    (.. 0 2)
-    #                    (.. 0 7)
-    #                    (.. 0 7))
-
-    variable ok
-    if {[inc_restore CharOctalFull]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq45                ; # (x (t \)
-                            #    (.. 0 2)
-                            #    (.. 0 7)
-                            #    (.. 0 7))
-
-    isv_nonterminal_range  CharOctalFull $pos
-    inc_save               CharOctalFull $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected CharOctalFull" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq45 {} {
-
-    # (x (t \)
-    #    (.. 0 2)
-    #    (.. 0 7)
-    #    (.. 0 7))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected \[0..2\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 2 "Expected \[0..2\]"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected \[0..7\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected \[0..7\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CharOctalPart {} {
-    # CharOctalPart = (x (t \)
-    #                    (.. 0 7)
-    #                    (? (.. 0 7)))
-
-    variable ok
-    if {[inc_restore CharOctalPart]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq47                ; # (x (t \)
-                            #    (.. 0 7)
-                            #    (? (.. 0 7)))
-
-    isv_nonterminal_range  CharOctalPart $pos
-    inc_save               CharOctalPart $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected CharOctalPart" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq47 {} {
-
-    # (x (t \)
-    #    (.. 0 7)
-    #    (? (.. 0 7)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected \[0..7\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    eopt46                ; # (? (.. 0 7))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::eopt46 {} {
-
-    # (? (.. 0 7))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \[0..7\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CharSpecial {} {
-    # CharSpecial = (x (t \)
-    #                  (/ (t n)
-    #                     (t r)
-    #                     (t t)
-    #                     (t ')
-    #                     (t \")
-    #                     (t [)
-    #                     (t ])
-    #                     (t \)))
-
-    variable ok
-    if {[inc_restore CharSpecial]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq44                ; # (x (t \)
-                            #    (/ (t n)
-                            #       (t r)
-                            #       (t t)
-                            #       (t ')
-                            #       (t \")
-                            #       (t [)
-                            #       (t ])
-                            #       (t \)))
-
-    isv_nonterminal_range  CharSpecial $pos
-    inc_save               CharSpecial $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected CharSpecial" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq44 {} {
-
-    # (x (t \)
-    #    (/ (t n)
-    #       (t r)
-    #       (t t)
-    #       (t ')
-    #       (t \")
-    #       (t [)
-    #       (t ])
-    #       (t \)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ebra43                ; # (/ (t n)
-                            #    (t r)
-                            #    (t t)
-                            #    (t ')
-                            #    (t \")
-                            #    (t [)
-                            #    (t ])
-                            #    (t \))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::ebra43 {} {
-
-    # (/ (t n)
-    #    (t r)
-    #    (t t)
-    #    (t ')
-    #    (t \")
-    #    (t [)
-    #    (t ])
-    #    (t \))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected n (got EOF)"
-    if {$ok} {ict_match_token n "Expected n"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected r (got EOF)"
-    if {$ok} {ict_match_token r "Expected r"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected t (got EOF)"
-    if {$ok} {ict_match_token t "Expected t"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected ' (got EOF)"
-    if {$ok} {ict_match_token ' "Expected '"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \" (got EOF)"
-    if {$ok} {ict_match_token \42 "Expected \""}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \[ (got EOF)"
-    if {$ok} {ict_match_token \133 "Expected \["}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \] (got EOF)"
-    if {$ok} {ict_match_token \135 "Expected \]"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CharUnescaped {} {
-    # CharUnescaped = (x (! (t \))
-    #                    (dot))
-
-    variable ok
-    if {[inc_restore CharUnescaped]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq55                ; # (x (! (t \))
-                            #    (dot))
-
-    isv_nonterminal_range  CharUnescaped $pos
-    inc_save               CharUnescaped $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected CharUnescaped" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq55 {} {
-
-    # (x (! (t \))
-    #    (dot))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang54
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected any character (got EOF)"
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::ebang54 {} {
-    variable ok
-
-    set pos [icl_get]
-
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CharUnicode {} {
-    # CharUnicode = (x (t \)
-    #                  (t u)
-    #                  (n HexDigit)
-    #                  (? (x (n HexDigit)
-    #                        (? (x (n HexDigit)
-    #                              (? (n HexDigit)))))))
-
-    variable ok
-    if {[inc_restore CharUnicode]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq53                ; # (x (t \)
-                            #    (t u)
-                            #    (n HexDigit)
-                            #    (? (x (n HexDigit)
-                            #          (? (x (n HexDigit)
-                            #                (? (n HexDigit)))))))
-
-    isv_nonterminal_range  CharUnicode $pos
-    inc_save               CharUnicode $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected CharUnicode" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq53 {} {
-
-    # (x (t \)
-    #    (t u)
-    #    (n HexDigit)
-    #    (? (x (n HexDigit)
-    #          (? (x (n HexDigit)
-    #                (? (n HexDigit)))))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \\ (got EOF)"
-    if {$ok} {ict_match_token \134 "Expected \\"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected u (got EOF)"
-    if {$ok} {ict_match_token u "Expected u"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_HexDigit    ; # (n HexDigit)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    eopt52                ; # (? (x (n HexDigit)
-                            #       (? (x (n HexDigit)
-                            #             (? (n HexDigit))))))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::eopt52 {} {
-
-    # (? (x (n HexDigit)
-    #       (? (x (n HexDigit)
-    #             (? (n HexDigit))))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    eseq51                ; # (x (n HexDigit)
-                            #    (? (x (n HexDigit)
-                            #          (? (n HexDigit)))))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq51 {} {
-
-    # (x (n HexDigit)
-    #    (? (x (n HexDigit)
-    #          (? (n HexDigit)))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_HexDigit    ; # (n HexDigit)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    eopt50                ; # (? (x (n HexDigit)
-                            #       (? (n HexDigit))))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::eopt50 {} {
-
-    # (? (x (n HexDigit)
-    #       (? (n HexDigit))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    eseq49                ; # (x (n HexDigit)
-                            #    (? (n HexDigit)))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq49 {} {
-
-    # (x (n HexDigit)
-    #    (? (n HexDigit)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_HexDigit    ; # (n HexDigit)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    eopt48                ; # (? (n HexDigit))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::eopt48 {} {
-
-    # (? (n HexDigit))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_HexDigit    ; # (n HexDigit)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Class {} {
-    # Class = (x (n OPENB)
-    #            (* (x (! (n CLOSEB))
-    #                  (n Range)))
-    #            (n CLOSEB)
-    #            (n SPACE))
-
-    variable ok
-    if {[inc_restore Class]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq32                ; # (x (n OPENB)
-                            #    (* (x (! (n CLOSEB))
-                            #          (n Range)))
-                            #    (n CLOSEB)
-                            #    (n SPACE))
-
-    isv_nonterminal_reduce Class $pos $mrk
-    inc_save               Class $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Class" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq32 {} {
-
-    # (x (n OPENB)
-    #    (* (x (! (n CLOSEB))
-    #          (n Range)))
-    #    (n CLOSEB)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_OPENB    ; # (n OPENB)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ekleene31                ; # (* (x (! (n CLOSEB))
-                               #       (n Range)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_CLOSEB    ; # (n CLOSEB)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ekleene31 {} {
-
-    # (* (x (! (n CLOSEB))
-    #       (n Range)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq30                ; # (x (! (n CLOSEB))
-                                #    (n Range))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq30 {} {
-
-    # (x (! (n CLOSEB))
-    #    (n Range))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang29
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Range    ; # (n Range)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ebang29 {} {
-    set pos [icl_get]
-
-    matchSymbol_CLOSEB    ; # (n CLOSEB)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CLOSE {} {
-    # CLOSE = (x (t \))
-    #            (n SPACE))
-
-    if {[inc_restore CLOSE]} return
-
-    set pos [icl_get]
-
-    eseq72                ; # (x (t \))
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               CLOSE $pos
-    ier_nonterminal        "Expected CLOSE" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq72 {} {
-
-    # (x (t \))
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \) (got EOF)"
-    if {$ok} {ict_match_token \51 "Expected \)"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_CLOSEB {} {
-    # CLOSEB = (t ])
-
-    variable ok
-    if {[inc_restore CLOSEB]} return
-
-    set pos [icl_get]
-
-    ict_advance "Expected \] (got EOF)"
-    if {$ok} {ict_match_token \135 "Expected \]"}
-
-    isv_clear
-    inc_save               CLOSEB $pos
-    ier_nonterminal        "Expected CLOSEB" $pos
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_COLON {} {
-    # COLON = (x (t :)
-    #            (n SPACE))
-
-    if {[inc_restore COLON]} return
-
-    set pos [icl_get]
-
-    eseq64                ; # (x (t :)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               COLON $pos
-    ier_nonterminal        "Expected COLON" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq64 {} {
-
-    # (x (t :)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected : (got EOF)"
-    if {$ok} {ict_match_token : "Expected :"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_COMMENT {} {
-    # COMMENT = (x (t #)
-    #              (* (x (! (n EOL))
-    #                    (dot)))
-    #              (n EOL))
-
-    if {[inc_restore COMMENT]} return
-
-    set pos [icl_get]
-
-    eseq81                ; # (x (t #)
-                            #    (* (x (! (n EOL))
-                            #          (dot)))
-                            #    (n EOL))
-
-    isv_clear
-    inc_save               COMMENT $pos
-    ier_nonterminal        "Expected COMMENT" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq81 {} {
-
-    # (x (t #)
-    #    (* (x (! (n EOL))
-    #          (dot)))
-    #    (n EOL))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected # (got EOF)"
-    if {$ok} {ict_match_token # "Expected #"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene80                ; # (* (x (! (n EOL))
-                               #       (dot)))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_EOL    ; # (n EOL)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::ekleene80 {} {
-
-    # (* (x (! (n EOL))
-    #       (dot)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq79                ; # (x (! (n EOL))
-                                #    (dot))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq79 {} {
-
-    # (x (! (n EOL))
-    #    (dot))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang78
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected any character (got EOF)"
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::ebang78 {} {
-    set pos [icl_get]
-
-    matchSymbol_EOL    ; # (n EOL)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_DAPOSTROPH {} {
-    # DAPOSTROPH = (t \")
-
-    variable ok
-    if {[inc_restore DAPOSTROPH]} return
-
-    set pos [icl_get]
-
-    ict_advance "Expected \" (got EOF)"
-    if {$ok} {ict_match_token \42 "Expected \""}
-
-    isv_clear
-    inc_save               DAPOSTROPH $pos
-    ier_nonterminal        "Expected DAPOSTROPH" $pos
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Definition {} {
-    # Definition = (x (? (n Attribute))
-    #                 (n Identifier)
-    #                 (n IS)
-    #                 (n Expression)
-    #                 (n SEMICOLON))
-
-    variable ok
-    if {[inc_restore Definition]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq5                ; # (x (? (n Attribute))
-                           #    (n Identifier)
-                           #    (n IS)
-                           #    (n Expression)
-                           #    (n SEMICOLON))
-
-    isv_nonterminal_reduce Definition $pos $mrk
-    inc_save               Definition $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Definition" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq5 {} {
-
-    # (x (? (n Attribute))
-    #    (n Identifier)
-    #    (n IS)
-    #    (n Expression)
-    #    (n SEMICOLON))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    eopt4                ; # (? (n Attribute))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_IS    ; # (n IS)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Expression    ; # (n Expression)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SEMICOLON    ; # (n SEMICOLON)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::eopt4 {} {
-
-    # (? (n Attribute))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Attribute    ; # (n Attribute)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_DOT {} {
-    # DOT = (x (t .)
-    #          (n SPACE))
-
-    variable ok
-    if {[inc_restore DOT]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq73                ; # (x (t .)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   DOT $pos
-    inc_save               DOT $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected DOT" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq73 {} {
-
-    # (x (t .)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected . (got EOF)"
-    if {$ok} {ict_match_token . "Expected ."}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_END {} {
-    # END = (x (t E)
-    #          (t N)
-    #          (t D)
-    #          (n SPACE))
-
-    if {[inc_restore END]} return
-
-    set pos [icl_get]
-
-    eseq62                ; # (x (t E)
-                            #    (t N)
-                            #    (t D)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               END $pos
-    ier_nonterminal        "Expected END" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq62 {} {
-
-    # (x (t E)
-    #    (t N)
-    #    (t D)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected E (got EOF)"
-    if {$ok} {ict_match_token E "Expected E"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected N (got EOF)"
-    if {$ok} {ict_match_token N "Expected N"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected D (got EOF)"
-    if {$ok} {ict_match_token D "Expected D"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_EOF {} {
-    # EOF = (! (dot))
-
-    if {[inc_restore EOF]} return
-
-    set pos [icl_get]
-
-    ebang84
-
-    isv_clear
-    inc_save               EOF $pos
-    ier_nonterminal        "Expected EOF" $pos
-    return
-}
-
-proc ::page::parse::peg::ebang84 {} {
-    set pos [icl_get]
-
-    ict_advance "Expected any character (got EOF)"
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_EOL {} {
-    # EOL = (/ (x (t \n)
-    #             (t \r))
-    #          (t \n)
-    #          (t \r))
-
-    if {[inc_restore EOL]} return
-
-    set pos [icl_get]
-
-    ebra83                ; # (/ (x (t \n)
-                            #       (t \r))
-                            #    (t \n)
-                            #    (t \r))
-
-    isv_clear
-    inc_save               EOL $pos
-    ier_nonterminal        "Expected EOL" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra83 {} {
-
-    # (/ (x (t \n)
-    #       (t \r))
-    #    (t \n)
-    #    (t \r))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    eseq82                ; # (x (t \n)
-                            #    (t \r))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \\n (got EOF)"
-    if {$ok} {ict_match_token \n "Expected \\n"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \\r (got EOF)"
-    if {$ok} {ict_match_token \r "Expected \\r"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::eseq82 {} {
-
-    # (x (t \n)
-    #    (t \r))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \\n (got EOF)"
-    if {$ok} {ict_match_token \n "Expected \\n"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected \\r (got EOF)"
-    if {$ok} {ict_match_token \r "Expected \\r"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Expression {} {
-    # Expression = (x (n Sequence)
-    #                 (* (x (n SLASH)
-    #                       (n Sequence))))
-
-    variable ok
-    if {[inc_restore Expression]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq10                ; # (x (n Sequence)
-                            #    (* (x (n SLASH)
-                            #          (n Sequence))))
-
-    isv_nonterminal_reduce Expression $pos $mrk
-    inc_save               Expression $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Expression" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq10 {} {
-
-    # (x (n Sequence)
-    #    (* (x (n SLASH)
-    #          (n Sequence))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Sequence    ; # (n Sequence)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    ekleene9                ; # (* (x (n SLASH)
-                              #       (n Sequence)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ekleene9 {} {
-
-    # (* (x (n SLASH)
-    #       (n Sequence)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq8                ; # (x (n SLASH)
-                               #    (n Sequence))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq8 {} {
-
-    # (x (n SLASH)
-    #    (n Sequence))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_SLASH    ; # (n SLASH)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Sequence    ; # (n Sequence)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Final {} {
-    # Final = (x (n END)
-    #            (n SEMICOLON)
-    #            (n SPACE))
-
-    if {[inc_restore Final]} return
-
-    set pos [icl_get]
-
-    eseq36                ; # (x (n END)
-                            #    (n SEMICOLON)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               Final $pos
-    ier_nonterminal        "Expected Final" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq36 {} {
-
-    # (x (n END)
-    #    (n SEMICOLON)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_END    ; # (n END)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SEMICOLON    ; # (n SEMICOLON)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Grammar {} {
-    # Grammar = (x (n SPACE)
-    #              (n Header)
-    #              (+ (n Definition))
-    #              (n Final)
-    #              (n EOF))
-
-    variable ok
-    if {[inc_restore Grammar]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq2                ; # (x (n SPACE)
-                           #    (n Header)
-                           #    (+ (n Definition))
-                           #    (n Final)
-                           #    (n EOF))
-
-    isv_nonterminal_reduce Grammar $pos $mrk
-    inc_save               Grammar $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Grammar" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq2 {} {
-
-    # (x (n SPACE)
-    #    (n Header)
-    #    (+ (n Definition))
-    #    (n Final)
-    #    (n EOF))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Header    ; # (n Header)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    epkleene1                ; # (+ (n Definition))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Final    ; # (n Final)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_EOF    ; # (n EOF)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::epkleene1 {} {
-
-    # (+ (n Definition))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Definition    ; # (n Definition)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Definition    ; # (n Definition)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Header {} {
-    # Header = (x (n PEG)
-    #             (n Identifier)
-    #             (n StartExpr))
-
-    variable ok
-    if {[inc_restore Header]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq3                ; # (x (n PEG)
-                           #    (n Identifier)
-                           #    (n StartExpr))
-
-    isv_nonterminal_reduce Header $pos $mrk
-    inc_save               Header $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Header" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq3 {} {
-
-    # (x (n PEG)
-    #    (n Identifier)
-    #    (n StartExpr))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_PEG    ; # (n PEG)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_StartExpr    ; # (n StartExpr)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_HexDigit {} {
-    # HexDigit = (/ (.. 0 9)
-    #               (.. a f)
-    #               (.. A F))
-
-    if {[inc_restore HexDigit]} return
-
-    set pos [icl_get]
-
-    ebra56                ; # (/ (.. 0 9)
-                            #    (.. a f)
-                            #    (.. A F))
-
-    isv_clear
-    inc_save               HexDigit $pos
-    ier_nonterminal        "Expected HexDigit" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra56 {} {
-
-    # (/ (.. 0 9)
-    #    (.. a f)
-    #    (.. A F))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \[0..9\] (got EOF)"
-    if {$ok} {ict_match_tokrange 0 9 "Expected \[0..9\]"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \[a..f\] (got EOF)"
-    if {$ok} {ict_match_tokrange a f "Expected \[a..f\]"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \[A..F\] (got EOF)"
-    if {$ok} {ict_match_tokrange A F "Expected \[A..F\]"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Ident {} {
-    # Ident = (x (/ (t _)
-    #               (t :)
-    #               (alpha))
-    #            (* (/ (t _)
-    #                  (t :)
-    #                  (alnum))))
-
-    variable ok
-    if {[inc_restore Ident]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq41                ; # (x (/ (t _)
-                            #       (t :)
-                            #       (alpha))
-                            #    (* (/ (t _)
-                            #          (t :)
-                            #          (alnum))))
-
-    isv_nonterminal_range  Ident $pos
-    inc_save               Ident $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Ident" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq41 {} {
-
-    # (x (/ (t _)
-    #       (t :)
-    #       (alpha))
-    #    (* (/ (t _)
-    #          (t :)
-    #          (alnum))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebra38                ; # (/ (t _)
-                            #    (t :)
-                            #    (alpha))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ekleene40                ; # (* (/ (t _)
-                               #       (t :)
-                               #       (alnum)))
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::ebra38 {} {
-
-    # (/ (t _)
-    #    (t :)
-    #    (alpha))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected _ (got EOF)"
-    if {$ok} {ict_match_token _ "Expected _"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected : (got EOF)"
-    if {$ok} {ict_match_token : "Expected :"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected <alpha> (got EOF)"
-    if {$ok} {ict_match_tokclass alpha "Expected <alpha>"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::ekleene40 {} {
-
-    # (* (/ (t _)
-    #       (t :)
-    #       (alnum)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ebra39                ; # (/ (t _)
-                                #    (t :)
-                                #    (alnum))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::ebra39 {} {
-
-    # (/ (t _)
-    #    (t :)
-    #    (alnum))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected _ (got EOF)"
-    if {$ok} {ict_match_token _ "Expected _"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected : (got EOF)"
-    if {$ok} {ict_match_token : "Expected :"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected <alnum> (got EOF)"
-    if {$ok} {ict_match_tokclass alnum "Expected <alnum>"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Identifier {} {
-    # Identifier = (x (n Ident)
-    #                 (n SPACE))
-
-    variable ok
-    if {[inc_restore Identifier]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq37                ; # (x (n Ident)
-                            #    (n SPACE))
-
-    isv_nonterminal_reduce Identifier $pos $mrk
-    inc_save               Identifier $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Identifier" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq37 {} {
-
-    # (x (n Ident)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Ident    ; # (n Ident)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_IS {} {
-    # IS = (x (t <)
-    #         (t -)
-    #         (n SPACE))
-
-    if {[inc_restore IS]} return
-
-    set pos [icl_get]
-
-    eseq58                ; # (x (t <)
-                            #    (t -)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               IS $pos
-    ier_nonterminal        "Expected IS" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq58 {} {
-
-    # (x (t <)
-    #    (t -)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected < (got EOF)"
-    if {$ok} {ict_match_token < "Expected <"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected - (got EOF)"
-    if {$ok} {ict_match_token - "Expected -"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_LEAF {} {
-    # LEAF = (x (t l)
-    #           (t e)
-    #           (t a)
-    #           (t f)
-    #           (n SPACE))
-
-    variable ok
-    if {[inc_restore LEAF]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq60                ; # (x (t l)
-                            #    (t e)
-                            #    (t a)
-                            #    (t f)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   LEAF $pos
-    inc_save               LEAF $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected LEAF" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq60 {} {
-
-    # (x (t l)
-    #    (t e)
-    #    (t a)
-    #    (t f)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected l (got EOF)"
-    if {$ok} {ict_match_token l "Expected l"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected e (got EOF)"
-    if {$ok} {ict_match_token e "Expected e"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected a (got EOF)"
-    if {$ok} {ict_match_token a "Expected a"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected f (got EOF)"
-    if {$ok} {ict_match_token f "Expected f"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Literal {} {
-    # Literal = (/ (x (n APOSTROPH)
-    #                 (* (x (! (n APOSTROPH))
-    #                       (n Char)))
-    #                 (n APOSTROPH)
-    #                 (n SPACE))
-    #              (x (n DAPOSTROPH)
-    #                 (* (x (! (n DAPOSTROPH))
-    #                       (n Char)))
-    #                 (n DAPOSTROPH)
-    #                 (n SPACE)))
-
-    variable ok
-    if {[inc_restore Literal]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    ebra28                ; # (/ (x (n APOSTROPH)
-                            #       (* (x (! (n APOSTROPH))
-                            #             (n Char)))
-                            #       (n APOSTROPH)
-                            #       (n SPACE))
-                            #    (x (n DAPOSTROPH)
-                            #       (* (x (! (n DAPOSTROPH))
-                            #             (n Char)))
-                            #       (n DAPOSTROPH)
-                            #       (n SPACE)))
-
-    isv_nonterminal_reduce Literal $pos $mrk
-    inc_save               Literal $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Literal" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra28 {} {
-
-    # (/ (x (n APOSTROPH)
-    #       (* (x (! (n APOSTROPH))
-    #             (n Char)))
-    #       (n APOSTROPH)
-    #       (n SPACE))
-    #    (x (n DAPOSTROPH)
-    #       (* (x (! (n DAPOSTROPH))
-    #             (n Char)))
-    #       (n DAPOSTROPH)
-    #       (n SPACE)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    eseq23                ; # (x (n APOSTROPH)
-                            #    (* (x (! (n APOSTROPH))
-                            #          (n Char)))
-                            #    (n APOSTROPH)
-                            #    (n SPACE))
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    eseq27                ; # (x (n DAPOSTROPH)
-                            #    (* (x (! (n DAPOSTROPH))
-                            #          (n Char)))
-                            #    (n DAPOSTROPH)
-                            #    (n SPACE))
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::eseq23 {} {
-
-    # (x (n APOSTROPH)
-    #    (* (x (! (n APOSTROPH))
-    #          (n Char)))
-    #    (n APOSTROPH)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_APOSTROPH    ; # (n APOSTROPH)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ekleene22                ; # (* (x (! (n APOSTROPH))
-                               #       (n Char)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_APOSTROPH    ; # (n APOSTROPH)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ekleene22 {} {
-
-    # (* (x (! (n APOSTROPH))
-    #       (n Char)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq21                ; # (x (! (n APOSTROPH))
-                                #    (n Char))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq21 {} {
-
-    # (x (! (n APOSTROPH))
-    #    (n Char))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang20
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Char    ; # (n Char)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ebang20 {} {
-    set pos [icl_get]
-
-    matchSymbol_APOSTROPH    ; # (n APOSTROPH)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::eseq27 {} {
-
-    # (x (n DAPOSTROPH)
-    #    (* (x (! (n DAPOSTROPH))
-    #          (n Char)))
-    #    (n DAPOSTROPH)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_DAPOSTROPH    ; # (n DAPOSTROPH)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    ekleene26                ; # (* (x (! (n DAPOSTROPH))
-                               #       (n Char)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_DAPOSTROPH    ; # (n DAPOSTROPH)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ekleene26 {} {
-
-    # (* (x (! (n DAPOSTROPH))
-    #       (n Char)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        eseq25                ; # (x (! (n DAPOSTROPH))
-                                #    (n Char))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::eseq25 {} {
-
-    # (x (! (n DAPOSTROPH))
-    #    (n Char))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebang24
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Char    ; # (n Char)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::ebang24 {} {
-    set pos [icl_get]
-
-    matchSymbol_DAPOSTROPH    ; # (n DAPOSTROPH)
-
-    icl_rewind $pos
-    iok_negate
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_MATCH {} {
-    # MATCH = (x (t m)
-    #            (t a)
-    #            (t t)
-    #            (t c)
-    #            (t h)
-    #            (n SPACE))
-
-    variable ok
-    if {[inc_restore MATCH]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq61                ; # (x (t m)
-                            #    (t a)
-                            #    (t t)
-                            #    (t c)
-                            #    (t h)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   MATCH $pos
-    inc_save               MATCH $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected MATCH" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq61 {} {
-
-    # (x (t m)
-    #    (t a)
-    #    (t t)
-    #    (t c)
-    #    (t h)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected m (got EOF)"
-    if {$ok} {ict_match_token m "Expected m"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected a (got EOF)"
-    if {$ok} {ict_match_token a "Expected a"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected t (got EOF)"
-    if {$ok} {ict_match_token t "Expected t"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected c (got EOF)"
-    if {$ok} {ict_match_token c "Expected c"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected h (got EOF)"
-    if {$ok} {ict_match_token h "Expected h"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_NOT {} {
-    # NOT = (x (t !)
-    #          (n SPACE))
-
-    variable ok
-    if {[inc_restore NOT]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq67                ; # (x (t !)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   NOT $pos
-    inc_save               NOT $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected NOT" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq67 {} {
-
-    # (x (t !)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected ! (got EOF)"
-    if {$ok} {ict_match_token ! "Expected !"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_OPEN {} {
-    # OPEN = (x (t \()
-    #           (n SPACE))
-
-    if {[inc_restore OPEN]} return
-
-    set pos [icl_get]
-
-    eseq71                ; # (x (t \()
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               OPEN $pos
-    ier_nonterminal        "Expected OPEN" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq71 {} {
-
-    # (x (t \()
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \( (got EOF)"
-    if {$ok} {ict_match_token \50 "Expected \("}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_OPENB {} {
-    # OPENB = (t [)
-
-    variable ok
-    if {[inc_restore OPENB]} return
-
-    set pos [icl_get]
-
-    ict_advance "Expected \[ (got EOF)"
-    if {$ok} {ict_match_token \133 "Expected \["}
-
-    isv_clear
-    inc_save               OPENB $pos
-    ier_nonterminal        "Expected OPENB" $pos
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_PEG {} {
-    # PEG = (x (t P)
-    #          (t E)
-    #          (t G)
-    #          (n SPACE))
-
-    if {[inc_restore PEG]} return
-
-    set pos [icl_get]
-
-    eseq57                ; # (x (t P)
-                            #    (t E)
-                            #    (t G)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               PEG $pos
-    ier_nonterminal        "Expected PEG" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq57 {} {
-
-    # (x (t P)
-    #    (t E)
-    #    (t G)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected P (got EOF)"
-    if {$ok} {ict_match_token P "Expected P"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected E (got EOF)"
-    if {$ok} {ict_match_token E "Expected E"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected G (got EOF)"
-    if {$ok} {ict_match_token G "Expected G"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_PLUS {} {
-    # PLUS = (x (t +)
-    #           (n SPACE))
-
-    variable ok
-    if {[inc_restore PLUS]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq70                ; # (x (t +)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   PLUS $pos
-    inc_save               PLUS $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected PLUS" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq70 {} {
-
-    # (x (t +)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected + (got EOF)"
-    if {$ok} {ict_match_token + "Expected +"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Prefix {} {
-    # Prefix = (x (? (/ (n AND)
-    #                   (n NOT)))
-    #             (n Suffix))
-
-    variable ok
-    if {[inc_restore Prefix]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq14                ; # (x (? (/ (n AND)
-                            #          (n NOT)))
-                            #    (n Suffix))
-
-    isv_nonterminal_reduce Prefix $pos $mrk
-    inc_save               Prefix $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Prefix" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq14 {} {
-
-    # (x (? (/ (n AND)
-    #          (n NOT)))
-    #    (n Suffix))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    eopt13                ; # (? (/ (n AND)
-                            #       (n NOT)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Suffix    ; # (n Suffix)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::eopt13 {} {
-
-    # (? (/ (n AND)
-    #       (n NOT)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebra12                ; # (/ (n AND)
-                            #    (n NOT))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::ebra12 {} {
-
-    # (/ (n AND)
-    #    (n NOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_AND    ; # (n AND)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_NOT    ; # (n NOT)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Primary {} {
-    # Primary = (/ (n ALNUM)
-    #              (n ALPHA)
-    #              (n Identifier)
-    #              (x (n OPEN)
-    #                 (n Expression)
-    #                 (n CLOSE))
-    #              (n Literal)
-    #              (n Class)
-    #              (n DOT))
-
-    variable ok
-    if {[inc_restore Primary]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    ebra19                ; # (/ (n ALNUM)
-                            #    (n ALPHA)
-                            #    (n Identifier)
-                            #    (x (n OPEN)
-                            #       (n Expression)
-                            #       (n CLOSE))
-                            #    (n Literal)
-                            #    (n Class)
-                            #    (n DOT))
-
-    isv_nonterminal_reduce Primary $pos $mrk
-    inc_save               Primary $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Primary" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra19 {} {
-
-    # (/ (n ALNUM)
-    #    (n ALPHA)
-    #    (n Identifier)
-    #    (x (n OPEN)
-    #       (n Expression)
-    #       (n CLOSE))
-    #    (n Literal)
-    #    (n Class)
-    #    (n DOT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_ALNUM    ; # (n ALNUM)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_ALPHA    ; # (n ALPHA)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Identifier    ; # (n Identifier)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    eseq18                ; # (x (n OPEN)
-                            #    (n Expression)
-                            #    (n CLOSE))
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Literal    ; # (n Literal)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Class    ; # (n Class)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_DOT    ; # (n DOT)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::eseq18 {} {
-
-    # (x (n OPEN)
-    #    (n Expression)
-    #    (n CLOSE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_OPEN    ; # (n OPEN)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Expression    ; # (n Expression)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_CLOSE    ; # (n CLOSE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_QUESTION {} {
-    # QUESTION = (x (t ?)
-    #               (n SPACE))
-
-    variable ok
-    if {[inc_restore QUESTION]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq68                ; # (x (t ?)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   QUESTION $pos
-    inc_save               QUESTION $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected QUESTION" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq68 {} {
-
-    # (x (t ?)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected ? (got EOF)"
-    if {$ok} {ict_match_token ? "Expected ?"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Range {} {
-    # Range = (/ (x (n Char)
-    #               (n TO)
-    #               (n Char))
-    #            (n Char))
-
-    variable ok
-    if {[inc_restore Range]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    ebra34                ; # (/ (x (n Char)
-                            #       (n TO)
-                            #       (n Char))
-                            #    (n Char))
-
-    isv_nonterminal_reduce Range $pos $mrk
-    inc_save               Range $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Range" $pos
-    return
-}
-
-proc ::page::parse::peg::ebra34 {} {
-
-    # (/ (x (n Char)
-    #       (n TO)
-    #       (n Char))
-    #    (n Char))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    eseq33                ; # (x (n Char)
-                            #    (n TO)
-                            #    (n Char))
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_Char    ; # (n Char)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::eseq33 {} {
-
-    # (x (n Char)
-    #    (n TO)
-    #    (n Char))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Char    ; # (n Char)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_TO    ; # (n TO)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_Char    ; # (n Char)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_SEMICOLON {} {
-    # SEMICOLON = (x (t ;)
-    #                (n SPACE))
-
-    if {[inc_restore SEMICOLON]} return
-
-    set pos [icl_get]
-
-    eseq63                ; # (x (t ;)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               SEMICOLON $pos
-    ier_nonterminal        "Expected SEMICOLON" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq63 {} {
-
-    # (x (t ;)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected \; (got EOF)"
-    if {$ok} {ict_match_token \73 "Expected \;"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Sequence {} {
-    # Sequence = (+ (n Prefix))
-
-    variable ok
-    if {[inc_restore Sequence]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    epkleene11                ; # (+ (n Prefix))
-
-    isv_nonterminal_reduce Sequence $pos $mrk
-    inc_save               Sequence $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Sequence" $pos
-    return
-}
-
-proc ::page::parse::peg::epkleene11 {} {
-
-    # (+ (n Prefix))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_Prefix    ; # (n Prefix)
-    ier_merge $old
-
-    if {!$ok} {
-        icl_rewind $pos
-        return
-    }
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        matchSymbol_Prefix    ; # (n Prefix)
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_SLASH {} {
-    # SLASH = (x (t /)
-    #            (n SPACE))
-
-    if {[inc_restore SLASH]} return
-
-    set pos [icl_get]
-
-    eseq65                ; # (x (t /)
-                            #    (n SPACE))
-
-    isv_clear
-    inc_save               SLASH $pos
-    ier_nonterminal        "Expected SLASH" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq65 {} {
-
-    # (x (t /)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected / (got EOF)"
-    if {$ok} {ict_match_token / "Expected /"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_SPACE {} {
-    # SPACE = (* (/ (t <blank>)
-    #               (t \t)
-    #               (n EOL)
-    #               (n COMMENT)))
-
-    if {[inc_restore SPACE]} return
-
-    set pos [icl_get]
-
-    ekleene77                ; # (* (/ (t <blank>)
-                               #       (t \t)
-                               #       (n EOL)
-                               #       (n COMMENT)))
-
-    isv_clear
-    inc_save               SPACE $pos
-    ier_nonterminal        "Expected SPACE" $pos
-    return
-}
-
-proc ::page::parse::peg::ekleene77 {} {
-
-    # (* (/ (t <blank>)
-    #       (t \t)
-    #       (n EOL)
-    #       (n COMMENT)))
-
-    variable ok
-
-    while {1} {
-        set pos [icl_get]
-
-        set old [ier_get]
-        ebra76                ; # (/ (t <blank>)
-                                #    (t \t)
-                                #    (n EOL)
-                                #    (n COMMENT))
-        ier_merge $old
-
-        if {$ok} continue
-        break
-    }
-
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::ebra76 {} {
-
-    # (/ (t <blank>)
-    #    (t \t)
-    #    (n EOL)
-    #    (n COMMENT))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected <blank> (got EOF)"
-    if {$ok} {ict_match_token \40 "Expected <blank>"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    ict_advance "Expected \\t (got EOF)"
-    if {$ok} {ict_match_token \t "Expected \\t"}
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_EOL    ; # (n EOL)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    set old [ier_get]
-    matchSymbol_COMMENT    ; # (n COMMENT)
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_STAR {} {
-    # STAR = (x (t *)
-    #           (n SPACE))
-
-    variable ok
-    if {[inc_restore STAR]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq69                ; # (x (t *)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   STAR $pos
-    inc_save               STAR $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected STAR" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq69 {} {
-
-    # (x (t *)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected * (got EOF)"
-    if {$ok} {ict_match_token * "Expected *"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_StartExpr {} {
-    # StartExpr = (x (n OPEN)
-    #                (n Expression)
-    #                (n CLOSE))
-
-    variable ok
-    if {[inc_restore StartExpr]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq35                ; # (x (n OPEN)
-                            #    (n Expression)
-                            #    (n CLOSE))
-
-    isv_nonterminal_reduce StartExpr $pos $mrk
-    inc_save               StartExpr $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected StartExpr" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq35 {} {
-
-    # (x (n OPEN)
-    #    (n Expression)
-    #    (n CLOSE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    matchSymbol_OPEN    ; # (n OPEN)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Expression    ; # (n Expression)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    matchSymbol_CLOSE    ; # (n CLOSE)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_Suffix {} {
-    # Suffix = (x (n Primary)
-    #             (? (/ (n QUESTION)
-    #                   (n STAR)
-    #                   (n PLUS))))
-
-    variable ok
-    if {[inc_restore Suffix]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-    set mrk [ias_mark]
-
-    eseq17                ; # (x (n Primary)
-                            #    (? (/ (n QUESTION)
-                            #          (n STAR)
-                            #          (n PLUS))))
-
-    isv_nonterminal_reduce Suffix $pos $mrk
-    inc_save               Suffix $pos
-    ias_pop2mark             $mrk
-    if {$ok} ias_push
-    ier_nonterminal        "Expected Suffix" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq17 {} {
-
-    # (x (n Primary)
-    #    (? (/ (n QUESTION)
-    #          (n STAR)
-    #          (n PLUS))))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-
-    set old [ier_get]
-    matchSymbol_Primary    ; # (n Primary)
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    set old [ier_get]
-    eopt16                ; # (? (/ (n QUESTION)
-                            #       (n STAR)
-                            #       (n PLUS)))
-    ier_merge $old
-
-    if {!$ok} {
-        ias_pop2mark $mrk
-        icl_rewind   $pos
-        return
-    }
-
-    return
-}
-
-proc ::page::parse::peg::eopt16 {} {
-
-    # (? (/ (n QUESTION)
-    #       (n STAR)
-    #       (n PLUS)))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ebra15                ; # (/ (n QUESTION)
-                            #    (n STAR)
-                            #    (n PLUS))
-    ier_merge $old
-
-    if {$ok} return
-    icl_rewind $pos
-    iok_ok
-    return
-}
-
-proc ::page::parse::peg::ebra15 {} {
-
-    # (/ (n QUESTION)
-    #    (n STAR)
-    #    (n PLUS))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_QUESTION    ; # (n QUESTION)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_STAR    ; # (n STAR)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    set mrk [ias_mark]
-    set old [ier_get]
-    matchSymbol_PLUS    ; # (n PLUS)
-    ier_merge $old
-
-    if {$ok} return
-    ias_pop2mark $mrk
-    icl_rewind   $pos
-
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_TO {} {
-    # TO = (t -)
-
-    variable ok
-    if {[inc_restore TO]} return
-
-    set pos [icl_get]
-
-    ict_advance "Expected - (got EOF)"
-    if {$ok} {ict_match_token - "Expected -"}
-
-    isv_clear
-    inc_save               TO $pos
-    ier_nonterminal        "Expected TO" $pos
-    return
-}
-
-proc ::page::parse::peg::matchSymbol_VOID {} {
-    # VOID = (x (t v)
-    #           (t o)
-    #           (t i)
-    #           (t d)
-    #           (n SPACE))
-
-    variable ok
-    if {[inc_restore VOID]} {
-        if {$ok} ias_push
-        return
-    }
-
-    set pos [icl_get]
-
-    eseq59                ; # (x (t v)
-                            #    (t o)
-                            #    (t i)
-                            #    (t d)
-                            #    (n SPACE))
-
-    isv_nonterminal_leaf   VOID $pos
-    inc_save               VOID $pos
-    if {$ok} ias_push
-    ier_nonterminal        "Expected VOID" $pos
-    return
-}
-
-proc ::page::parse::peg::eseq59 {} {
-
-    # (x (t v)
-    #    (t o)
-    #    (t i)
-    #    (t d)
-    #    (n SPACE))
-
-    variable ok
-
-    set pos [icl_get]
-
-    set old [ier_get]
-    ict_advance "Expected v (got EOF)"
-    if {$ok} {ict_match_token v "Expected v"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected o (got EOF)"
-    if {$ok} {ict_match_token o "Expected o"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected i (got EOF)"
-    if {$ok} {ict_match_token i "Expected i"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    ict_advance "Expected d (got EOF)"
-    if {$ok} {ict_match_token d "Expected d"}
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    set old [ier_get]
-    matchSymbol_SPACE    ; # (n SPACE)
-    ier_merge $old
-
-    if {!$ok} {icl_rewind $pos ; return}
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Package Management
-
-package provide page::parse::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_peghb.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_peghb.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,118 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Frontend - Read halfbaked PEG container.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::page::parse::peghb {
-    variable fixup {}
-    variable definitions
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::parse::peghb {halfbaked t} {
-    variable peghb::fixup
-    variable peghb::definitions
-    array set definitions {}
-
-    set fixup {}
-
-    interp create -safe sb
-    # Should remove everything.
-    interp alias  sb Start  {} ::page::parse::peghb::Start  $t
-    interp alias  sb Define {} ::page::parse::peghb::Define $t
-    interp eval   sb $halfbaked
-    interp delete sb
-
-    array set undefined {}
-    array set users     {}
-    foreach {n sym} $fixup {
-	if {[info exists definitions($sym)]} {
-	    set def $definitions($sym)
-	    $t set $n def $def
-	    lappend users($def) $n
-	} else {
-	    lappend undefined($sym) $n
-	}
-    }
-
-    foreach def [array names users] {
-	$t set $def users $users($def)
-    }
-
-    $t set root definitions [array get definitions]
-    $t set root undefined   [array get undefined]
-    $t set root symbol <StartExpression>
-    $t set root name   <HalfBaked>
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::parse::peghb::Start {t pe} {
-    variable fixup
-    $t set root start [treeOf $t root $pe fixup]
-    return
-}
-
-proc ::page::parse::peghb::Define {t mode sym pe} {
-    variable fixup
-    variable definitions
-
-    set def [$t insert root end]
-
-    $t set $def users  {}
-    $t set $def symbol $sym
-    $t set $def label  $sym
-    $t set $def mode   $mode
-
-    treeOf $t $def $pe fixup
-
-    set definitions($sym) $def
-    return
-}
-
-proc ::page::parse::peghb::treeOf {t root pe fv} {
-    upvar 1 $fv fixup
-
-    set n  [$t insert $root end]
-    set op [lindex $pe 0]
-    $t set $n op $op
-
-    if {$op eq "t"} {
-	$t set $n char [lindex $pe 1]
-
-    } elseif {$op eq ".."} {
-	$t set $n begin [lindex $pe 1]
-	$t set $n end   [lindex $pe 2]
-
-    } elseif {$op eq "n"} {
-
-	set sym [lindex $pe 1]
-	$t set $n sym $sym
-	$t set $n def ""
-
-	lappend fixup $n $sym
-    } else {
-	foreach sub [lrange $pe 1 end] {
-	    treeOf $t $n $sub fixup
-	}
-    }
-    return $n
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::parse::peghb {}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::parse::peghb 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_pegser.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/parse_pegser.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,99 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Frontend - Read serialized PEG container.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require grammar::peg
-
-namespace eval ::page::parse::pegser {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::parse::pegser {serial t} {
-
-    ::grammar::peg gr deserialize $serial
-
-    $t set root start [pegser::treeOf $t root [gr start] fixup]
-
-    array set definitions {}
-    foreach sym [gr nonterminals] {
-	set def [$t insert root end]
-
-	$t set $def users  {}
-	$t set $def symbol $sym
-	$t set $def label  $sym
-	$t set $def mode       [gr nonterminal mode $sym]
-	pegser::treeOf $t $def [gr nonterminal rule $sym] fixup
-
-	set definitions($sym) $def
-    }
-
-    array set undefined {}
-    array set users     {}
-    foreach {n sym} $fixup {
-	if {[info exists definitions($sym)]} {
-	    set def $definitions($sym)
-	    $t set $n def $def
-	    lappend users($def) $n
-	} else {
-	    lappend undefined($sym) $n
-	}
-    }
-
-    foreach def [array names users] {
-	$t set $def users $users($def)
-    }
-
-    $t set root definitions [array get definitions]
-    $t set root undefined   [array get undefined]
-    $t set root symbol <StartExpression>
-    $t set root name   <Serialization>
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::parse::pegser::treeOf {t root pe fv} {
-    upvar 1 $fv fixup
-
-    set n  [$t insert $root end]
-    set op [lindex $pe 0]
-    $t set $n op $op
-
-    if {$op eq "t"} {
-	$t set $n char [lindex $pe 1]
-
-    } elseif {$op eq ".."} {
-	$t set $n begin [lindex $pe 1]
-	$t set $n end   [lindex $pe 2]
-
-    } elseif {$op eq "n"} {
-
-	set sym [lindex $pe 1]
-	$t set $n sym $sym
-	$t set $n def ""
-
-	lappend fixup $n $sym
-    } else {
-	foreach sub [lrange $pe 1 end] {
-	    treeOf $t $n $sub fixup
-	}
-    }
-    return $n
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Strings.
-
-namespace eval ::page::parse::pegser {}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::parse::pegser 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/peg_grammar.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/peg_grammar.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,116 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Grammar for reading of PE grammars
-
-## Parsing Expression Grammar 'pg::peg::grammar'.
-
-# ### ### ### ######### ######### #########
-## Package description
-
-## It provides a single command returning the handle of a
-## grammar container in which the grammar 'pg::peg::grammar'
-## is stored. The container is usable by a PEG interpreter
-## or other packages taking PE grammars.
-
-# ### ### ### ######### ######### #########
-## Requisites.
-## - PEG container type
-
-package require grammar::peg
-
-namespace eval ::pg::peg::grammar {}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::pg::peg::grammar {} {
-    return $grammar::gr
-}
-
-# ### ### ### ######### ######### #########
-# ### ### ### ######### ######### #########
-## Data and helpers.
-
-namespace eval ::pg::peg::grammar {
-    # Grammar container
-    variable gr [::grammar::peg gr]
-}
-
-proc ::pg::peg::grammar::Start {pe} {
-    variable gr
-    $gr start $pe
-    return
-}
-
-proc ::pg::peg::grammar::Define {mode nt pe} {
-    variable gr
-    $gr nonterminal add  $nt $pe
-    $gr nonterminal mode $nt $mode
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization = Grammar definition
-    
-namespace eval ::pg::peg::grammar {
-    Start  {n Grammar}
-
-    Define leaf    ALNUM         {x {t <} {t a} {t l} {t n} {t u} {t m} {t >} {n SPACE}}
-    Define leaf    ALPHA         {x {t <} {t a} {t l} {t p} {t h} {t a} {t >} {n SPACE}}
-    Define leaf    AND           {x {t &} {n SPACE}}
-    Define discard APOSTROPH     {t '}
-    Define value   Attribute     {x {/ {n VOID} {n LEAF} {n MATCH}} {n COLON}}
-    Define value   Char          {/ {n CharSpecial} {n CharOctalFull} {n CharOctalPart} {n CharUnicode} {n CharUnescaped}}
-    Define match   CharOctalFull {x {t \134} {.. 0 2} {.. 0 7} {.. 0 7}}
-    Define match   CharOctalPart {x {t \134} {.. 0 7} {? {.. 0 7}}}
-    Define match   CharSpecial   {x {t \134} {/ {t n} {t r} {t t} {t '} {t \42} {t \133} {t \135} {t \134}}}
-    Define match   CharUnescaped {x {! {t \134}} dot}
-    Define match   CharUnicode   {x {t \134} {t u} {n HexDigit} {? {x {n HexDigit} {? {x {n HexDigit} {? {n HexDigit}}}}}}}
-    Define value   Class         {x {n OPENB} {* {x {! {n CLOSEB}} {n Range}}} {n CLOSEB} {n SPACE}}
-    Define discard CLOSE         {x {t \51} {n SPACE}}
-    Define discard CLOSEB        {t \135}
-    Define discard COLON         {x {t :} {n SPACE}}
-    Define discard COMMENT       {x {t #} {* {x {! {n EOL}} dot}} {n EOL}}
-    Define discard DAPOSTROPH    {t \42}
-    Define value   Definition    {x {? {n Attribute}} {n Identifier} {n IS} {n Expression} {n SEMICOLON}}
-    Define leaf    DOT           {x {t .} {n SPACE}}
-    Define discard END           {x {t E} {t N} {t D} {n SPACE}}
-    Define discard EOF           {! dot}
-    Define discard EOL           {/ {x {t \n} {t \r}} {t \n} {t \r}}
-    Define value   Expression    {x {n Sequence} {* {x {n SLASH} {n Sequence}}}}
-    Define discard Final         {x {n END} {n SEMICOLON} {n SPACE}}
-    Define value   Grammar       {x {n SPACE} {n Header} {+ {n Definition}} {n Final} {n EOF}}
-    Define value   Header        {x {n PEG} {n Identifier} {n StartExpr}}
-    Define discard HexDigit      {/ {.. 0 9} {.. a f} {.. A F}}
-    Define match   Ident         {x {/ {t _} {t :} alpha} {* {/ {t _} {t :} alnum}}}
-    Define value   Identifier    {x {n Ident} {n SPACE}}
-    Define discard IS            {x {t <} {t -} {n SPACE}}
-    Define leaf    LEAF          {x {t l} {t e} {t a} {t f} {n SPACE}}
-    Define value   Literal       {/ {x {n APOSTROPH} {* {x {! {n APOSTROPH}} {n Char}}} {n APOSTROPH} {n SPACE}} {x {n DAPOSTROPH} {* {x {! {n DAPOSTROPH}} {n Char}}} {n DAPOSTROPH} {n SPACE}}}
-    Define leaf    MATCH         {x {t m} {t a} {t t} {t c} {t h} {n SPACE}}
-    Define leaf    NOT           {x {t !} {n SPACE}}
-    Define discard OPEN          {x {t \50} {n SPACE}}
-    Define discard OPENB         {t \133}
-    Define discard PEG           {x {t P} {t E} {t G} {n SPACE}}
-    Define leaf    PLUS          {x {t +} {n SPACE}}
-    Define value   Prefix        {x {? {/ {n AND} {n NOT}}} {n Suffix}}
-    Define value   Primary       {/ {n ALNUM} {n ALPHA} {n Identifier} {x {n OPEN} {n Expression} {n CLOSE}} {n Literal} {n Class} {n DOT}}
-    Define leaf    QUESTION      {x {t ?} {n SPACE}}
-    Define value   Range         {/ {x {n Char} {n TO} {n Char}} {n Char}}
-    Define discard SEMICOLON     {x {t \73} {n SPACE}}
-    Define value   Sequence      {+ {n Prefix}}
-    Define discard SLASH         {x {t /} {n SPACE}}
-    Define discard SPACE         {* {/ {t \40} {t \t} {n EOL} {n COMMENT}}}
-    Define leaf    STAR          {x {t *} {n SPACE}}
-    Define value   StartExpr     {x {n OPEN} {n Expression} {n CLOSE}}
-    Define value   Suffix        {x {n Primary} {? {/ {n QUESTION} {n STAR} {n PLUS}}}}
-    Define discard TO            {t -}
-    Define leaf    VOID          {x {t v} {t o} {t i} {t d} {n SPACE}}
-}
-
-# ### ### ### ######### ######### #########
-## Package Management - Ready
-
-package provide pg::peg::grammar 0.1
-    
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,80 +1,0 @@
-# -- PAGE application packages --
-# -- ---- plugin management
-
-package ifneeded page::pluginmgr 0.2 [list source [file join $dir pluginmgr.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Canned configurations
-
-package ifneeded page::config::peg   0.1 [list source [file join $dir plugins/config_peg.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Readers
-
-package ifneeded page::reader::peg     0.1 [list source [file join $dir plugins/reader_peg.tcl]]
-package ifneeded page::reader::lemon   0.1 [list source [file join $dir plugins/reader_lemon.tcl]]
-package ifneeded page::reader::hb      0.1 [list source [file join $dir plugins/reader_hb.tcl]]
-package ifneeded page::reader::ser     0.1 [list source [file join $dir plugins/reader_ser.tcl]]
-package ifneeded page::reader::treeser 0.1 [list source [file join $dir plugins/reader_treeser.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Writers
-
-package ifneeded page::writer::null     0.1   [list source [file join $dir plugins/writer_null.tcl]]
-package ifneeded page::writer::me       0.1   [list source [file join $dir plugins/writer_me.tcl]]
-package ifneeded page::writer::mecpu    0.1.1 [list source [file join $dir plugins/writer_mecpu.tcl]]
-package ifneeded page::writer::tree     0.1   [list source [file join $dir plugins/writer_tree.tcl]]
-package ifneeded page::writer::tpc      0.1   [list source [file join $dir plugins/writer_tpc.tcl]]
-package ifneeded page::writer::hb       0.1   [list source [file join $dir plugins/writer_hb.tcl]]
-package ifneeded page::writer::ser      0.1   [list source [file join $dir plugins/writer_ser.tcl]]
-package ifneeded page::writer::peg      0.1   [list source [file join $dir plugins/writer_peg.tcl]]
-package ifneeded page::writer::identity 0.1   [list source [file join $dir plugins/writer_identity.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Transformations
-
-package ifneeded page::transform::reachable  0.1 \
-	[list source [file join $dir plugins/transform_reachable.tcl]]
-package ifneeded page::transform::realizable 0.1 \
-	[list source [file join $dir plugins/transform_realizable.tcl]]
-package ifneeded page::transform::mecpu 0.1 \
-	[list source [file join $dir plugins/transform_mecpu.tcl]]
-
-# -- PAGE packages --
-# -- --- Parsing and normalization packages used by the reader plugins.
-
-package ifneeded page::parse::peg        0.1 [list source [file join $dir parse_peg.tcl]]
-package ifneeded page::parse::lemon      0.1 [list source [file join $dir parse_lemon.tcl]]
-package ifneeded page::parse::pegser     0.1 [list source [file join $dir parse_pegser.tcl]]
-package ifneeded page::parse::peghb      0.1 [list source [file join $dir parse_peghb.tcl]]
-
-package ifneeded page::util::norm::peg   0.1 [list source [file join $dir util_norm_peg.tcl]]
-package ifneeded page::util::norm::lemon 0.1 [list source [file join $dir util_norm_lemon.tcl]]
-
-# @mdgen EXCLUDE: peg_grammar.tcl
-### package ifneeded pg::peg::grammar      0.1 [list source [file join $dir peg_grammar.tcl]]
-
-# -- PAGE packages --
-# -- --- Code generation packages used by the writer plugins.
-
-package ifneeded page::gen::tree::text 0.1 [list source [file join $dir gen_tree_text.tcl]]
-package ifneeded page::gen::peg::cpkg  0.1 [list source [file join $dir gen_peg_cpkg.tcl]]
-package ifneeded page::gen::peg::hb    0.1 [list source [file join $dir gen_peg_hb.tcl]]
-package ifneeded page::gen::peg::ser   0.1 [list source [file join $dir gen_peg_ser.tcl]]
-package ifneeded page::gen::peg::canon 0.1 [list source [file join $dir gen_peg_canon.tcl]]
-package ifneeded page::gen::peg::me    0.1 [list source [file join $dir gen_peg_me.tcl]]
-package ifneeded page::gen::peg::mecpu 0.1 [list source [file join $dir gen_peg_mecpu.tcl]]
-
-# -- Transformation Helper Packages --
-
-package ifneeded page::analysis::peg::minimize   0.1 [list source [file join $dir analysis_peg_minimize.tcl]]
-package ifneeded page::analysis::peg::reachable  0.1 [list source [file join $dir analysis_peg_reachable.tcl]]
-package ifneeded page::analysis::peg::realizable 0.1 [list source [file join $dir analysis_peg_realizable.tcl]]
-package ifneeded page::analysis::peg::emodes     0.1 [list source [file join $dir analysis_peg_emodes.tcl]]
-package ifneeded page::compiler::peg::mecpu      0.1.1 [list source [file join $dir compiler_peg_mecpu.tcl]]
-
-# -- Various other utilities --
-
-package ifneeded page::util::peg   0.1 [list source [file join $dir util_peg.tcl]]
-package ifneeded page::util::quote 0.1 [list source [file join $dir util_quote.tcl]]
-package ifneeded page::util::flow  0.1 [list source [file join $dir util_flow.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/pluginmgr.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/pluginmgr.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,575 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-
-## This package provides custom plugin management specific to PAGE. It
-## is built on top of the generic plugin management framework (See
-## ---> pluginmgr).
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require fileutil
-package require pluginmgr           ; # Generic plugin management framework
-
-namespace eval ::page::pluginmgr {}
-
-# ### ### ### ######### ######### #########
-## API (Public, exported)
-
-proc ::page::pluginmgr::reportvia {cmd} {
-    variable reportcmd $cmd
-    return
-}
-
-proc ::page::pluginmgr::log {cmd} {
-    variable reader
-    variable writer
-    variable transforms
-
-    set     iplist {}
-    lappend iplist [$reader interpreter]
-    lappend iplist [$writer interpreter]
-    foreach t $transforms {
-	lappend iplist [$t interpreter]
-    }
-
-    if {$cmd eq ""} {
-	# No logging. Disable with empty command,
-	# to allow the system to completely remove
-	# them from the bytecode (= No execution
-	# overhead).
-
-	foreach ip $iplist {
-	    $ip eval [list proc page_log_error   args {}]
-	    $ip eval [list proc page_log_warning args {}]
-	    $ip eval [list proc page_log_info    args {}]
-	}
-    } else {
-	# Activate logging. Make the commands in
-	# the interpreters aliases to us.
-
-	foreach ip $iplist {
-	    interp alias $ip page_log_error   {} ${cmd}::error
-	    interp alias $ip page_log_warning {} ${cmd}::warning
-	    interp alias $ip page_log_info    {} ${cmd}::info
-	}
-    }
-    return
-}
-
-proc ::page::pluginmgr::reader {name} {
-    variable reader
-
-    $reader load $name
-    return [$reader do page_roptions]
-}
-
-proc ::page::pluginmgr::rconfigure {dict} {
-    variable reader
-    foreach {k v} $dict {
-	$reader do page_rconfigure $k $v
-    }
-    return
-}
-
-proc ::page::pluginmgr::rtimeable {} {
-    variable reader
-    return [$reader do page_rfeature timeable]
-}
-
-proc ::page::pluginmgr::rtime {} {
-    variable reader
-    $reader do page_rtime
-    return
-}
-
-proc ::page::pluginmgr::rgettime {} {
-    variable reader
-    return [$reader do page_rgettime]
-}
-
-proc ::page::pluginmgr::rhelp {} {
-    variable reader
-    return [$reader do page_rhelp]
-}
-
-proc ::page::pluginmgr::rlabel {} {
-    variable reader
-    return [$reader do page_rlabel]
-}
-
-proc ::page::pluginmgr::read {read eof {complete {}}} {
-    variable reader
-
-    #interp alias $ip page_read {} {*}$read
-    #interp alias $ip page_eof  {} {*}$eof
-
-    set ip [$reader interpreter]
-    eval [linsert $read 0 interp alias $ip page_read {}]
-    eval [linsert $eof  0 interp alias $ip page_eof  {}]
-
-    if {![llength $complete]} {
-	interp alias $ip page_read_done {} ::page::pluginmgr::Nop
-    } else {
-	eval [linsert $complete  0 interp alias $ip page_read_done  {}]
-    }
-
-    return [$reader do page_rrun]
-}
-
-proc ::page::pluginmgr::writer {name} {
-    variable writer
-
-    $writer load $name
-    return [$writer do page_woptions]
-}
-
-proc ::page::pluginmgr::wconfigure {dict} {
-    variable writer
-    foreach {k v} $dict {
-	$writer do page_wconfigure $k $v
-    }
-    return
-}
-
-proc ::page::pluginmgr::wtimeable {} {
-    variable writer
-    return [$writer do page_wfeature timeable]
-}
-
-proc ::page::pluginmgr::wtime {} {
-    variable writer
-    $writer do page_wtime
-    return
-}
-
-proc ::page::pluginmgr::wgettime {} {
-    variable writer
-    return [$writer do page_wgettime]
-}
-
-proc ::page::pluginmgr::whelp {} {
-    variable writer
-    return [$writer do page_whelp]
-}
-
-proc ::page::pluginmgr::wlabel {} {
-    variable writer
-    return [$writer do page_wlabel]
-}
-
-proc ::page::pluginmgr::write {chan data} {
-    variable writer
-
-    $writer do page_wrun $chan $data
-    return
-}
-
-proc ::page::pluginmgr::transform {name} {
-    variable transform
-    variable transforms
-
-    $transform load $name
-
-    set id [llength $transforms]
-    set opt [$transform do page_toptions]
-    lappend transforms [$transform clone]
-
-    return [list $id $opt]
-}
-
-proc ::page::pluginmgr::tconfigure {id dict} {
-    variable transforms
-
-    set t [lindex $transforms $id]
-
-    foreach {k v} $dict {
-	$t do page_tconfigure $k $v
-    }
-    return
-}
-
-proc ::page::pluginmgr::ttimeable {id} {
-    variable transforms
-    set t [lindex $transforms $id]
-    return [$t do page_tfeature timeable]
-}
-
-proc ::page::pluginmgr::ttime {id} {
-    variable transforms
-    set t [lindex $transforms $id]
-    $t do page_ttime
-    return
-}
-
-proc ::page::pluginmgr::tgettime {id} {
-    variable transforms
-    set t [lindex $transforms $id]
-    return [$t do page_tgettime]
-}
-
-proc ::page::pluginmgr::thelp {id} {
-    variable transforms
-    set t [lindex $transforms $id]
-    return [$t do page_thelp]
-}
-
-proc ::page::pluginmgr::tlabel {id} {
-    variable transforms
-    set t [lindex $transforms $id]
-    return [$t do page_tlabel]
-}
-
-proc ::page::pluginmgr::transform_do {id data} {
-    variable transforms
-    variable reader
-
-    set t [lindex $transforms $id]
-
-    return [$t do page_trun $data]
-}
-
-proc ::page::pluginmgr::configuration {name} {
-    variable config
-
-    if {[file exists $name]} {
-	# Try as plugin first. On failure read it as list of options,
-	# separated by spaces and tabs, and possibly quoted with
-	# quotes and double-quotes.
-
-	if {[catch {$config load $name}]} {
-	    set ch      [open $name r]
-	    set options [::read $ch]
-	    close $ch
-
-	    set def {}
-	    while {[string length $options]} {
-		if {[regsub "^\[ \t\n\]+" $options {} options]} {
-		    # Skip whitespace
-		    continue
-		}
-		if {[regexp -indices {^'(([^']|(''))*)'} \
-			$options -> word]} {
-		    foreach {__ end} $word break
-		    lappend def [string map {'' '} [string range $options 1 $end]]
-		    set options [string range $options [incr end 2] end]
-		} elseif {[regexp -indices {^"(([^"]|(""))*)"} \
-			$options -> word]} {
-		    foreach {__ end} $word break
-		    lappend def [string map {{""} {"}} [string range $options 1 $end]]
-		    set options [string range $options [incr end 2] end]
-		} elseif {[regexp -indices "^(\[^ \t\n\]+)" \
-			$options -> word]} {
-		    foreach {__ end} $word break
-		    lappend def [string range $options 0 $end]
-		    set options [string range $options [incr end] end]
-		}
-	    }
-	    return $def
-	}
-    } else {
-	$config load $name
-    }
-    set def [$config do page_cdefinition]
-    $config unload
-    return $def
-}
-
-proc ::page::pluginmgr::report {level text {from {}} {to {}}} {
-    variable replevel
-    variable reportcmd
-    uplevel #0 [linsert $reportcmd end $replevel($level) $text $from $to]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internals
-
-## Data structures
-##
-## - reader    | Instances of pluginmgr configured for input,
-## - transform | transformational, and output plugins. The
-## - writer    | manager for transforms is actually a template
-##             | from which the actual instances are cloned.
-
-## - reportcmd | Callback for reporting of input error and warnings.
-## - replevel  | Mapping from chosen level to the right-padded text
-##             | to use.
-
-namespace eval ::page::pluginmgr {
-    variable  replevel
-    array set replevel {
-	info    {info   }
-	warning {warning}
-	error   {error  }
-    }
-}
-
-proc ::page::pluginmgr::Initialize {} {
-    InitializeReporting
-    InitializeConfig
-    InitializeReader
-    InitializeTransform
-    InitializeWriter
-    return
-}
-
-proc ::page::pluginmgr::InitializeReader {} {
-    variable commands
-    variable reader_api
-    variable reader [pluginmgr RD \
-	    -setup   ::page::pluginmgr::InitializeReaderIp \
-	    -pattern page::reader::* \
-	    -api     $reader_api \
-	    -cmdip   {} \
-	    -cmds    $commands]
-
-    # The page_log_* commands are set later, when it is known if
-    # logging is active or not, as their implementation depends on
-    # this.
-
-    pluginmgr::paths $reader page::reader
-    return
-}
-
-proc ::page::pluginmgr::InitializeReaderIp {p ip} {
-    interp eval $ip {
-	package provide page::plugin         1.0
-	package provide page::plugin::reader 1.0
-    }
-    interp alias $ip puts  {} puts
-    interp alias $ip open  {} ::page::pluginmgr::AliasOpen $ip
-    interp alias $ip write {} ::page::pluginmgr::WriteFile $ip
-    return
-}
-
-proc ::page::pluginmgr::InitializeWriter {} {
-    variable commands
-    variable writer_api
-    variable writer [pluginmgr WR \
-	    -setup   ::page::pluginmgr::InitializeWriterIp \
-	    -pattern page::writer::* \
-	    -api     $writer_api \
-	    -cmdip   {} \
-	    -cmds    $commands]
-
-    # The page_log_* commands are set later, when it is known if
-    # logging is active or not, as their implementation depends on
-    # this.
-
-    pluginmgr::paths $writer page::writer
-    return
-}
-
-proc ::page::pluginmgr::InitializeWriterIp {p ip} {
-    interp eval $ip {
-	package provide page::plugin         1.0
-	package provide page::plugin::writer 1.0
-    }
-    interp alias $ip puts  {} puts
-    interp alias $ip open  {} ::page::pluginmgr::AliasOpen $ip
-    interp alias $ip write {} ::page::pluginmgr::WriteFile $ip
-    return
-}
-
-proc ::page::pluginmgr::InitializeTransform {} {
-    variable transforms {}
-    variable commands
-    variable transform_api
-    variable transform [pluginmgr TR \
-	    -setup   ::page::pluginmgr::InitializeTransformIp \
-	    -pattern page::transform::* \
-	    -api     $transform_api \
-	    -cmdip   {} \
-	    -cmds    $commands]
-
-    # The page_log_* commands are set later, when it is known if
-    # logging is active or not, as their implementation depends on
-    # this.
-
-    pluginmgr::paths $transform page::transform
-    return
-}
-
-proc ::page::pluginmgr::InitializeTransformIp {p ip} {
-    interp eval $ip {
-	package provide page::plugin            1.0
-	package provide page::plugin::transform 1.0
-    }
-    interp alias $ip puts  {} puts
-    interp alias $ip open  {} ::page::pluginmgr::AliasOpen $ip
-    interp alias $ip write {} ::page::pluginmgr::WriteFile $ip
-    return
-}
-
-proc ::page::pluginmgr::InitializeConfig {} {
-    variable config [pluginmgr CO \
-	    -pattern page::config::* \
-	    -api {page_cdefinition}]
-
-    pluginmgr::paths $config page::config
-    return
-}
-
-proc ::page::pluginmgr::InitializeReporting {} {
-    variable reportcmd ::page::pluginmgr::ReportStderr
-    return
-}
-
-proc ::page::pluginmgr::ReportStderr {level text from to} {
-    # from = epsilon | list (line col)
-    # to   = epsilon | list (line col)
-    # line = 5 digits, col = 3 digits
-
-    if {
-	($text eq "") &&
-	![llength $from] &&
-	![llength $to]
-    } {
-	puts stderr ""
-	return
-    }
-
-    puts -nonewline stderr $level
-    WriteLocation $from
-    if {![llength $to]} {
-	puts -nonewline stderr { }
-    } {
-	puts -nonewline stderr {-}
-    }
-    WriteLocation $to
-    puts -nonewline stderr " "
-    puts -nonewline stderr $text
-    puts stderr ""
-    return
-}
-
-proc ::page::pluginmgr::WriteLocation {loc} {
-    if {![llength $loc]} {
-	set text {         }
-    } else {
-	set line [lindex $loc 0]
-	set col  [lindex $loc 1]
-	set text {}
-	if {![string length $line]} {
-	    append text _____
-	} else {
-	    append text [string map {{ } _} [format %5d $line]]
-	}
-	append text @
-	if {![string length $col]} {
-	    append text ___
-	} else {
-	    append text [string map {{ } _} [format %3d $col]]
-	}
-    }
-    puts -nonewline stderr $text
-    return
-}
-
-proc ::page::pluginmgr::AliasOpen {slave file {acc {}} {perm {}}} {
-
-    if {$acc eq ""} {set acc r}
-
-    ::safe::Log $slave =============================================
-    ::safe::Log $slave "open $file $acc $perm"
-
-    if {[regexp {[wa+]|(WRONLY)|(RDWR)|(APPEND)|(CREAT)|(TRUNC)} $acc]} {
-	# Do not allow write acess.
-	::safe::Log $slave "permission denied"
-	::safe::Log $slave 0/============================================
-	return -code error "permission denied"
-    }
-
-    if {[catch {set file [::safe::TranslatePath $slave $file]} msg]} {
-	::safe::Log $slave $msg
-	::safe::Log $slave "permission denied"
-	::safe::Log $slave 1/============================================
-	return -code error "permission denied"
-    }
-    
-    # check that the path is in the access path of that slave
-
-    if {[catch {::safe::FileInAccessPath $slave $file} msg]} {
-	::safe::Log $slave $msg
-	::safe::Log $slave "permission denied"
-	::safe::Log $slave 2/============================================
-	return -code error "permission denied"
-    }
-
-    # do the checks on the filename :
-
-    if {[catch {::safe::CheckFileName $slave $file} msg]} {
-	::safe::Log $slave "$file: $msg"
-	::safe::Log $slave "$msg"
-	::safe::Log $slave 3/============================================
-	return -code error $msg
-    }
-
-    if {[catch {::interp invokehidden $slave open $file $acc} msg]} {
-	::safe::Log $slave "Caught: $msg"
-	::safe::Log $slave "script error"
-	::safe::Log $slave 4/============================================
-	return -code error "script error"
-    }
-
-    ::safe::Log $slave =/============================================
-    return $msg
-
-}
-
-proc ::page::pluginmgr::Nop {args} {}
-
-proc ::page::pluginmgr::WriteFile {slave file text} {
-    if {[file pathtype $file] ne "relative"} {
-	set file [file join [pwd] [file tail $fail]]
-    }
-    file mkdir [file dirname $file]
-    fileutil::writeFile      $file $text
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-namespace eval ::page::pluginmgr {
-
-    # List of functions in the various plugin APIs
-
-    variable reader_api {
-	page_rhelp
-	page_rlabel
-	page_roptions
-	page_rconfigure
-	page_rrun
-	page_rfeature
-    }
-    variable writer_api {
-	page_whelp
-	page_wlabel
-	page_woptions
-	page_wconfigure
-	page_wrun
-	page_wfeature
-    }
-    variable transform_api {
-	page_thelp
-	page_tlabel
-	page_toptions
-	page_tconfigure
-	page_trun
-	page_tfeature
-    }
-    variable commands {
-	page_info    {::page::pluginmgr::report info}
-	page_warning {::page::pluginmgr::report warning}
-	page_error   {::page::pluginmgr::report error}
-    }
-}
-
-::page::pluginmgr::Initialize
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::pluginmgr 0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/config_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/config_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# -*- tcl -*- $Id: config_peg.tcl,v 1.2 2005/09/28 06:16:38 andreas_kupries Exp $
-
-package provide page::config::peg 0.1
-
-proc page_cdefinition {} {
-    return {
-	--reset
-	--append
-	--reader    peg
-	--transform reachable
-	--transform realizable
-	--writer    me
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#puts @plugins
-# -- PAGE plugin packages
-# -- ---- Canned configurations
-
-package ifneeded page::config::peg   0.1 [list source [file join $dir config_peg.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Readers
-
-package ifneeded page::reader::peg     0.1 [list source [file join $dir reader_peg.tcl]]
-package ifneeded page::reader::lemon   0.1 [list source [file join $dir reader_lemon.tcl]]
-package ifneeded page::reader::hb      0.1 [list source [file join $dir reader_hb.tcl]]
-package ifneeded page::reader::ser     0.1 [list source [file join $dir reader_ser.tcl]]
-package ifneeded page::reader::treeser 0.1 [list source [file join $dir reader_treeser.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Writers
-
-package ifneeded page::writer::null     0.1 [list source [file join $dir writer_null.tcl]]
-package ifneeded page::writer::me       0.1 [list source [file join $dir writer_me.tcl]]
-package ifneeded page::writer::mecpu    0.1.1 [list source [file join $dir writer_mecpu.tcl]]
-package ifneeded page::writer::tree     0.1 [list source [file join $dir writer_tree.tcl]]
-package ifneeded page::writer::tpc      0.1 [list source [file join $dir writer_tpc.tcl]]
-package ifneeded page::writer::hb       0.1 [list source [file join $dir writer_hb.tcl]]
-package ifneeded page::writer::ser      0.1 [list source [file join $dir writer_ser.tcl]]
-package ifneeded page::writer::peg      0.1 [list source [file join $dir writer_peg.tcl]]
-package ifneeded page::writer::identity 0.1 [list source [file join $dir writer_identity.tcl]]
-
-# -- PAGE plugin packages
-# -- ---- Transformations
-
-package ifneeded page::transform::reachable  0.1 [list source [file join $dir transform_reachable.tcl]]
-package ifneeded page::transform::realizable 0.1 [list source [file join $dir transform_realizable.tcl]]
-package ifneeded page::transform::mecpu      0.1 [list source [file join $dir transform_mecpu.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_hb.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_hb.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,114 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: reader_hb.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - reader - HB ~ Half baked PEG Container
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_read        | Access to the input stream.
-# page_read_done   |
-# page_eof         |
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_rfeature    | Query for special plugin features page might wish to use.
-# page_rtime       | Activate collection of timing statistics.
-# page_rgettime    | Return the collected timing statistics.
-# page_rlabel      | User readable label for the plugin.
-# page_rhelp       | Doctools help text for plugin.
-# page_roptions    | Options understood by plugin.
-# page_rconfigure  | Option (re)configuration.
-# page_rdata       | External access to processed input stream.
-# page_rrun        | Process input stream per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require struct::tree         ; # Data structure.
-package require page::parse::peghb
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_rlabel {} {
-    return {Halfbaked PEG Container}
-}
-
-proc page_rfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_rtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_rgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_rhelp {} {
-    return {}
-}
-
-proc page_roptions {} {
-    return {}
-}
-
-proc page_rconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-## proc page_rdata {} {}
-## Created in 'Initialize'
-
-proc page_rrun {} {
-    global timed usec
-    page_log_info "reader/hb/run/parse"
-
-    struct::tree ::tree
-
-    if {$timed} {
-	set usec [lindex [time {
-	    page::parse::peghb [page_read] ::tree
-	}] 0] ; #{}
-    } else {
-	page::parse::peghb [page_read] ::tree
-    }
-    page_read_done
-
-    set ast [::tree serialize]
-    ::tree destroy
-
-    page_log_info "reader/hb/run/ok"
-    return $ast
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::reader::hb 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_lemon.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_lemon.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,170 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: reader_lemon.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - reader - LEMON ~ Grammar specification as understood
-#                                by drh's lemon parser generator.
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_read        | Access to the input stream.
-# page_read_done   |
-# page_eof         |
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_rfeature    | Query for special plugin features page might wish to use.
-# page_rtime       | Activate collection of timing statistics.
-# page_rgettime    | Return the collected timing statistics.
-# page_rlabel      | User readable label for the plugin.
-# page_rhelp       | Doctools help text for plugin.
-# page_roptions    | Options understood by plugin.
-# page_rconfigure  | Option (re)configuration.
-# page_rdata       | External access to processed input stream.
-# page_rrun        | Process input stream per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::norm::lemon ; # Normalize AST generated by PE matcher.
-package require page::parse::lemon      ; # Mengine based parser for Lemon grammars.
-package require struct::tree            ; # Data structure.
-package require grammar::me::util       ; # AST conversion
-
-global usec
-global timed
-set    timed 0
-
-global cline
-global ccol
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_rlabel {} {
-    return {Lemon specification}
-}
-
-proc page_rfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_rtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_rgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_rhelp {} {
-    return {}
-}
-
-proc page_roptions {} {
-    return {}
-}
-
-proc page_rconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-## proc page_rdata {} {}
-## Created in 'Initialize'
-
-proc page_rrun {} {
-    global timed usec cline ccol
-    page_log_info "reader/lemon/run/parse"
-
-    set ast {}
-    set err {}
-
-    # Location of the next character to be read.
-    set cline 1
-    set ccol  0
-
-    if {$timed} {
-	set usec [lindex [time {
-	    set ok [::page::parse::lemon::parse ::Next err ast]
-	}] 0] ; #{}
-    } else {
-	set ok [::page::parse::lemon::parse ::Next err ast]
-    }
-    page_read_done
-    page_log_info "reader/lemon/run/check-for-errors"
-
-    if {!$ok} {
-	foreach {olc   messages} $err     break
-	foreach {offset linecol} $olc     break
-	foreach {line       col} $linecol break
-
-	set olc [string map {{ } _} \
-		[format %5d $line]]@[string map {{ } _} \
-		[format %3d $col]]/([format %5d $offset])
-
-	foreach m $messages {
-	    page_log_error "reader/lemon/run: $olc: $m"
-	    page_error $m $linecol
-	}
-
-	page_log_info "reader/lemon/run/failed"
-	return {}
-    }
-
-    page_log_info "reader/lemon/run/ast-conversion"
-
-    struct::tree                        ::tree
-    ::grammar::me::util::ast2etree $ast ::grammar::me::tcl ::tree
-    ::page::util::norm::lemon           ::tree
-
-    set ast [::tree serialize]
-    ::tree destroy
-
-    page_log_info "reader/lemon/run/ok"
-    return $ast
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-proc Next {} {
-    global cline ccol
-
-    if {[page_eof]} {return {}}
-
-    set ch [page_read 1]
-
-    if {$ch eq ""} {return {}}
-
-    set tok [list $ch {} $cline $ccol]
-
-    if {$ch eq "\n"} {
-	incr cline ; set ccol 0
-    } else {
-	incr ccol
-    }
-
-    return $tok
-}
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::reader::lemon 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,169 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: reader_peg.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - reader - PEG ~ Parsing Expression Grammar
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_read        | Access to the input stream.
-# page_read_done   |
-# page_eof         |
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_rfeature    | Query for special plugin features page might wish to use.
-# page_rtime       | Activate collection of timing statistics.
-# page_rgettime    | Return the collected timing statistics.
-# page_rlabel      | User readable label for the plugin.
-# page_rhelp       | Doctools help text for plugin.
-# page_roptions    | Options understood by plugin.
-# page_rconfigure  | Option (re)configuration.
-# page_rdata       | External access to processed input stream.
-# page_rrun        | Process input stream per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::norm::peg ; # Normalize AST generated by reader of PEG grammars
-package require page::parse::peg      ; # Mengine based parser for PE grammars.
-package require struct::tree          ; # Data structure.
-package require grammar::me::util     ; # AST conversion
-
-global usec
-global timed
-set    timed 0
-
-global cline
-global ccol
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_rlabel {} {
-    return {Parsing Expression Grammar}
-}
-
-proc page_rfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_rtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_rgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_rhelp {} {
-    return {}
-}
-
-proc page_roptions {} {
-    return {}
-}
-
-proc page_rconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-## proc page_rdata {} {}
-## Created in 'Initialize'
-
-proc page_rrun {} {
-    global timed usec cline ccol
-    page_log_info "reader/peg/run/parse"
-
-    set ast {}
-    set err {}
-
-    # Location of the next character to be read.
-    set cline 1
-    set ccol  0
-
-    if {$timed} {
-	set usec [lindex [time {
-	    set ok [::page::parse::peg::parse ::Next err ast]
-	}] 0] ; #{}
-    } else {
-	set ok [::page::parse::peg::parse ::Next err ast]
-    }
-    page_read_done
-    page_log_info "reader/peg/run/check-for-errors"
-
-    if {!$ok} {
-	foreach {olc   messages} $err     break
-	foreach {offset linecol} $olc     break
-	foreach {line       col} $linecol break
-
-	set olc [string map {{ } _} \
-		[format %5d $line]]@[string map {{ } _} \
-		[format %3d $col]]/([format %5d $offset])
-
-	foreach m $messages {
-	    page_log_error "reader/peg/run: $olc: $m"
-	    page_error $m $linecol
-	}
-
-	page_log_info "reader/peg/run/failed"
-	return {}
-    }
-
-    page_log_info "reader/peg/run/ast-conversion"
-
-    struct::tree                        ::tree
-    ::grammar::me::util::ast2etree $ast ::grammar::me::tcl ::tree
-    ::page::util::norm::peg             ::tree
-
-    set ast [::tree serialize]
-    ::tree destroy
-
-    page_log_info "reader/peg/run/ok"
-    return $ast
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-proc Next {} {
-    global cline ccol
-
-    if {[page_eof]} {return {}}
-
-    set ch [page_read 1]
-
-    if {$ch eq ""} {return {}}
-
-    set tok [list $ch {} $cline $ccol]
-
-    if {$ch eq "\n"} {
-	incr cline ; set ccol 0
-    } else {
-	incr ccol
-    }
-
-    return $tok
-}
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::reader::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_ser.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_ser.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,114 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: reader_ser.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - reader - SER ~ Serialized PEG Container
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_read        | Access to the input stream.
-# page_read_done   |
-# page_eof         |
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_rfeature    | Query for special plugin features page might wish to use.
-# page_rtime       | Activate collection of timing statistics.
-# page_rgettime    | Return the collected timing statistics.
-# page_rlabel      | User readable label for the plugin.
-# page_rhelp       | Doctools help text for plugin.
-# page_roptions    | Options understood by plugin.
-# page_rconfigure  | Option (re)configuration.
-# page_rdata       | External access to processed input stream.
-# page_rrun        | Process input stream per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require struct::tree         ; # Data structure.
-package require page::parse::pegser
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_rlabel {} {
-    return {Serialized PEG Container}
-}
-
-proc page_rfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_rtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_rgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_rhelp {} {
-    return {}
-}
-
-proc page_roptions {} {
-    return {}
-}
-
-proc page_rconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-## proc page_rdata {} {}
-## Created in 'Initialize'
-
-proc page_rrun {} {
-    global timed usec
-    page_log_info "reader/ser/run/parse"
-
-    struct::tree                    ::tree
-
-    if {$timed} {
-	set usec [lindex [time {
-	    page::parse::pegser [page_read] ::tree
-	}] 0] ; #{}
-    } else {
-	page::parse::pegser [page_read] ::tree
-    }
-    page_read_done
-
-    set ast [::tree serialize]
-    ::tree destroy
-
-    page_log_info "reader/ser/run/ok"
-    return $ast
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::reader::ser 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_treeser.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/reader_treeser.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,116 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: reader_treeser.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - reader - TREESER ~ Serialized TREE
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_read        | Access to the input stream.
-# page_read_done   |
-# page_eof         |
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_rfeature    | Query for special plugin features page might wish to use.
-# page_rtime       | Activate collection of timing statistics.
-# page_rgettime    | Return the collected timing statistics.
-# page_rlabel      | User readable label for the plugin.
-# page_rhelp       | Doctools help text for plugin.
-# page_roptions    | Options understood by plugin.
-# page_rconfigure  | Option (re)configuration.
-# page_rdata       | External access to processed input stream.
-# page_rrun        | Process input stream per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require struct::tree ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_rlabel {} {
-    return {Serialized Tree}
-}
-
-proc page_rfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_rtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_rgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_rhelp {} {
-    return {}
-}
-
-proc page_roptions {} {
-    return {}
-}
-
-proc page_rconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-## proc page_rdata {} {}
-## Created in 'Initialize'
-
-proc page_rrun {} {
-    global timed usec
-    page_log_info "reader/treeser/run/parse"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    set data [page_read]
-	}] 0] ; #{}
-    } else {
-	set data [page_read]
-    }
-    page_read_done
-
-    # Reading and passing it on is trivial.
-    # Here however we validate the we truly got
-    # a sensible serialization.
-
-    struct::tree ::tree
-    ::tree deserialize $data
-    ::tree destroy
-
-    page_log_info "reader/treeser/run/ok"
-    return $data
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::reader::treeser 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_mecpu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_mecpu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,107 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: transform_mecpu.tcl,v 1.1 2006/07/01 01:35:21 andreas_kupries Exp $ ---
-#
-# PAGE plugin - transform - mecpu ~ Translation of grammar to ME cpu instruction set.
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_tdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_tfeature    | Query for special plugin features page might wish to use.
-# page_ttime       | Activate collection of timing statistics.
-# page_tgettime    | Return the collected timing statistics.
-# page_tlabel      | User readable label for the plugin.
-# page_thelp       | Doctools help text for plugin.
-# page_toptions    | Options understood by plugin.
-# page_tconfigure  | Option (re)configuration.
-# page_trun        | Transform input data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::compiler::peg::mecpu
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_tlabel {} {
-    return {ME cpu Translation}
-}
-
-proc page_tfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_ttime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_tgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_thelp {} {
-    return {}
-}
-
-proc page_toptions {} {
-    return {}
-}
-
-proc page_tconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_trun {data} {
-    global timed usec
-    page_log_info "transform/mecpu/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree             ::tree deserialize $data
-	    page::compiler::peg::mecpu ::tree
-	}] 0] ; #{}
-    } else {
-	::struct::tree             ::tree deserialize $data
-	page::compiler::peg::mecpu ::tree
-    }
-    set name [::tree get root name]
-    set asm  [::tree get root asm]
-    ::tree destroy
-
-    page_log_info "transform/mecpu/run/ok"
-    return [list $name $asm]
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::transform::mecpu 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_reachable.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_reachable.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,107 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: transform_reachable.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - transform - reachable ~ Reachability Analysis
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_tdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_tfeature    | Query for special plugin features page might wish to use.
-# page_ttime       | Activate collection of timing statistics.
-# page_tgettime    | Return the collected timing statistics.
-# page_tlabel      | User readable label for the plugin.
-# page_thelp       | Doctools help text for plugin.
-# page_toptions    | Options understood by plugin.
-# page_tconfigure  | Option (re)configuration.
-# page_trun        | Transform input data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::analysis::peg::reachable
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_tlabel {} {
-    return Reachability
-}
-
-proc page_tfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_ttime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_tgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_thelp {} {
-    return {}
-}
-
-proc page_toptions {} {
-    return {}
-}
-
-proc page_tconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_trun {data} {
-    global timed usec
-    page_log_info "transform/reachable/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree          ::tree deserialize $data
-	    ::page::analysis::peg::reachable::remove! ::tree
-	}] 0] ; #{}
-    } else {
-	::struct::tree          ::tree deserialize $data
-	::page::analysis::peg::reachable::remove! ::tree
-    }
-
-    set data [::tree serialize]
-    ::tree destroy
-
-    page_log_info "transform/reachable/run/ok"
-    return $data
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::transform::reachable 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_realizable.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/transform_realizable.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,106 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: transform_realizable.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - transform - realizable ~ Realizability Analysis
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_tdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_tfeature    | Query for special plugin features page might wish to use.
-# page_ttime       | Activate collection of timing statistics.
-# page_tgettime    | Return the collected timing statistics.
-# page_tlabel      | User readable label for the plugin.
-# page_thelp       | Doctools help text for plugin.
-# page_toptions    | Options understood by plugin.
-# page_tconfigure  | Option (re)configuration.
-# page_trun        | Transform input data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::analysis::peg::realizable
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_tlabel {} {
-    return Realizability
-}
-
-proc page_tfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_ttime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_tgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_thelp {} {
-    return {}
-}
-
-proc page_toptions {} {
-    return {}
-}
-
-proc page_tconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_trun {data} {
-    global timed usec
-    page_log_info "transform/realizable/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree           ::tree deserialize $data
-	    ::page::analysis::peg::realizable::remove! ::tree
-	}] 0] ; #{}
-    } else {
-	::struct::tree           ::tree deserialize $data
-	::page::analysis::peg::realizable::remove! ::tree
-    }
-    set data [::tree serialize]
-    ::tree destroy
-
-    page_log_info "transform/realizable/run/ok"
-    return $data
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::transform::realizable 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_hb.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_hb.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,106 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_hb.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - HB ~ Half Baked / Tcl Peg Container
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::hb
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Half baked PEG Container}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/hb/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree     ::tree deserialize $data
-	    page::gen::peg::hb ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree     ::tree deserialize $data
-	page::gen::peg::hb ::tree             $chan
-    }
-
-    page_log_info "writer/hb/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::hb 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_identity.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_identity.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,98 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_identity.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - Generic dump
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Raw data unchanged}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/identity/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    puts $chan $data
-	}] 0] ; #{}
-    } else {
-	puts $chan $data
-    }
-
-    page_log_info "writer/identity/run/ok"
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::identity 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_me.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_me.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,115 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_me.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - ME ~ Match Engine
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::me
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {MatchEngine RecDescent}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {--package --copyright}
-}
-
-proc page_wconfigure {option value} {
-    switch -exact -- $option {
-	--package {
-	    page::gen::peg::me::package $value
-	}
-	--copyright {
-	    page::gen::peg::me::copyright $value
-	}
-	default {
-	    return -code error "Cannot set value of unknown option \"$option\""
-	}
-    }
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/me/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree     ::tree deserialize $data
-	    page::gen::peg::me ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree     ::tree deserialize $data
-	page::gen::peg::me ::tree             $chan
-    }
-    page_log_info "writer/me/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::me 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_mecpu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_mecpu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,116 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_mecpu.tcl,v 1.2 2007/03/21 23:15:53 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - ME cpu ~ Match Engine CPU
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::mecpu
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {ME cpu Assembler}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {--package --copyright --template --cmarker}
-}
-
-proc page_wconfigure {option value} {
-    switch -exact -- $option {
-	--package {
-	    page::gen::peg::mecpu::package $value
-	}
-	--copyright {
-	    page::gen::peg::mecpu::copyright $value
-	}
-	--template {
-	    page::gen::peg::mecpu::template $value
-	}
-	--cmarker {
-	    page::gen::peg::mecpu::cmarker $value
-	}
-	default {
-	    return -code error "Cannot set value of unknown option \"$option\""
-	}
-    }
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/me-cpu/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    page::gen::peg::mecpu $data $chan
-	}] 0] ; #{}
-    } else {
-	page::gen::peg::mecpu $data $chan
-    }
-    page_log_info "writer/me-cpu/run/ok"
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::mecpu 0.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_null.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_null.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,97 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_null.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - NULL ~ /dev/null the output
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return /dev/null
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    if {$timed} {
-	set usec [lindex [time {
-	    page_log_info "writer/null/run/"
-	    page_log_info "writer/null/run/ok"
-	}] 0] ; #{}
-    } else {
-	page_log_info "writer/null/run/"
-	page_log_info "writer/null/run/ok"
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::null 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,106 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_peg.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - PEG ~ Canonical PE Grammar
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::canon
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Canonical PEG}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/peg/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree        ::tree deserialize $data
-	    page::gen::peg::canon ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree        ::tree deserialize $data
-	page::gen::peg::canon ::tree             $chan
-    }
-
-    page_log_info "writer/peg/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_ser.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_ser.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,104 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_ser.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - SER ~ Serialized PEG Container
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::ser
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Serialized PEG Container}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/ser/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree      ::tree deserialize $data
-	    page::gen::peg::ser ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree      ::tree deserialize $data
-	page::gen::peg::ser ::tree             $chan
-    }
-    page_log_info "writer/ser/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::ser 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_tpc.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_tpc.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,105 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_tpc.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - TPC ~ Tcl Peg Container
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::peg::cpkg
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Tcl PEG Container (Package)}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/tpc/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree       ::tree deserialize $data
-	    page::gen::peg::cpkg ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree       ::tree deserialize $data
-	page::gen::peg::cpkg ::tree             $chan
-    }
-
-    page_log_info "writer/tpc/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::tpc 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_tree.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/plugins/writer_tree.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,105 +1,0 @@
-# -*- tcl -*- 
-# -- $Id: writer_tree.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
-#
-# PAGE plugin - writer - TREE ~ Generic Tree dump
-#
-
-# ### ### ### ######### ######### #########
-## Imported API
-
-# -----------------+--
-# page_wdata       | Access to processed input stream.
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Exported API
-
-# -----------------+--
-# page_wfeature    | Query for special plugin features page might wish to use.
-# page_wtime       | Activate collection of timing statistics.
-# page_wgettime    | Return the collected timing statistics.
-# page_wlabel      | User readable label for the plugin.
-# page_whelp       | Doctools help text for plugin.
-# page_woptions    | Options understood by plugin.
-# page_wconfigure  | Option (re)configuration.
-# page_wrun        | Generate output from data per plugin configuration and hardwiring.
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::gen::tree::text
-package require struct::tree         ; # Data structure.
-
-global usec
-global timed
-set    timed 0
-
-# ### ### ### ######### ######### #########
-## Implementation of exported API
-
-proc page_wlabel {} {
-    return {Tree Dump}
-}
-
-proc page_wfeature {key} {
-    return [string eq $key timeable]
-}
-
-proc page_wtime {} {
-    global timed
-    set    timed 1
-    return
-}
-
-proc page_wgettime {} {
-    global  usec
-    return $usec
-}
-proc page_whelp {} {
-    return {}
-}
-
-proc page_woptions {} {
-    return {}
-}
-
-proc page_wconfigure {option value} {
-    return -code error "Cannot set value of unknown option \"$option\""
-}
-
-proc page_wrun {chan data} {
-    global timed usec
-    page_log_info "writer/tree/run/"
-
-    if {$timed} {
-	set usec [lindex [time {
-	    ::struct::tree        ::tree deserialize $data
-	    page::gen::tree::text ::tree             $chan
-	}] 0] ; #{}
-    } else {
-	::struct::tree        ::tree deserialize $data
-	page::gen::tree::text ::tree             $chan
-    }
-
-    page_log_info "writer/tree/run/ok"
-
-    ::tree destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper code.
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-package provide page::writer::tree 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/util_flow.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/util_flow.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,90 +1,0 @@
-# -*- tcl -*-
-# General tree iterative walking for dataflow algorithms.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-
-# ### ### ### ######### ######### #########
-## API
-
-namespace eval ::page::util::flow {}
-
-proc ::page::util::flow {start fvar nvar script} {
-    set f [uplevel 1 [list ::page::util::flow::iter %AUTO% $start $fvar $nvar $script]]
-    $f destroy
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internals
-
-snit::type ::page::util::flow::iter {
-    constructor {startset fvar nvar script} {
-	$self visitl $startset
-
-	# Export the object for use by the flow script
-	upvar 3 $fvar flow ; set flow $self
-	upvar 3 $nvar current
-
-	while {[array size visit]} {
-	    set nodes [array names visit]
-	    array unset visit *
-
-	    foreach n $nodes {
-		set current $n
-		set code [catch {uplevel 3 $script} result]
-
-		# decide what to do upon the return code:
-		#
-		#               0 - the body executed successfully
-		#               1 - the body raised an error
-		#               2 - the body invoked [return]
-		#               3 - the body invoked [break]
-		#               4 - the body invoked [continue]
-		# everything else - return and pass on the results
-
-		switch -exact -- $code {
-		    0 {}
-		    1 {
-			return -errorinfo $::errorInfo  \
-				-errorcode $::errorCode -code error $result
-		    }
-		    3 {
-			# FRINK: nocheck
-			return -code break
-		    }
-		    4 {}
-		    default {
-			# This includes code 2 (return).
-			return -code $code $result
-		    }
-		}
-	    }
-	}
-	return
-    }
-
-    method visit {n} {
-	set visit($n) .
-	return
-    }
-
-    method visitl {nodelist} {
-	foreach n $nodelist {set visit($n) .}
-	return
-    }
-
-    method visita {args} {
-	foreach n $args {set visit($n) .}
-	return
-    }
-
-    variable visit -array {}
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::util::flow 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/util_norm_lemon.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/util_norm_lemon.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,427 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Transformation - Normalize PEG AST for later.
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-package require treeql
-package require page::util::quote
-package require page::util::peg
-
-namespace eval ::page::util::norm::lemon {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl)
-
-    namespace import ::page::util::quote::*
-    namespace import ::page::util::peg::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::util::norm::lemon {t} {
-    set q [treeql q -tree $t]
-
-    page_info {[Lemon Normalization]}
-
-    # Retrieve grammar name out of one directive.
-    # Or from LHS of first rule.
-
-    page_log_info ..Startsymbol
-
-    set start {}
-
-    $q query tree \
-	    withatt type nonterminal \
-	    withatt detail StartSymbol \
-	    descendants \
-	    withatt type terminal \
-	    over n {
-
-	lemon::TokReduce $t $n detail
-	set start [$t get $n detail]
-
-	page_info "  StartSymbol: $start"
-    }
-
-    $q query tree \
-	    withatt type   nonterminal \
-	    withatt detail Name \
-	    descendants \
-	    withatt type terminal \
-	    over n {
-
-	lemon::TokReduce $t $n detail
-	set name [$t get $n detail]
-
-	page_info "  Name:        $name"
-
-	$t set root name $name
-    }
-
-    page_log_info ..Drop        ; lemon::Drop        $q $t
-    page_log_info ..Terminals   ; lemon::Terminals   $q $t
-    page_log_info ..Definitions ; lemon::Definitions $q $t
-    page_log_info ..Rules       ; lemon::Rules       $q $t start
-    page_log_info ..Epsilon     ; lemon::ElimEpsilon $q $t
-    page_log_info ..Autoclass   ; lemon::AutoClassId $q $t
-    page_log_info ..Chains
-
-    # Find and cut operator chains, very restricted. Cut only chains
-    # of x- and /-operators. The other operators have only one child
-    # by definition and are thus not chains.
-
-    #set q [treeql q -tree $t]
-    # q query tree over n
-    foreach n [$t children -all root] {
-	if {[$t keyexists $n symbol]}        continue
-	if {[llength [$t children $n]] != 1} continue
-
-	set op [$t get $n op]
-	if {($op ne "/") && ($op ne "x")} continue
-	$t cut $n
-    }
-
-    page_log_info ..Flatten
-
-    lemon::flatten $q $t
-
-    # Analysis: Left recursion, and where.
-    # Manual: Definitions for terminals.
-    #         Definitions for space, comments.
-    #         Integration of this into the grammar.
-
-    # Sentinel for PE algorithms.
-    $t set root symbol <StartExpression>
-
-    if {$start eq ""} {
-	page_error "  Startsymbol missing"
-    } else {
-	set s [$t insert root end]
-	$t set $s op  n
-	$t set $s sym $start
-	$t set root start $s
-
-	array set def [$t get root definitions]
-
-	if {![info exists def($start)]} {
-	    page_error "  Startsymbol is undefined"
-	    $t set $s def ""
-	} else {
-	    $t set $s def $def($start)
-	}
-	unset def
-    }
-
-    $q destroy
-
-    page_log_info Ok
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Documentation
-#
-## See doc_normalize.txt for the specification of the publicly visible
-## attributes.
-##
-## Internal attributes
-## - DATA - Transient storage for terminal data.
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::util::norm::lemon::Drop {q t} {
-    # Simple normalization.
-    # All lemon specific data is dropped completely.
-
-    foreach drop {
-	Directive Codeblock Label Precedence
-    } {
-	$q query tree withatt type nonterminal \
-	    withatt detail $drop over n {
-		$t delete $n
-	    }
-    }
-
-    # Some nodes can be dropped, but not their children.
-
-    $q query tree withatt type nonterminal \
-	withatt detail Statement over n {
-	    $t cut $n
-	}
-
-    # Cut the ALL and LemonGrammar nodes, direct access, no search
-    # needed.
-
-    $t cut [lindex [$t children root] 0]
-    $t cut [lindex [$t children root] 0]
-
-    return
-}
-
-proc ::page::util::norm::lemon::Terminals {q t} {
-    # The data for all terminals is stored in their grandparental
-    # nodes. We get rid of both terminals and their parents.
-
-    $q query tree withatt type terminal over n {
-	set p  [$t parent $n]
-	set gp [$t parent $p]
-
-	CopyLocation $t $n $gp
-	AttrCopy     $t $n detail $gp DATA
-	TokReduce    $t           $gp DATA
-	$t delete $p
-    }
-
-    # We can now drop the type attribute, as all the remaining nodes
-    # (which have it) will contain the value 'nonterminal'.
-
-    $q query tree hasatt type over n {
-	$t unset $n type
-    }
-    return
-}
-
-proc ::page::util::norm::lemon::Definitions {q t} {
-    # Convert 'Definition' into the sequences they are.
-    # Sequences of length one will be flattened later.
-    # Empty sequences (Length zero) are epsilon.
-    # Epsilon will be later converted to ? of the
-    # whole choice they are part of.
-
-    $q query tree withatt detail Definition over n {
-	$t unset $n detail
-
-	if {[$t children $n] < 1} {
-	    $t set $n op epsilon
-	} else {
-	    $t set $n op x
-	}
-    }
-    return
-}
-
-proc ::page::util::norm::lemon::Rules {q t sv} {
-    upvar $sv start
-    # We move nonterminal hint information from nodes into attributes,
-    # and delete the now irrelevant nodes.
-
-    # Like with the global metadata we move definition specific
-    # information out of nodes into attributes, get rid of the
-    # superfluous nodes, and tag the definition roots with marker
-    # attributes.
-
-    array set defs {}
-    $q query tree withatt detail Rule over n {
-	set first [Child $t $n 0]
-
-	set sym   [$t get $first DATA]
-	$t set $n symbol $sym
-	$t set $n label  $sym
-	$t set $n users  {}
-	$t set $n mode value
-
-	if {$start eq ""} {
-	    page_info "  StartSymbol: $sym"
-	    set start $sym
-	}
-
-	# We get the left extend of the definition from the terminal
-	# for the symbol it defines.
-
-	MergeLocations $t $first [Rightmost $t $n] $n
-	$t unset $n detail
-
-	lappend defs($sym) $n
-	$t cut $first
-    }
-
-    set d {}
-    foreach sym [array names defs] {
-	set nodes $defs($sym)
-	if {[llength $nodes] == 1} {
-	    lappend d $sym [lindex $nodes 0]
-	} else {
-	    # Merge multi-node definition together, under a choice.
-
-	    set r [$t insert root end]
-	    set c [$t insert $r end]
-
-	    $t set $r symbol $sym
-	    $t set $r label  $sym
-	    $t set $r users  {}
-	    $t set $r mode value
-	    $t set $c op     /
-
-	    foreach n $nodes {
-		set seq [lindex [$t children $n] 0]
-		$t move $c end $seq
-		$t delete $n
-	    }
-
-	    lappend d $sym $r
-	}
-    }
-
-    # We remember a mapping from nonterminal names to their defining
-    # nodes in the root as well, for quick reference later, when we
-    # build nonterminal usage references
-
-    $t set root definitions $d
-    return
-}
-
-proc ::page::util::norm::lemon::Rightmost {t n} {
-    # Determine the rightmost leaf under the specified node.
-
-    if {[$t isleaf $n]} {return $n}
-    return [Rightmost $t [lindex [$t children $n] end]]
-}
-
-proc ::page::util::norm::lemon::ElimEpsilon {q t} {
-    # We convert choices with an epsilon in them into
-    # optional choices without an epsilon branch.
-
-    $q query tree withatt op epsilon over n {
-	set choice [$t parent $n]
-
-	# Move branches into the epsilon, which becomes the new
-	# choice. And the choice becomes an option.
-	foreach c [$t children $choice] {
-	    if {$c eq $n} continue
-	    $t move $n end $c
-	}
-	$t set $n      op /
-	$t set $choice op ?
-    }
-    return
-}
-
-proc ::page::util::norm::lemon::AutoClassId {q t} {
-
-    array set defs [$t get root definitions]
-    array set use {}
-
-    $q query tree \
-	    withatt op x \
-	    children \
-	    hasatt DATA \
-	    over n {
-	# All identifiers are nonterminals, and for the
-	# undefined ones we create rules which define
-	# them as terminal sequences.
-
-	set sym  [$t get $n DATA]
-	$t unset $n DATA
-
-	$t set $n op  n
-	$t set $n sym $sym
-
-	if {![info exists defs($sym)]} {
-	    set defs($sym) [NewTerminal $t $sym]
-	}
-	$t set $n def $defs($sym)
-
-	lappend use($sym) $n
-	$t unset $n detail
-    }
-
-    $t set root definitions [array get defs]
-
-    foreach sym [array names use] {
-	$t set $defs($sym) users $use($sym)
-    }
-
-    $t set root undefined {}
-    return
-}
-
-proc ::page::util::norm::lemon::NewTerminal {t sym} {
-    page_log_info "  Terminal: $sym"
-
-    set     r [$t insert root end]
-    $t set $r symbol $sym
-    $t set $r label  $sym
-    $t set $r users  {}
-    $t set $r mode   leaf
-
-    set     s [$t insert $r end]
-    $t set $s op x
-
-    foreach ch [split $sym {}] {
-	set c [$t insert $s end]
-	$t set $c op   t
-	$t set $c char $ch
-    }
-    return $r
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Low-level helpers.
-
-proc ::page::util::norm::lemon::CopyLocation {t src dst} {
-    $t set $dst range    [$t get $src range]
-    $t set $dst range_lc [$t get $src range_lc]
-    return
-}
-
-proc ::page::util::norm::lemon::MergeLocations {t srca srcb dst} {
-    set ar   [$t get $srca range]
-    set arlc [$t get $srca range_lc]
-
-    set br   [$t get $srcb range]
-    set brlc [$t get $srcb range_lc]
-
-    $t set $dst range    [list [lindex $ar   0] [lindex $br   1]]
-    $t set $dst range_lc [list [lindex $arlc 0] [lindex $brlc 1]]
-    return
-}
-
-proc ::page::util::norm::lemon::AttrCopy {t src asrc dst adst} {
-    $t set $dst $adst [$t get $src $asrc]
-    return
-}
-
-proc ::page::util::norm::lemon::Child {t n index} {
-    return [lindex [$t children $n] $index]
-}
-
-proc ::page::util::norm::lemon::TokReduce {t src attr} {
-    set tokens [$t get $src $attr]
-    set ch     {}
-    foreach tok $tokens {
-	lappend ch [lindex $tok 0]
-    }
-    $t set $src $attr [join $ch {}]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::util::norm::lemon 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/util_norm_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/util_norm_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,415 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / Transformation - Normalize PEG AST for later.
-
-# This package assumes to be used from within a PAGE plugin. It uses
-# the API commands listed below. These are identical across the major
-# types of PAGE plugins, allowing this package to be used in reader,
-# transform, and writer plugins. It cannot be used in a configuration
-# plugin, and this makes no sense either.
-#
-# To ensure that our assumption is ok we require the relevant pseudo
-# package setup by the PAGE plugin management code.
-#
-# -----------------+--
-# page_info        | Reporting to the user.
-# page_warning     |
-# page_error       |
-# -----------------+--
-# page_log_error   | Reporting of internals.
-# page_log_warning |
-# page_log_info    |
-# -----------------+--
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-# @mdgen NODEP: page::plugin
-
-package require page::plugin ; # S.a. pseudo-package.
-package require treeql
-package require page::util::quote
-
-namespace eval ::page::util::norm::peg {
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl)
-
-    namespace import ::page::util::quote::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::util::norm::peg {t} {
-    set q [treeql q -tree $t]
-
-    page_info {[PEG Normalization]}
-    page_log_info ..Terminals   ; peg::Terminals   $q $t
-    page_log_info ..Chains      ; peg::CutChains   $q $t
-    page_log_info ..Metadata    ; peg::Metadata    $q $t
-    page_log_info ..Definitions ; peg::Definitions $q $t
-    page_log_info ..Expressions ; peg::Expressions $q $t
-
-    # Sentinel for PE algorithms.
-    $t set root symbol <StartExpression>
-    $q destroy
-
-    page_log_info Ok
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Documentation
-#
-## See doc_normalize.txt for the specification of the publicly visible
-## attributes.
-##
-## Internal attributes
-## - DATA - Transient storage for terminal data.
-
-# ### ### ### ######### ######### #########
-## Internal. Helpers
-
-proc ::page::util::norm::peg::Terminals {q t} {
-    # The data for all terminals is stored in their grandparental
-    # nodes. We get rid of both terminals and their parents.
-
-    $q query tree withatt type terminal over n {
-	set p  [$t parent $n]
-	set gp [$t parent $p]
-
-	CopyLocation $t $n $gp
-	AttrCopy     $t $n detail $gp DATA
-	TokReduce    $t           $gp DATA
-	$t delete $p
-    }
-
-    # We can now drop the type attribute, as all the remaining nodes
-    # (which have it) will contain the value 'nonterminal'.
-
-    $q query tree hasatt type over n {
-	$t unset $n type
-    }
-    return
-}
-
-proc ::page::util::norm::peg::CutChains {q t} {
-    # All nodes which have exactly one child are irrelevant. We get
-    # rid of them. The root node is the sole exception. The immediate
-    # child of the root however is superfluous as well.
-
-    $q query tree notq {root} over n {
-	if {[llength [$t children $n]] != 1} continue
-	$t cut $n
-    }
-
-    foreach n [$t children root] {$t cut $n}
-    return
-}
-
-proc ::page::util::norm::peg::Metadata {q t} {
-    # Having the name of the grammar in a tree node is overkill. We
-    # move this information into an attribute of the root node.
-    # The node keeping the start expression separate is irrelevant as
-    # well. We get rid of it, and tag the root of the start expression
-    # with a marker attribute.
-
-    $q query tree withatt detail Header over n {
-	set tmp    [Child $t $n 0]
-	set sexpr  [Child $t $n 1]
-
-	AttrCopy $t $tmp DATA root name
-	$t cut $tmp
-	$t cut $n
-	break
-    }
-
-    # Remember the node for the start expression in the root for quick
-    # access by later stages.
-
-    $t set root start $sexpr
-    return
-}
-
-proc ::page::util::norm::peg::Definitions {q t} {
-    # We move nonterminal hint information from nodes into attributes,
-    # and delete the now irrelevant nodes.
-
-    # NOTE: This transformation is dependent on the removal of all
-    # nodes with exactly one child, as it removes the all 'Attribute'
-    # nodes already. Otherwise this transformation would have to put
-    # the information into the grandparental node.
-
-    # The default mode for nonterminals is 'value'.
-
-    $q query tree withatt detail Definition over n {
-	$t set $n mode value
-    }
-
-    foreach {a mode} {
-	VOID  discard
-	MATCH match
-	LEAF  leaf
-    } {
-	$q query tree withatt detail $a over n {
-	    set p [$t parent $n]
-	    $t set $p mode $mode
-	    $t delete $n
-	}
-    }
-
-    # Like with the global metadata we move definition specific
-    # information out of nodes into attributes, get rid of the
-    # superfluous nodes, and tag the definition roots with marker
-    # attributes.
-
-    set defs {}
-    $q query tree withatt detail Definition over n {
-	# Define mode information for all nonterminals without an
-	# explicit specification. We also save the mode information
-	# from deletion when we redo the definition node.
-
-	set first [Child $t $n 0]
-
-	set sym [$t get $first DATA]
-	$t set $n symbol $sym
-	$t set $n label  $sym
-	$t set $n users  {}
-
-	# Now determine the range in the input covered by the
-	# definition. The left extent comes from the terminal for the
-	# nonterminal symbol it defines. The right extent comes from
-	# the rightmost child under the definition. While this not an
-	# expression tree yet the location data is sound already.
-
-	MergeLocations $t $first [Rightmost $t $n] $n
-	$t unset $n detail
-
-	lappend defs $sym $n
-	$t cut $first
-    }
-
-    # We remember a mapping from nonterminal names to their defining
-    # nodes in the root as well, for quick reference later, when we
-    # build nonterminal usage references
-
-    $t set root definitions $defs
-    return
-}
-
-proc ::page::util::norm::peg::Rightmost {t n} {
-    # Determine the rightmost leaf under the specified node.
-
-    if {[$t isleaf $n]} {return $n}
-    return [Rightmost $t [lindex [$t children $n] end]]
-}
-
-proc ::page::util::norm::peg::Expressions {q t} {
-    # We now transform the remaining nodes into proper expression
-    # trees. The order matters, to shed as much nodes as possible
-    # early, and to avoid unncessary work.
-
-    ExprRanges       $q $t
-    ExprUnaryOps     $q $t
-    ExprChars        $q $t
-    ExprNonterminals $q $t
-    ExprOperators    $q $t
-    ExprFlatten      $q $t
-    return
-}
-
-proc ::page::util::norm::peg::ExprRanges {q t} {
-    # Ranges = .. operator
-
-    $q query tree withatt detail Range over n {
-	# Two the children, both of text 'Char', their data is what we
-	# take. The children become irrelevant and are removed.
-
-	foreach {b e} [$t children $n] break
-	set begin [unquote [$t get $b DATA]]
-	set end   [unquote [$t get $e DATA]]
-
-	$t set $n op ..
-	$t set $n begin $begin
-	$t set $n end   $end
-
-	MergeLocations $t $b $e $n
-
-	$t unset $n detail
-
-	$t delete $b
-	$t delete $e
-    }
-    return
-}
-
-proc ::page::util::norm::peg::ExprUnaryOps {q t} {
-    # Unary operators ... Their transformation sheds more nodes.
-
-    foreach {a op} {
-	QUESTION ?
-	STAR     *
-	PLUS     +
-	AND      &
-	NOT      !
-    } {
-	$q query tree withatt detail $a over n {
-	    set p [$t parent $n]
-
-	    $t set $p op $op
-	    $t cut $n
-
-	    $t unset $p detail
-	}
-    }
-    return
-}
-
-proc ::page::util::norm::peg::ExprChars {q t} {
-    # Chars = t operator (The remaining Char'acters are plain terminal
-    # symbols.
-
-    $q query tree withatt detail Char over n {
-	set ch [unquote [$t get $n DATA]]
-
-	$t set $n op   t
-	$t set $n char $ch
-
-	$t unset $n detail
-	$t unset $n DATA
-    }
-    return
-}
-
-proc ::page::util::norm::peg::ExprNonterminals {q t} {
-    # Identifiers = n operator (nonterminal references) ...
-
-    array set defs [$t get root definitions]
-    array set undefined {}
-
-    $q query tree withatt detail Identifier over n {
-	set sym [$t get $n DATA]
-
-	$t set $n op  n
-	$t set $n sym $sym
-
-	$t unset $n detail
-	$t unset $n DATA
-
-	# Create x-references between the users and the definition of
-	# a nonterminal symbol.
-
-	if {![info exists defs($sym)]} {
-	    $t set $n def {}
-	    lappend undefined($sym) $n
-	    continue
-	} else {
-	    set def $defs($sym)
-	    $t set $n def $def
-	}
-
-	set users [$t get $def users]
-	lappend users $n
-	$t set $def users $users
-    }
-
-    $t set root undefined [array get undefined]
-    return
-}
-
-proc ::page::util::norm::peg::ExprOperators {q t} {
-    # The remaining operator nodes can be changed directly from node
-    # text to operator. Se we do.
-
-    foreach {a op} {
-	EPSILON    epsilon
-	ALNUM      alnum
-	ALPHA      alpha
-	DOT        dot
-	Literal    x
-	Class      /
-	Sequence   x
-	Expression /
-    } {
-	$q query tree withatt detail $a over n {
-	    $t set   $n op $op
-	    $t unset $n detail
-	}
-    }
-    return
-}
-
-proc ::page::util::norm::peg::ExprFlatten {q t} {
-    # Last tweaks of the expressions. Classes inside of Expressions,
-    # and Literals in Sequences create nested / or x expressions. We
-    # locate such and flatten the nested expression, cutting out the
-    # superfluous operator.
-
-    foreach op {x /} {
-	# Locate all x operators, whose parents are x operators as
-	# well, then go back to the child operators and cut them out.
-
-	$q query tree withatt op $op \
-		parent unique withatt op $op \
-		children withatt op $op \
-		over n {
-	    $t cut $n
-	}
-
-	# Locate all x operators without children and convert them
-	# into epsilon operators. Because that is what they accept,
-	# nothing.
-
-	$q query tree withatt op $op over n {
-	    if {[$t numchildren $n]} continue
-	    $t set $n op epsilon
-	}
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal. Low-level helpers.
-
-proc ::page::util::norm::peg::CopyLocation {t src dst} {
-    $t set $dst range    [$t get $src range]
-    $t set $dst range_lc [$t get $src range_lc]
-    return
-}
-
-proc ::page::util::norm::peg::MergeLocations {t srca srcb dst} {
-    set ar   [$t get $srca range]
-    set arlc [$t get $srca range_lc]
-
-    set br   [$t get $srcb range]
-    set brlc [$t get $srcb range_lc]
-
-    $t set $dst range    [list [lindex $ar   0] [lindex $br   1]]
-    $t set $dst range_lc [list [lindex $arlc 0] [lindex $brlc 1]]
-    return
-}
-
-proc ::page::util::norm::peg::TokReduce {t src attr} {
-    set tokens [$t get $src $attr]
-    set ch     {}
-    foreach tok $tokens {
-	lappend ch [lindex $tok 0]
-    }
-    $t set $src $attr [join $ch {}]
-    return
-}
-
-proc ::page::util::norm::peg::AttrCopy {t src asrc dst adst} {
-    $t set $dst $adst [$t get $src $asrc]
-    return
-}
-
-proc ::page::util::norm::peg::Child {t n index} {
-    return [lindex [$t children $n] $index]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::util::norm::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/util_peg.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/util_peg.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,209 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-
-## This package provides a number of utility commands to
-## transformations for common operations. It assumes a 'Normalized PE
-## Grammar Tree' as input, possibly augmented with attributes coming
-## from transformation not in conflict with the base definition.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require page::util::quote
-
-namespace eval ::page::util::peg {
-    namespace export \
-	    symbolOf symbolNodeOf \
-	    updateUndefinedDueRemoval \
-	    flatten peOf printTclExpr \
-	    getWarnings printWarnings
-
-    # Get the peg char de/encoder commands.
-    # (unquote, quote'tcl).
-
-    namespace import ::page::util::quote::*
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::util::peg::symbolNodeOf {t n} {
-    # Given an arbitrary root it determines the node (itself or an
-    # ancestor) containing the name of the nonterminal symbol the node
-    # belongs to, and returns its id. The result is either the root of
-    # the tree (for the start expression), or a definition mode.
-
-    while {![$t keyexists $n symbol]} {
-	set n [$t parent $n]
-    }
-    return $n
-}
-
-proc ::page::util::peg::symbolOf {t n} {
-    # As above, but returns the symbol name.
-
-    return [$t get [symbolNodeOf $t $n] symbol]
-}
-
-proc ::page::util::peg::updateUndefinedDueRemoval {t} {
-    # The removal of nodes may have caused symbols to lose one or more
-    # users. Example: A used by B and C, B is reachable, C is not, so A
-    # now loses a node in the expression for C calling it, or rather
-    # not anymore.
-
-    foreach {sym def} [$t get root definitions] {
-	set res {}
-	foreach u [$t get $def users] {
-	    if {![$t exists $u]} continue
-	    lappend res $u
-	}
-	$t set $def users $res
-    }
-
-    # Update the knowledge of undefined nonterminals. To be used when
-    # a transformation can remove invokations of undefined symbols,
-    # and is not able to generate such invokations.
-
-    set res {}
-    foreach {sym invokers} [$t get root undefined] {
-	set sres {}
-	foreach n $invokers {
-	    if {![$t exists $n]} continue
-	    lappend sres $n
-	}
-	if {[llength $sres]} {
-	    lappend res $sym $sres
-	}
-    }
-    $t set root undefined $res
-    return
-}
-
-proc ::page::util::peg::flatten {q t} {
-    # Flatten nested x-, or /-operators.
-    # See peg_normalize.tcl, peg::normalize::ExprFlatten
-
-    foreach op {x /} {
-	# Locate all x operators, whose parents are x oerators as
-	# well, then go back to the child operators and cut them out.
-
-	$q query \
-		tree          withatt op $op \
-		parent unique withatt op $op \
-		children      withatt op $op \
-		over n {
-	    $t cut $n
-	}
-    }
-    return
-}
-
-proc ::page::util::peg::getWarnings {t} {
-    # Look at the attributes for problems with the grammar and issue
-    # warnings. They do not prevent us from writing the grammar, but
-    # still represent problems with it the user should be made aware
-    # of.
-
-    array set msg {}
-    array set undefined [$t get root undefined]
-    foreach sym [array names undefined] {
-	set msg($sym) {}
-	foreach ref $undefined($sym) {
-	    lappend msg($sym) "Undefined symbol used by the definition of '[symbolOf $t $ref]'."
-	}
-    }
-
-    foreach {sym def} [$t get root definitions] {
-	if {[llength [$t get $def users]] == 0} {
-	    set msg($sym) [list "This symbol has been defined, but is not used."]
-	}
-    }
-
-    return [array get msg]
-}
-
-proc ::page::util::peg::printWarnings {msg} {
-    if {![llength $msg]} return
-
-    set dict {}
-    set max -1
-    foreach {k v} $msg {
-	set l [string length [list $k]]
-	if {$l > $max} {set max $l}
-	lappend dict [list $k $v $l]
-    }
-
-    foreach e [lsort -dict -index 0 $dict] {
-	foreach {k msgs l} $e break
-
-	set off [string repeat " " [expr {$max - $l}]]
-	page_info "[list $k]$off : [lindex $msgs 0]"
-
-	if {[llength $msgs] > 1} {
-	    set indent [string repeat " " [string length [list $k]]]
-	    foreach m [lrange $msgs 1 end] {
-		puts stderr "  $indent$off : $m"
-	    }
-	}
-    }
-    return
-}
-
-proc ::page::util::peg::peOf {t eroot} {
-    set op [$t get $eroot op]
-    set pe [list $op]
-
-    set ch [$t children $eroot]
-
-    if {[llength $ch]} {
-	foreach c $ch {
-	    lappend pe [peOf $t $c]
-	}
-    } elseif {$op eq "n"} {
-	lappend pe [$t get $eroot sym]
-    } elseif {$op eq "t"} {
-	lappend pe [unquote [$t get $eroot char]]
-    } elseif {$op eq ".."} {
-	lappend pe \
-		[unquote [$t get $eroot begin]] \
-		[unquote [$t get $eroot end]]
-
-    }
-    return $pe
-}
-
-proc ::page::util::peg::printTclExpr {pe} {
-    list [PrintExprSub $pe]
-}
-
-# ### ### ### ######### ######### #########
-## Internal
-
-proc ::page::util::peg::PrintExprSub {pe} {
-    set op   [lindex $pe 0]
-    set args [lrange $pe 1 end]
-
-    #puts stderr "PE [llength $args] $op | $args"
-
-    if {$op eq "t"} {
-	set a [lindex $args 0]
-	return "$op [quote'tcl $a]"
-    } elseif {$op eq ".."} {
-	set a [lindex $args 0]
-	set b [lindex $args 1]
-	return "$op [quote'tcl $a] [quote'tcl $b]"
-    } elseif {$op eq "n"} {
-	return $pe
-    } else {
-	set res $op
-	foreach a $args {
-	    lappend res [PrintExprSub $a]
-	}
-	return $res
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::util::peg 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/page/util_quote.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/page/util_quote.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,173 +1,0 @@
-# -*- tcl -*-
-#
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Parser Generator / (Un)quoting characters.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-namespace eval ::page::util::quote {
-    namespace export unquote \
-	    quote'tcl quote'tclstr quote'tclcom
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-proc ::page::util::quote::unquote {ch} {
-    # A character, as stored in the grammar tree
-    # by the frontend is transformed into a proper
-    # Tcl character (internal representation).
-
-    switch -exact -- $ch {
-	"\\n"  {return \n}
-	"\\t"  {return \t}
-	"\\r"  {return \r}
-	"\\["  {return \[}
-	"\\]"  {return \]}
-	"\\'"  {return '}
-	"\\\"" {return "\""}
-	"\\\\" {return \\}
-    }
-
-    if {[regexp {^\\([0-2][0-7][0-7])$} $ch -> ocode]} {
-	return [format %c $ocode]
-    } elseif {[regexp {^\\([0-7][0-7]?)$} $ch -> ocode]} {
-	return [format %c 0$ocode]
-    } elseif {[regexp {^\\u([0-9a-fA-F][0-9a-fA-F]?[0-9a-fA-F]?[0-9a-fA-F]?)$} $ch -> hcode]} {
-	return [format %c 0x$hcode]
-    }
-
-    return $ch
-}
-
-proc ::page::util::quote::quote'tcl {ch} {
-    # Converts a Tcl character (internal representation)
-    # into a string which is accepted by the Tcl parser,
-    # will regenerate the character in question and is
-    # 7bit ASCII. 'quoted' is a boolean flag and set if
-    # the returned representation is a \-quoted form.
-    # Because they have to be treated specially when
-    # creating a list containing the reperesentation.
-
-    # Special characters
-
-    switch -exact -- $ch {
-	"\n" {return "\\n"}
-	"\r" {return "\\r"}
-	"\t" {return "\\t"}
-	"\\" - "\;" -
-	" "  - "\"" -
-	"("  - ")"  -
-	"\{" - "\}" -
-	"\[" - "\]" {
-	    # Quote space and all the brackets as well, using octal,
-	    # for easy impure list-ness.
-
-	    scan $ch %c chcode
-	    return \\[format %o $chcode]
-	}
-    }
-
-    scan $ch %c chcode
-
-    # Control characters: Octal
-    if {[string is control -strict $ch]} {
-	return \\[format %o $chcode]
-    }
-
-    # Beyond 7-bit ASCII: Unicode
-
-    if {$chcode > 127} {
-	return \\u[format %04x $chcode]
-    }
-
-    # Regular character: Is its own representation.
-
-    return $ch
-}
-
-proc ::page::util::quote::quote'tclstr {ch} {
-    # Converts a Tcl character (internal representation)
-    # into a string which is accepted by the Tcl parser and will
-    # generate a human readable representation of the character in
-    # question, one which when puts to a channel describes the
-    # character without using any unprintable characters. It may use
-    # \-quoting. High utf characters are quoted to avoid problem with
-    # the still prevalent ascii terminals. It is assumed that the
-    # string will be used in a ""-quoted environment.
-
-    # Special characters
-
-    switch -exact -- $ch {
-	" "  {return "<blank>"}
-	"\n" {return "\\\\n"}
-	"\r" {return "\\\\r"}
-	"\t" {return "\\\\t"}
-	"\"" - "\\" - "\;" -
-	"("  - ")"  -
-	"\{" - "\}" -
-	"\[" - "\]" {
-	    return \\$ch
-	}
-    }
-
-    scan $ch %c chcode
-
-    # Control characters: Octal
-    if {[string is control -strict $ch]} {
-	return \\\\[format %o $chcode]
-    }
-
-    # Beyond 7-bit ASCII: Unicode
-
-    if {$chcode > 127} {
-	return \\\\u[format %04x $chcode]
-    }
-
-    # Regular character: Is its own representation.
-
-    return $ch
-}
-
-proc ::page::util::quote::quote'tclcom {ch} {
-    # Converts a Tcl character (internal representation)
-    # into a string which is accepted by the Tcl parser when used
-    # within a Tcl comment.
-
-    # Special characters
-
-    switch -exact -- $ch {
-	" "  {return "<blank>"}
-	"\n" {return "\\n"}
-	"\r" {return "\\r"}
-	"\t" {return "\\t"}
-	"\"" -
-	"\{" - "\}" -
-	"("  - ")"  {
-	    return \\$ch
-	}
-    }
-
-    scan $ch %c chcode
-
-    # Control characters: Octal
-    if {[string is control -strict $ch]} {
-	return \\[format %o $chcode]
-    }
-
-    # Beyond 7-bit ASCII: Unicode
-
-    if {$chcode > 127} {
-	return \\u[format %04x $chcode]
-    }
-
-    # Regular character: Is its own representation.
-
-    return $ch
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide page::util::quote 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,109 +1,0 @@
-# Tcl package index file, version 1.1
-# Do NOT edit by hand.  Let tcllib install generate this file.
-# Generated by tcllib installer for version 1.10
-
-# All tcllib packages need Tcl 8 (use [namespace])
-if {![package vsatisfies [package provide Tcl] 8]} {return}
-
-# Extend the auto_path to make tcllib packages available
-if {[lsearch -exact $::auto_path $dir] == -1} {
-    lappend ::auto_path $dir
-}
-
-# For Tcl 8.3.1 and later, that's all we need
-if {[package vsatisfies [package provide Tcl] 8.4]} {return}
-if {(0 == [catch {
-    package vcompare [info patchlevel] [info patchlevel]
-}]) && (
-    [package vcompare [info patchlevel] 8.3.1] >= 0
-)} {return}
-
-# For older Tcl releases, here are equivalent contents
-# of the pkgIndex.tcl files of all the modules
-
-if {![package vsatisfies [package provide Tcl] 8.0]} {return}
-
-
-set maindir $dir
-set dir [file join $maindir aes] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir asn] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir base32] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir base64] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir bee] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir bench] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir bibtex] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir blowfish] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir cmdline] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir comm] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir control] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir counter] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir crc] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir csv] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir des] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir dns] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir docstrip] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir doctools] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir exif] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir fileutil] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ftp] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ftpd] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir fumagic] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir grammar_fa] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir grammar_me] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir grammar_peg] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir html] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir htmlparse] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir http] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ident] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir inifile] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir interp] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir irc] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir javascript] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir jpeg] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir json] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ldap] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir log] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir mapproj] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir math] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir md4] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir md5] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir md5crypt] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir mime] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir multiplexer] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ncgi] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir nmea] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir nns] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir nntp] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ntp] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir otp] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir page] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir pluginmgr] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir png] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir pop3] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir pop3d] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir profiler] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir rc4] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir rcs] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir report] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir ripemd] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir sasl] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir sha1] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir smtpd] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir snit] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir soundex] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir stooop] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir struct] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir tar] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir term] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir textutil] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir tie] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir tiff] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir transfer] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir treeql] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir uev] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir units] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir uri] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir uuid] ;	 source [file join $dir pkgIndex.tcl]
-set dir [file join $maindir wip] ;	 source [file join $dir pkgIndex.tcl]
-unset maindir
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pluginmgr/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pluginmgr/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded pluginmgr 0.1 [list source [file join $dir pluginmgr.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pluginmgr/pluginmgr.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pluginmgr/pluginmgr.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,394 +1,0 @@
-# plugin.tcl --
-#
-#	Generic plugin management.
-#
-# Copyright (c) 2005 Andreas Kupries <andreas_kupries@sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: pluginmgr.tcl,v 1.6 2007/06/23 03:39:34 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Description
-
-# Each instance of the plugin manager can be configured with data
-# which specifies where to find plugins, and how to validate
-# them. With that it can then be configured to load and provide access
-# to a specific plugin, doing all required checks and
-# initialization. Users for specific plugin types simply have to
-# encapsulate the generic class, providing all the specifics, leaving
-# their users only the task of naming the requested actual plugin.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require Tcl 8.4
-package require snit
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::pluginmgr {
-
-    # ### ### ### ######### ######### #########
-    ## Public API - Options
-
-    # - Pattern to match package name. Exactly one '*'. No default.
-    # - List of commands the plugin has to provide. Empty list default.
-    # - Callback for additional checking after the API presence has
-    #   been verified. Empty list default.
-    # - Dictionary of commands to put into the plugin interpreter.
-    #   Key: cmds for plugin, value is cmds to invoke for them.
-    # - Interpreter to use for the -cmds (invoked commands). Default
-    #   is current interp.
-
-    option -pattern {}
-    option -api     {}
-    option -check   {}
-    option -cmds    {}
-    option -cmdip   {}
-    option -setup   {}
-
-    # ### ### ### ######### ######### #########
-    ## Public API - Methods
-
-    method do {args} {
-	if {$plugin eq ""} {
-	    return -code error "No plugin defined"
-	}
-	return [$sip eval $args]
-    }
-
-    method interpreter {} {
-	return $sip
-    }
-
-    method plugin {} {
-	return $plugin
-    }
-
-    method load {name} {
-	if {$name eq $plugin} return
-
-	if {$options(-pattern) eq ""} {
-	    return -code error "Translation pattern is not configured"
-	}
-
-	set save $sip
-
-	$self SetupIp
-	if {![$self LoadPlugin $name]} {
-	    set sip $save
-	    return -code error "Unable to locate plugin \"$name\""
-	}
-
-	if {![$self CheckAPI missing]} {
-	    set sip $save
-	    return -code error \
-		    "Cannot use plugin \"$name\", API incomplete: \"$missing\" missing"
-	}
-
-	set savedname $plugin
-	set plugin    $name
-	if {![$self CheckExternal]} {
-	    set sip    $save
-	    set plugin $savedname
-	    return -code error \
-		    "Cannot use plugin \"$name\", API bad"
-	}
-	$self SetupExternalCmds
-
-	if {$save ne ""} {interp delete $save}
-	return
-    }
-
-    method unload {} {
-	if {$sip eq ""} return
-	interp delete $sip
-	set sip    ""
-	set plugin ""
-	return
-    }
-
-    method list {} {
-	if {$options(-pattern) eq ""} {
-	    return -code error "Translation pattern is not configured"
-	}
-
-	set save $sip
-	$self SetupIp
-
-	set result {}
-	set pattern [string map [list \
-		+  \\+  ?  \\?    \
-		\[ \\\[ \] \\\]   \
-		(  \\(  )  \\)    \
-		. \\. \ *  {(.*)} \
-		] $options(-pattern)]
-
-	# @mdgen NODEP: bogus-package
-	$sip eval {catch {package require bogus-package}}
-	foreach p [$sip eval {package names}] {
-	    if {![regexp $pattern $p -> plugin]} continue
-	    lappend result $plugin
-	}
-
-	interp delete $sip
-	set sip $save
-	return $result
-    }
-
-    method path {path} {
-	set path [file join [pwd] $path]
-	if {[lsearch -exact $paths $path] < 0} {
-	    lappend paths $path
-	}
-	return
-    }
-
-    method paths {} {
-	return $paths
-    }
-
-    method clone {} {
-	set o [$type create %AUTO% \
-		-pattern $options(-pattern) \
-		-api     $options(-api)    \
-		-check   $options(-check) \
-		-cmds    $options(-cmds) \
-		-cmdip   $options(-cmdip) \
-		-setup   $options(-setup)]
-
-	$o __clone__ $paths $sip $plugin
-
-	# Clone has become owner of the interp.
-	set sip    {}
-	set plugin {}
-
-	return $o
-    }
-
-    method __clone__ {_paths _sip _plugin} {
-	set paths  $_paths
-	set sip    $_sip
-	set plugin $_plugin
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal - Configuration and state
-
-    variable paths  {} ; # List of paths to provide the sip with.
-    variable sip    {} ; # Safe interp used for plugin execution.
-    variable plugin {} ; # Name of currently loaded plugin.
-
-    # ### ### ### ######### ######### #########
-    ## Internal - Object construction and descruction.
-
-    constructor {args} {
-	$self configurelist $args
-	return
-    }
-
-    destructor {
-	if {$sip ne ""} {interp delete $sip}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal - Option management
-
-    onconfigure -pattern {newvalue} {
-	set current $options(-pattern)
-	if {$newvalue eq $current} return
-
-	set n [regexp -all "\\*" $newvalue]
-	if {$n < 1} {
-	    return -code error "Invalid pattern, * missing"
-	} elseif {$n > 1} {
-	    return -code error "Invalid pattern, too many *'s"
-	}
-
-	set options(-pattern) $newvalue
-	return
-    }
-
-    onconfigure -api {newvalue} {
-	set current $options(-api)
-	if {$newvalue eq $current} return
-	set options(-api) $newvalue
-	return
-    }
-
-    onconfigure -cmds {newvalue} {
-	set current $options(-cmds)
-	if {$newvalue eq $current} return
-	set options(-cmds) $newvalue
-	return
-    }
-
-    onconfigure -cmdip {newvalue} {
-	set current $options(-cmdip)
-	if {$newvalue eq $current} return
-	set options(-cmdip) $newvalue
-	return
-    }
-
-
-    # ### ### ### ######### ######### #########
-    ## Internal - Helper commands
-
-    method SetupIp {} {
-	set sip [::safe::interpCreate]
-	foreach p $paths {
-	    ::safe::interpAddToAccessPath $sip $p
-	}
-
-	if {![llength $options(-setup)]} return
-	uplevel \#0 [linsert $options(-setup) end $self $sip]
-	return
-    }
-
-    method LoadPlugin {name} {
-	if {[file exists $name]} {
-	    # Plugin files are loaded directly.
-
-	    $sip invokehidden source $name
-	    return 1
-	}
-
-	# Otherwise the name is transformed into a package name
-	# and loaded thorugh the package management.
-
-	set pluginpackage [string map \
-		[list * $name] $options(-pattern)]
-	if {[catch {
-	    $sip eval [list package require $pluginpackage]
-	} res]} {
-	    return 0
-	}
-	return 1
-    }
-
-    method CheckAPI {mv} {
-	upvar 1 $mv missing
-	if {![llength $options(-api)]} {return 1}
-
-	# Check the plugin for useability.
-
-	foreach p $options(-api) {
-	    if {[llength [$sip eval [list info commands $p]]] == 1} continue
-	    interp delete $sip
-	    set missing $p
-	    return 0
-	}
-	return 1
-    }
-
-    method CheckExternal {} {
-	if {![llength $options(-check)]} {return 1}
-	return [uplevel \#0 [linsert $options(-check) end $self]]
-    }
-
-
-    method SetupExternalCmds {} {
-	if {![llength $options(-cmds)]} return
-
-	set cip $options(-cmdip)
-	foreach {pcmd ecmd} $options(-cmds) {
-	    eval [linsert $ecmd 0 interp alias $sip $pcmd $cip]
-	    #interp alias $sip $pcmd $cip {*}$ecmd
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-
-    proc paths {pmgr args} {
-	if {[llength $args] == 0} {
-	    return -code error "wrong#args: Expect \"[info level 0] object name...\""
-	}
-	foreach name $args {
-	    AddPaths $pmgr $name
-	}
-	return
-    }
-
-    proc AddPaths {pmgr name} {
-	global env tcl_platform
-
-	if {$tcl_platform(platform) eq "windows"} {
-	    set sep \;
-	} else {
-	    set sep :
-	}
-
-	#puts "$pmgr += ($name) $sep"
-
-	regsub -all {::+} $name \000 name
-	set name [split $name \000]
-
-	# Environment variables
-
-	set prefix {}
-	foreach part $name {
-	    lappend prefix $part
-	    set ev [string toupper [join $prefix _]]_PLUGINS
-
-	    #puts "+? env($ev)"
-
-	    if {[info exists env($ev)]} {
-		foreach path [split $env($ev) $sep] {
-		    $pmgr path $path
-		}
-	    }
-	}
-
-	# Windows registry
-
-	if {
-	    ($tcl_platform(platform) eq "windows") &&
-	    ![catch {package require registry}]
-	} {
-	    foreach root {
-		HKEY_LOCAL_MACHINE
-		HKEY_CURRENT_USER
-	    } {
-		set prefix {}
-		foreach part $name {
-		    lappend prefix $part
-		    set rk $root\\SOFTWARE\\[join $prefix \\]PLUGINS
-
-		    #puts "+? registry($rk)"
-
-		    if {![catch {set data [registry get $rk {}]}]} {
-			foreach path [split $data $sep] {
-			    $pmgr path $path
-			}
-		    }
-		}
-	    }
-	}
-
-	# Home directory dot path
-
-	set prefix {}
-	foreach part $name {
-	    lappend prefix $part
-	    set pd [file join ~ .[join $prefix /] plugin]
-
-	    #puts "+? path($pd)"
-
-	    if {[file exists $pd]} {
-		$pmgr path $pd
-	    }
-	}
-	return
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide pluginmgr 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/png/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/png/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded png 0.1.2 [list source [file join $dir png.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/png/png.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/png/png.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,202 +1,0 @@
-# png.tcl --
-#
-#       Querying and modifying PNG image files.
-#
-# Copyright (c) 2004    Aaron Faupell <afaupell@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: png.tcl,v 1.10 2007/08/20 22:06:58 andreas_kupries Exp $
-
-package provide png 0.1.2
-
-namespace eval ::png {}
-
-proc ::png::_openPNG {file {mode r}} {
-    set fh [open $file $mode]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    if {[read $fh 8] != "\x89PNG\r\n\x1a\n"} { close $fh; return -code error "not a png file" }
-    return $fh
-}
-
-proc ::png::isPNG {file} {
-    if {[catch {_openPNG $file} fh]} { return 0 }
-    close $fh
-    return 1
-}
-
-proc ::png::validate {file} {
-    package require crc32
-    if {[catch {_openPNG $file} fh]} { return SIG }
-    set num 0
-    set idat 0
-    set last {}
-
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        if {$len < 0} { close $fh; return BADLEN }
-        set r [read $fh $len]
-        binary scan [read $fh 4] I crc
-	if {$crc < 0} {set crc [format %u [expr {$crc & 0xffffffff}]]}
-        if {[eof $fh]} { close $fh; return EOF }
-        if {($num == 0) && ($type != "IHDR")} { close $fh; return NOHDR }
-        if {$type == "IDAT"} { set idat 1 }
-        if {[::crc::crc32 $type$r] != $crc} { close $fh; return CKSUM }
-        set last $type
-        incr num
-    }
-    close $fh
-    if {!$idat} { return NODATA }
-    if {$last != "IEND"} { return NOEND }
-    return OK
-}
-
-proc ::png::imageInfo {file} {
-    set fh [_openPNG $file]
-    binary scan [read $fh 8] Ia4 len type
-    set r [read $fh $len]
-    if {![eof $fh] && $type == "IHDR"} {
-        binary scan $r IIccccc width height depth color compression filter interlace
-	binary scan [read $fh 4] I check
-	if {$check < 0} {set check [format %u [expr {$check & 0xffffffff}]]}
-	if {[::crc::crc32 IHDR$r] != $check} {
-	    return -code error "header checksum failed"
-	}
-        close $fh
-        return [list width $width height $height depth $depth color $color \
-		compression $compression filter $filter interlace $interlace]
-    }
-    close $fh
-    return
-}
-
-proc ::png::getTimestamp {file} {
-    set fh [_openPNG $file]
-
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        if {$type == "tIME"} {
-            set r [read $fh [expr {$len + 4}]]
-            binary scan $r Sccccc year month day hour minute second
-            close $fh
-            return [clock scan "$month/$day/$year $hour:$minute:$second" -gmt 1]
-        }
-        seek $fh [expr {$len + 4}] current
-    }
-    close $fh
-    return
-}
-
-proc ::png::setTimestamp {file time} {
-    set fh [_openPNG $file r+]
-    
-    set time [eval binary format Sccccc [string map {" 0" " "} [clock format $time -format "%Y %m %d %H %M %S" -gmt 1]]]
-    if {![catch {package present crc32}]} {
-        append time [binary format I [::crc::crc32 tIME$time]]
-    } else {
-        append time [binary format I 0]
-    }
-
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        if {[eof $fh]} { close $fh; return }
-        if {$type == "tIME"} {
-            seek $fh 0 current
-            puts -nonewline $fh $time
-            close $fh
-            return
-        }
-        if {$type == "IDAT" && ![info exists idat]} { set idat [expr {[tell $fh] - 8}] }
-        seek $fh [expr {$len + 4}] current
-    }
-    if {![info exists idat]} { close $fh; return -code error "no timestamp or data chunk found" }
-    seek $fh $idat start
-    set data [read $fh]
-    seek $fh $idat start
-    puts -nonewline $fh [binary format I 7]tIME$time$data
-    close $fh
-    return
-}
-
-proc ::png::getComments {file} {
-    set fh [_openPNG $file]
-    set text {}
-
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        set pos [tell $fh]
-        if {$type == "tEXt"} {
-            set r [read $fh $len]
-            lappend text [split $r \x00]
-        } elseif {$type == "iTXt"} {
-            set r [read $fh $len]
-            set keyword [lindex [split $r \x00] 0]
-            set r [string range $r [expr {[string length $keyword] + 1}] end]
-            binary scan $r cc comp method
-            if {$comp == 0} {
-                lappend text [linsert [split [string range $r 2 end] \x00] 0 $keyword]
-            }
-        }
-        seek $fh [expr {$pos + $len + 4}] start
-    }
-    close $fh
-    return $text
-}
-
-proc ::png::removeComments {file} {
-    set fh [_openPNG $file r+]
-    set data "\x89PNG\r\n\x1a\n"
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        if {$type == "zTXt" || $type == "iTXt" || $type == "tEXt"} {
-            seek $fh [expr {$len + 4}] current
-        } else {
-            seek $fh -8 current
-            append data [read $fh [expr {$len + 12}]]
-        }
-    }
-    close $fh
-    set fh [open $file w]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    puts -nonewline $fh $data
-    close $fh
-}
-
-proc ::png::addComment {file keyword arg1 args} {
-    if {[llength $args] > 0 && [llength $args] != 2} { close $fh; return -code error "wrong number of arguments" }
-    set fh [_openPNG $file r+]
-
-    if {[llength $args] > 0} {
-        set comment "iTXt$keyword\x00\x00\x00$arg1\x00[encoding convertto utf-8 [lindex $args 0]]\x00[encoding convertto utf-8 [lindex $args 1]]"
-    } else {
-        set comment "tEXt$keyword\x00$arg1"
-    }
-    
-    if {![catch {package present crc32}]} {
-        append comment [binary format I [::crc::crc32 $comment]]
-    } else {
-        append comment [binary format I 0]
-    }
-
-    while {[set r [read $fh 8]] != ""} {
-        binary scan $r Ia4 len type
-        if {$type ==  "IDAT"} {
-            seek $fh -8 current
-            set pos [tell $fh]
-            set data [read $fh]
-            seek $fh $pos start
-            set 1 [tell $fh]
-            puts -nonewline $fh $comment
-            set clen [binary format I [expr {[tell $fh] - $1 - 8}]]
-            seek $fh $pos start
-            puts -nonewline $fh $clen$comment$data
-            close $fh
-            return
-        }
-        seek $fh [expr {$len + 4}] current
-    }
-    close $fh
-    return -code error "no data chunk found"
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded pop3 1.6.3 [list source [file join $dir pop3.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3/pop3.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3/pop3.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,717 +1,0 @@
-# pop3.tcl --
-#
-#	POP3 mail client package, written in pure Tcl.
-#	Some concepts borrowed from "frenchie", a POP3
-#	mail client utility written by Scott Beasley.
-#
-# Copyright (c) 2000 by Ajuba Solutions.
-# portions Copyright (c) 2000 by Scott Beasley
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: pop3.tcl,v 1.33 2005/09/30 05:36:39 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require cmdline
-package require log
-package provide pop3 1.6.3
-
-namespace eval ::pop3 {
-
-    # The state variable remembers information about the open pop3
-    # connection. It is indexed by channel id. The information is
-    # a keyed list, with keys "msex" and "retr_mode". The value
-    # associated with "msex" is boolean, a true value signals that the
-    # server at the other end is MS Exchange. The value associated
-    # with "retr_mode" is one of {retr, list, slow}.
-
-    # The value of "msex" influences how the translation for the
-    # channel is set and is determined by the contents of the received
-    # greeting. The value of "retr_mode" is initially "retr" and
-    # completely determined by the first call to [retrieve]. For "list"
-    # the system will use LIST before RETR to retrieve the message size.
-
-    # The state can be influenced by options given to "open".
-
-    variable  state
-    array set state {}
-
-}
-
-# ::pop3::config --
-#
-#	Retrieve configuration of pop3 connection
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#
-# Results:
-#	A serialized array.
-
-proc ::pop3::config {chan} {
-    variable state
-    return  $state($chan)
-}
-
-# ::pop3::close --
-#
-#	Close the connection to the POP3 server.
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#
-# Results:
-#	None.
-
-proc ::pop3::close {chan} {
-    variable state
-    catch {::pop3::send $chan "QUIT"}
-    unset state($chan)
-    ::close $chan
-}
-
-# ::pop3::delete --
-#
-#	Delete messages on the POP3 server.
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#       start     The first message to delete in the range.
-#                 May be "next" (the next message after the last
-#                 one seen, see ::pop3::last), "start" (aka 1),
-#                 "end" (the last message in the spool, for 
-#                 deleting only the last message).
-#       end       (optional, defaults to -1) The last message
-#                 to delete in the range. May be "last"
-#                 (the last message viewed), "end" (the last
-#                 message in the spool), or "-1" (the default,
-#                 any negative number means delete only
-#                 one message).
-#
-# Results:
-#	None.
-#       May throw errors from the server.
-
-proc ::pop3::delete {chan start {end -1}} {
-
-    variable state
-    array set  cstate $state($chan)
-    set count $cstate(limit)
-    set last 0
-    catch {set last [::pop3::last $chan]}
-
-    if {![string is integer $start]} {
-	if {[string match $start "next"]} {
-	    set start $last
-	    incr start
-	} elseif {$start == "start"} {
-	    set start 1
-	} elseif {$start == "end"} {
-	    set start $count
-	} else {
-	    error "POP3 Deletion error: Bad start index $start"
-	}
-    } 
-    if {$start == 0} {
-	set start 1
-    }
-    
-    if {![string is integer $end]} {
-	if {$end == "end"} {
-	    set end $count
-	} elseif {$end == "last"} {
-	    set end $last
-	} else {
-	    error "POP3 Deletion error: Bad end index $end"
-	}
-    } elseif {$end < 0} {
-	set end $start
-    }
-
-    if {$end > $count} {
-	set end $count
-    }
-    
-    for {set index $start} {$index <= $end} {incr index} {
-	if {[catch {::pop3::send $chan "DELE $index"} errorStr]} {
-	    error "POP3 DELETE ERROR: $errorStr"
-	}
-    }
-    return {}
-}
-
-# ::pop3::last --
-#
-#	Gets the index of the last email read from the server.
-#       Note, some POP3 servers do not support this feature,
-#       in which case the value returned may always be zero,
-#       or an error may be thrown.
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#
-# Results:
-#	The index of the last email message read, which may
-#       be zero if none have been read or if the server does
-#       not support this feature.
-#       Server errors may be thrown, including some cases
-#       when the LAST command is not supported.
-
-proc ::pop3::last {chan} {
-
-    if {[catch {
-	    set resultStr [::pop3::send $chan "LAST"]
-        } errorStr]} {
-	error "POP3 LAST ERROR: $errorStr"
-    }
-    
-    return [string trim $resultStr]
-}
-
-# ::pop3::list --
-#
-#	Returns "scan listing" of the mailbox. If parameter msg
-#       is defined, then the listing only for the given message 
-#       is returned.
-#
-# Arguments:
-#	chan        The channel open to the POP3 server.
-#       msg         The message number (optional).
-#
-# Results:
-#	If msg parameter is not given, Tcl list of scan listings in 
-#       the maildrop is returned. In case msg parameter is given,
-#       a list of length one containing the specified message listing
-#       is returned.
-
-proc ::pop3::list {chan {msg ""}} {
-    global PopErrorNm PopErrorStr debug
- 
-    if {$msg == ""} {
-	if {[catch {::pop3::send $chan "LIST"} errorStr]} {
-	    error "POP3 LIST ERROR: $errorStr"
-	}
-	set msgBuffer [RetrSlow $chan]
-    } else {
-	# argument msg given, single-line response expected
-
-	if {[catch {expr {0 + $msg}}]} {
-	    error "POP3 LIST ERROR: malformed message number '$msg'"
-	} else {
-	    set msgBuffer [string trim [::pop3::send $chan "LIST $msg"]]
-	}
-    }
-    return $msgBuffer
-}
-
-# pop3::open --
-#
-#	Opens a connection to a POP3 mail server.
-#
-# Arguments:
-#       args     A list of options and values, possibly empty,
-#		 followed by the regular arguments, i.e. host, user,
-#		 passwd and port. The latter is optional.
-#
-#	host     The name or IP address of the POP3 server host.
-#       user     The username to use when logging into the server.
-#       passwd   The password to use when logging into the server.
-#       port     (optional) The socket port to connect to, defaults
-#                to port 110, the POP standard port address.
-#
-# Results:
-#	The connection channel (a socket).
-#       May throw errors from the server.
-
-proc ::pop3::open {args} {
-    variable state
-    array set cstate {msex 0 retr_mode retr limit {}}
-
-    log::log debug "pop3::open | [join $args]"
-
-    while {[set err [cmdline::getopt args {msex.arg retr-mode.arg} opt arg]]} {
-	if {$err < 0} {
-	    return -code error "::pop3::open : $arg"
-	}
-	switch -exact -- $opt {
-	    msex {
-		if {![string is boolean $arg]} {
-		    return -code error \
-			    ":pop3::open : Argument to -msex has to be boolean"
-		}
-		set cstate(msex) $arg
-	    }
-	    retr-mode {
-		switch -exact -- $arg {
-		    retr - list - slow {
-			set cstate(retr_mode) $arg
-		    }
-		    default {
-			return -code error \
-				":pop3::open : Argument to -retr-mode has to be one of retr, list or slow"
-		    }
-		}
-	    }
-	    default {# Can't happen}
-	}
-    }
-
-    if {[llength $args] > 4} {
-	return -code error "To many arguments to ::pop3::open"
-    }
-    if {[llength $args] < 3} {
-	return -code error "Not enough arguments to ::pop3::open"
-    }
-    foreach {host user password port} $args break
-    if {$port == {}} {
-	set port 110
-    }
-
-    log::log debug "pop3::open | protocol, connect to $host $port"
-
-    # Argument processing is finally complete, now open the channel
-
-    set chan [socket $host $port]
-    fconfigure $chan -buffering none
-
-    log::log debug "pop3::open | connect on $chan"
-
-    if {$cstate(msex)} {
-	# We are talking to MS Exchange. Work around its quirks.
-	fconfigure $chan -translation binary
-    } else {
-	fconfigure $chan -translation {binary crlf}
-    }
-
-    log::log debug "pop3::open | wait for greeting"
-
-    if {[catch {::pop3::send $chan {}} errorStr]} {
-	::close $chan
-	error "POP3 CONNECT ERROR: $errorStr"
-    }
-
-    if {0} {
-	# -FUTURE- Identify MS Exchange servers
-	set cstate(msex) 1
-
-	# We are talking to MS Exchange. Work around its quirks.
-	fconfigure $chan -translation binary
-    }
-
-    log::log debug "pop3::open | authenticate $user (*password not shown*)"
-
-    if {[catch {
-	::pop3::send $chan "USER $user"
-	::pop3::send $chan "PASS $password"
-    } errorStr]} {
-	::close $chan
-	error "POP3 LOGIN ERROR: $errorStr"
-    }
-
-    # [ 833486 ] Can't delete messages one at a time ...
-    # Remember the number of messages in the maildrop at the beginning
-    # of the session. This gives us the highest possible number for
-    # message ids later. Note that this number must not be affected
-    # when deleting mails later. While the number of messages drops
-    # down the limit for the message id's stays the same. The messages
-    # are not renumbered before the session actually closed.
-
-    set cstate(limit) [lindex [::pop3::status $chan] 0]
-
-    # Remember the state.
-
-    set state($chan) [array get cstate]
-
-    log::log debug "pop3::open | ok ($chan)"
-    return $chan
-}
-
-# ::pop3::retrieve --
-#
-#	Retrieve email message(s) from the server.
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#       start     The first message to retrieve in the range.
-#                 May be "next" (the next message after the last
-#                 one seen, see ::pop3::last), "start" (aka 1),
-#                 "end" (the last message in the spool, for 
-#                 retrieving only the last message).
-#       end       (optional, defaults to -1) The last message
-#                 to retrieve in the range. May be "last"
-#                 (the last message viewed), "end" (the last
-#                 message in the spool), or "-1" (the default,
-#                 any negative number means retrieve only
-#                 one message).
-#
-# Results:
-#	A list containing all of the messages retrieved.
-#       May throw errors from the server.
-
-proc ::pop3::retrieve {chan start {end -1}} {
-    variable state
-    array set cstate $state($chan)
-    
-    set count $cstate(limit)
-    set last 0
-    catch {set last [::pop3::last $chan]}
-
-    if {![string is integer $start]} {
-	if {[string match $start "next"]} {
-	    set start $last
-	    incr start
-	} elseif {$start == "start"} {
-	    set start 1
-	} elseif {$start == "end"} {
-	    set start $count
-	} else {
-	    error "POP3 Retrieval error: Bad start index $start"
-	}
-    } 
-    if {$start == 0} {
-	set start 1
-    }
-    
-    if {![string is integer $end]} {
-	if {$end == "end"} {
-	    set end $count
-	} elseif {$end == "last"} {
-	    set end $last
-	} else {
-	    error "POP3 Retrieval error: Bad end index $end"
-	}
-    } elseif {$end < 0} {
-	set end $start
-    }
-
-    if {$end > $count} {
-	set end $count
-    }
-    
-    set result {}
-
-    ::log::log debug "pop3 $chan retrieve $start -- $end"
-
-    for {set index $start} {$index <= $end} {incr index} {
-	switch -exact -- $cstate(retr_mode) {
-	    retr {
-		set sizeStr [::pop3::send $chan "RETR $index"]
-
-		::log::log debug "pop3 $chan retrieve ($sizeStr)"
-
-		if {[scan $sizeStr {%d %s} size dummy] < 1} {
-		    # The server did not deliver the size information.
-		    # Switch our mode to "list" and use the slow
-		    # method this time. The next call will use LIST before
-		    # RETR to get the size information. If even that fails
-		    # the system will fall back to slow mode all the time.
-
-		    ::log::log debug "pop3 $chan retrieve - no size information, go slow"
-
-		    set cstate(retr_mode) list
-		    set state($chan) [array get cstate]
-
-		    # Retrieve in slow motion.
-		    set msgBuffer [RetrSlow $chan]
-		} else {
-		    ::log::log debug "pop3 $chan retrieve - size information present, use fast mode"
-
-		    set msgBuffer [RetrFast $chan $size]
-		}
-	    }
-	    list {
-		set sizeStr [::pop3::send $chan "LIST $index"]
-
-		if {[scan $sizeStr {%d %d %s} dummy size dummy] < 2} {
-		    # Not even LIST generates the necessary size information.
-		    # Switch to full slow mode and don't bother anymore.
-
-		    set cstate(retr_mode) slow
-		    set state($chan) [array get cstate]
-
-		    ::pop3::send $chan "RETR $index"
-
-		    # Retrieve in slow motion.
-		    set msgBuffer [RetrSlow $chan]
-		} else {
-		    # Ignore response of RETR, already know the size
-		    # through LIST
-
-		    ::pop3::send $chan "RETR $index"
-		    set msgBuffer [RetrFast $chan $size]
-		}
-	    }
-	    slow {
-		# Retrieve in slow motion.
-
-		::pop3::send $chan "RETR $index"
-		set msgBuffer [RetrSlow $chan]
-	    }
-	}
-	lappend result $msgBuffer
-    }
-    return $result
-}
-
-# ::pop3::RetrFast --
-#
-#	Fast retrieval of a message from the pop3 server.
-#	Internal helper to prevent code bloat in "pop3::retrieve"
-#
-# Arguments:
-#	chan	The channel to read the message from.
-#
-# Results:
-#	The text of the retrieved message.
-
-proc ::pop3::RetrFast {chan size} {
-    set msgBuffer [read $chan $size]
-
-    foreach line [split $msgBuffer \n] {
-	::log::log debug "pop3 $chan fast <$line>"
-    }
-
-    # There is a small discrepance in counting octets we have to be
-    # aware of. 'size' is #octets before transmission, i.e. can be
-    # with one eol character, CR or LF. The channel system in binary
-    # mode counts every character, and the protocol specified CRLF as
-    # eol, so for every line in the message we read that many
-    # characters _less_. Another factor which can cause a miscount is
-    # the ".-stuffing performed by the sender. I.e. what we got now is
-    # not necessarily the complete message. We have to perform slow
-    # reads to get the remainder of the message. This has another
-    # complication. We cannot simply check for a line containing the
-    # terminating signature, simply because the point where the
-    # message was broken in two might just be in between the dots of a
-    # "\r\n..\r\n" sequence. We have to make sure that we do not
-    # misinterpret the second part of this sequence as terminator.
-    # Another possibility: "\r\n.\r\n" is broken just after the dot.
-    # Then we have to ensure to not to miss the terminator entirely.
-
-    # Sometimes the gets returns nothing, need to get the real
-    # terminating "."                                    / "
-
-    if {[string equal [string range $msgBuffer end-3 end] "\n.\r\n"]} {
-	# Complete terminator found. Remove it from the message buffer.
-
-	::log::log debug "pop3 $chan /5__"
-	set msgBuffer [string range $msgBuffer 0 end-3]
-
-    } elseif {[string equal [string range $msgBuffer end-2 end] "\n.\r"]} {
-	# Complete terminator found. Remove it from the message buffer.
-	# Also perform an empty read to remove the missing '\n' from
-	# the channel. If we don't do this all following commands will
-	# run into off-by-one (character) problems.
-
-	::log::log debug "pop3 $chan /4__"
-	set msgBuffer [string range $msgBuffer 0 end-2]
-	while {[read $chan 1] != "\n"} {}
-
-    } elseif {[string equal [string range $msgBuffer end-1 end] "\n."]} {
-	# \n. at the end of the fast buffer.
-	# Can be	\n.\r\n	 = Terminator
-	# or		\n..\r\n = dot-stuffed single .
-
-	log::log debug "pop3 $chan /check for cut .. or terminator sequence"
-
-	# Idle until non-empty line encountered.
-	while {[set line [gets $chan]] == ""} {}
-	if {"$line" == "\r"} {
-	    # Terminator already found. Note that we have to
-	    # remove the partial terminator sequence from the
-	    # message buffer.
-	    ::log::log debug "pop3 $chan /3__ <$line>"
-	    set msgBuffer [string range $msgBuffer 0 end-1]
-	} else {
-	    # Append line and look for the real terminator
-	    append msgBuffer $line
-	    ::log::log debug "pop3 $chan ____ <$line>"
-	    while {[set line [gets $chan]] != ".\r"} {
-		::log::log debug "pop3 $chan ____ <$line>"
-		append msgBuffer $line
-	    }
-	    ::log::log debug "pop3 $chan /2__ <$line>"
-	}
-    } elseif {[string equal [string index $msgBuffer end] \n]} {
-	# Line terminator (\n) found. The remainder of the mail has to
-	# consist of true lines we can read directly.
-
-	while {![string equal [set line [gets $chan]] ".\r"]} {
-	    ::log::log debug "pop3 $chan ____ <$line>"
-	    append msgBuffer $line
-	}
-	::log::log debug "pop3 $chan /1__ <$line>"
-    } else {
-	# Incomplete line at the end of the buffer. We complete it in
-	# a single read, and then handle the remainder like the case
-	# before, where we had a complete line at the end of the
-	# buffer.
-
-	set line [gets $chan]
-	::log::log debug "pop3 $chan /1a_ <$line>"
-	append msgBuffer $line
-
-	::log::log debug "pop3 $chan /1b_"
-
-	while {![string equal [set line [gets $chan]] ".\r"]} {
-	    ::log::log debug "pop3 $chan ____ <$line>"
-	    append msgBuffer $line
-	}
-	::log::log debug "pop3 $chan /1c_ <$line>"
-    }
-
-    ::log::log debug "pop3 $chan done"
-
-    # Map both cr+lf and cr to lf to simulate auto EOL translation, then
-    # unstuff .-stuffed lines.
-
-    return [string map [::list \n.. \n.] [string map [::list \r \n] [string map [::list \r\n \n] $msgBuffer]]]
-}
-
-# ::pop3::RetrSlow --
-#
-#	Slow retrieval of a message from the pop3 server.
-#	Internal helper to prevent code bloat in "pop3::retrieve"
-#
-# Arguments:
-#	chan	The channel to read the message from.
-#
-# Results:
-#	The text of the retrieved message.
-
-proc ::pop3::RetrSlow {chan} {
-
-    set msgBuffer ""
-	
-    while {1} {
-	set line [string trimright [gets $chan] \r]
-	::log::log debug "pop3 $chan slow $line"
-
-	# End of the message is a line with just "."
-	if {$line == "."} {
-	    break
-	} elseif {[string index $line 0] == "."} {
-	    set line [string range $line 1 end]
-	}
-		
-	append msgBuffer $line "\n"
-    }
-
-    return $msgBuffer
-}
-
-# ::pop3::send --
-#
-#	Send a command string to the POP3 server.  This is an
-#       internal function, but may be used in rare cases.
-#
-# Arguments:
-#	chan        The channel open to the POP3 server.
-#       cmdstring   POP3 command string
-#
-# Results:
-#	Result string from the POP3 server, except for the +OK tag.
-#       Errors from the POP3 server are thrown.
-
-proc ::pop3::send {chan cmdstring} {
-   global PopErrorNm PopErrorStr debug
-
-   if {$cmdstring != {}} {
-       ::log::log debug "pop3 $chan >>> $cmdstring"       
-       puts $chan $cmdstring
-   }
-   
-   set popRet [string trim [gets $chan]]
-   ::log::log debug "pop3 $chan <<< $popRet"
-
-   if {[string first "+OK" $popRet] == -1} {
-       error [string range $popRet 4 end]
-   }
-
-   return [string range $popRet 3 end]
-}
-
-# ::pop3::status --
-#
-#	Get the status of the mail spool on the POP3 server.
-#
-# Arguments:
-#	chan      The channel, returned by ::pop3::open
-#
-# Results:
-#	A list containing two elements, {msgCount octetSize},
-#       where msgCount is the number of messages in the spool
-#       and octetSize is the size (in octets, or 8 bytes) of
-#       the entire spool.
-
-proc ::pop3::status {chan} {
-
-    if {[catch {set statusStr [::pop3::send $chan "STAT"]} errorStr]} {
-	error "POP3 STAT ERROR: $errorStr"
-    }
-
-    # Dig the sent size and count info out.
-    set rawStatus [split [string trim $statusStr]]
-    
-    return [::list [lindex $rawStatus 0] [lindex $rawStatus 1]]
-}
-
-# ::pop3::top --
-#
-#       Optional POP3 command (see RFC1939). Retrieves message header
-#       and given number of lines from the message body.
-#
-# Arguments:
-#	chan        The channel open to the POP3 server.
-#       msg         The message number to be retrieved.
-#       n           Number of lines returned from the message body.
-#
-# Results:
-#	Text (with newlines) from the server.
-#       Errors from the POP3 server are thrown.
-
-proc ::pop3::top {chan msg n} {
-    global PopErrorNm PopErrorStr debug
-    
-    if {[catch {::pop3::send $chan "TOP $msg $n"} errorStr]} {
-	error "POP3 TOP ERROR: $errorStr"
-    }
-
-    return [RetrSlow $chan]
-}
-
-# ::pop3::uidl --
-#
-#	Returns "uid listing" of the mailbox. If parameter msg
-#	is defined, then the listing only for the given message
-#	is returned.
-#
-# Arguments:
-#	chan        The channel open to the POP3 server.
-#	msg         The message number (optional).
-#
-# Results:
-#	If msg parameter is not given, Tcl list of uid listings in
-#	the maildrop is returned. In case msg parameter is given,
-#	a list of length one containing the uid of the specified
-#	message listing is returned.
-
-proc ::pop3::uidl {chan {msg ""}} {
-    if {$msg == ""} {
-	if {[catch {::pop3::send $chan "UIDL"} errorStr]} {
-	    error "POP3 UIDL ERROR: $errorStr"
-	}
-	set msgBuffer [RetrSlow $chan]
-    } else {
-	# argument msg given, single-line response expected
-	
-	if {[catch {expr {0 + $msg}}]} {
-	    error "POP3 UIDL ERROR: malformed message number '$msg'"
-	} else {
-	    set msgBuffer [string trim [::pop3::send $chan "UIDL $msg"]]
-	}
-    }
-
-    return $msgBuffer
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,16 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded pop3d::udb  1.1   [list source [file join $dir pop3d_udb.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded pop3d       1.1.0 [list source [file join $dir pop3d.tcl]]
-package ifneeded pop3d::dbox 1.0.2 [list source [file join $dir pop3d_dbox.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1147 +1,0 @@
-# pop3d.tcl --
-#
-#	Implementation of a pop3 server for Tcl.
-#
-# Copyright (c) 2002 by Andreas Kupries
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: pop3d.tcl,v 1.22 2006/01/10 23:05:19 andreas_kupries Exp $
-
-package require md5  ; # tcllib | APOP
-package require mime ; # tcllib | storage callback
-package require log  ; # tcllib | tracing
-
-namespace eval ::pop3d {
-    # Data storage in the pop3d module
-    # -------------------------------
-    #
-    # There's a number of bits to keep track of for each server and
-    # connection managed by it.
-    #
-    #   port
-    #	callbacks
-    #	connections
-    #	connection state
-    #   server state
-    #
-    # It would quickly become unwieldy to try to keep these in arrays or lists
-    # within the pop3d namespace itself.  Instead, each pop3 server will
-    # get its own namespace.  Each namespace contains:
-    #
-    # port    - port to listen on
-    # sock    - listening socket
-    # authCmd - authentication callback
-    # storCmd - storage callback
-    # sockCmd - command prefix for openin the server socket
-    # state   - state of the server (up, down, exiting)
-    # conn    - map : sock -> state array
-    # counter - counter for state arrays
-    #
-    # Per connection in a server its own state array 'connXXX'.
-    #
-    # id         - unique id for the connection (APOP)
-    # state      - state of connection       (auth, trans, update, fail)
-    # name       - user for that connection
-    # storage    - storage ref for that user
-    # logon      - authentication method     (empty, apop, user)
-    # deleted    - list of deleted messages
-    # msg        - number of messages in storage
-    # remotehost - name of remote host for connection
-    # remoteport - remote port for connection
-
-    # counter is used to give a unique name for unnamed server
-    variable counter 0
-
-    # commands is the list of subcommands recognized by the server
-    variable commands [list	\
-	    "cget"		\
-	    "configure"		\
-	    "destroy"		\
-	    "down"		\
-	    "up"		\
-	    ]
-
-    variable version ; set version 1.1.0
-    variable server  "tcllib/pop3d-$version"
-
-    variable cmdMap ; array set cmdMap {
-	CAPA H_capa
-	USER H_user
-	PASS H_pass
-	APOP H_apop
-	STAT H_stat
-	DELE H_dele
-	RETR H_retr
-	TOP  H_top
-	QUIT H_quit
-	NOOP H_noop
-	RSET H_rset
-	LIST H_list
-    }
-
-    # Capabilities to be reported by the CAPA command. The list
-    # contains pairs of capability strings and the connection state in
-    # which they are reported. The state can be "auth", "trans", or
-    # "both".
-    variable capabilities \
-	[list \
-	     USER			both \
-	     PIPELINING			both \
-	     "IMPLEMENTATION $server"	trans \
-	    ]
-    
-    # -- UIDL -- not implemented --
-
-    # Only export one command, the one used to instantiate a new server
-    namespace export new
-}
-
-# ::pop3d::new --
-#
-#	Create a new pop3 server with a given name; if no name is given, use
-#	pop3dX, where X is a number.
-#
-# Arguments:
-#	name	name of the pop3 server; if null, generate one.
-#
-# Results:
-#	name	name of the pop3 server created
-
-proc ::pop3d::new {{name ""}} {
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "pop3d${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-	return -code error "command \"$name\" already exists, unable to create pop3 server"
-    }
-
-    # Set up the namespace
-    namespace eval ::pop3d::pop3d::$name {
-	variable port     110
-	variable trueport 110
-	variable sock     {}
-	variable sockCmd  socket
-	variable authCmd  {}
-	variable storCmd  {}
-	variable state    down
-	variable conn     ; array set conn {}
-	variable counter  0
-    }
-
-    # Create the command to manipulate the pop3 server
-    interp alias {} ::$name {} ::pop3d::Pop3dProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::pop3d::Pop3dProc --
-#
-#	Command that processes all pop3 server object commands.
-#
-# Arguments:
-#	name	name of the pop3 server object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::pop3d::Pop3dProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    if { [llength [info commands ::pop3d::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    eval [list ::pop3d::_$cmd $name] $args
-}
-
-# ::pop3d::_up --
-#
-#	Start listening on the configured port.
-#
-# Arguments:
-#	name	name of the pop3 server.
-#
-# Results:
-#	None.
-
-proc ::pop3d::_up {name} {
-    upvar ::pop3d::pop3d::${name}::port     port
-    upvar ::pop3d::pop3d::${name}::trueport trueport
-    upvar ::pop3d::pop3d::${name}::state    state
-    upvar ::pop3d::pop3d::${name}::sockCmd  sockCmd
-    upvar ::pop3d::pop3d::${name}::sock     sock
-
-    log::log debug "pop3d $name up"
-    if {[string equal $state up]} {return}
-
-    log::log debug "pop3d $name listening, requested port $port"
-
-    set cmd $sockCmd
-    lappend cmd -server [list ::pop3d::HandleNewConnection $name] $port
-    #puts $cmd
-    set s [eval $cmd]
-    set trueport [lindex [fconfigure $s -sockname] 2]
-
-    ::log::log debug "pop3d $name listening on $trueport, socket $s ([fconfigure $s -sockname])"
-
-    set state up
-    set sock  $s
-    return
-}
-
-# ::pop3d::_down --
-#
-#	Stop listening on the configured port.
-#
-# Arguments:
-#	name	name of the pop3 server.
-#
-# Results:
-#	None.
-
-proc ::pop3d::_down {name} {
-    upvar ::pop3d::pop3d::${name}::state    state
-    upvar ::pop3d::pop3d::${name}::sock     sock
-    upvar ::pop3d::pop3d::${name}::trueport trueport
-    upvar ::pop3d::pop3d::${name}::port     port
-
-    # Ignore if server is down or exiting
-    if {![string equal $state up]} {return}
-
-    close $sock
-    set state down
-    set sock  {}
-
-    set trueport $port
-    return
-}
-
-# ::pop3d::_destroy --
-#
-#	Destroy a pop3 server.
-#
-# Arguments:
-#	name	name of the pop3 server.
-#	mode	destruction mode
-#
-# Results:
-#	None.
-
-proc ::pop3d::_destroy {name {mode kill}} {
-    upvar ::pop3d::pop3d::${name}::conn  conn
-
-    switch -exact -- $mode {
-	kill {
-	    _down $name
-	    foreach c [array names conn] {
-		CloseConnection $name $c
-	    }
-
-	    namespace delete ::pop3d::pop3d::$name
-	    interp alias {} ::$name {}
-	}
-	defer {
-	    if {[array size conn] > 0} {
-		upvar ::pop3d::pop3d::${name}::state state
-
-		_down $name
-		set state exiting
-		return
-	    }
-	    _destroy $name kill
-	    return
-	}
-	default {
-	    return -code error \
-		    "Illegal destruction mode \"$mode\":\
-		    Expected \"kill\", or \"defer\""
-	}
-    }
-    return
-}
-
-# ::pop3d::_cget --
-#
-#	Query option value
-#
-# Arguments:
-#	name	name of the pop3 server.
-#
-# Results:
-#	None.
-
-proc ::pop3d::_cget {name anoption} {
-    switch -exact -- $anoption {
-	-state {
-	    upvar ::pop3d::pop3d::${name}::state state
-	    return $state
-	}
-	-port {
-	    upvar ::pop3d::pop3d::${name}::trueport trueport
-	    return $trueport
-	}
-	-auth {
-	    upvar ::pop3d::pop3d::${name}::authCmd authCmd
-	    return $authCmd
-	}
-	-storage {
-	    upvar ::pop3d::pop3d::${name}::storCmd storCmd
-	    return $storCmd
-	}
-	-socket {
-	    upvar ::pop3d::pop3d::${name}::sockCmd sockCmd
-	    return $sockCmd
-	}
-	default {
-	    return -code error \
-		    "Unknown option \"$anoption\":\
-		    Expected \"-state\", \"-port\", \"-auth\", \"-socket\", or \"-storage\""
-	}
-    }
-    # return - in all branches
-}
-
-# ::pop3d::_configure --
-#
-#	Query and set option values
-#
-# Arguments:
-#	name	name of the pop3 server.
-#	args	options and option values
-#
-# Results:
-#	None.
-
-proc ::pop3d::_configure {name args} {
-    set argc [llength $args]
-    if {($argc > 1) && (($argc % 2) == 1)} {
-	return -code error \
-		"wrong # args, expected: -option | (-option value)..."
-    }
-    if {$argc == 1} {
-	return [_cget $name [lindex $args 0]]
-    }
-
-    upvar ::pop3d::pop3d::${name}::trueport trueport
-    upvar ::pop3d::pop3d::${name}::port     port
-    upvar ::pop3d::pop3d::${name}::authCmd  authCmd
-    upvar ::pop3d::pop3d::${name}::storCmd  storCmd
-    upvar ::pop3d::pop3d::${name}::sockCmd  sockCmd
-    upvar ::pop3d::pop3d::${name}::state    state
-
-    if {$argc == 0} {
-	# Return the full configuration.
-	return [list \
-		-port    $trueport \
-		-auth    $authCmd  \
-		-storage $storCmd  \
-		-socket  $sockCmd \
-		-state   $state \
-		]
-    }
-
-    while {[llength $args] > 0} {
-	set option [lindex $args 0]
-	set value  [lindex $args 1]
-	switch -exact -- $option {
-	    -auth    {set authCmd $value}
-	    -storage {set storCmd $value}
-	    -socket  {set sockCmd $value}
-	    -port    {
-		set port $value
-
-		# Propagate to the queried value if the server is down
-		# and thus has no real true port.
-
-		if {[string equal $state down]} {
-		    set trueport $value
-		}
-	    }
-	    -state {
-		return -code error "Option -state is read-only"
-	    }
-	    default {
-		return -code error \
-			"Unknown option \"$option\":\
-			Expected \"-port\", \"-auth\", \"-socket\", or \"-storage\""
-	    }
-	}
-	set args [lrange $args 2 end]
-    }
-    return ""
-}
-
-
-# ::pop3d::_conn --
-#
-#	Query connection state.
-#
-# Arguments:
-#	name	name of the pop3 server.
-#	cmd	subcommand to perform
-#	args	arguments for subcommand
-#
-# Results:
-#	Specific to subcommand
-
-proc ::pop3d::_conn {name cmd args} {
-    upvar ::pop3d::pop3d::${name}::conn    conn
-    switch -exact -- $cmd {
-	list {
-	    if {[llength $args] > 0} {
-		return -code error "wrong # args: should be \"$name conn list\""
-	    }
-	    return [array names conn]
-	}
-	state {
-	    if {[llength $args] != 1} {
-		return -code error "wrong # args: should be \"$name conn state connId\""
-	    }
-	    set sock [lindex $args 0]
-	    upvar $conn($sock) cstate
-	    return [array get  cstate]
-	}
-	default {
-	    return -code error "bad option \"$cmd\": must be list, or state"
-	}
-    }
-}
-
-##########################
-##########################
-# Server implementation.
-
-proc ::pop3d::HandleNewConnection {name sock rHost rPort} {
-    upvar ::pop3d::pop3d::${name}::conn    conn
-    upvar ::pop3d::pop3d::${name}::counter counter
-
-    set csa ::pop3d::pop3d::${name}::conn[incr counter]
-    set conn($sock) $csa
-    upvar $csa cstate
-
-    set cstate(remotehost) $rHost
-    set cstate(remoteport) $rPort
-    set cstate(server)     $name
-    set cstate(id)         "<[string map {- {}} [clock clicks]]_${name}_[pid]@[::info hostname]>"
-    set cstate(state)      "auth"
-    set cstate(name)       ""
-    set cstate(logon)      ""
-    set cstate(storage)    ""
-    set cstate(deleted)    ""
-    set cstate(msg)        0
-    set cstate(size)       0
-
-    ::log::log notice "pop3d $name $sock state auth, waiting for logon"
-
-    fconfigure $sock -buffering line -translation crlf -blocking 0
-
-    if {[catch {::pop3d::GreetPeer $name $sock} errmsg]} {
-	close $sock
-	log::log error "pop3d $name $sock greeting $errmsg"
-	unset cstate
-	unset conn($sock)
-	return
-    }
-
-    fileevent $sock readable [list ::pop3d::HandleCommand $name $sock]
-    return
-}
-
-proc ::pop3d::CloseConnection {name sock} {
-    upvar ::pop3d::pop3d::${name}::storCmd storCmd
-    upvar ::pop3d::pop3d::${name}::state   state
-    upvar ::pop3d::pop3d::${name}::conn    conn
-
-    upvar $conn($sock) cstate
-
-    # Kill a pending idle event for CloseConnection, we are closing now.
-    catch {after cancel $cstate(idlepending)}
-
-    ::log::log debug "pop3d $name $sock closing connection"
-
-    if {[catch {close $sock} msg]} {
-	::log::log error "pop3d $name $sock close: $msg"
-    }
-    if {$storCmd != {}} {
-	# remove possible lock set in storage facility.
-	if {[catch {
-	    uplevel #0 [linsert $storCmd end unlock $cstate(storage)]
-	} msg]} {
-	    ::log::log error "pop3d $name $sock storage unlock: $msg"
-	    # -W- future ? kill all connections, execute clean up of storage
-	    # -W-          facility.
-	}
-    }
-
-    unset cstate
-    unset conn($sock)
-
-    ::log::log notice "pop3d $name $sock closed"
-
-    if {[string equal $state existing] && ([array size conn] == 0)} {
-	_destroy $name
-    }
-    return
-}
-
-proc ::pop3d::HandleCommand {name sock} {
-    # @c Called by the event system after arrival of a new command for
-    # @c connection.
-
-    # @a sock:   Direct access to the channel representing the connection.
-    
-    # Client closed connection, bye bye
-    if {[eof $sock]} {
-	CloseConnection $name $sock
-	return
-    }
-
-    # line was incomplete, wait for more
-    if {[gets $sock line] < 0} {
-	return
-    }
-
-    upvar ::pop3d::pop3d::${name}::conn    conn
-    upvar $conn($sock)                   cstate
-    variable                             cmdMap
-
-    ::log::log info "pop3d $name $sock < $line"
-
-    set fail [catch {
-	set cmd [string toupper [lindex $line 0]]
-
-	if {![::info exists cmdMap($cmd)]} {
-	    # unknown command, use unknown handler
-
-	    HandleUnknownCmd $name $sock $cmd $line
-	} else {
-	    $cmdMap($cmd) $name $sock $cmd $line
-	}
-    } errmsg] ;#{}
-
-    if {$fail} {
-	# Had an error during handling of 'cmd'.
-	# Handled by closing the connection.
-	# (We do not know how to relay the internal error to the client)
-
-	::log::log error "pop3d $name $sock $cmd: $errmsg"
-	CloseConnection $name $sock
-    }
-    return
-}
-
-proc ::pop3d::GreetPeer {name sock} {
-    # @c Called after the initialization of a new connection. Writes the
-    # @c greeting to the new client. Overides the baseclass definition
-    # @c (<m server:GreetPeer>).
-    #
-    # @a conn: Descriptor of connection to write to.
-
-    upvar cstate cstate
-    variable server
-
-    log::log debug "pop3d $name $sock _ Greeting"
-
-    Respond2Client $name $sock +OK \
-	    "[::info hostname] $server ready $cstate(id)"
-    return
-}
-
-proc ::pop3d::HandleUnknownCmd {name sock cmd line} {
-    Respond2Client $name $sock -ERR "unknown command '$cmd'"
-    return
-}
-
-proc ::pop3d::Respond2Client {name sock ok wtext} {
-    ::log::log info "pop3d $name $sock > $ok $wtext"
-    puts $sock                          "$ok $wtext"
-    return
-}
-
-##########################
-##########################
-# Command implementations.
-
-proc ::pop3d::H_capa {name sock cmd line} {
-    # @c Handle CAPA command.
-
-    # Capabilities should better be configurable and handled per
-    # server object, so that e.g. USER/PASS authentication can be
-    # turned off.
-
-    upvar cstate cstate
-    variable capabilities
-
-    Respond2Client $name $sock +OK "Capability list follows"
-    foreach {capability state} $capabilities {
-	if {
-	    [string equal $state "both"] ||
-	    [string equal $state $cstate(state)]
-	} {
-	    puts $sock $capability
-	}
-    }
-    puts $sock .
-    return
-}
-
-proc ::pop3d::H_user {name sock cmd line} {
-    # @c Handle USER command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(logon) apop]} {
-	Respond2Client $name $sock -ERR "login mechanism APOP was chosen"
-    } elseif {[string equal $cstate(state) trans]} {
-	Respond2Client $name $sock -ERR "client already authenticated"
-    } else {
-	# The user name is the first argument to the command
-
-	set cstate(name)  [lindex [split $line] 1]
-	set cstate(logon) user
-
-	Respond2Client $name $sock +OK "please send PASS command"
-    }
-    return
-}
-
-
-proc ::pop3d::H_pass {name sock cmd line} {
-    # @c Handle PASS command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(logon) apop]} {
-	Respond2Client $name $sock -ERR "login mechanism APOP was chosen"
-    } elseif {[string equal $cstate(state) trans]} {
-	Respond2Client $name $sock -ERR "client already authenticated"
-    } else {
-	upvar ::pop3d::pop3d::${name}::authCmd authCmd
-
-	if {$authCmd == {}} {
-	    # No authentication is possible. Reject all users.
-	    CheckLogin $name $sock "" "" ""
-	    return
-	}
-
-	# The password is given as the first argument of the command
-
-	set pwd [lindex [split $line] 1]
-
-	if {![uplevel #0 [linsert $authCmd end exists $cstate(name)]]} {
-	    ::log::log warning "pop3d $name $sock $authCmd lookup $cstate(name) : user does not exist"
-	    CheckLogin $name $sock "" "" ""
-	    return
-	}
-	if {[catch {
-	    set info [uplevel #0 [linsert $authCmd end lookup $cstate(name)]]
-	} msg]} {
-	    ::log::log error "pop3d $name $sock $authCmd lookup $cstate(name) : $msg"
-	    CheckLogin $name $sock "" "" ""
-	    return
-	}
-	CheckLogin $name $sock $pwd [lindex $info 0] [lindex $info 1]
-    }
-    return
-}
-
-
-proc ::pop3d::H_apop {name sock cmd line} {
-    # @c Handle APOP command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(logon) user]} {
-	Respond2Client $name $sock -ERR "login mechanism USER/PASS was chosen"
-	return
-    } elseif {[string equal $cstate(state) trans]} {
-	Respond2Client $name $sock -ERR "client already authenticated"
-	return
-    }
-
-    # The first two arguments to the command are user name and its
-    # response to the challenge set by the server.
-
-    set cstate(name)  [lindex $line 1]
-    set cstate(logon) apop
-
-    upvar ::pop3d::pop3d::${name}::authCmd authCmd
-
-    #log::log debug "authCmd|$authCmd|"
-
-    if {$authCmd == {}} {
-	# No authentication is possible. Reject all users.
-	CheckLogin $name $sock "" "" ""
-	return
-    }
-
-    set digest  [lindex $line 2]
-
-    if {![uplevel #0 [linsert $authCmd end exists $cstate(name)]]} {
-	::log::log warning "pop3d $name $sock $authCmd lookup $cstate(name) : user does not exist"
-	CheckLogin $name $sock "" "" ""
-	return
-    }
-    if {[catch {
-	set info [uplevel #0 [linsert $authCmd end lookup $cstate(name)]]
-    } msg]} {
-	::log::log error "pop3d $name $sock $authCmd lookup $cstate(name) : $msg"
-	CheckLogin $name $sock "" "" ""
-	return
-    }
-
-    set pwd     [lindex $info 0]
-    set storage [lindex $info 1]
-
-    ::log::log debug "pop3d $name $sock info = <$info>"
-
-    if {$storage == {}} {
-	# user does not exist, skip over digest computation
-	CheckLogin $name $sock "" "" $storage
-	return
-    }
-
-    # Do the same algorithm as the client to generate a digest, then
-    # compare our data with information sent by the client. As we are
-    # using tcl 8.x there is need to use channels, an immediate
-    # computation is possible.
-
-    set ourDigest [Md5 "$cstate(id)$pwd"]
-
-    ::log::log debug "pop3d $name $sock digest input <$cstate(id)$pwd>"
-    ::log::log debug "pop3d $name $sock digest outpt <$ourDigest>"
-    ::log::log debug "pop3d $name $sock digest given <$digest>"
-
-    CheckLogin $name $sock $digest $ourDigest $storage
-    return
-}
-
-
-proc ::pop3d::H_stat {name sock cmd line} {
-    # @c Handle STAT command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-    } else {
-	# Return number of messages waiting and size of the contents
-	# of the chosen maildrop in octects.
-	Respond2Client $name $sock +OK  "$cstate(msg) $cstate(size)"
-    }
-
-    return
-}
-
-
-proc ::pop3d::H_dele {name sock cmd line} {
-    # @c Handle DELE command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-	return
-    }
-
-    set msgid [lindex $line 1]
-
-    if {
-	($msgid < 1) ||
-	($msgid > $cstate(msg)) ||
-	([lsearch $msgid $cstate(deleted)] >= 0)
-    } {
-	Respond2Client $name $sock -ERR "no such message"
-    } else {
-	lappend cstate(deleted) $msgid
-	Respond2Client $name $sock +OK "message $msgid deleted"
-    }
-    return
-}
-
-
-proc ::pop3d::H_retr {name sock cmd line} {
-    # @c Handle RETR command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-	return
-    }
-
-    set msgid [lindex $line 1]
-
-    if {
-	($msgid > $cstate(msg)) ||
-	([lsearch $msgid $cstate(deleted)] >= 0)
-    } {
-	Respond2Client $name $sock -ERR "no such message"
-    } else {
-	Transfer $name $sock $msgid
-    }
-    return
-}
-
-
-proc ::pop3d::H_top  {name sock cmd line} {
-    # @c Handle RETR command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-	return
-    }
-
-    set msgid  [lindex $line 1]
-    set nlines [lindex $line 2]
-
-    if {
-	($msgid > $cstate(msg)) ||
-	([lsearch $msgid $cstate(deleted)] >= 0)
-    } {
-	Respond2Client $name $sock -ERR "no such message"
-    } elseif {$nlines == {}} {
-	Respond2Client $name $sock -ERR "missing argument: #lines to read"
-    } elseif {$nlines < 0} {
-	Respond2Client $name $sock -ERR \
-		"number of lines has to be greater than or equal to zero."
-    } elseif {$nlines == 0} {
-	# nlines == 0, no limit, same as H_retr
-	Transfer $name $sock $msgid
-    } else {
-	# nlines > 0
-	Transfer $name $sock $msgid $nlines
-    }
-    return
-}
-
-
-proc ::pop3d::H_quit {name sock cmd line} {
-    # @c Handle QUIT command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-    variable server
-
-    set cstate(state) update
-
-    if {$cstate(deleted) != {}} {
-	upvar ::pop3d::pop3d::${name}::storCmd storCmd
-	if {$storCmd != {}} {
-	    uplevel #0 [linsert $storCmd end \
-		    dele $cstate(storage) $cstate(deleted)]
-	}
-    }
-
-    set cstate(idlepending) [after idle [list ::pop3d::CloseConnection $name $sock]]
-
-    Respond2Client $name $sock +OK \
-	    "[::info hostname] $server shutting down"
-    return
-}
-
-
-proc ::pop3d::H_noop {name sock cmd line} {
-    # @c Handle NOOP command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) fail]} {
-	Respond2Client $name $sock -ERR "login failed, no actions possible"
-    } elseif {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-    } else {
-	Respond2Client $name $sock +OK ""
-    }
-    return
-}
-
-
-proc ::pop3d::H_rset {name sock cmd line} {
-    # @c Handle RSET command.
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) fail]} {
-	Respond2Client $name $sock -ERR "login failed, no actions possible"
-    } elseif {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-    } else {
-	set cstate(deleted) ""
-
-	Respond2Client $name $sock +OK "$cstate(msg) messages waiting"
-    }
-    return
-}
-
-
-proc ::pop3d::H_list {name sock cmd line} {
-    # @c Handle LIST command. Generates scan listing
-    #
-    # @a conn: Descriptor of connection to write to.
-    # @a cmd:  The sent command
-    # @a line: The sent line, with <a cmd> as first word.
-
-    # Called only in places where cstate is known!
-    upvar cstate cstate
-
-    if {[string equal $cstate(state) fail]} {
-	Respond2Client $name $sock -ERR "login failed, no actions possible"
-	return
-    } elseif {[string equal $cstate(state) auth]} {
-	Respond2Client $name $sock -ERR "client not authenticated"
-	return
-    }
-
-    set msgid [lindex $line 1]
-
-    upvar ::pop3d::pop3d::${name}::storCmd storCmd
-
-    if {$msgid == {}} {
-	# full listing
-	Respond2Client $name $sock +OK "$cstate(msg) messages"
-
-	set n $cstate(msg)
-
-	for {set i 1} {$i <= $n} {incr i} {
-	    Respond2Client $name $sock $i \
-		    [uplevel #0 [linsert $storCmd end \
-		    size $cstate(storage) $i]]
-	}
-	puts $sock "."
-
-    } else {
-	# listing for specified message
-
-	if {
-	    ($msgid < 1) ||
-	    ($msgid > $cstate(msg)) ||
-	    ([lsearch $msgid $cstate(deleted)] >= 0)
-	}  {
-	    Respond2Client $name $sock -ERR "no such message"
-	    return
-	}
-
-	Respond2Client $name $sock +OK \
-		"$msgid [uplevel #0 [linsert $storCmd end \
-		size $cstate(storage) $msgid]]"
-	return
-    }
-}
-
-##########################
-##########################
-# Command helper commands.
-
-proc ::pop3d::CheckLogin {name sock clientid serverid storage} {
-    # @c Internal procedure. General code used by USER/PASS and
-    # @c APOP login mechanisms to verify the given user-id.
-    # @c Locks the mailbox in case of a match.
-    #
-    # @a conn:     Descriptor of connection to write to.
-    # @a clientid: Authentication code transmitted by client
-    # @a serverid: Authentication code calculated here.
-    # @a storage:  Handle of mailbox requested by client.
-
-    #log::log debug "CheckLogin|$name|$sock|$clientid|$serverid|$storage|"
-
-    upvar cstate cstate
-    upvar ::pop3d::pop3d::${name}::storCmd storCmd
-
-    set noStorage [expr {$storCmd == {}}]
-
-    if {$storage == {}} {
-	# The user given by the client has no storage, therefore it does
-	# not exist. React as if wrong password was given.
-
-	set cstate(state) auth
-	set cstate(logon) ""
-
-	::log::log notice "pop3d $name $sock state auth, no maildrop"
-	Respond2Client $name $sock -ERR "authentication failed, sorry"
-
-    } elseif {[string compare $clientid $serverid] != 0} {
-	# password/digest given by client dos not match
-
-	set cstate(state) auth
-	set cstate(logon) ""
-
-	::log::log notice "pop3d $name $sock state auth, secret does not match"
-	Respond2Client $name $sock -ERR "authentication failed, sorry"
-
-    } elseif {
-	!$noStorage &&
-	! [uplevel #0 [linsert $storCmd end lock $storage]]
-    } {
-	# maildrop is locked already (by someone else).
-
-	set cstate(state) auth
-	set cstate(logon) ""
-
-	::log::log notice "pop3d $name $sock state auth, maildrop already locked"
-	Respond2Client $name $sock -ERR \
-		"could not aquire lock for maildrop $cstate(name)"
-    } else {
-	# everything went fine. allow to proceed in session.
-
-	set cstate(storage) $storage
-	set cstate(state)   trans
-	set cstate(logon)   ""
-
-	set cstate(msg) 0
-	if {!$noStorage} {
-	    set cstate(msg) [uplevel #0 [linsert $storCmd end \
-		    stat $cstate(storage)]]
-	    set cstate(size) [uplevel #0 [linsert $storCmd end \
-		    size $cstate(storage)]]
-	}
-	
-	::log::log notice \
-		"pop3d $name $sock login $cstate(name) $storage $cstate(msg)"
-	::log::log notice "pop3d $name $sock state trans"
-
-	Respond2Client $name $sock +OK "congratulations"
-    }
-    return
-}
-
-proc ::pop3d::Transfer {name sock msgid {limit -1}} {
-    # We ask the storage for the mime token of the mail and use
-    # that to generate and copy the mail to the requestor.
-
-    upvar cstate cstate
-    upvar ::pop3d::pop3d::${name}::storCmd storCmd
-
-    if {$limit < 0} {
-	Respond2Client $name $sock +OK \
-		"[uplevel #0 [linsert $storCmd end \
-		size $cstate(storage) $msgid]] octets"
-    } else {
-	Respond2Client $name $sock +OK ""
-    }
-
-    set token [uplevel #0 [linsert $storCmd end get $cstate(storage) $msgid]]
-    
-    ::log::log debug "pop3d $name $sock transfering data ($token)"
-
-    if {$limit < 0} {
-	# Full transfer, we can use "copymessage" and avoid
-	# construction in memory (depending on source of token).
-
-	log::log debug "pop3d $name Transfer $msgid /full"
-
-	# We do "."-stuffing here. This is not in the scope of the
-	# MIME library we use, but a transport dependent thing.
-
-	set msg [string trimright [string map [list "\n." "\n.."] \
-				       [mime::buildmessage $token]] \n]
-	log::log debug "($msg)"
-	puts $sock $msg
-	puts $sock .
-
-    } else {
-	# As long as FR #531541 is not implemented we have to build
-	# the entire message in memory and then cut it down to the
-	# requested size. If limit was greater than the number of
-	# lines in the message we will get the terminating "."
-	# too. Using regsub we make sure that it is not present and
-	# reattach during the transfer. Otherwise we would have to use
-	# a regexp/if combo to decide wether to attach the terminator
-	# not.
-
-	set msg [split [mime::buildmessage $token] \n]
-	set i 0
-	incr limit -1
-	while {[lindex $msg $i] != {}} {
-	    incr i
-	    incr limit
-	}
-	# i now refers to the line separating header and body
-
-	regsub -- "\n\\.\n$" [string map [list "\n." "\n.."] [join [lrange $msg 0 $limit] \n]] {} data
-	puts $sock ${data}\n.
-    }
-    ::log::log debug "pop3d $name $sock transfer complete"
-    # response already sent.
-    return
-}
-
-set major [lindex [split [package require md5] .] 0]
-if {$::major < 2} {
-    proc ::pop3d::Md5 {text} {md5::md5 $text}
-} else {
-    proc ::pop3d::Md5 {text} {string tolower [md5::md5 -hex $text]}
-}
-unset major
-
-##########################
-# Module initialization
-
-package provide pop3d $::pop3d::version
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d_dbox.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d_dbox.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,489 +1,0 @@
-# -*- tcl -*-
-# pop3d_dbox.tcl --
-#
-#	Implementation of a simple mailbox database for the pop3 server
-#       Each mailbox is a a directory in a base directory, with each mail
-#	a file in that directory. The mail file contains both headers and
-#	body of the mail.
-#
-# Copyright (c) 2002 by Andreas Kupries
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: pop3d_dbox.tcl,v 1.12 2005/09/28 04:51:23 andreas_kupries Exp $
-
-package require mime ; # tcllib | mime token is result of "get".
-package require log  ; # tcllib | Logging package
-
-namespace eval ::pop3d::dbox {
-    # Data storage in the pop3d::dbox module
-    # -------------------------------------
-    # One array per object containing the db contents. Keyed by user name.
-    # And the information about the last file data was read from.
-
-    # counter is used to give a unique name for unnamed databases
-    variable counter 0
-
-    # commands is the list of subcommands recognized by the server
-    variable commands [list	\
-	    "add"	\
-	    "base"	\
-	    "dele"	\
-	    "destroy"   \
-	    "exists"	\
-	    "get"	\
-	    "list"	\
-	    "lock"	\
-	    "locked"	\
-	    "move"	\
-	    "remove"	\
-	    "size"	\
-	    "stat"	\
-	    "unlock"	\
-	    ]
-
-    variable version ; set version 1.0.2
-}
-
-
-# ::pop3d::dbox::new --
-#
-#	Create a new mailbox database with a given name;
-#	if no name is given, use
-#	p3dboxX, where X is a number.
-#
-# Arguments:
-#	name	name of the mailbox database; if null, generate one.
-#
-# Results:
-#	name	name of the mailbox database created
-
-proc ::pop3d::dbox::new {{name ""}} {
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "p3dbox${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-	return -code error \
-		"command \"$name\" already exists,\
-		unable to create mailbox database"
-    }
-
-    # Set up the namespace
-    namespace eval ::pop3d::dbox::dbox::$name {
-	variable dir ""
-	variable state    ; array set state  {}
-	variable locked   ; array set locked {}
-	variable transfer ; array set transfer {}
-    }
-
-    # Create the command to manipulate the mailbox database
-    interp alias {} ::$name {} ::pop3d::dbox::DboxProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::pop3d::dbox::DboxProc --
-#
-#	Command that processes all mailbox database object commands.
-#
-# Arguments:
-#	name	name of the mailbox database object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::pop3d::dbox::DboxProc {name {cmd ""} args} {
-
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error \
-		"wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    if { [llength [info commands ::pop3d::dbox::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    eval [list ::pop3d::dbox::_$cmd $name] $args
-}
-
-
-proc ::pop3d::dbox::_base {name base} {
-    # @c Constructor. Does some more checks on the given base directory.
-
-    # sanity checks
-    if {$base == {}} {
-	return -code error "directory not specified"
-    }
-    if {! [file exists      $base]} {
-	return -code error "base: \"$base\" does not exist"
-    }
-    if {! [file isdirectory $base]} {
-	return -code error "base: \"$base\" not a directory"
-    }
-    if {! [file readable    $base]} {
-	return -code error "base: \"$base\" not readable"
-    }
-    if {! [file writable    $base]} {
-	return -code error "base: \"$base\" not writable"
-    }
-
-    upvar ::pop3d::dbox::dbox::${name}::dir dir
-    set dir $base
-    return
-}
-
-
-# ::pop3d::dbox::_destroy --
-#
-#	Destroy a mail database, including its associated command and
-#	data storage.
-#
-# Arguments:
-#	name	Name of the database to destroy.
-#
-# Results:
-#	None.
-
-proc ::pop3d::dbox::_destroy {name} {
-    namespace delete ::pop3d::dbox::dbox::$name
-    interp alias {} ::$name {}
-    return
-}
-
-proc ::pop3d::dbox::_add {name mbox} {
-    # @c Create a mailbox with handle <a mbox>. The handle is used as the
-    # @c name of the directory to contain the mails too.
-    #
-    # @a mbox: Reference to the mailbox to be operated on.
-
-    set dir      [CheckDir $name]
-    set mboxpath [file join $dir $mbox]
-
-    if {[file exists $mboxpath]} {
-	return -code error "cannot add \"$mbox\", mailbox already in existence"
-    }
-
-    file mkdir $mboxpath
-    return
-}
-
-
-proc ::pop3d::dbox::_remove {name mbox} {
-    # @c Remove mailbox with handle <a mbox>. This will destroy all mails
-    # @c contained in it too.
-    #
-    # @a mbox: Reference to the mailbox to be operated on.
-
-    set dir      [CheckDir $name]
-    set mboxpath [file join $dir $mbox]
-
-    if {![file exists $mboxpath]} {
-	return -code error "cannot remove \"$mbox\", mailbox does not exist"
-    }
-
-    if {[_locked $name $mbox]} {
-	return -code error "cannot remove \"$mbox\", mailbox is locked"
-    }
-
-    file delete -force $mboxpath
-    return
-}
-
-
-proc ::pop3d::dbox::_move {name old new} {
-    # @c Change the handle of mailbox <a old> to <a new>.
-    #
-    # @a old: Reference to the mailbox to be operated on.
-    # @a new: New reference to the mailbox
-
-    set dir     [CheckDir $name]
-    set oldpath [file join $dir $old]
-    set newpath [file join $dir $new]
-
-    if {![file exists $oldpath]} {
-	return -code error "cannot move \"$old\", mailbox does not exist"
-    }
-    if {[file exists $newpath]} {
-	return -code error \
-		"cannot move \"$old\", destination \"$new\" already exists"
-    }
-
-    file rename -force $oldpath $newpath
-    return
-}
-
-
-proc ::pop3d::dbox::_list {name} {
-    # @c Lists known mailboxes in object.
-    # @r List of mailbox names.
-
-    set dir  [CheckDir $name]
-    set here [pwd]
-    cd $dir
-    set files [glob -nocomplain *]
-    cd $here
-
-    set res [list]
-    foreach f $files {
-	set mboxpath [file join $dir $f]
-	if {! [file isdirectory $mboxpath]} {continue}
-	if {! [file readable    $mboxpath]} {continue}
-	if {! [file writable    $mboxpath]} {continue}
-	lappend res $f
-    }
-    return $res
-}
-
-
-proc ::pop3d::dbox::_exists {name mbox} {
-    # @c Determines existence of mailbox <a mbox>.
-    # @a mbox: Reference to the mailbox to check for.
-    # @r 1 if the mailbox exists, 0 else.
-
-    set dir  [CheckDir $name]
-    set mbox [file join $dir $mbox]
-    return   [file exists    $mbox]
-}
-
-
-proc ::pop3d::dbox::_locked {name mbox} {
-    # @c Checks wether the specified mailbox is locked or not.
-    # @a mbox: Reference to the mailbox to check.
-    # @r 1 if the mailbox is locked, 0 else.
-
-    set     dir  [CheckDir $name]
-    set     mbox [file join $dir $mbox]
-
-    upvar ::pop3d::dbox::dbox::${name}::locked locked
-
-    return [::info exists locked($mbox)]
-}
-
-
-# -- interface to the pop server (storage callback) --
-
-proc ::pop3d::dbox::_lock {name mbox} {
-    # @c Locks the given mailbox, additionally stores a list of the
-    # @c available files in the manager state. All files (= messages)
-    # @c added to the mailbox after this operation will be ignored
-    # @c during the session.
-    #
-    # @a mbox: Reference to the mailbox to be locked.
-    # @r 1 if mailbox was locked sucessfully, 0 else.
-
-    # locked already ?
-    if {[_locked $name $mbox]} {
-	return 0
-    }
-
-    set dir [Check $name $mbox]
-
-    # Compute a list of message files residing in the mailbox directory
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-    upvar ::pop3d::dbox::dbox::${name}::locked locked
-
-    set  state($dir)  [lsort [glob -nocomplain [file join $dir *]]]
-    set locked($dir) 1
-    return 1
-}
-
-
-proc ::pop3d::dbox::_unlock {name mbox} {
-    # @c A locked mailbox is unlocked, thereby made available
-    # @c to other sessions.
-    #
-    # @a mbox: Reference to the mailbox to be locked.
-
-    # not locked ?
-    if {![_locked $name $mbox]} {return}
-    set dir [Check $name $mbox]
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-    upvar ::pop3d::dbox::dbox::${name}::locked locked
-
-    unset   state($dir)
-    unset  locked($dir)
-    return
-}
-
-
-proc ::pop3d::dbox::_stat {name mbox} {
-    # @c Determines the number of messages picked up by <m lock>.
-    # @c Will fail if the mailbox was not locked.
-    #
-    # @a mbox: Reference to the mailbox queried.
-    # @r The number of messages in the mailbox
-
-    set dir [Check $name $mbox]
-
-    if {![_locked $name $mbox]} {
-	return -code error "mailbox \"$mbox\" is not locked"
-    }
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-
-    return  [llength $state($dir)]
-}
-
-
-proc ::pop3d::dbox::_size {name mbox {msgId {}}} {
-    # @c Determines the size of the specified message, in bytes.
-    #
-    # @a mbox: Reference to the mailbox to be operated on.
-    # @a msgId: Numerical index of the message to look at.
-    # @r size of the message in bytes.
-
-    log::log debug "$name size $mbox ($msgId)"
-
-    set dir [Check $name $mbox]
-
-    log::log debug "$name mbox dir = $dir"
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-
-    if {$msgId == {}} {
-	log::log debug "$name size /full"
-
-	# Full size of the maildrop requested.
-	if {![info exists state($dir)]} {
-	    # No stat before size, assume that there are no messages
-	    # in the maildrop, which implies that the maildrop is
-	    # empty, i.e. of size 0.
-	    return 0
-	}
-
-	set n 0
-	set k [llength $state($dir)]
-	for {set id 0} {$id < $k} {incr id} {
-	    incr n [file size [lindex $state($dir) $id]]
-	}
-	return $n
-    }
-
-    if {
-	($msgId < 1) ||
-	(![info exists state($dir)]) ||
-	([llength $state($dir)] < $msgId)
-    } {
-	return -code error "id \"$msgId\" out of range"
-    }
-    incr msgId -1
-
-    ## log::log debug "$name msg mails = $state($dir)"
-    log::log debug "$name msg file = [lindex $state($dir) $msgId]"
-
-    return [file size [lindex $state($dir) $msgId]]
-}
-
-
-proc ::pop3d::dbox::_dele {name mbox msgList} {
-    # @c Deletes the specified messages from the mailbox. This should
-    # @c be followed by a <m unlock> as the state is not updated
-    # @c accordingly.
-    #
-    # @a mbox: Reference to the mailbox to be operated on.
-    # @a msgList: List of message ids.
-
-    set dir [Check $name $mbox]
-    if {[llength $msgList] == 0} {
-	return -code error "nothing to delete"
-    }
-
-    # @d The code assumes that the id's in the list were already
-    # @d checked against the maximal number of messages.
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-
-    foreach msgId $msgList {
-	if {
-	    ($msgId < 1) ||
-	    (![info exists state($dir)]) ||
-	    ([llength $state($dir)] < $msgId)
-	} {
-	    return -code error "id \"$msgId\" out of range"
-	}
-    }
-    foreach msgId $msgList {
-	file delete [lindex $state($dir) [incr msgId -1]]
-    }
-
-    # the mailbox state is unusable now.
-    return
-}
-
-proc ::pop3d::dbox::_get {name mbox msgId} {
-    set dir [Check $name $mbox]
-
-    upvar ::pop3d::dbox::dbox::${name}::state  state
-
-    if {
-	($msgId < 1) ||
-	(![info exists state($dir)]) ||
-	([llength $state($dir)] < $msgId)
-    } {
-	return -code error "id \"$msgId\" out of range"
-    }
-    incr msgId -1
-
-    set mailfile [lindex $state($dir) $msgId]
-
-    set token [::mime::initialize -file $mailfile]
-    return $token
-}
-
-###########################
-###########################
-# Internal helper commands.
-
-proc ::pop3d::dbox::Check {name mbox} {
-    # @c Internal procedure. Used to map a mailbox handle
-    # @c to the directory containing the messages.
-    # @a mbox: Reference to the mailbox to be operated on.
-    # @r Path of directory holding the message files of the
-    # @r specified mailbox.
-
-    set dir      [CheckDir $name]
-    set mboxpath [file join $dir $mbox]
-
-    if {! [file exists      $mboxpath]} {
-	return -code error "\"$mbox\" does not exist"
-    }
-    if {! [file isdirectory $mboxpath]} {
-	return -code error "\"$mbox\" is not a directory"
-    }
-    if {! [file readable    $mboxpath]} {
-	return -code error "\"$mbox\" is not readable"
-    }
-    if {! [file writable    $mboxpath]} {
-	return -code error "\"$mbox\" is not writable"
-    }
-    return $mboxpath
-}
-
-proc ::pop3d::dbox::CheckDir {name} {
-    upvar ::pop3d::dbox::dbox::${name}::dir dir
-
-    if {$dir == {}} {
-	return -code error "base directory not specified"
-    }
-    return $dir
-}
-
-##########################
-# Module initialization
-
-package provide pop3d::dbox $::pop3d::dbox::version
Index: tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d_udb.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/pop3d/pop3d_udb.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,304 +1,0 @@
-# -*- tcl -*-
-# pop3d_udb.tcl --
-#
-#	Implementation of a simple user database for the pop3 server
-#
-# Copyright (c) 2002 by Andreas Kupries
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: pop3d_udb.tcl,v 1.6 2004/01/15 06:36:13 andreas_kupries Exp $
-
-namespace eval ::pop3d::udb {
-    # Data storage in the pop3d::udb module
-    # -------------------------------------
-    # One array per object containing the db contents. Keyed by user name.
-    # And the information about the last file data was read from.
-
-    # counter is used to give a unique name for unnamed databases
-    variable counter 0
-
-    # commands is the list of subcommands recognized by the server
-    variable commands [list	\
-	    "add"		\
-	    "destroy"           \
-	    "exists"		\
-	    "lookup"		\
-	    "read"		\
-	    "remove"		\
-	    "rename"		\
-	    "save"		\
-	    "who"		\
-	    ]
-
-    variable version ; set version 1.1
-}
-
-
-# ::pop3d::udb::new --
-#
-#	Create a new user database with a given name; if no name is given, use
-#	p3udbX, where X is a number.
-#
-# Arguments:
-#	name	name of the user database; if null, generate one.
-#
-# Results:
-#	name	name of the user database created
-
-proc ::pop3d::udb::new {{name ""}} {
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "p3udb${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-	return -code error \
-		"command \"$name\" already exists,\
-		unable to create user database"
-    }
-
-    # Set up the namespace
-    namespace eval ::pop3d::udb::udb::$name {
-	variable user     ;  array set user {}
-	variable lastfile ""
-    }
-
-    # Create the command to manipulate the user database
-    interp alias {} ::$name {} ::pop3d::udb::UdbProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::pop3d::udb::UdbProc --
-#
-#	Command that processes all user database object commands.
-#
-# Arguments:
-#	name	name of the user database object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::pop3d::udb::UdbProc {name {cmd ""} args} {
-
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error \
-		"wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    if { [llength [info commands ::pop3d::udb::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	return -code error "bad option \"$cmd\": must be $optlist"
-    }
-    eval [list ::pop3d::udb::_$cmd $name] $args
-}
-
-
-# ::pop3d::udb::_destroy --
-#
-#	Destroy a user database, including its associated command and
-#	data storage.
-#
-# Arguments:
-#	name	Name of the database to destroy.
-#
-# Results:
-#	None.
-
-proc ::pop3d::udb::_destroy {name} {
-    namespace delete ::pop3d::udb::udb::$name
-    interp alias {} ::$name {}
-    return
-}
-
-
-proc ::pop3d::udb::_add {name usrName password storage} {
-    # @c Add the user <a usrName> to the database, together with its
-    # @c password and a storage reference. The latter is stored and passed
-    # @c through this system without interpretation of the given value.
-
-    # @a usrName:  The name of the user defined here.
-    # @a password: Password given to the user.
-    # @a storage:  symbolic reference to the maildrop of user <a usrName>.
-    # @a storage:  Usable for a storage system only.
-
-    if {$usrName  == {}} {return -code error "user specification missing"}
-    if {$password == {}} {return -code error "password not specified"}
-    if {$storage  == {}} {return -code error "storage location not defined"}
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    set      user($usrName) [list $password $storage]
-    return
-}
-
-
-proc ::pop3d::udb::_remove {name usrName} {
-    # @c Remove the user <a usrName> from the database.
-    #
-    # @a usrName: The name of the user to remove.
-
-    if {$usrName == {}} {return -code error "user specification missing"}
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    if {![::info exists user($usrName)]} {
-	return -code error "user \"$usrName\" not known"
-    }
-
-    unset user($usrName)
-    return
-}
-
-
-proc ::pop3d::udb::_rename {name usrName newName} {
-    # @c Renames user <a usrName> to <a newName>.
-    # @a usrName: The name of the user to rename.
-    # @a newName: The new name to give to the user
-
-    if {$usrName == {}} {return -code error "user specification missing"}
-    if {$newName == {}} {return -code error "user specification missing"}
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    if {![::info exists user($usrName)]} {
-	return -code error "user \"$usrName\" not known"
-    }
-    if {[::info exists user($newName)]} {
-	return -code error "user \"$newName\" is known"
-    }
-
-    set data $user($usrName)
-    unset     user($usrName)
-
-    set user($newName) $data
-    return
-}
-
-
-proc ::pop3d::udb::_lookup {name usrName} {
-    # @c Query database for information about user <a usrName>.
-    # @c Overrides <m userdbBase:lookup>.
-    # @a usrName: Name of the user to query for.
-    # @r a 2-element list containing password and storage 
-    # @r reference for user <a usrName>, in this order.
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    if {![::info exists user($usrName)]} {
-	return -code error "user \"$usrName\" not known"
-    }
-    return $user($usrName)
-}
-
-
-proc ::pop3d::udb::_exists {name usrName} {
-    # @c Determines wether user <a usrName> is registered or not.
-    # @a usrName:     The name of the user to check for.
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    return [::info exists user($usrName)]
-}
-
-
-proc ::pop3d::udb::_who {name} {
-    # @c Determines the names of all registered users.
-    # @r A list containing the names of all registered users.
-
-    upvar ::pop3d::udb::udb::${name}::user user
-
-    return [array names user]
-}
-
-
-proc ::pop3d::udb::_save {name {file {}}} {
-    # @c Stores the current contents of the in-memory user database
-    # @c into the specified file.
-
-    # @a file: The name of the file to write to. If it is not specified, or
-    # @a file: as empty, the value of the member variable <v externalFile>
-    # @a file: is used instead.
-
-    # save operation: do a backup of the file, write new contents,
-    # restore backup in case of problems.
-
-    upvar ::pop3d::udb::udb::${name}::user user
-    upvar ::pop3d::udb::udb::${name}::lastfile lastfile
-
-    if {$file == {}} {
-	set file $lastfile
-    }
-    if {$file == {}} {
-	return -code error "No file known to save data into"
-    }
-
-    set tmp [file join [file dirname $file] [pid]]
-
-    set   f [open $tmp w]
-    puts $f "# -*- tcl -*-"
-    puts $f "# ----------- user authentication database -"
-    puts $f ""
-
-    foreach name [array names user] {
-	set password [lindex $user($name) 0]
-	set storage  [lindex $user($name) 1]
-
-	puts $f "\tadd [list $name] [list $password] [list $storage]"
-    }
-
-    puts  $f ""
-    close $f
-    
-    if {[file exists $file]} {
-	file rename -force $file $file.old
-    }
-    file rename -force $tmp $file
-    return
-}
-
-
-proc ::pop3d::udb::_read {name path} {
-    # @c Reads the contents of the specified <a path> into the in-memory
-    # @c database of users, passwords and storage references.
-
-    # @a path: The name of the file to read.
-
-    # @n The name of the file is remembered internally, and used by
-    # @n <m save> (if called without or empty argument).
-
-    upvar ::pop3d::udb::udb::${name}::user user
-    upvar ::pop3d::udb::udb::${name}::lastfile lastfile
-
-    if {$path == {}} {
-	return -code error "No file known to read from"
-    }
-
-    set lastfile $path
-
-    foreach key [array names user] {unset user($key)}
-
-    set ip [interp create -safe]
-    interp alias $ip add {} ::pop3d::udb::_add $name
-    $ip invokehidden -global source $path
-    interp delete $ip
-
-    return
-}
-
-##########################
-# Module initialization
-
-package provide pop3d::udb $::pop3d::udb::version
Index: tolsh/tolsh.vfs/lib/tcllib1.10/profiler/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/profiler/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded profiler 0.3 [list source [file join $dir profiler.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/profiler/profiler.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/profiler/profiler.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,638 +1,0 @@
-# profiler.tcl --
-#
-#	Tcl code profiler.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: profiler.tcl,v 1.29 2006/09/19 23:36:17 andreas_kupries Exp $
-
-package require Tcl 8.3		;# uses [clock clicks -milliseconds]
-package provide profiler 0.3
-
-namespace eval ::profiler {
-}
-
-# ::profiler::tZero --
-#
-#	Start a named timer instance
-#
-# Arguments:
-#	tag	name for the timer instance; if none is given, defaults to ""
-#
-# Results:
-#	None.
-
-proc ::profiler::tZero { { tag "" } } {
-    set ms [ clock clicks -milliseconds ]
-    set us [ clock clicks ]
-    set tag [string map {: ""} $tag]
-    # FRINK: nocheck
-    set ::profiler::T$tag [ list $us $ms ] 
-    return
-}
-
-# ::profiler::tMark --
-#
-#	Return the delta time since the start of a named timer.
-#
-# Arguments:
-#	tag	Tag for which to return a delta; if none is given, defaults to
-#		"" 
-#
-# Results:
-#	dt	Time difference between start of the timer and the current
-#		time, in microseconds.
-
-proc ::profiler::tMark { { tag "" } } {
-    set ut [ clock clicks ]
-    set mt [ clock clicks -milliseconds ]
-    set tag [string map {: ""} $tag]
-
-    # Per tag a variable was created within the profiler
-    # namespace. But we should check if the tag does ecxist.
-
-    if {![info exists ::profiler::T$tag]} {
-	error "Unknown tag \"$tag\""
-    }
-    # FRINK: nocheck
-     set ust [ lindex [ set ::profiler::T$tag ] 0 ] 
-    # FRINK: nocheck
-     set mst [ lindex [ set ::profiler::T$tag ] 1 ]
-     set udt [ expr { ($ut-$ust) } ]
-     set mdt [ expr { ($mt-$mst) } ]000
-     set dt $udt
-     ;## handle wrapping of the microsecond clock
-     if { $dt < 0 || $dt > 1000000 } { set dt $mdt }
-     set dt
-}
-
-# ::profiler::stats --
-#
-#	Compute statistical information for a set of values, including
-#	the mean, the standard deviation, and the covariance.
-#
-# Arguments:
-#	args	Values for which to compute information.
-#
-# Results:
-#	A list with three elements:  the mean, the standard deviation, and the
-#	covariance.
-
-proc ::profiler::stats {args} {
-    set sum      0
-    set mean     0
-    set sigma_sq 0
-    set sigma    0
-    set cov      0
-    set N [ llength $args ]
-    if { $N > 1 } { 
-        foreach val $args {
-            incr sum $val
-        }
-        if {$sum > 0} {
-            set mean [ expr { $sum/$N } ]
-            foreach val $args {
-                set sigma_sq [ expr { $sigma_sq+pow(($val-$mean),2) } ]
-            }
-            set sigma_sq [ expr { $sigma_sq/($N-1) } ] 
-            set sigma [ expr { round(sqrt($sigma_sq)) } ]
-	    if { $mean != 0 } {
-		set cov [ expr { (($sigma*1.0)/$mean)*100 } ]
-		set cov [ expr { round($cov*10)/10.0 } ]
-	    }
-        }
-    }
-    return [ list $mean $sigma $cov ]
-}
-
-# ::profiler::Handler --
-#
-#	Profile a function (tcl8.3).  This function works together with 
-#       profProc, which replaces the proc command.  When a new procedure
-#       is defined, it creates and alias to this function; when that
-#       procedure is called, it calls this handler first, which gathers
-#       profiling information from the call.
-#
-# Arguments:
-#	name	name of the function to profile.
-#	args	arguments to pass to the original function.
-#
-# Results:
-#	res	result from the original function.
-
-proc ::profiler::Handler {name args} {
-    variable enabled
-
-    if { [info level] == 1 } {
-        set caller GLOBAL
-    } else {
-        # Get the name of the calling procedure
-	set caller [lindex [info level -1] 0]
-	# Remove the ORIG suffix
-	set caller [string range $caller 0 end-4]
-
-        # Make sure that caller names always include the "::" prefix;
-        # otherwise we get confused by the string inequality between
-        # "::foo" and "foo" -- even though those refer to the same proc.
-
-        if { ![string equal -length 2 $caller "::"] } {
-            set caller "::$caller"
-        }
-    }
-
-    ::profiler::enterHandler $name $caller
-    set CODE [uplevel 1 [list ${name}ORIG] $args]
-    ::profiler::leaveHandler $name $caller
-    return $CODE
-}
-
-# ::profiler::TraceHandler --
-#
-#	Profile a function (tcl8.4+).  This function works together with
-#       profProc, which replaces the proc command.  When a new procedure
-#       is defined, it creates an execution trace on the function; when
-#       that function is called, 'enter' and 'leave' traces invoke this
-#       handler first, which gathers profiling information from the call.
-#
-# Arguments:
-#	name	name of the function to profile.
-#	cmd	command name and its expanded arguments.
-#	args	for 'enter' operation, value of args is "enter"
-#	    	for 'leave' operation, args is list of
-#               3 elements: <code> <result> "leave"
-#
-# Results:
-#	None
-
-proc ::profiler::TraceHandler {name cmd args} {
-
-    if { [info level] == 1 } {
-        set caller GLOBAL
-    } else {
-        # Get the name of the calling procedure
-	set caller [lindex [info level -1] 0]
-
-        # Make sure that caller names always include the "::" prefix;
-        # otherwise we get confused by the string inequality between
-        # "::foo" and "foo" -- even though those refer to the same proc.
-
-        if { ![string equal -length 2 $caller "::"] } {
-            set caller "::$caller"
-        }
-    }
-
-    set type [lindex $args end]
-    ::profiler::${type}Handler $name $caller
-}
-
-# ::profiler::enterHandler --
-#
-#	Profile a function.  This function works together with Handler and
-#       TraceHandler to collect profiling information just before it invokes
-#       the function.
-#
-# Arguments:
-#	name	name of the function to profile.
-#	caller	name of the function that calls the profiled function.
-#
-# Results:
-#	None
-
-proc ::profiler::enterHandler {name caller} {
-    variable enabled
-
-    if { !$enabled($name) } {
-        return
-    }
-
-    if { [catch {incr ::profiler::callers($name,$caller)}] } {
-        set ::profiler::callers($name,$caller) 1
-    }
-    ::profiler::tZero $name.$caller
-}
-
-# ::profiler::leaveHandler --
-#
-#	Profile a function.  This function works together with Handler and
-#       TraceHandler to collect profiling information just after it invokes
-#       the function.
-#
-# Arguments:
-#	name	name of the function to profile.
-#	caller	name of the function that calls the profiled function.
-#
-# Results:
-#	None
-
-proc ::profiler::leaveHandler {name caller} {
-    variable enabled
-
-    if { !$enabled($name) } {
-        return
-    }
-
-    set t [::profiler::tMark $name.$caller]
-    lappend ::profiler::statTime($name) $t
-
-    if { [incr ::profiler::callCount($name)] == 1 } {
-        set ::profiler::compileTime($name) $t
-    }
-    incr ::profiler::totalRuntime($name) $t
-    if { [catch {incr ::profiler::descendantTime($caller) $t}] } {
-        set ::profiler::descendantTime($caller) $t
-    }
-    if { [catch {incr ::profiler::descendants($caller,$name)}] } {
-        set ::profiler::descendants($caller,$name) 1
-    }
-}
-
-# ::profiler::profProc --
-#
-#	Replacement for the proc command that adds rudimentary profiling
-#	capabilities to Tcl.
-#
-# Arguments:
-#	name		name of the procedure
-#	arglist		list of arguments
-#	body		body of the procedure
-#
-# Results:
-#	None.
-
-proc ::profiler::profProc {name arglist body} {
-    variable callCount
-    variable compileTime
-    variable totalRuntime
-    variable descendantTime
-    variable statTime
-    variable enabled
-    variable paused
-    
-    # Get the fully qualified name of the proc
-    set ns [uplevel [list namespace current]]
-    # If the proc call did not happen at the global context and it did not
-    # have an absolute namespace qualifier, we have to prepend the current
-    # namespace to the command name
-    if { ![string equal $ns "::"] } {
-	if { ![string match "::*" $name] } {
-	    set name "${ns}::${name}"
-	}
-    }
-    if { ![string match "::*" $name] } {
-	set name "::$name"
-    }
-
-    # Set up accounting for this procedure
-    set callCount($name) 0
-    set compileTime($name) 0
-    set totalRuntime($name) 0
-    set descendantTime($name) 0
-    set statTime($name) {}
-    set enabled($name) [expr {!$paused}]
-
-    if {[package vsatisfies [package provide Tcl] 8.4]} {
-        uplevel 1 [list ::_oldProc $name $arglist $body]
-        trace add execution $name {enter leave} \
-                 [list ::profiler::TraceHandler $name]
-    } else {
-        uplevel 1 [list ::_oldProc ${name}ORIG $arglist $body]
-        uplevel 1 [list interp alias {} $name {} ::profiler::Handler $name]
-    }
-    return
-}
-
-# ::profiler::init --
-#
-#	Initialize the profiler.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	None.  Renames proc to _oldProc and sets an alias for proc to 
-#		profiler::profProc
-
-proc ::profiler::init {} {
-    # paused is set to 1 when the profiler is suspended.
-    variable paused 0
-
-    rename ::proc ::_oldProc
-    interp alias {} proc {} ::profiler::profProc
-
-    return
-}
-
-# ::profiler::printname --
-#
-#	Returns a string with some human readable information about
-#	the command name that was passed to this procedure.
-
-proc ::profiler::printname {name} {
-    variable callCount
-    variable compileTime
-    variable totalRuntime
-    variable descendantTime
-    variable descendants
-    variable statTime
-    variable callers
-
-    set result ""
-
-    set avgRuntime 0
-    set sigmaRuntime 0
-    set covRuntime 0
-    set avgDesTime 0
-    if { $callCount($name) > 0 } {
-	foreach {m s c} [eval ::profiler::stats $statTime($name)] { break }
-	set avgRuntime   $m
-	set sigmaRuntime $s
-	set covRuntime   $c
-	set avgDesTime \
-	    [expr {$descendantTime($name)/$callCount($name)}]
-    }
-
-    append result "Profiling information for $name\n"
-    append result "[string repeat = 60]\n"
-    append result "            Total calls:  $callCount($name)\n"
-    if { !$callCount($name) } {
-	append result "\n"
-	return $result
-    }
-    append result "    Caller distribution:\n"
-    set i [expr {[string length $name] + 1}]
-    foreach index [lsort [array names callers $name,*]] {
-	append result "  [string range $index $i end]:  $callers($index)\n"
-    }
-    append result "           Compile time:  $compileTime($name)\n"
-    append result "          Total runtime:  $totalRuntime($name)\n"
-    append result "        Average runtime:  $avgRuntime\n"
-    append result "          Runtime StDev:  $sigmaRuntime\n"
-    append result "         Runtime cov(%):  $covRuntime\n"
-    append result "  Total descendant time:  $descendantTime($name)\n"
-    append result "Average descendant time:  $avgDesTime\n"
-    append result "Descendants:\n"
-    if { !$descendantTime($name) } {
-	append result "  none\n"
-    }
-    foreach index [lsort [array names descendants $name,*]] {
-	append result "  [string range $index $i end]: \
-		    $descendants($index)\n"
-    }
-    append result "\n"
-    return $result
-}
-
-
-# ::profiler::print --
-#
-#	Print information about a proc.
-#
-# Arguments:
-#	pattern	pattern of the proc's to get info for; default is *.
-#
-# Results:
-#	A human readable printout of info.
-
-proc ::profiler::print {{pattern *}} {
-    variable callCount
-
-    set result ""
-    foreach name [lsort [array names callCount $pattern]] {
-	append result [printname $name]
-    }
-    return $result
-}
-
-# ::profiler::printsorted --
-#
-#	This proc takes a key and a pattern as arguments, and produces
-#	human readable results for the procs that match the pattern,
-#	sorted by the key.
-
-proc ::profiler::printsorted {key {pattern *}} {
-    variable callCount
-    variable compileTime
-    variable totalRuntime
-    variable descendantTime
-    variable descendants
-    variable statTime
-    variable callers
-
-    set data [sortFunctions $key]
-    foreach {k v} $data {
-	append result [printname [lindex $k 0]]
-    }
-    return $result
-}
-
-
-# ::profiler::dump --
-#
-#	Dump out the information for a proc in a big blob.
-#
-# Arguments:
-#	pattern	pattern of the proc's to lookup; default is *.
-#
-# Results:
-#	data	data about the proc's.
-
-proc ::profiler::dump {{pattern *}} {
-    variable callCount
-    variable compileTime
-    variable totalRuntime
-    variable callers
-    variable descendantTime
-    variable descendants
-    variable statTime
-
-    set result ""
-    foreach name [lsort [array names callCount $pattern]] {
-	set i [expr {[string length $name] + 1}]
-	catch {unset thisCallers}
-	foreach index [lsort [array names callers $name,*]] {
-	    set thisCallers([string range $index $i end]) $callers($index)
-	}
-	set avgRuntime 0
-	set sigmaRuntime 0
-	set covRuntime 0
-	set avgDesTime 0
-	if { $callCount($name) > 0 } {
-	    foreach {m s c} [eval ::profiler::stats $statTime($name)] { break }
-	    set avgRuntime   $m
-	    set sigmaRuntime $s
-	    set covRuntime   $c
-	    set avgDesTime \
-		    [expr {$descendantTime($name)/$callCount($name)}]
-	}
-	set descendantList [list ]
-	foreach index [lsort [array names descendants $name,*]] {
-	    lappend descendantList [string range $index $i end]
-	}
-	lappend result $name [list callCount $callCount($name) \
-		callerDist [array get thisCallers] \
-		compileTime $compileTime($name) \
-		totalRuntime $totalRuntime($name) \
-		averageRuntime $avgRuntime \
-		stddevRuntime  $sigmaRuntime \
-		covpercentRuntime $covRuntime \
-		descendantTime $descendantTime($name) \
-		averageDescendantTime $avgDesTime \
-		descendants $descendantList]
-    }
-    return $result
-}
-
-# ::profiler::sortFunctions --
-#
-#	Return a list of functions sorted by a particular field and the
-#	value of that field.
-#
-# Arguments:
-#	field	field to sort by
-#
-# Results:
-#	slist	sorted list of lists, sorted by the field in question.
-
-proc ::profiler::sortFunctions {{field ""}} {
-    switch -glob -- $field {
-	"calls" {
-	    upvar ::profiler::callCount data
-	}
-	"compileTime" {
-	    upvar ::profiler::compileTime data
-	}
-	"totalRuntime" {
-	    upvar ::profiler::totalRuntime data
-	}
-	"avgRuntime" -
-	"averageRuntime" {
-	    variable callCount
-	    variable totalRuntime
-	    foreach fxn [array names callCount] {
-		if { $callCount($fxn) > 1 } {
-		    set data($fxn) \
-			    [expr {$totalRuntime($fxn)/($callCount($fxn) - 1)}]
-		}
-	    }
-	}
-	"exclusiveRuntime" {
-	    variable totalRuntime
-	    variable descendantTime
-	    foreach fxn [array names totalRuntime] {
-		set data($fxn) \
-			[expr {$totalRuntime($fxn) - $descendantTime($fxn)}]
-	    }
-	}
-	"avgExclusiveRuntime" {
-	    variable totalRuntime
-	    variable callCount
-	    variable descendantTime
-	    foreach fxn [array names totalRuntime] {
-		if { $callCount($fxn) } {
-		    set data($fxn) \
-			    [expr {($totalRuntime($fxn) - \
-				$descendantTime($fxn)) / $callCount($fxn)}]
-		}
-	    }
-	}
-	"nonCompileTime" {
-	    variable compileTime
-	    variable totalRuntime
-	    foreach fxn [array names totalRuntime] {
-		set data($fxn) [expr {$totalRuntime($fxn)-$compileTime($fxn)}]
-	    }
-	}
-	default {
-	    error "unknown statistic \"$field\": should be calls,\
-		    compileTime, exclusiveRuntime, nonCompileTime,\
-		    totalRuntime, avgExclusiveRuntime, or avgRuntime"
-	}
-    }
-	    
-    set result [list ]
-    foreach fxn [array names data] {
-	lappend result [list $fxn $data($fxn)]
-    }
-    return [lsort -integer -index 1 $result]
-}
-
-# ::profiler::reset --
-#
-#	Reset collected data for functions matching a given pattern.
-#
-# Arguments:
-#	pattern		pattern of functions to reset; default is *.
-#
-# Results:
-#	None.
-
-proc ::profiler::reset {{pattern *}} {
-    variable callCount
-    variable compileTime
-    variable totalRuntime
-    variable callers
-    variable statTime
-
-    foreach name [array names callCount $pattern] {
-	set callCount($name) 0
-	set compileTime($name) 0
-	set totalRuntime($name) 0
-	set statTime($name) {}
-	foreach caller [array names callers $name,*] {
-	    unset callers($caller)
-	}
-    }
-    return
-}
-
-# ::profiler::suspend --
-#
-#	Suspend the profiler.
-#
-# Arguments:
-#	pattern		pattern of functions to suspend; default is *.
-#
-# Results:
-#	None.  Resets the `enabled($name)' variable to 0
-#	       to suspend profiling
-
-proc ::profiler::suspend {{pattern *}} {
-    variable callCount
-    variable enabled
-    variable paused
-
-    set paused 1
-    foreach name [array names callCount $pattern] {
-        set enabled($name) 0
-    }
-
-    return
-}
-
-# ::profiler::resume --
-#
-#	Resume the profiler, after it has been suspended.
-#
-# Arguments:
-#	pattern		pattern of functions to suspend; default is *.
-#
-# Results:
-#	None.  Sets the `enabled($name)' variable to 1
-#	       so as to enable the profiler.
-
-proc ::profiler::resume {{pattern *}} {
-    variable callCount
-    variable enabled
-    variable paused
-
-    set paused 0
-    foreach name [array names callCount $pattern] {
-        set enabled($name) 1
-    }
-
-    return
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/rc4/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/rc4/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# pkgIndex.tcl - 
-#
-# RC4 package index file
-#
-# This package has been tested with tcl 8.2.3 and above.
-#
-# $Id: pkgIndex.tcl,v 1.4 2005/12/20 16:19:38 patthoyts Exp $
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded rc4 1.1.0 [list source [file join $dir rc4.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/rc4/rc4.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/rc4/rc4.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,427 +1,0 @@
-# rc4.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# RC4 is a symmetric stream cipher developed by Ron Rivest of RSA Data
-# Security Inc. The algorithm was a trade secret of RSA but was reverse
-# engineered and published to the internet in 1994. This pure Tcl
-# implementation is based on the description of the algorithm.
-#
-# The algorithm is a pseudo-random number generator with the output of
-# the PRNG being xored with the plaintext stream. Decryption is done
-# by feeding the ciphertext as input with the same key.
-#
-# $Id: rc4.tcl,v 1.7 2005/12/20 16:19:38 patthoyts Exp $
-
-package require Tcl 8.2
-
-# @mdgen EXCLUDE: rc4c.tcl
-
-namespace eval ::rc4 {
-    variable version 1.1.0
-    variable rcsid {$Id: rc4.tcl,v 1.7 2005/12/20 16:19:38 patthoyts Exp $}
-
-    namespace export rc4
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# RC4Init - create and initialize the RC4 state as an array
-#
-proc ::rc4::RC4Init_Array {keystr} {
-    variable uid
-
-    binary scan $keystr c* key
-    set keylen [llength $key]
-
-    set Key [namespace current]::key[incr uid]
-    # FRINK: nocheck
-    variable $Key
-    upvar #0 $Key state
-    catch {unset state}
-
-    set state(x) 0
-    set state(y) 0
-    for {set cn 0} {$cn < 256} {incr cn} {
-        set state(s,$cn) $cn
-    }
-    set i 0
-    set j 0
-    for {set cn 0} {$cn < 256} {incr cn} {
-        set j [expr {([lindex $key $i] + $state(s,$cn) + $j) % 256}]
-        set t $state(s,$cn)
-        set state(s,$cn) $state(s,$j)
-        set state(s,$j) $t
-        set i [expr {($i + 1) % $keylen}]
-    }
-
-    return $Key
-}
-
-# RC4 - process the data using the array based state
-#
-proc ::rc4::RC4_Array {Key datastr} {
-    upvar #0 $Key state
-    set res {}
-
-    binary scan $datastr c* data
-    set datalen [llength $data]
-    
-    set x $state(x)
-    set y $state(y)
-
-    for {set cn 0} {$cn < $datalen} {incr cn} {
-        set x [expr {($x + 1) % 256}]
-        set y [expr {($state(s,$x) + $y) % 256}]
-        set t $state(s,$y)
-        set state(s,$y) $state(s,$x)
-        set state(s,$x) $t
-        set i [expr {($state(s,$x) + $state(s,$y)) % 256}]
-        lappend res [expr {([lindex $data $cn] ^ $state(s,$i)) & 0xFF}]
-    }
-    set state(x) $x
-    set state(y) $y
-    return [binary format c* $res]
-}
-
-# RC4Init - create and initialize the RC4 state as a list.
-#
-proc ::rc4::RC4Init_List {keystr} {
-    variable uid
-
-    binary scan $keystr c* key
-    set keylen [llength $key]
-
-    set Key [namespace current]::key[incr uid]
-    # FRINK: nocheck
-    variable $Key
-    upvar #0 $Key State
-    catch {unset State}
-
-    set i 0
-    set j 0
-    set s {}; #[::struct::list::Liota 256]
-    for {set n 0} {$n < 256} {incr n} {lappend s $n}
-    
-    for {set cn 0} {$cn < 256} {incr cn} {
-        set j [expr {([lindex $key $i] + [lindex $s $cn] + $j) % 256}]
-        set t [lindex $s $cn]
-        lset s $cn [lindex $s $j]
-        lset s $j $t
-        set i [expr {($i + 1) % $keylen}]
-    }
-    
-    set State(x) 0
-    set State(y) 0
-    set State(s) $s
-
-    return $Key
-}
-
-# RC4 - process the data using the list-based state.
-#
-proc ::rc4::RC4_List {Key datastr} {
-    upvar #0 $Key State
-    set res {}
-
-    binary scan $datastr c* data
-    set datalen [llength $data]
-    
-    set x $State(x)
-    set y $State(y)
-    set s $State(s)
-
-    for {set cn 0} {$cn < $datalen} {incr cn} {
-        set x [expr {($x + 1) % 256}]
-        set y [expr {([lindex $s $x] + $y) % 256}]
-        set t [lindex $s $y]
-        lset s $y [lindex $s $x]
-        lset s $x $t
-        set i [expr {([lindex $s $x] + [lindex $s $y]) % 256}]
-        lappend res [expr {([lindex $data $cn] ^ [lindex $s $i]) & 0xFF}]
-    }
-    set State(x) $x
-    set State(y) $y
-    set State(s) $s
-    return [binary format c* $res]
-}
-
-# PRAGMA: nocheck
-proc ::rc4::K {x y} {set x}
-
-# Using this compat function for < 8.4 is 2x slower than using arrays.
-if {[package vcompare [package provide Tcl] 8.4] < 0} {
-    proc ::rc4::lset {var index arg} {
-        upvar 1 $var list
-        set list [::lreplace [K $list [set list {}]] $index $index $arg]
-    }
-}
-
-proc ::rc4::RC4Final {Key} {
-    upvar #0 $Key state
-    catch {unset state}
-    return {}
-}
-
-# -------------------------------------------------------------------------
-# Helper to turn binary data into hex format.
-#
-proc ::rc4::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# Demo function for use with Trf transform command to add automatic
-# RC4 encryption to a channel. Illustrates use of [transform]
-#
-# For instance, to create a file with all ondisk data encrypted:
-#   set f [open secretfile r+]
-#   transform -attach $f -command [list rc4::Transform $f Secret]
-#   puts -nonewline $f yourdata   ;# write to encrypt
-#   read $f                       ;# read to decrypt
-#   close $f
-#
-proc ::rc4::Transform {channel keystr operation data} {
-    set readkey [namespace current]::R$channel
-    # FRINK: nocheck
-    variable $readkey
-    upvar #0 $readkey rk
-    set writekey [namespace current]::W$channel
-    # FRINK: nocheck
-    variable $writekey
-    upvar #0 $writekey wk
-    set result {}
-
-    #puts stderr "$operation {$data}"
-    switch -- $operation {
-        create/write {
-            if {[info exists wk]} {
-                RCFinal $wk
-            }
-            set wk [RC4Init $keystr] 
-        }
-        clear/write {}
-        delete/write {
-            if {[info exists wk]} {
-                RC4Final $wk
-                unset wk
-            }
-        }
-        write - flush/write {
-            if {![info exists wk]} {
-                set wk [RC4Init $keystr]
-            }
-            set result [RC4 $wk $data] 
-        }
-
-        create/read {
-            if {[info exists rk]} {
-                RCFinal $rk
-            }
-            set rk [RC4Init $keystr] 
-        }
-        clear/read {}
-        delete/read {
-            if {[info exists rk]} {
-                RC4Final $rk
-                unset rk
-            }
-        }
-        read - flush/read {
-            if {![info exists rk]} {
-                set rk [RC4Init $keystr]
-            }
-            set result [RC4 $rk $data] 
-        }
-        
-        query/ratio {
-            set result {1 1};           # RC4 is a 1:1 stream cipher.
-        }
-        query/maxRead {
-            set result -1;              # Permit read of any amount
-        }
-        default {
-            # ignore unknown operations.
-        }
-    }
-    return $result
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::rc4::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Fileevent handler for chunked file hashing.
-#
-proc ::rc4::Chunk {State} {
-    upvar #0 $State state
-    
-    if {[eof $state(-in)]} {
-        fileevent $state(-in) readable {}
-        set state(reading) 0
-    }
-    set data [read $state(-in) $state(-chunksize)]
-    if {[llength $state(-out)] == 0} {
-        append state(output) [RC4 $state(Key) $data]
-    } else {
-        puts -nonewline $state(-out) [RC4 $state(Key) $data]
-    }
-    if {!$state(reading) && [llength $state(-command)] != 0} {
-        Cleanup $State; # cleanup and call users command 
-    }
-}
-
-
-proc ::rc4::Cleanup {State} {
-    upvar #0 $State state
-    set cmd $state(-command)
-    set res $state(output)
-    # If we opened the channel then we should close it too.
-    if {[string length $state(-infile)] > 0} {
-        close $state(-in)
-    }
-    RC4Final $state(Key)
-    unset state
-    if {[llength $cmd] != 0} {
-        eval $cmd [list $res]
-    }
-    return $res
-}
-
-# -------------------------------------------------------------------------
-
-proc ::rc4::rc4 {args} {
-    array set opts {-hex 0 -infile {} -in {} -out {} -chunksize 4096
-        -key {} -command {}}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -key        { set opts(-key) [Pop args 1] }
-            -hex        { set opts(-hex) 1}
-            -infile     { set opts(-infile) [Pop args 1] }
-            -in         { set opts(-in) [Pop args 1] }
-            -out        { set opts(-out) [Pop args 1] }
-            -chunksize  { set opts(-chunksize) [Pop args 1] }
-            -command    { set opts(-command) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {[string length $opts(-key)] < 1} {
-        return -code error "wrong # args:\
-            should be \"rc4 ?-hex? -key key -in channel | string\""
-    }
-
-    if {$opts(-infile) != {}} {
-        set opts(-in) [open $opts(-infile) r]
-        fconfigure $opts(-in) -translation binary
-    }
-
-    set r {}
-    if {$opts(-in) == {}} {
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"rc4 ?-hex? -key key -in channel | string\""
-        }
-
-        set Key [RC4Init $opts(-key)]
-        set r [RC4 $Key [lindex $args 0]]
-        if {[llength $opts(-command)] != 0} {
-            eval $opts(-command) [list $r]
-            set r {}
-        } elseif {$opts(-out) != {}} {
-            puts -nonewline $opts(-out) $r
-            set r {}
-        }
-        RC4Final $Key
-
-    } else {
-
-        variable uid
-        set State [namespace current]::state[incr uid]
-        upvar #0 $State state
-        array set state [array get opts]
-        set state(Key) [RC4Init $opts(-key)]
-        set state(reading) 1
-        set state(output) ""
-        fileevent $opts(-in) readable [list [namespace origin Chunk] $State]
-        if {[llength $opts(-command)] != 0} {
-            return {}
-        } else {
-            vwait [set State](reading)
-            set r [Cleanup $State]
-        }
-    }
-
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::rc4::SelectImplementation {impl} {
-    switch -exact -- $impl {
-        critcl {
-            interp alias {} ::rc4::RC4Init {} ::rc4::rc4c_init
-            interp alias {} ::rc4::RC4     {} ::rc4::rc4c
-        }
-        array {
-            interp alias {} ::rc4::RC4Init {} ::rc4::RC4Init_Array
-            interp alias {} ::rc4::RC4     {} ::rc4::RC4_Array
-        }
-        list {
-            interp alias {} ::rc4::RC4Init {} ::rc4::RC4Init_List
-            interp alias {} ::rc4::RC4     {} ::rc4::RC4_List
-        }
-        default {
-            return -code error "invalid implementation \"$impl\":\
-                must be one of \"critcl\", \"array\" or \"list\""
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# Using a list to hold the keystream state is a lot faster than using
-# an array. However, for Tcl < 8.4 we don't have the lset command.
-# Using a compatability lset is slower than using arrays.
-# Obviously, a compiled C version is fastest of all.
-# So lets pick the fastest method we can find...
-#
-namespace eval ::rc4 {
-    if {[catch {package require tcllibc}]} {
-        catch {package require rc4c}
-    }
-    if {[info commands ::rc4::rc4c] != {}} {
-        SelectImplementation critcl
-    } elseif {[package vcompare [package provide Tcl] 8.4] < 0} {
-        SelectImplementation array
-    } else {
-        SelectImplementation list
-    }
-}
-
-package provide rc4 $::rc4::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/rc4/rc4c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/rc4/rc4c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,164 +1,0 @@
-# rc4c.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This provides a critcl C implementation of RC4 
-#
-# INSTALLATION
-# ------------
-# This package uses critcl (http://wiki.tcl.tk/critcl). To build do:
-#  critcl -libdir <your-tcl-lib-dir> -pkg rc4c rc4c
-#
-# To build this for tcllib use sak.tcl:
-#  tclsh sak.tcl critcl
-# generates a tcllibc module.
-#
-# $Id: rc4c.tcl,v 1.2 2005/10/05 00:18:39 patthoyts Exp $
-
-package require critcl
-package provide rc4c 1.0.0
-
-namespace eval ::rc4 {
-
-    critcl::ccode {
-        typedef struct RC4_CTX {
-            unsigned char x;
-            unsigned char y;
-            unsigned char s[256];
-        } RC4_CTX;
-
-        /* #define TRACE trace */
-        #define TRACE 1 ? ((void)0) : trace
-
-        static void trace(const char *format, ...)
-        {
-            va_list args;
-            va_start(args, format);
-            vfprintf(stderr, format, args);
-            va_end(args);
-        }
-        static Tcl_ObjType rc4_type;
-    
-        static void rc4_free_rep(Tcl_Obj *obj)
-        {
-            RC4_CTX *ctx = (RC4_CTX *)obj->internalRep.otherValuePtr;
-            TRACE("rc4_free_rep(%08x)\n", (long)obj);
-            Tcl_Free((char *)ctx);
-        }
-
-        static void rc4_dup_rep(Tcl_Obj *obj, Tcl_Obj *dup)
-        {
-            RC4_CTX *ctx = (RC4_CTX *)obj->internalRep.otherValuePtr;
-            TRACE("rc4_dup_rep(%08x,%08x)\n", (long)obj, (long)dup);
-            dup->internalRep.otherValuePtr = (RC4_CTX *)Tcl_Alloc(sizeof(RC4_CTX));
-            memcpy(dup->internalRep.otherValuePtr, ctx, sizeof(RC4_CTX));
-            dup->typePtr = &rc4_type;
-        }
-
-        static void rc4_string_rep(Tcl_Obj* obj)
-        {
-            RC4_CTX *ctx = (RC4_CTX *)obj->internalRep.otherValuePtr;
-            Tcl_Obj* tmpObj;
-            char* str;
-            TRACE("rc4_string_rep(%08x)\n", (long)obj);
-            /* convert via a byte array to properly handle null bytes */
-            tmpObj = Tcl_NewByteArrayObj((char *)ctx, sizeof(RC4_CTX));
-            Tcl_IncrRefCount(tmpObj);
-            
-            str = Tcl_GetStringFromObj(tmpObj, &obj->length);
-            obj->bytes = Tcl_Alloc(obj->length + 1);
-            memcpy(obj->bytes, str, obj->length + 1);
-            
-            Tcl_DecrRefCount(tmpObj);
-        }
-
-        static int rc4_from_any(Tcl_Interp* interp, Tcl_Obj* obj)
-        {
-            TRACE("rc4_from_any %08x\n", (long)obj);
-            return TCL_ERROR;
-        }
-
-        static Tcl_ObjType rc4_type = {
-            "rc4c", rc4_free_rep, rc4_dup_rep, rc4_string_rep, rc4_from_any
-        };
-#ifdef __GNUC__
-        inline
-#endif
-        void swap (unsigned char *lhs, unsigned char *rhs) {
-            unsigned char t = *lhs;
-            *lhs = *rhs;
-            *rhs = t;
-        }
-    }
-
-    critcl::ccommand rc4c_init {dummy interp objc objv} {
-        RC4_CTX *ctx;
-        Tcl_Obj *obj;
-        const unsigned char *k;
-        int n = 0, i = 0, j = 0, keylen;
-
-        if (objc != 2) {
-            Tcl_WrongNumArgs(interp, 1, objv, "keystring");
-            return TCL_ERROR;
-        }
-        
-        k = Tcl_GetByteArrayFromObj(objv[1], &keylen);
-
-        obj = Tcl_NewObj();
-        ctx = (RC4_CTX *)Tcl_Alloc(sizeof(RC4_CTX));
-        ctx->x = 0;
-        ctx->y = 0;
-        for (n = 0; n < 256; n++)
-            ctx->s[n] = n;
-        for (n = 0; n < 256; n++) {
-            j = (k[i] + ctx->s[n] + j) % 256;
-            swap(&ctx->s[n], &ctx->s[j]);
-            i = (i + 1) % keylen;
-        }
-        
-        if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
-            obj->typePtr->freeIntRepProc(obj);
-        obj->internalRep.otherValuePtr = ctx;
-        obj->typePtr = &rc4_type;
-        Tcl_SetObjResult(interp, obj);
-        Tcl_IncrRefCount(obj);
-        Tcl_InvalidateStringRep(obj);
-        return TCL_OK;
-    }
-
-    critcl::ccommand rc4c {dummy interp objc objv} {
-        Tcl_Obj *resObj = NULL;
-        RC4_CTX *ctx = NULL;
-        unsigned char *data, *res, x, y;
-        int size, n, i;
-
-        if (objc != 3) {
-            Tcl_WrongNumArgs(interp, 1, objv, "key data");
-            return TCL_ERROR;
-        }
-
-        if (objv[1]->typePtr != &rc4_type
-            && rc4_from_any(interp, objv[1]) != TCL_OK) {
-            return TCL_ERROR;
-        }
-
-        ctx = objv[1]->internalRep.otherValuePtr;
-        data = Tcl_GetByteArrayFromObj(objv[2], &size);
-        res = (unsigned char *)Tcl_Alloc(size);
-
-        x = ctx->x;
-        y = ctx->y;
-        for (n = 0; n < size; n++) {
-            x = (x + 1) % 256;
-            y = (ctx->s[x] + y) % 256;
-            swap(&ctx->s[x], &ctx->s[y]);
-            i = (ctx->s[x] + ctx->s[y]) % 256;
-            res[n] = data[n] ^ ctx->s[i];
-        }
-        ctx->x = x;
-        ctx->y = y;
-
-        resObj = Tcl_NewByteArrayObj(res, size);
-        Tcl_SetObjResult(interp, resObj);
-        Tcl_Free(res);
-        return TCL_OK;
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/rcs/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/rcs/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded rcs 0.1 [list source [file join $dir rcs.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/rcs/rcs.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/rcs/rcs.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,281 +1,0 @@
-# rcs.tcl --
-#
-#	Utilities for RCS related operations.
-#
-# Copyright (c) 2005 by Colin McCormack <coldstore@users.sourceforge.net>
-# Copyright (c) 2005 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: rcs.tcl,v 1.4 2005/09/28 04:51:23 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites.
-
-package require Tcl 8.4
-
-# ### ### ### ######### ######### #########
-## API Implementation
-
-namespace eval rcs {}
-
-# ::rcs::text2dict --
-#
-# Convert a text into a dictionary. The dictionary is keyed by line
-# numbers, and the value is the text of the corresponding line. The
-# first line has index/number 1.
-#
-# Arguments
-# - text	The text to convert.
-#
-# Results
-#  A dictionary containing the text in split form.
-#
-# Side effects
-#  None
-
-proc ::rcs::text2dict {text} {
-    array set lines {}
-    set lnum 0
-    foreach line [split $text \n] {
-	set lines([incr lnum]) $line
-    }
-    return [array get lines]
-}
-
-# ::rcs::file2dict --
-#
-# Convert a text stored in a file into a dictionary. The dictionary is
-# keyed by line numbers, and the value is the text of the
-# corresponding line. The first line has index/number 1.
-#
-# Arguments
-# - file	The path of the file containing the text to convert.
-#
-# Results
-#  A dictionary containing the text in split form.
-#
-# Side effects
-#  None
-
-proc ::rcs::file2dict {filename} {
-    set chan [open $filename r]
-    set text [read $chan]
-    close $chan
-
-    return [text2dict $text]
-}
-
-# ::rcs::dict2text --
-#
-# Converts a dictionary as created by the 2dict commands back into a
-# text. The dictionary is keyed by line numbers, and the value is the
-# text of the corresponding line. The first line has index/number 1.
-# The dictionary may have gaps in the line numbers.
-#
-# Arguments
-# - dict	The dictionary to convert.
-#
-# Results
-#  The text stored in the dictionary.
-#
-# Side effects
-#  None
-
-proc ::rcs::dict2text {dict} {
-    array set lines $dict
-    set result {}
-    foreach lnum [lsort -integer [array names lines]] {
-	lappend result $lines($lnum)
-    }
-    return [join $result \n]
-}
-
-# ::rcs::dict2file --
-#
-# Converts a dictionary as created by the 2dict commands back into a
-# text and stores it into the specified file. The dictionary is keyed
-# by line numbers, and the value is the text of the corresponding
-# line. The first line has index/number 1.  The dictionary may have
-# gaps in the line numbers.
-#
-# Arguments
-# - filename	The path to the file to store the reconstructed text into.
-# - dict	The dictionary to convert.
-#
-# Results
-#  None.
-#
-# Side effects
-#  None
-
-proc ::rcs::dict2file {filename dict} {
-    set chan [open $filename w]
-    puts -nonewline $chan [dict2text $dict]
-    close $chan
-}
-
-# ::rcs::decodeRcsPatch --
-#
-# Converts a text containing a RCS patch (diff -n format) into a list
-# of patch commands. Each element of the list is a list containing the
-# patch command and its arguments, in this order.
-#
-# The valid patch commands are 'a' and 'd'. 'a' has two arguments, the
-# index of the line where to add the text, and the text itself. The
-# 'd' command has two arguments as well, the index of the first line
-# to delete, and the number of lines to delete.
-#
-# Arguments
-# - patch	The text in diff -n format, the patch to parse.
-#
-# Results
-#   A list containing the patch as sequence of commands.
-#
-# Side effects
-#  None
-
-proc ::rcs::decodeRcsPatch {patch} {
-    set patch [split $patch \n]
-    set plen  [llength $patch]
-    set at    0
-    set res   {}
-
-    while {$at < $plen} {
-	# I use an index into the list to avoid shifting the list
-	# elements down with each line processed. That is a lot of
-	# memcpy's.
-
-	set cmd [string trim [lindex $patch $at]]
-	incr at
-
-	switch -glob -- $cmd {
-	    "" {}
-	    a* {
-		foreach {start len} [split [string range $cmd 1 end]] break
-
-		set to [expr {$at + $len - 1}]
-		lappend res [list \
-				 a \
-				 $start \
-				 [join [lrange $patch $at $to] \n]]
-		incr to
-		set at $to
-	    }
-	    d* {
-		foreach {start len} [split [string range $cmd 1 end]] break
-		lappend res [list d $start $len]
-	    }
-	    default {
-		return -code error "Unknown patch command: '$cmd'"
-	    }
-	}
-    }
-
-    return $res
-}
-
-# ::rcs::encodeRcsPatch --
-#
-# Converts a list of patch commands into a text containing the same
-# command as a RCS patch (i.e. in diff -n format). See decodePatch for
-# a description of the input format.
-#
-# Arguments
-# - patch	The patch as list of patch commands.
-#
-# Results
-#   A text containing the patch in diff -n format.
-#
-# Side effects
-#  None
-
-proc ::rcs::encodeRcsPatch {patch} {
-    set res {}
-
-    foreach cmd $patch {
-	foreach {op a b} $cmd break
-
-	switch -exact -- $op {
-	    a {
-		# a = index of line where to add
-		# b = text to add
-
-		set  lines [llength [split $b \n]]
-
-		lappend res "a$a $lines"
-		lappend res $b
-	    }
-	    d {
-		# a = index of first line to delete.
-		# b = #lines to delete.
-
-		lappend res "d$a $b"
-	    }
-	    default {
-		return -code error "Unknown patch command: '$op'"
-	    }
-	}
-    }
-
-    return [join $res \n]\n
-}
-
-# ::rcs::applyRcsPatch --
-#
-# Apply a patch in the format returned by decodeRcsPatch to a text in
-# the format returned by the xx2dict commands. The result is
-# dictionary containing the modified text. Use the dict2xx commands to
-# convert this back into a regular text.
-#
-# Arguments
-# - text	The text (as dict) to patch
-# - patch	The patch (as cmd list) to apply.
-#
-# Results
-#  The modified text (as dict)
-#
-# Side effects
-#  None
-
-proc ::rcs::applyRcsPatch {text patch} {
-    array set lines $text
-
-    foreach cmd $patch {
-	foreach {op a b} $cmd break
-
-	switch -exact -- $op {
-	    a {
-		# a = index of line where to add
-		# b = text to add
-
-		if {[info exists lines($a)]} {
-		    append lines($a) \n $b
-		} else {
-		    set lines($a) $b
-		}
-	    }
-	    d {
-		# a = index of first line to delete.
-		# b = #lines to delete.
-
-		while {$b > 0} {
-		    unset lines($a)
-		    incr a
-		    incr b -1
-		}
-	    }
-	    default {
-		return -code error "Unknown patch command: '$op'"
-	    }
-	}
-    }
-
-    return [array get lines]
-}
-
-# ### ### ### ######### ######### #########
-## Ready for use.
-
-package provide rcs 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/report/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/report/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded report 0.3.1 [list source [file join $dir report.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/report/report.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/report/report.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1378 +1,0 @@
-# report.tcl --
-#
-#	Implementation of report objects for Tcl.
-#
-# Copyright (c) 2001 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: report.tcl,v 1.8 2004/01/15 06:36:13 andreas_kupries Exp $
-
-package require Tcl 8.2
-package provide report 0.3.1
-
-namespace eval ::report {
-    # Data storage in the report module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #  1) An array mapping from template codes to templates
-    #  2) An array mapping from template codes and columns to horizontal template items
-    #  3) An array mapping from template codes and columns to vertical template items
-    #  4) ... deleted, local to formatting
-    #  5) An array mapping from columns to left padding
-    #  6) An array mapping from columns to right padding
-    #  7) An array mapping from columns to column size
-    #  8) An array mapping from columns to justification
-    #  9) A scalar containing the number of columns in the report.
-    # 10) An array mapping from template codes to enabledness
-    # 11) A scalar containing the size of the top caption
-    # 12) A scalar containing the size of the bottom caption
-    #
-    # 1 - template		5 - lpad	 9 - columns
-    # 2 - hTemplate		6 - rpad	10 - enabled
-    # 3 - vTemplate		7 - csize	11 - tcaption
-    # 4 - fullHTemplate		8 - cjust	12 - bcaption
-
-    # commands is the list of subcommands recognized by the report
-    variable commands [list		\
-	    "bcaption"			\
-	    "botcapsep"			\
-	    "botdata"			\
-	    "botdatasep"		\
-	    "bottom"			\
-	    "columns"			\
-	    "data"			\
-	    "datasep"			\
-	    "justify"			\
-	    "pad"			\
-	    "printmatrix"		\
-	    "printmatrix2channel"	\
-	    "size"			\
-	    "sizes"			\
-	    "tcaption"			\
-	    "top"			\
-	    "topcapsep"			\
-	    "topdata"			\
-	    "topdatasep"
-	    ]
-
-    # Only export the toplevel commands
-    namespace export report defstyle rmstyle stylearguments stylebody
-
-    # Global data, style definitions
-
-    variable styles [list plain]
-    variable styleargs
-    variable stylebody
-
-    array set styleargs {plain {}}
-    array set stylebody {plain {}}
-
-    # Global data, template codes, for easy checking
-
-    variable  tcode
-    array set tcode {
-	topdata    0	data       0
-	botdata    0	top        1
-	topdatasep 1	topcapsep  1
-	datasep    1	botcapsep  1
-	botdatasep 1	bottom     1
-    }
-}
-
-# ::report::report --
-#
-#	Create a new report with a given name
-#
-# Arguments:
-#	name	Optional name of the report; if null or not given, generate one.
-#
-# Results:
-#	name	Name of the report created
-
-proc ::report::report {name columns args} {
-    variable styleargs
-
-    if { [llength [info commands ::$name]] } {
-	error "command \"$name\" already exists, unable to create report"
-    }
-    if {![string is integer $columns]} {
-	return -code error "columns: expected integer greater than zero, got \"$columns\""
-    } elseif {$columns <= 0} {
-	return -code error "columns: expected integer greater than zero, got \"$columns\""
-    }
-
-    set styleName ""
-    switch -exact -- [llength $args] {
-	0 {# No style was specied. This is OK}
-	1 {
-	    # We possibly got the "style" keyword, but everything behind is missing
-	    return -code error "wrong # args: report name columns ?\"style\" styleName ?arg...??"
-	}
-	default {
-	    # Break tail apart, check for correct keyword, ensure that style is known too.
-	    # Don't forget to check the actual against the formal arguments.
-
-	    foreach {dummy styleName} $args break
-	    set args [lrange $args 2 end]
-
-	    if {![string equal $dummy style]} {
-		return -code error "wrong # args: report name columns ?\"style\" styleName ?arg...??"
-	    }
-	    if {![info exists styleargs($styleName)]} {
-		return -code error "style \"$styleName\" is not known"
-	    }
-	    CheckStyleArguments $styleName $args
-	}
-    }
-
-    # The arguments seem to be ok, setup the namespace for the object
-    # and configure it to style "plain".
-
-    namespace eval ::report::report$name "variable columns $columns"
-    namespace eval ::report::report$name {
-	variable tcaption 0
-	variable bcaption 0
-	variable template
-	variable enabled
-	variable hTemplate
-	variable vTemplate
-	variable lpad
-	variable rpad
-	variable csize
-	variable cjust
-
-	variable t
-	variable i
-	variable dt [list]
-	variable st [list]
-	for {set i 0} {$i < $columns} {incr i} {
-	    set lpad($i) ""
-	    set rpad($i) ""
-	    set csize($i) dyn
-	    set cjust($i) left
-	    lappend dt {}
-	    lappend st {} {}
-	}
-	lappend dt {}
-	lappend st {}
-
-	foreach t {
-	    topdata data botdata
-	} {
-	    set enabled($t) 1
-	    set template($t) $dt
-	    for {set i 0} {$i <= $columns} {incr i} {
-		set vTemplate($t,$i) {}
-	    }
-	}
-	foreach t {
-	    top topdatasep topcapsep
-	    datasep
-	    botcapsep botdatasep bottom
-	} {
-	    set enabled($t) 0
-	    set template($t) $st
-	    for {set i 0} {$i < $columns} {incr i} {
-		set hTemplate($t,$i) {}
-	    }
-	    for {set i 0} {$i <= $columns} {incr i} {
-		set vTemplate($t,$i) {}
-	    }
-	}
-
-	unset t i dt st
-    }
-
-    # Create the command to manipulate the report
-    #                 $name -> ::report::ReportProc $name
-    interp alias {} ::$name {} ::report::ReportProc $name
-
-    # If a style was specified execute it now, before the oobject is
-    # handed back to the user.
-
-    if {$styleName != {}} {
-	ExecuteStyle $name $styleName $args
-    }
-
-    return $name
-}
-
-# ::report::defstyle --
-#
-#	Defines a new named style, with arguments and defining script.
-#
-# Arguments:
-#	styleName	Name of the new style.
-#	arguments	Formal arguments of the style, some format as for proc.
-#	body		The script actually defining the style.
-#
-# Results:
-#	None.
-
-proc ::report::defstyle {styleName arguments body} {
-    variable styleargs
-    variable stylebody
-    variable styles
-
-    if {[info exists styleargs($styleName)]} {
-	return -code error "Cannot create style \"$styleName\", already exists"
-    }
-
-    # Check the formal arguments
-    # 1. Arguments without default may not follow an argument with a
-    #    default. The special "args" is no exception!
-    # 2. Compute the minimal number of arguments required by the proc.
-
-    set min 0
-    set def 0
-    set ca  0
-
-    foreach v $arguments {
-	switch -- [llength $v] {
-	    1 {
-		if {$def} {
-		    return -code error \
-			    "Found argument without default after arguments having defaults"
-		}
-		incr min
-	    }
-	    2 {
-		set def 1
-	    }
-	    default {
-		error "Illegal length of value \"$v\""
-	    }
-	}
-    }
-    if {[string equal args [lindex $arguments end]]} {
-	# Correct requirements if we have a catch-all at the end.
-	incr min -1
-	set  ca 1
-    }
-
-    # Now we are allowed to extend the internal database
-
-    set styleargs($styleName) [list $min $ca $arguments]
-    set stylebody($styleName) $body
-    lappend styles $styleName
-    return
-}
-
-# ::report::rmstyle --
-#
-#	Deletes the specified style.
-#
-# Arguments:
-#	styleName	Name of the style to destroy.
-#
-# Results:
-#	None.
-
-proc ::report::rmstyle {styleName} {
-    variable styleargs
-    variable stylebody
-    variable styles
-
-    if {![info exists styleargs($styleName)]} {
-	return -code error "cannot delete unknown style \"$styleName\""
-    }
-    if {[string equal $styleName plain]} {
-	return -code error {cannot delete builtin style "plain"}
-    }
-
-    unset styleargs($styleName)
-    unset stylebody($styleName)
-
-    set pos    [lsearch -exact $styles $styleName]
-    set styles [lreplace $styles $pos $pos]
-    return
-}
-
-# ::report::_stylearguments --
-#
-#	Introspection, returns the list of formal arguments of the
-#	specified style.
-#
-# Arguments:
-#	styleName	Name of the style to query.
-#
-# Results:
-#	A list containing the formal argument of the style
-
-proc ::report::stylearguments {styleName} {
-    variable styleargs
-    if {![info exists styleargs($styleName)]} {
-	return -code error "style \"$styleName\" is not known"
-    }
-    return [lindex $styleargs($styleName) 2]
-}
-
-# ::report::_stylebody --
-#
-#	Introspection, returns the body/script of the
-#	specified style.
-#
-# Arguments:
-#	styleName	Name of the style to query.
-#
-# Results:
-#	A script, the body of the style.
-
-proc ::report::stylebody {styleName} {
-    variable stylebody
-    if {![info exists stylebody($styleName)]} {
-	return -code error "style \"$styleName\" is not known"
-    }
-    return $stylebody($styleName)
-}
-
-# ::report::_styles --
-#
-#	Returns alist containing the names of all known styles.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list containing the names of all known styles
-
-proc ::report::styles {} {
-    variable styles
-    return  $styles
-}
-
-##########################
-# Private functions follow
-
-# ::report::CheckStyleArguments --
-#
-#	Internal helper. Used to check actual arguments of a style against the formal ones.
-#
-# Arguments:
-#	styleName	Name of the style in question
-#	arguments	Actual arguments for the style.
-#
-# Results:
-#	None, or an error in case of problems.
-
-proc ::report::CheckStyleArguments {styleName arguments} {
-    variable styleargs
-
-    # Match formal and actual arguments, error out in case of problems.
-    foreach {min catchall formal} $styleargs($styleName) break
-
-    if {[llength $arguments] < $min} {
-	# Determine the name of the first formal parameter which did not get a value.
-	set firstmissing [lindex $formal [llength $arguments]]
-	return -code error "no value given for parameter \"$firstmissing\" to style \"$styleName\""
-    } elseif {[llength $arguments] > $min} {
-	if {!$catchall && ([llength $arguments] > [llength $formal])} {
-	    # More actual arguments than formals, without catch-all argument, error
-	    return -code error "called style \"$styleName\" with too many arguments"
-	}
-    }
-}
-
-# ::report::ExecuteStyle --
-#
-#	Internal helper. Applies a named style to the specified report object.
-#
-# Arguments:
-#	name		Name of the report the style is applied to.
-#	styleName	Name of the style to apply
-#	arguments	Actual arguments for the style.
-#
-# Results:
-#	None.
-
-proc ::report::ExecuteStyle {name styleName arguments} {
-    variable styleargs
-    variable stylebody
-    variable styles
-    variable commands
-
-    CheckStyleArguments $styleName $arguments
-    foreach {min catchall formal} $styleargs($styleName) break
-
-    array set a {}
-
-    if {([llength $arguments] > $min) && $catchall} {
-	# #min = number of formal arguments - 1
-	set a(args) [lrange $arguments $min end]
-	set formal  [lrange $formal 0 end-1]
-	incr min -1
-	set arguments [lrange $arguments 0 $min]
-
-	# arguments and formal are now of equal length and we also
-	# know that there are no arguments having a default value.
-	foreach v $formal aval $arguments {
-	    set a($v) $aval
-	}
-    }
-
-    # More arguments than minimally required, but no more than formal
-    # arguments! Proceed to standard matching: Go through the actual
-    # values and associate them with a formal argument. Then fill the
-    # remaining formal arguments with their default values.
-
-    foreach aval $arguments {
-	set v      [lindex $formal 0]
-	set formal [lrange $formal 1 end]
-	if {[llength $v] > 1} {set v [lindex $v 0]}
-	set a($v) $aval
-    }
-
-    foreach vd $formal {
-	foreach {var default} $vd {
-	    set a($var) $default
-	}
-    }
-
-    # Create and initialize a safe interpreter, execute the style and
-    # then break everything down again.
-
-    set ip [interp create -safe]
-
-    # -- Report methods --
-
-    foreach m $commands {
-	# safe-ip method --> here report method
-	interp alias $ip $m {} $name $m
-    }
-
-    # -- Styles defined before this one --
-
-    foreach s $styles {
-	if {[string equal $s $styleName]} {break}
-	interp alias $ip $s {} ::report::LinkExec $name $s
-    }
-
-    # -- Arguments as variables --
-
-    foreach {var val} [array get a] {
-	$ip eval [list set $var $val]
-    }
-
-    # Finally execute / apply the style.
-
-    $ip eval $stylebody($styleName)
-    interp delete $ip
-    return
-}
-
-# ::report::_LinkExec --
-#
-#	Internal helper. Used for application of styles from within
-#	another style script. Collects the formal arguments into the
-#	one list which is expected by "ExecuteStyle".
-#
-# Arguments:
-#	name		Name of the report the style is applied to.
-#	styleName	Name of the style to apply
-#	args		Actual arguments for the style.
-#
-# Results:
-#	None.
-
-proc ::report::LinkExec {name styleName args} {
-    ExecuteStyle $name $styleName $args
-}
-
-# ::report::ReportProc --
-#
-#	Command that processes all report object commands.
-#
-# Arguments:
-#	name	Name of the report object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::report::ReportProc {name {cmd ""} args} {
-    variable tcode
-
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-
-    if {[info exists tcode($cmd)]} {
-	# Template codes are a bit special
-	eval [list ::report::_tAction $name $cmd] $args
-    } else {
-	if { [llength [info commands ::report::_$cmd]] == 0 } {
-	    variable commands
-	    set optlist [join $commands ", "]
-	    set optlist [linsert $optlist "end-1" "or"]
-	    error "bad option \"$cmd\": must be $optlist"
-	}
-	eval [list ::report::_$cmd $name] $args
-    }
-}
-
-# ::report::CheckColumn --
-#
-#	Helper to check and transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of columns.
-#
-# Arguments:
-#	columns Number of columns
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::report::CheckColumn {columns column} {
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    regsub -- {end-} $column {} column
-	    set cc [expr {$columns - 1 - $column}]
-	    if {($cc < 0) || ($cc >= $columns)} {
-		return -code error "column: index \"end-$column\" out of range"
-	    }
-	    return $cc
-	}
-	end {
-	    if {$columns <= 0} {
-		return -code error "column: index \"$column\" out of range"
-	    }
-	    return [expr {$columns - 1}]
-	}
-	{[0-9]+} {
-	    if {($column < 0) || ($column >= $columns)} {
-		return -code error "column: index \"$column\" out of range"
-	    }
-	    return $column
-	}
-	default {
-	    return -code error "column: syntax error in index \"$column\""
-	}
-    }
-}
-
-# ::report::CheckVerticals --
-#
-#	Internal helper. Used to check the consistency of all active
-#	templates with respect to the generated vertical separators
-#	(Same length).
-#
-# Arguments:
-#	name	Name of the report object to check.
-#
-# Results:
-#	None.
-
-proc ::report::CheckVerticals {name} {
-    upvar ::report::report${name}::vTemplate vTemplate
-    upvar ::report::report${name}::enabled   enabled
-    upvar ::report::report${name}::columns   columns
-    upvar ::report::report${name}::tcaption  tcaption
-    upvar ::report::report${name}::bcaption  bcaption
-
-    for {set c 0} {$c <= $columns} {incr c} {
-	# Collect all lengths for a column in a list, sort that and
-	# compare first against last element. If they are not equal we
-	# have found an inconsistent definition.
-
-	set     res [list]
-	lappend res [string length $vTemplate(data,$c)]
-
-	if {$tcaption > 0} {
-	    lappend res [string length $vTemplate(topdata,$c)]
-	    if {($tcaption > 1) && $enabled(topdatasep)} {
-		lappend res [string length $vTemplate(topdatasep,$c)]
-	    }
-	    if {$enabled(topcapsep)} {
-		lappend res [string length $vTemplate(topcapsep,$c)]
-	    }
-	}
-	if {$bcaption > 0} {
-	    lappend res [string length $vTemplate(botdata,$c)]
-	    if {($bcaption > 1) && $enabled(botdatasep)} {
-		lappend res [string length $vTemplate(botdatasep,$c)]
-	    }
-	    if {$enabled(botcapsep)} {
-		lappend res [string length $vTemplate(botcapsep,$c)]
-	    }
-	}
-	foreach t {top datasep bottom} {
-	    if {$enabled($t)} {
-		lappend res [string length $vTemplate($t,$c)]
-	    }
-	}
-
-	set res [lsort $res]
-
-	if {[lindex $res 0] != [lindex $res end]} {
-	    return -code error "inconsistent verticals in report"
-	}
-    }
-}
-
-# ::report::_tAction --
-#
-#	Implements the actions on templates (set, get, enable, disable, enabled)
-#
-# Arguments:
-#	name		Name of the report object.
-#	template	Name of the template to query or manipulate.
-#	cmd		The action applied to the template
-#	args		Additional arguments per action, see documentation.
-#
-# Results:
-#	None.
-
-proc ::report::_tAction {name template cmd args} {
-    # When coming in here we know that $template contains a legal
-    # template code. No need to check again. We need 'tcode'
-    # nevertheless to distinguish between separator (1) and data
-    # templates (0).
-
-    variable tcode
-
-    switch -exact -- $cmd {
-	set {
-	    if {[llength $args] != 1} {
-		return -code error "Wrong # args: $name $template $cmd template"
-	    }
-	    set templval [lindex $args 0]
-
-	    upvar ::report::report${name}::columns   columns
-	    upvar ::report::report${name}::template  tpl
-	    upvar ::report::report${name}::hTemplate hTemplate
-	    upvar ::report::report${name}::vTemplate vTemplate
-	    upvar ::report::report${name}::enabled   enabled	    
-
-	    if {$tcode($template)} {
-		# Separator template, expected size = 2*colums+1
-		if {[llength $templval] > (2*$columns+1)} {
-		    return -code error {template to long for number of columns in report}
-		} elseif {[llength $templval] < (2*$columns+1)} {
-		    return -code error {template to short for number of columns in report}
-		}
-
-		set tpl($template) $templval
-
-		set even 1
-		set c1   0
-		set c2   0
-		foreach item $templval {
-		    if {$even} {
-			set vTemplate($template,$c1) $item
-			incr c1
-			set even 0
-		    } else {
-			set hTemplate($template,$c2) $item
-			incr c2
-			set even 1
-		    }
-		}
-	    } else {
-		# Data template, expected size = columns+1
-		if {[llength $templval] > ($columns+1)} {
-		    return -code error {template to long for number of columns in report}
-		} elseif {[llength $templval] < ($columns+1)} {
-		    return -code error {template to short for number of columns in report}
-		}
-
-		set tpl($template) $templval
-
-		set c 0
-		foreach item $templval {
-		    set vTemplate($template,$c) $item
-		    incr c
-		}
-	    }
-	    if {$enabled($template)} {
-		# Perform checks for active separator templates and
-		# all data templates.
-		CheckVerticals $name
-	    }
-	}
-	get -
-	enable -
-	disable -
-	enabled {
-	    if {[llength $args] > 0} {
-		return -code error "Wrong # args: $name $template $cmd"
-	    }
-	    switch -exact -- $cmd {
-		get {
-		    upvar ::report::report${name}::template  tpl
-		    return $tpl($template)
-		}
-		enable {
-		    if {!$tcode($template)} {
-			# Data template, can't be enabled.
-			return -code error "Cannot enable data template \"$template\""
-		    }
-
-		    upvar ::report::report${name}::enabled enabled
-
-		    if {!$enabled($template)} {
-			set enabled($template) 1
-			CheckVerticals $name
-		    }
-
-		}
-		disable {
-		    if {!$tcode($template)} {
-			# Data template, can't be disabled.
-			return -code error "Cannot disable data template \"$template\""
-		    }
-
-		    upvar ::report::report${name}::enabled enabled
-		    if {$enabled($template)} {
-			set enabled($template) 0
-		    }
-		}
-		enabled {
-		    if {!$tcode($template)} {
-			# Data template, can't be disabled.
-			return -code error "Cannot query state of data template \"$template\""
-		    }
-
-		    upvar ::report::report${name}::enabled enabled
-		    return $enabled($template)
-		}
-		default {error "Can't happen, panic, run, shout"}
-	    }
-	}
-	default {
-	    return -code error "Unknown template command \"$cmd\""
-	}
-    }
-    return ""
-}
-
-# ::report::_tcaption --
-#
-#	Sets or queries the size of the top caption region of the report.
-#
-# Arguments:
-#	name	Name of the report object.
-#	size	The new size, if not empty. Emptiness indicates that a
-#		query was requested
-#
-# Results:
-#	None, or the current size of the top caption region
-
-proc ::report::_tcaption {name {size {}}} {
-    upvar ::report::report${name}::tcaption tcaption
-
-    if {$size == {}} {
-	return $tcaption
-    }
-    if {![string is integer $size]} {
-	return -code error "size: expected integer greater than or equal to zero, got \"$size\""
-    }
-    if {$size < 0} {
-	return -code error "size: expected integer greater than or equal to zero, got \"$size\""
-    }
-    if {$size == $tcaption} {
-	# No change, nothing to do
-	return ""
-    }
-    if {($size > 0) && ($tcaption == 0)} {
-	# Perform a consistency check after the assignment, the
-	# template might have been changed.
-	set tcaption $size
-	CheckVerticals $name
-    } else {
-	set tcaption $size
-    }
-    return ""
-}
-
-# ::report::_bcaption --
-#
-#	Sets or queries the size of the bottom caption region of the report.
-#
-# Arguments:
-#	name	Name of the report object.
-#	size	The new size, if not empty. Emptiness indicates that a
-#		query was requested
-#
-# Results:
-#	None, or the current size of the bottom caption region
-
-proc ::report::_bcaption {name {size {}}} {
-    upvar ::report::report${name}::bcaption bcaption
-
-    if {$size == {}} {
-	return $bcaption
-    }
-    if {![string is integer $size]} {
-	return -code error "size: expected integer greater than or equal to zero, got \"$size\""
-    }
-    if {$size < 0} {
-	return -code error "size: expected integer greater than or equal to zero, got \"$size\""
-    }
-    if {$size == $bcaption} {
-	# No change, nothing to do
-	return ""
-    }
-    if {($size > 0) && ($bcaption == 0)} {
-	# Perform a consistency check after the assignment, the
-	# template might have been changed.
-	set bcaption $size
-	CheckVerticals $name
-    } else {
-	set bcaption $size
-    }
-    return ""
-}
-
-# ::report::_size --
-#
-#	Sets or queries the size of the specified column.
-#
-# Arguments:
-#	name	Name of the report object.
-#	column	Index of the column to manipulate or query
-#	size	The new size, if not empty. Emptiness indicates that a
-#		query was requested
-#
-# Results:
-#	None, or the current size of the column
-
-proc ::report::_size {name column {size {}}} {
-    upvar ::report::report${name}::columns columns
-    upvar ::report::report${name}::csize   csize
-
-    set column [CheckColumn $columns $column]
-
-    if {$size == {}} {
-	return $csize($column)
-    }
-    if {[string equal $size dyn]} {
-	set csize($column) $size
-	return ""
-    }
-    if {![string is integer $size]} {
-	return -code error "expected integer greater than zero, got \"$size\""
-    }
-    if {$size <= 0} {
-	return -code error "expected integer greater than zero, got \"$size\""
-    }
-    set csize($column) $size
-    return ""
-}
-
-# ::report::_sizes --
-#
-#	Sets or queries the sizes of all columns.
-#
-# Arguments:
-#	name	Name of the report object.
-#	sizes	The new sizes, if not empty. Emptiness indicates that a
-#		query was requested
-#
-# Results:
-#	None, or a list containing the sizes of all columns.
-
-proc ::report::_sizes {name {sizes {}}} {
-    upvar ::report::report${name}::columns columns
-    upvar ::report::report${name}::csize   csize
-
-    if {$sizes == {}} {
-	set res [list]
-	foreach k [lsort -integer [array names csize]] {
-	    lappend res $csize($k)
-	}
-	return $res
-    }
-    if {[llength $sizes] != $columns} {
-	return -code error "Wrong # number of column sizes"
-    }
-    foreach size $sizes {
-	if {[string equal $size dyn]} {
-	    continue
-	}
-	if {![string is integer $size]} {
-	    return -code error "expected integer greater than zero, got \"$size\""
-	}
-	if {$size <= 0} {
-	    return -code error "expected integer greater than zero, got \"$size\""
-	}
-    }
-
-    set i 0
-    foreach s $sizes {
-	set csize($i) $s
-	incr i
-    }
-    return ""
-}
-
-# ::report::_pad --
-#
-#	Sets or queries the padding for the specified column.
-#
-# Arguments:
-#	name	Name of the report object.
-#	column	Index of the column to manipulate or query
-#	where	Where to place the padding. Emptiness indicates
-#		that a query was requested.
-#
-# Results:
-#	None, or the padding for the specified column.
-
-proc ::report::_pad {name column {where {}} {string { }}} {
-    upvar ::report::report${name}::columns columns
-    upvar ::report::report${name}::lpad   lpad
-    upvar ::report::report${name}::rpad   rpad
-
-    set column [CheckColumn $columns $column]
-
-    if {$where == {}} {
-	return [list $lpad($column) $rpad($column)]
-    }
-
-    switch -exact -- $where {
-	left {
-	    set lpad($column) $string
-	}
-	right {
-	    set rpad($column) $string
-	}
-	both {
-	    set lpad($column) $string
-	    set rpad($column) $string
-	}
-	default {
-	    return -code error "where: expected left, right, or both, got \"$where\""
-	}
-    }
-    return ""
-}
-
-# ::report::_justify --
-#
-#	Sets or queries the justification for the specified column.
-#
-# Arguments:
-#	name	Name of the report object.
-#	column	Index of the column to manipulate or query
-#	jvalue	Justification to set. Emptiness indicates
-#		that a query was requested
-#
-# Results:
-#	None, or the current justication for the specified column
-
-proc ::report::_justify {name column {jvalue {}}} {
-    upvar ::report::report${name}::columns columns
-    upvar ::report::report${name}::cjust   cjust
-
-    set column [CheckColumn $columns $column]
-
-    if {$jvalue == {}} {
-	return $cjust($column)
-    }
-    switch -exact -- $jvalue {
-	left - right - center {
-	    set cjust($column) $jvalue
-	    return ""
-	}
-	default {
-	    return -code error "justification: expected, left, right, or center, got \"$jvalue\""
-	}
-    }
-}
-
-# ::report::_printmatrix --
-#
-#	Format the specified matrix according to the configuration of
-#	the report.
-#
-# Arguments:
-#	name	Name of the report object.
-#	matrix	Name of the matrix object to format.
-#
-# Results:
-#	A string containing the formatted matrix.
-
-proc ::report::_printmatrix {name matrix} {
-    CheckMatrix $name $matrix
-    ColumnSizes $name $matrix state
-
-    upvar ::report::report${name}::tcaption tcaption
-    upvar ::report::report${name}::bcaption bcaption
-
-    set    row 0
-    set    out ""
-    append out [Separator top $name $matrix state]
-    if {$tcaption > 0} {
-	set n $tcaption
-	while {$n > 0} {
-	    append out [FormatData topdata $name state [$matrix get row $row] [$matrix rowheight $row]]
-	    if {$n > 1} {
-		append out [Separator topdatasep $name $matrix state]
-	    }
-	    incr n -1
-	    incr row
-	}
-	append out [Separator topcapsep $name $matrix state]
-    }
-
-    set n [expr {[$matrix rows] - $bcaption}]
-
-    while {$row < $n} {
-	append out [FormatData data $name state [$matrix get row $row] [$matrix rowheight $row]]
-	incr row
-	if {$row < $n} {
-	    append out [Separator datasep $name $matrix state]
-	}
-    }
-
-    if {$bcaption > 0} {
-	append out [Separator botcapsep $name $matrix state]
-	set n $bcaption
-	while {$n > 0} {
-	    append out [FormatData botdata $name state [$matrix get row $row] [$matrix rowheight $row]]
-	    if {$n > 1} {
-		append out [Separator botdatasep $name $matrix state]
-	    }
-	    incr n -1
-	    incr row
-	}
-    }
-
-    append out [Separator bottom $name $matrix state]
-
-    #parray state
-    return $out
-}
-
-# ::report::_printmatrix2channel --
-#
-#	Format the specified matrix according to the configuration of
-#	the report.
-#
-# Arguments:
-#	name	Name of the report.
-#	matrix	Name of the matrix object to format.
-#	chan	Handle of the channel to write the formatting result into.
-#
-# Results:
-#	None.
-
-proc ::report::_printmatrix2channel {name matrix chan} {
-    CheckMatrix $name $matrix
-    ColumnSizes $name $matrix state
-
-    upvar ::report::report${name}::tcaption tcaption
-    upvar ::report::report${name}::bcaption bcaption
-
-    set    row 0
-    puts -nonewline $chan [Separator top $name $matrix state]
-    if {$tcaption > 0} {
-	set n $tcaption
-	while {$n > 0} {
-	    puts -nonewline $chan \
-		    [FormatData topdata $name state [$matrix get row $row] [$matrix rowheight $row]]
-	    if {$n > 1} {
-		puts -nonewline $chan [Separator topdatasep $name $matrix state]
-	    }
-	    incr n -1
-	    incr row
-	}
-	puts -nonewline $chan [Separator topcapsep $name $matrix state]
-    }
-
-    set n [expr {[$matrix rows] - $bcaption}]
-
-    while {$row < $n} {
-	puts -nonewline $chan \
-		[FormatData data $name state [$matrix get row $row] [$matrix rowheight $row]]
-	incr row
-	if {$row < $n} {
-	    puts -nonewline $chan [Separator datasep $name $matrix state]
-	}
-    }
-
-    if {$bcaption > 0} {
-	puts -nonewline $chan [Separator botcapsep $name $matrix state]
-	set n $bcaption
-	while {$n > 0} {
-	    puts -nonewline $chan \
-		    [FormatData botdata $name state [$matrix get row $row] [$matrix rowheight $row]]
-	    if {$n > 1} {
-		puts -nonewline $chan [Separator botdatasep $name $matrix state]
-	    }
-	    incr n -1
-	    incr row
-	}
-    }
-
-    puts -nonewline $chan [Separator bottom $name $matrix state]
-    return
-}
-
-# ::report::_columns --
-#
-#	Retrieves the number of columns in the report.
-#
-# Arguments:
-#	name	Name of the report queried
-#
-# Results:
-#	A number
-
-proc ::report::_columns {name} {
-    upvar ::report::report${name}::columns columns
-    return $columns
-}
-
-# ::report::_destroy --
-#
-#	Destroy a report, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the report to destroy.
-#
-# Results:
-#	None.
-
-proc ::report::_destroy {name} {
-    namespace delete ::report::report$name
-    interp alias {} ::$name {}
-    return
-}
-
-# ::report::CheckMatrix --
-#
-#	Internal helper for the "print" methods. Checks that the
-#	supplied matrix can be formatted by the specified report.
-#
-# Arguments:
-#	name	Name of the report to use for the formatting
-#	matrix	Name of the matrix to format.
-#
-# Results:
-#	None, or an error in case of problems.
-
-proc ::report::CheckMatrix {name matrix} {
-    upvar ::report::report${name}::columns  columns
-    upvar ::report::report${name}::tcaption tcaption
-    upvar ::report::report${name}::bcaption bcaption
-
-    if {$columns != [$matrix columns]} {
-	return -code error "report/matrix mismatch in number of columns"
-    }
-    if {($tcaption + $bcaption) > [$matrix rows]} {
-	return -code error "matrix too small, top and bottom captions overlap"
-    }
-}
-
-# ::report::ColumnSizes --
-#
-#	Internal helper for the "print" methods. Computes the final
-#	column sizes (with and without padding) and stores them in
-#	the print-state
-#
-# Arguments:
-#	name		Name of the report used for the formatting
-#	matrix		Name of the matrix to format.
-#	statevar	Name of the array variable holding the state
-#			of the formatter.
-#
-# Results:
-#	None.
-
-proc ::report::ColumnSizes {name matrix statevar} {
-    # Calculate the final column sizes with and without padding and
-    # store them in the local state.
-
-    upvar $statevar state
-
-    upvar ::report::report${name}::columns  columns
-    upvar ::report::report${name}::csize    csize
-    upvar ::report::report${name}::lpad     lpad
-    upvar ::report::report${name}::rpad     rpad
-
-    for {set c 0} {$c < $columns} {incr c} {
-	if {[string equal dyn $csize($c)]} {
-	    set size [$matrix columnwidth $c]
-	} else {
-	    set size $csize($c)
-	}
-
-	set state(s,$c) $size
-
-	incr size [string length $lpad($c)]
-	incr size [string length $rpad($c)]
-
-	set state(s/pad,$c) $size
-    }
-
-    return
-}
-
-# ::report::Separator --
-#
-#	Internal helper for the "print" methods. Computes the final
-#	shape of the various separators using the column sizes with
-#	padding found in the print state. Uses also the print state as
-#	a cache to avoid costly recomputation for the separators which
-#	are used multiple times.
-#
-# Arguments:
-#	tcode		Code of the separator to compute / template to use
-#	name		Name of the report used for the formatting
-#	matrix		Name of the matrix to format.
-#	statevar	Name of the array variable holding the state
-#			of the formatter.
-#
-# Results:
-#	The final separator string. Empty for disabled separators.
-
-proc ::report::Separator {tcode name matrix statevar} {
-    upvar ::report::report${name}::enabled  e
-    if {!$e($tcode)} {return ""}
-    upvar $statevar state
-    if {![info exists state($tcode)]} {
-	upvar ::report::report${name}::vTemplate vt
-	upvar ::report::report${name}::hTemplate ht
-	upvar ::report::report${name}::columns   cs
-	set str ""
-	for {set c 0} {$c < $cs} {incr c} {
-	    append str $vt($tcode,$c)
-	    set fill $ht($tcode,$c)
-	    set flen [string length $fill]
-	    set rep  [expr {($state(s/pad,$c)/$flen)+1}]
-	    append str [string range [string repeat $fill $rep] 0 [expr {$state(s/pad,$c)-1}]]
-	}
-	append str $vt($tcode,$cs)
-	set state($tcode) $str
-    }
-    return $state($tcode)\n
-}
-
-# ::report::FormatData --
-#
-#	Internal helper for the "print" methods. Computes the output
-#	for one row in the matrix, given its values, the rowheight,
-#	padding and justification.
-#
-# Arguments:
-#	tcode		Code of the data template to use
-#	name		Name of the report used for the formatting
-#	statevar	Name of the array variable holding the state
-#			of the formatter.
-#	line		List containing the values to format
-#	rh		Height of the row (line) in lines.
-#
-# Results:
-#	The formatted string for the supplied row.
-
-proc ::report::FormatData {tcode name statevar line rh} {
-    upvar $statevar state
-    upvar ::report::report${name}::vTemplate vt
-    upvar ::report::report${name}::columns   cs
-    upvar ::report::report${name}::lpad      lpad
-    upvar ::report::report${name}::rpad      rpad
-    upvar ::report::report${name}::cjust     cjust
-
-    if {$rh == 1} {
-	set str ""
-	set c 0
-	foreach cell $line {
-	    # prefix, cell (pad-l, value, pad-r)
-	    append str $vt($tcode,$c)$lpad($c)[FormatCell $cell $state(s,$c) $cjust($c)]$rpad($c)
-	    incr c
-	}
-	append str $vt($tcode,$cs)\n
-	return $str
-    } else {
-	array set str {}
-	for {set l 1} {$l <= $rh} {incr l} {set str($l) ""}
-
-	# - Future - Vertical justification of cells less tall than rowheight
-	# - Future - Vertical cutff aftert n lines, auto-repeat of captions
-	# - Future - => Higher level, not here, use virtual matrices for this
-	# - Future -  and count the generated lines
-
-	set c 0
-	foreach fcell $line {
-	    set fcell [split $fcell \n]
-	    for {set l 1; set lo 0} {$l <= $rh} {incr l; incr lo} {
-		append str($l) $vt($tcode,$c)$lpad($c)[FormatCell \
-			[lindex $fcell $lo] $state(s,$c) $cjust($c)]$rpad($c)
-	    }
-	    incr c
-	}
-	set strout ""
-	for {set l 1} {$l <= $rh} {incr l} {
-	    append strout $str($l)$vt($tcode,$cs)\n
-	}
-	return $strout
-    }
-}
-
-# ::report::FormatCell --
-#
-#	Internal helper for the "print" methods. Formats the value of
-#	a single cell according to column size and justification.
-#
-# Arguments:
-#	value	The value to format
-#	size	The size of the column, without padding
-#	just	The justification for the current cell/column
-#
-# Results:
-#	The formatted string for the supplied cell.
-
-proc ::report::FormatCell {value size just} {
-    set vlen [string length $value]
-
-    if {$vlen == $size} {
-	# Value fits exactly, justification is irrelevant
-	return $value
-    }
-
-    # - Future - Other fill characters ...
-    # - Future - Different fill characters per class of value => regex/glob pattern|functions
-    # - Future - Wraparound - interacts with rowheight!
-
-    switch -exact -- $just {
-	left {
-	    if {$vlen < $size} {
-		return $value[string repeat " " [expr {$size - $vlen}]]
-	    }
-	    return [string range $value [expr {$vlen - $size}] end]
-	}
-	right {
-	    if {$vlen < $size} {
-		return [string repeat " " [expr {$size - $vlen}]]$value
-	    }
-	    incr size -1
-	    return [string range $value 0 $size]
-	}
-	center {
-	    if {$vlen < $size} {
-		set fill  [expr {$size - $vlen}]
-		set rfill [expr {$fill / 2}]
-		set lfill [expr {$fill - $rfill}]
-		return [string repeat " " $lfill]$value[string repeat " " $rfill]
-	    }
-
-	    set cut  [expr {$vlen - $size}]
-	    set lcut [expr {$cut / 2}]
-	    set rcut [expr {$cut - $lcut}]
-
-	    return [string range $value $lcut end-$rcut]
-	}
-	default {
-	    error "Can't happen, panic, run, shout"
-	}
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,11 +1,0 @@
-# pkgIndex.tcl - 
-#
-# RIPEMD package index file
-#
-# This package has been tested with tcl 8.2.3 and above.
-#
-# $Id: pkgIndex.tcl,v 1.5 2005/02/23 12:41:37 patthoyts Exp $
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded ripemd128 1.0.3 [list source [file join $dir ripemd128.tcl]]
-package ifneeded ripemd160 1.0.3 [list source [file join $dir ripemd160.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/ripemd128.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/ripemd128.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,730 +1,0 @@
-# ripemd128.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sf.net>
-#
-# This is a Tcl-only implementation of the RIPEMD-128 hash algorithm as 
-# described in [RIPE].
-# Included is an implementation of keyed message authentication using 
-# the RIPEMD-128 function [HMAC].
-#
-# See http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/
-#
-# [RIPE] Dobbertin, H., Bosselaers A., and Preneel, B.
-#        "RIPEMD-160: A Strengthened Version of RIPEMD" 
-#        Fast Software Encryption, LNCS 1039, D. Gollmann, Ed., 
-#        Springer-Verlag, 1996, pp. 71-82
-# [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, 
-#       "HMAC: Keyed-Hashing for Message Authentication",
-#        RFC 2104, February 1997.
-#
-# RFC 2286, ``Test cases for HMAC-RIPEMD160 and HMAC-RIPEMD128,''
-# Internet Request for Comments 2286, J. Kapp, 
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: ripemd128.tcl,v 1.9 2005/10/17 19:39:52 andreas_kupries Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::ripemd {
-    namespace eval ripemd128 {
-        variable version 1.0.3
-        variable rcsid {$Id: ripemd128.tcl,v 1.9 2005/10/17 19:39:52 andreas_kupries Exp $}
-        variable accel
-        array set accel {trf 0}
-
-        variable uid
-        if {![info exists uid]} {
-            set uid 0
-        }
-
-        namespace export ripemd128 hmac128 Hex \
-            RIPEMD128Init RIPEMD128Update RIPEMD128Final \
-            RIPEHMAC128Init RIPEHMAC128Update RIPEHMAC128Final
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# RIPEMD128Init - create and initialize an MD4 state variable. This will be
-# cleaned up when we call MD4Final
-#
-proc ::ripemd::ripemd128::RIPEMD128Init {} {
-    variable accel
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # Initialize RIPEMD-128 state structure (same as MD4).
-    array set state \
-        [list \
-             A [expr {0x67452301}] \
-             B [expr {0xefcdab89}] \
-             C [expr {0x98badcfe}] \
-             D [expr {0x10325476}] \
-             n 0 i "" ]
-    if {$accel(trf)} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::ripemd128 -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-proc ::ripemd::ripemd128::RIPEMD128Update {token data} {
-    upvar #0 $token state
-
-    if {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        RIPEMD128Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-proc ::ripemd::ripemd128::RIPEMD128Final {token} {
-    upvar #0 $token state
-
-    if {[info exists state(trf)]} {
-        close $state(trf)
-        set r $state(trfwrite)
-        unset state
-        return $r
-    }
-
-    # RFC1320:3.1 - Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # RFC1320:3.2 - Append length in bits as little-endian wide int.
-    append state(i) [binary format ii [expr {8 * $state(n)}] 0]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        RIPEMD128Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # RFC1320:3.5 - Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-proc ::ripemd::ripemd128::RIPEHMAC128Init {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the RIPEMD-128 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [RIPEMD128Init]
-        RIPEMD128Update $tok $K
-        set K [RIPEMD128Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [RIPEMD128Init]
-    RIPEMD128Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-proc ::ripemd::ripemd128::RIPEHMAC128Update {token data} {
-    RIPEMD128Update $token $data
-    return
-}
-
-proc ::ripemd::ripemd128::RIPEHMAC128Final {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set tok [RIPEMD128Init];            # init the outer hashing function
-    RIPEMD128Update $tok $state(Ko);    # prepare with the outer pad.
-    RIPEMD128Update $tok [RIPEMD128Final $token];  # hash the inner result
-    return [RIPEMD128Final $tok]
-}
-
-# -------------------------------------------------------------------------
-
-set ::ripemd::ripemd128::RIPEMD128Hash_body {
-    variable $token
-    upvar 0 $token state
-
-    # RFC1320:3.4 - Process Message in 16-Word Blocks
-    binary scan $msg i* blocks
-    foreach {X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15} $blocks {
-        set A $state(A)   ;  set AA $state(A)
-        set B $state(B)   ;  set BB $state(B)
-        set C $state(C)   ;  set CC $state(C)
-        set D $state(D)   ;  set DD $state(D)
-
-        # Round 1 (track 1). 
-        #    F(x,y,z) = x ^ y ^ z
-        # Let [abcd x s] denote the operation
-        #    a = (a + F(b,c,d) + X[x]) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  0  11]  [DABC  1  14]  [CDAB  2 15]  [BCDA  3 12]
-        set A [expr {($A + [F $B $C $D] + $X0)  <<< 11}]
-        set D [expr {($D + [F $A $B $C] + $X1)  <<< 14}]
-        set C [expr {($C + [F $D $A $B] + $X2)  <<< 15}]
-        set B [expr {($B + [F $C $D $A] + $X3)  <<< 12}]
-        # [ABCD  4  5]  [DABC  5  8]  [CDAB  6 7]  [BCDA  7 9]
-        set A [expr {($A + [F $B $C $D] + $X4)  <<< 5}]
-        set D [expr {($D + [F $A $B $C] + $X5)  <<< 8}]
-        set C [expr {($C + [F $D $A $B] + $X6)  <<< 7}]
-        set B [expr {($B + [F $C $D $A] + $X7)  <<< 9}]
-        # [ABCD  8  11]  [DABC  9  13]  [CDAB 10 14]  [BCDA 11 15]
-        set A [expr {($A + [F $B $C $D] + $X8)  <<< 11}]
-        set D [expr {($D + [F $A $B $C] + $X9)  <<< 13}]
-        set C [expr {($C + [F $D $A $B] + $X10) <<< 14}]
-        set B [expr {($B + [F $C $D $A] + $X11) <<< 15}]
-        # [ABCD 12  6]  [DABC 13  7]  [CDAB 14 9]  [BCDA 15 8]
-        set A [expr {($A + [F $B $C $D] + $X12) <<< 6}]
-        set D [expr {($D + [F $A $B $C] + $X13) <<< 7}]
-        set C [expr {($C + [F $D $A $B] + $X14) <<< 9}]
-        set B [expr {($B + [F $C $D $A] + $X15) <<< 8}]
-
-        # Round 2 (track 1).
-        #   G(x, y, z) = (x & y) | (~x & z)
-        # Let [abcd k s] denote the operation
-        #   a = (a + G(b,c,d) + X[k] + 5A827999) <<< s
-        # Do the following 16 operations.
-        # [ABCD  7  7]  [DABC  4  6]  [CDAB  13  8]  [BCDA 1 13]
-        set A [expr {($A + [G $B $C $D] + $X7  + 0x5a827999) <<< 7}]
-        set D [expr {($D + [G $A $B $C] + $X4  + 0x5a827999) <<< 6}]
-        set C [expr {($C + [G $D $A $B] + $X13 + 0x5a827999) <<< 8}]
-        set B [expr {($B + [G $C $D $A] + $X1  + 0x5a827999) <<< 13}]
-        # [ABCD  10  11]  [DABC  6  9]  [CDAB  15  7]  [BCDA 3 15]
-        set A [expr {($A + [G $B $C $D] + $X10 + 0x5a827999) <<< 11}]
-        set D [expr {($D + [G $A $B $C] + $X6  + 0x5a827999) <<< 9}]
-        set C [expr {($C + [G $D $A $B] + $X15 + 0x5a827999) <<< 7}]
-        set B [expr {($B + [G $C $D $A] + $X3  + 0x5a827999) <<< 15}]
-        # [ABCD 12  7]  [DABC  0  12]  [CDAB 9  15]  [BCDA 5 9]
-        set A [expr {($A + [G $B $C $D] + $X12 + 0x5a827999) <<< 7}]
-        set D [expr {($D + [G $A $B $C] + $X0  + 0x5a827999) <<< 12}]
-        set C [expr {($C + [G $D $A $B] + $X9  + 0x5a827999) <<< 15}]
-        set B [expr {($B + [G $C $D $A] + $X5  + 0x5a827999) <<< 9}]
-        # [ABCD  2  11]  [DABC  14  7]  [CDAB 11  13]  [BCDA 8 12]
-        set A [expr {($A + [G $B $C $D] + $X2  + 0x5a827999) <<< 11}]
-        set D [expr {($D + [G $A $B $C] + $X14 + 0x5a827999) <<< 7}]
-        set C [expr {($C + [G $D $A $B] + $X11 + 0x5a827999) <<< 13}]
-        set B [expr {($B + [G $C $D $A] + $X8  + 0x5a827999) <<< 12}]
-        
-        # Round 3 (track 1).
-        #   H(x,y,z) = (x | ~y) ^ z
-        # Let [abcd k s] denote the operation
-        #   a = (a + H(b,c,d) + X[k] + 6ED9EBA1) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  3  11]  [DABC  10  13]  [CDAB  14 6]  [BCDA 4 7]
-        set A [expr {($A + [H $B $C $D] + $X3  + 0x6ed9eba1) <<< 11}]
-        set D [expr {($D + [H $A $B $C] + $X10 + 0x6ed9eba1) <<< 13}]
-        set C [expr {($C + [H $D $A $B] + $X14 + 0x6ed9eba1) <<< 6}]
-        set B [expr {($B + [H $C $D $A] + $X4  + 0x6ed9eba1) <<< 7}]
-        # [ABCD  9  14]  [DABC 15  9]  [CDAB  8 13]  [BCDA 1 15]
-        set A [expr {($A + [H $B $C $D] + $X9  + 0x6ed9eba1) <<< 14}]
-        set D [expr {($D + [H $A $B $C] + $X15 + 0x6ed9eba1) <<< 9}]
-        set C [expr {($C + [H $D $A $B] + $X8  + 0x6ed9eba1) <<< 13}]
-        set B [expr {($B + [H $C $D $A] + $X1  + 0x6ed9eba1) <<< 15}]
-        # [ABCD  2  14]  [DABC  7  8]  [CDAB  0 13]  [BCDA 6 6]
-        set A [expr {($A + [H $B $C $D] + $X2  + 0x6ed9eba1) <<< 14}]
-        set D [expr {($D + [H $A $B $C] + $X7  + 0x6ed9eba1) <<< 8}]
-        set C [expr {($C + [H $D $A $B] + $X0  + 0x6ed9eba1) <<< 13}]
-        set B [expr {($B + [H $C $D $A] + $X6  + 0x6ed9eba1) <<< 6}]
-        # [ABCD  13  5]  [DABC 11  12]  [CDAB  5 7]  [BCDA 12  5]
-        set A [expr {($A + [H $B $C $D] + $X13 + 0x6ed9eba1) <<< 5}]
-        set D [expr {($D + [H $A $B $C] + $X11 + 0x6ed9eba1) <<< 12}]
-        set C [expr {($C + [H $D $A $B] + $X5  + 0x6ed9eba1) <<< 7}]
-        set B [expr {($B + [H $C $D $A] + $X12 + 0x6ed9eba1) <<< 5}]
-
-        # Round 4 (track 1).
-        #   I(x,y,z) = (x & z) | (y & ^ ~z)
-        # Let [abcd k s] denote the operation
-        #   a = (a + I(b,c,d) + X[k] + 8F1BBCDC) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  1  11]  [DABC  9  12]  [CDAB  11 14]  [BCDA 10 15]
-        set A [expr {($A + [I $B $C $D] + $X1  + 0x8f1bbcdc) <<< 11}]
-        set D [expr {($D + [I $A $B $C] + $X9  + 0x8f1bbcdc) <<< 12}]
-        set C [expr {($C + [I $D $A $B] + $X11 + 0x8f1bbcdc) <<< 14}]
-        set B [expr {($B + [I $C $D $A] + $X10 + 0x8f1bbcdc) <<< 15}]
-        # [ABCD  0  14]  [DABC 8  15]  [CDAB 12 9]  [BCDA 4 8]
-        set A [expr {($A + [I $B $C $D] + $X0  + 0x8f1bbcdc) <<< 14}]
-        set D [expr {($D + [I $A $B $C] + $X8  + 0x8f1bbcdc) <<< 15}]
-        set C [expr {($C + [I $D $A $B] + $X12 + 0x8f1bbcdc) <<< 9}]
-        set B [expr {($B + [I $C $D $A] + $X4  + 0x8f1bbcdc) <<< 8}]
-        # [ABCD  13  9]  [DABC  3  14]  [CDAB  7 5]  [BCDA 15 6]
-        set A [expr {($A + [I $B $C $D] + $X13 + 0x8f1bbcdc) <<< 9}]
-        set D [expr {($D + [I $A $B $C] + $X3  + 0x8f1bbcdc) <<< 14}]
-        set C [expr {($C + [I $D $A $B] + $X7  + 0x8f1bbcdc) <<< 5}]
-        set B [expr {($B + [I $C $D $A] + $X15 + 0x8f1bbcdc) <<< 6}]
-        # [ABCD  14  8]  [DABC 5  6]  [CDAB  6 5]  [BCDA 2 12]
-        set A [expr {($A + [I $B $C $D] + $X14 + 0x8f1bbcdc) <<< 8}]
-        set D [expr {($D + [I $A $B $C] + $X5  + 0x8f1bbcdc) <<< 6}]
-        set C [expr {($C + [I $D $A $B] + $X6  + 0x8f1bbcdc) <<< 5}]
-        set B [expr {($B + [I $C $D $A] + $X2  + 0x8f1bbcdc) <<< 12}]
-
-
-        # Round 1 (track 2).
-        #   I(x,y,z) = (x & z) | (y & ^ ~z)
-        # Let [abcd k s] denote the operation
-        #   a = (a + I(b,c,d) + X[k] + 50A28BE6) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  5  8]  [DABC  14  9]  [CDAB  7 9]  [BCDA 0 11]
-        set AA [expr {($AA + [I $BB $CC $DD] + $X5  + 0x50a28be6) <<< 8}]
-        set DD [expr {($DD + [I $AA $BB $CC] + $X14 + 0x50a28be6) <<< 9}]
-        set CC [expr {($CC + [I $DD $AA $BB] + $X7  + 0x50a28be6) <<< 9}]
-        set BB [expr {($BB + [I $CC $DD $AA] + $X0  + 0x50a28be6) <<< 11}]
-        # [ABCD  9  13]  [DABC 2  15]  [CDAB 11 15]  [BCDA 4 5]
-        set AA [expr {($AA + [I $BB $CC $DD] + $X9  + 0x50a28be6) <<< 13}]
-        set DD [expr {($DD + [I $AA $BB $CC] + $X2  + 0x50a28be6) <<< 15}]
-        set CC [expr {($CC + [I $DD $AA $BB] + $X11 + 0x50a28be6) <<< 15}]
-        set BB [expr {($BB + [I $CC $DD $AA] + $X4  + 0x50a28be6) <<< 5}]
-        # [ABCD  13  7]  [DABC  6  7]  [CDAB  15 8]  [BCDA 8 11]
-        set AA [expr {($AA + [I $BB $CC $DD] + $X13 + 0x50a28be6) <<< 7}]
-        set DD [expr {($DD + [I $AA $BB $CC] + $X6  + 0x50a28be6) <<< 7}]
-        set CC [expr {($CC + [I $DD $AA $BB] + $X15 + 0x50a28be6) <<< 8}]
-        set BB [expr {($BB + [I $CC $DD $AA] + $X8  + 0x50a28be6) <<< 11}]
-        # [ABCD  1  14]  [DABC 10  14]  [CDAB  3 12]  [BCDA 12 6]
-        set AA [expr {($AA + [I $BB $CC $DD] + $X1  + 0x50a28be6) <<< 14}]
-        set DD [expr {($DD + [I $AA $BB $CC] + $X10 + 0x50a28be6) <<< 14}]
-        set CC [expr {($CC + [I $DD $AA $BB] + $X3  + 0x50a28be6) <<< 12}]
-        set BB [expr {($BB + [I $CC $DD $AA] + $X12 + 0x50a28be6) <<< 6}]
-
-        # Round 2 (track 2).
-        #   H(x,y,z) = (x | ~y) ^ z
-        # Let [abcd k s] denote the operation
-        #   a = (a + H(b,c,d) + X[k] + 5C4DD124) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  6  9]  [DABC  11  13]  [CDAB  3 15]  [BCDA 7 7]
-        set AA [expr {($AA + [H $BB $CC $DD] + $X6  + 0x5c4dd124) <<< 9}]
-        set DD [expr {($DD + [H $AA $BB $CC] + $X11 + 0x5c4dd124) <<< 13}]
-        set CC [expr {($CC + [H $DD $AA $BB] + $X3  + 0x5c4dd124) <<< 15}]
-        set BB [expr {($BB + [H $CC $DD $AA] + $X7  + 0x5c4dd124) <<< 7}]
-        # [ABCD  0  12]  [DABC 13  8]  [CDAB 5 9]  [BCDA 10 11]
-        set AA [expr {($AA + [H $BB $CC $DD] + $X0  + 0x5c4dd124) <<< 12}]
-        set DD [expr {($DD + [H $AA $BB $CC] + $X13 + 0x5c4dd124) <<< 8}]
-        set CC [expr {($CC + [H $DD $AA $BB] + $X5  + 0x5c4dd124) <<< 9}]
-        set BB [expr {($BB + [H $CC $DD $AA] + $X10 + 0x5c4dd124) <<< 11}]
-        # [ABCD  14  7]  [DABC  15  7]  [CDAB  8 12]  [BCDA 12 7]
-        set AA [expr {($AA + [H $BB $CC $DD] + $X14 + 0x5c4dd124) <<< 7}]
-        set DD [expr {($DD + [H $AA $BB $CC] + $X15 + 0x5c4dd124) <<< 7}]
-        set CC [expr {($CC + [H $DD $AA $BB] + $X8  + 0x5c4dd124) <<< 12}]
-        set BB [expr {($BB + [H $CC $DD $AA] + $X12 + 0x5c4dd124) <<< 7}]
-        # [ABCD  4  6]  [DABC 9  15]  [CDAB  1 13]  [BCDA 2 11]
-        set AA [expr {($AA + [H $BB $CC $DD] + $X4  + 0x5c4dd124) <<< 6}]
-        set DD [expr {($DD + [H $AA $BB $CC] + $X9  + 0x5c4dd124) <<< 15}]
-        set CC [expr {($CC + [H $DD $AA $BB] + $X1  + 0x5c4dd124) <<< 13}]
-        set BB [expr {($BB + [H $CC $DD $AA] + $X2  + 0x5c4dd124) <<< 11}]
-
-        # Round 3 (track 2).
-        #   G(x, y, z) = (x & y) | (~x & z)
-        # Let [abcd k s] denote the operation
-        #   a = (a + G(b,c,d) + X[k] + 6D703EF3) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  15  9]  [DABC  5 7]  [CDAB  1 15]  [BCDA 3 11]
-        set AA [expr {($AA + [G $BB $CC $DD] + $X15 + 0x6d703ef3) <<< 9}]
-        set DD [expr {($DD + [G $AA $BB $CC] + $X5  + 0x6d703ef3) <<< 7}]
-        set CC [expr {($CC + [G $DD $AA $BB] + $X1  + 0x6d703ef3) <<< 15}]
-        set BB [expr {($BB + [G $CC $DD $AA] + $X3  + 0x6d703ef3) <<< 11}]
-        # [ABCD  7  8]  [DABC 14  6]  [CDAB 6 6]  [BCDA 9 14]
-        set AA [expr {($AA + [G $BB $CC $DD] + $X7  + 0x6d703ef3) <<< 8}]
-        set DD [expr {($DD + [G $AA $BB $CC] + $X14 + 0x6d703ef3) <<< 6}]
-        set CC [expr {($CC + [G $DD $AA $BB] + $X6  + 0x6d703ef3) <<< 6}]
-        set BB [expr {($BB + [G $CC $DD $AA] + $X9  + 0x6d703ef3) <<< 14}]
-        # [ABCD  11  12]  [DABC  8  13]  [CDAB  12 5]  [BCDA 2 14]
-        set AA [expr {($AA + [G $BB $CC $DD] + $X11 + 0x6d703ef3) <<< 12}]
-        set DD [expr {($DD + [G $AA $BB $CC] + $X8  + 0x6d703ef3) <<< 13}]
-        set CC [expr {($CC + [G $DD $AA $BB] + $X12 + 0x6d703ef3) <<< 5}]
-        set BB [expr {($BB + [G $CC $DD $AA] + $X2  + 0x6d703ef3) <<< 14}]
-        # [ABCD  10  13]  [DABC 0  13]  [CDAB  4 7]  [BCDA 13 5]
-        set AA [expr {($AA + [G $BB $CC $DD] + $X10 + 0x6d703ef3) <<< 13}]
-        set DD [expr {($DD + [G $AA $BB $CC] + $X0  + 0x6d703ef3) <<< 13}]
-        set CC [expr {($CC + [G $DD $AA $BB] + $X4  + 0x6d703ef3) <<< 7}]
-        set BB [expr {($BB + [G $CC $DD $AA] + $X13 + 0x6d703ef3) <<< 5}]
-
-        # Round 4 (track 2).
-        #   F(x,y,z) = x ^ y ^ z
-        # Let [abcd k s] denote the operation
-        #   a = (a + F(b,c,d) + X[k]) <<< s.
-        # Do the following 16 operations.
-        # [ABCD  8  15]  [DABC  6 5]  [CDAB  4 8]  [BCDA 1 11]
-        set AA [expr {($AA + [F $BB $CC $DD] + $X8)  <<< 15}]
-        set DD [expr {($DD + [F $AA $BB $CC] + $X6)  <<< 5}]
-        set CC [expr {($CC + [F $DD $AA $BB] + $X4)  <<< 8}]
-        set BB [expr {($BB + [F $CC $DD $AA] + $X1)  <<< 11}]
-        # [ABCD  3  14]  [DABC 11 14]  [CDAB 15 6]  [BCDA 0 14]
-        set AA [expr {($AA + [F $BB $CC $DD] + $X3)  <<< 14}]
-        set DD [expr {($DD + [F $AA $BB $CC] + $X11) <<< 14}]
-        set CC [expr {($CC + [F $DD $AA $BB] + $X15) <<< 6}]
-        set BB [expr {($BB + [F $CC $DD $AA] + $X0)  <<< 14}]
-        # [ABCD  5  6]  [DABC  12 9]  [CDAB  2 12]  [BCDA 13 9]
-        set AA [expr {($AA + [F $BB $CC $DD] + $X5)  <<< 6}]
-        set DD [expr {($DD + [F $AA $BB $CC] + $X12) <<< 9}]
-        set CC [expr {($CC + [F $DD $AA $BB] + $X2)  <<< 12}]
-        set BB [expr {($BB + [F $CC $DD $AA] + $X13) <<< 9}]
-        # [ABCD  9  12]  [DABC 7  5]  [CDAB  10 15]  [BCDA 14 8]
-        set AA [expr {($AA + [F $BB $CC $DD] + $X9)  <<< 12}]
-        set DD [expr {($DD + [F $AA $BB $CC] + $X7)  <<< 5}]
-        set CC [expr {($CC + [F $DD $AA $BB] + $X10) <<< 15}]
-        set BB [expr {($BB + [F $CC $DD $AA] + $X14) <<< 8}]
-
-        # Then perform the following additions to combine the results.
-        set DD       [expr {$state(B) + $C + $DD}]
-        set state(B) [expr {$state(C) + $D + $AA}]
-        set state(C) [expr {$state(D) + $A + $BB}]
-        set state(D) [expr {$state(A) + $B + $CC}]
-        set state(A) $DD
-    }
-
-    return
-}
-
-proc ::ripemd::ripemd128::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::ripemd::ripemd128::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {0xFF & $v}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}]
-}
-
-# 32bit rotate-left
-proc ::ripemd::ripemd128::<<< {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-# Convert our <<< pseudo-operator into a procedure call.
-regsub -all -line \
-    {\[expr {(.*) <<< (\d+)}\]} \
-    $::ripemd::ripemd128::RIPEMD128Hash_body \
-    {[<<< [expr {\1}] \2]} \
-    ::ripemd::ripemd128::RIPEMD128Hash_body
-
-#  F(x,y,z) = x ^ y ^ z
-proc ::ripemd::ripemd128::F {X Y Z} {
-    return [expr {$X ^ $Y ^ $Z}]
-}
-# Inline the F function F
-regsub -all -line \
-    {\[F (\$[ABCD]{1,2}) (\$[ABCD]{1,2}) (\$[ABCD]{1,2})\]} \
-    $::ripemd::ripemd128::RIPEMD128Hash_body \
-    {(\1 ^ \2 ^ \3)} \
-    ::ripemd::ripemd128::RIPEMD128Hash_body
-    
-# G(x,y,z) = (x & y) | (~x & z)
-proc ::ripemd::ripemd128::G {X Y Z} {
-    return [expr {($X & $Y) | (~$X & $Z)}]
-}
-# Inline the G function
-regsub -all -line \
-    {\[G (\$[ABCD]{1,2}) (\$[ABCD]{1,2}) (\$[ABCD]{1,2})\]} \
-    $::ripemd::ripemd128::RIPEMD128Hash_body \
-    {((\1 \& \2) | (~\1 \& \3))} \
-    ::ripemd::ripemd128::RIPEMD128Hash_body
-
-# H(x,y,z) = (x | ~y) ^ z
-proc ::ripemd::ripemd128::H {X Y Z} {
-    return [expr {($X | ~$Y) ^ $Z}]
-}
-# Inline the H function
-regsub -all -line \
-    {\[H (\$[ABCD]{1,2}) (\$[ABCD]{1,2}) (\$[ABCD]{1,2})\]} \
-    $::ripemd::ripemd128::RIPEMD128Hash_body \
-    {( (\1 | ~\2) ^ \3)} \
-    ::ripemd::ripemd128::RIPEMD128Hash_body
-
-# I(x,y,z) = (x & z) | (y & ~z)
-proc ::ripemd::ripemd128::I {X Y Z} {
-    return [expr {($X & $Z) | ($Y & ~$Z)}]
-}
-# Inline the I function
-regsub -all -line \
-    {\[I (\$[ABCD]{1,2}) (\$[ABCD]{1,2}) (\$[ABCD]{1,2})\]} \
-    $::ripemd::ripemd128::RIPEMD128Hash_body \
-    {( (\1 \& \3) | (\2 \& ~\3) )} \
-    ::ripemd::ripemd128::RIPEMD128Hash_body
-
-# Define the MD4 hashing procedure with inline functions.
-proc ::ripemd::ripemd128::RIPEMD128Hash {token msg} $::ripemd::ripemd128::RIPEMD128Hash_body
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd128::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::ripemd::ripemd128::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        #critcl {
-        #    if {![catch {package require tcllibc}]
-        #        || ![catch {package require sha1c}]} {
-        #        set r [expr {[info command ::sha1::sha1c] != {}}]
-        #    }
-        #}
-        #cryptkit {
-        #    if {![catch {package require cryptkit}]} {
-        #        set r [expr {![catch {cryptkit::cryptInit}]}]
-        #    }
-        #}
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::ripemd128 aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::ripemd::ripemd128::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::ripemd::ripemd128::Chunk {token channel {chunksize 4096}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    RIPEMD128Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd128::ripemd128 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-    
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"ripemd128 ?-hex? -filename file | string\""
-        }
-        set tok [RIPEMD128Init]
-        RIPEMD128Update $tok [lindex $args 0]
-        set r [RIPEMD128Final $tok]
-
-    } else {
-
-        set tok [RIPEMD128Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [RIPEMD128Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd128::hmac128 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -key       { set opts(-key) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac128 ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac128 ?-hex? -key key -filename file | string\""
-        }
-        set tok [RIPEHMAC128Init $opts(-key)]
-        RIPEHMAC128Update $tok [lindex $args 0]
-        set r [RIPEHMAC128Final $tok]
-
-    } else {
-
-        set tok [RIPEHMAC128Init $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [RIPEHMAC128Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-namespace eval ::ripemd {
-
-    namespace import -force [namespace current]::ripemd128::*
-
-    namespace export ripemd128 hmac128 \
-        RIPEMD128Init RIPEMD128Update RIPEMD128Final \
-        RIPEHMAC128Init RIPEHMAC128Update RIPEHMAC128Final
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::ripemd::ripemd128 {
-    foreach e {trf} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide ripemd128 $::ripemd::ripemd128::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/ripemd160.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/ripemd/ripemd160.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,864 +1,0 @@
-# ripemd160.tcl - Copyright (C) 2003 Pat Thoyts <patthoyts@users.sf.net>
-#
-# This is a Tcl-only implementation of the RIPEMD-160 hash algorithm as 
-# described in [RIPE].
-# Included is an implementation of keyed message authentication using 
-# the RIPEMD-160 function [HMAC].
-#
-# See http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9601/
-#
-# [RIPE] Dobbertin, H., Bosselaers A., and Preneel, B.
-#        "RIPEMD-160: A Strengthened Version of RIPEMD" 
-#        Fast Software Encryption, LNCS 1039, D. Gollmann, Ed., 
-#        Springer-Verlag, 1996, pp. 71-82
-# [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, 
-#       "HMAC: Keyed-Hashing for Message Authentication",
-#        RFC 2104, February 1997.
-#
-# RFC 2286, ``Test cases for HMAC-RIPEMD160 and HMAC-RIPEMD128,''
-# Internet Request for Comments 2286, J. Kapp, 
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: ripemd160.tcl,v 1.7 2005/02/24 03:25:50 patthoyts Exp $
-
-package require Tcl 8.2;                # tcl minimum version
-#catch {package require ripemdc 1.0};   # tcllib critcl alternative
-
-namespace eval ::ripemd {
-    namespace eval ripemd160 {
-        variable version 1.0.3
-        variable rcsid {$Id: ripemd160.tcl,v 1.7 2005/02/24 03:25:50 patthoyts Exp $}
-        variable accel
-        array set accel {cryptkit 0 trf 0}
-
-        variable uid
-        if {![info exists uid]} {
-            set uid 0
-        }
-
-        namespace export ripemd160 hmac160 Hex \
-            RIPEMD160Init RIPEMD160Update RIPEMD160Final \
-            RIPEHMAC160Init RIPEHMAC160Update RIPEHMAC160Final
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# RIPEMD160Init - create and initialize the state variable. This will be
-# cleaned up when we call RIPEMD160Final
-#
-proc ::ripemd::ripemd160::RIPEMD160Init {} {
-    variable accel
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # Initialize RIPEMD-160 state structure (same as MD4).
-    array set state \
-        [list \
-             A [expr {0x67452301}] \
-             B [expr {0xefcdab89}] \
-             C [expr {0x98badcfe}] \
-             D [expr {0x10325476}] \
-             E [expr {0xc3d2e1f0}] \
-             n 0 i "" ]
-    if {$accel(cryptkit)} {
-        cryptkit::cryptCreateContext state(ckctx) \
-            CRYPT_UNUSED CRYPT_ALGO_RIPEMD160
-    } elseif {$accel(trf)} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::ripemd160 -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-proc ::ripemd::ripemd160::RIPEMD160Update {token data} {
-    upvar #0 $token state
-
-    if {[info exists state(ckctx)]} {
-        if {[string length $data] > 0} {
-            cryptkit::cryptEncrypt $state(ckctx) $data
-        }
-        return
-    } elseif {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        RIPEMD160Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-proc ::ripemd::ripemd160::RIPEMD160Final {token} {
-    upvar #0 $token state
-
-    if {[info exists state(ckctx)]} {
-        cryptkit::cryptEncrypt $state(ckctx) ""
-        cryptkit::cryptGetAttributeString $state(ckctx) \
-            CRYPT_CTXINFO_HASHVALUE r 20
-        cryptkit::cryptDestroyContext $state(ckctx)
-        # If nothing was hashed, we get no r variable set!
-        if {[info exists r]} {
-            unset state
-            return $r
-        }
-    } elseif {[info exists state(trf)]} {
-        close $state(trf)
-        set r $state(trfwrite)
-        unset state
-        return $r
-    }
-
-    # Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # Append length in bits as little-endian wide int.
-    append state(i) [binary format ii [expr {8 * $state(n)}] 0]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        RIPEMD160Hash $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-proc ::ripemd::ripemd160::RIPEHMAC160Init {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the RIPEMD-160 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [RIPEMD160Init]
-        RIPEMD160Update $tok $K
-        set K [RIPEMD160Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [RIPEMD160Init]
-    RIPEMD160Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-proc ::ripemd::ripemd160::RIPEHMAC160Update {token data} {
-    RIPEMD160Update $token $data
-    return
-}
-
-proc ::ripemd::ripemd160::RIPEHMAC160Final {token} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-
-    set tok [RIPEMD160Init];            # init the outer hashing function
-    RIPEMD160Update $tok $state(Ko);    # prepare with the outer pad.
-    RIPEMD160Update $tok [RIPEMD160Final $token];  # hash the inner result
-    return [RIPEMD160Final $tok]
-}
-
-# -------------------------------------------------------------------------
-
-set ::ripemd::ripemd160::RIPEMD160Hash_body {
-    variable $token
-    upvar 0 $token state
-
-    binary scan $msg i* blocks
-    foreach {X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15} $blocks {
-        set A $state(A)   ;  set AA $state(A)
-        set B $state(B)   ;  set BB $state(B)
-        set C $state(C)   ;  set CC $state(C)
-        set D $state(D)   ;  set DD $state(D)
-        set E $state(E)   ;  set EE $state(E)
-
-        FF A B C D E $X0 11
-        FF E A B C D $X1 14
-        FF D E A B C $X2 15
-        FF C D E A B $X3 12
-        FF B C D E A $X4 5
-        FF A B C D E $X5 8
-        FF E A B C D $X6 7
-        FF D E A B C $X7 9
-        FF C D E A B $X8 11
-        FF B C D E A $X9 13
-        FF A B C D E $X10 14
-        FF E A B C D $X11 15
-        FF D E A B C $X12 6
-        FF C D E A B $X13 7
-        FF B C D E A $X14 9
-        FF A B C D E $X15 8
-        
-        GG E A B C D $X7 7
-        GG D E A B C $X4 6
-        GG C D E A B $X13 8
-        GG B C D E A $X1 13
-        GG A B C D E $X10 11
-        GG E A B C D $X6 9
-        GG D E A B C $X15 7
-        GG C D E A B $X3 15
-        GG B C D E A $X12 7
-        GG A B C D E $X0 12
-        GG E A B C D $X9 15
-        GG D E A B C $X5 9
-        GG C D E A B $X2 11
-        GG B C D E A $X14 7
-        GG A B C D E $X11 13
-        GG E A B C D $X8 12
-        
-        HH D E A B C $X3 11
-        HH C D E A B $X10 13
-        HH B C D E A $X14 6
-        HH A B C D E $X4 7
-        HH E A B C D $X9 14
-        HH D E A B C $X15 9
-        HH C D E A B $X8 13
-        HH B C D E A $X1 15
-        HH A B C D E $X2 14
-        HH E A B C D $X7 8
-        HH D E A B C $X0 13
-        HH C D E A B $X6 6
-        HH B C D E A $X13 5
-        HH A B C D E $X11 12
-        HH E A B C D $X5 7
-        HH D E A B C $X12 5
-        
-        II C D E A B $X1 11
-        II B C D E A $X9 12
-        II A B C D E $X11 14
-        II E A B C D $X10 15
-        II D E A B C $X0 14
-        II C D E A B $X8 15
-        II B C D E A $X12 9
-        II A B C D E $X4 8
-        II E A B C D $X13 9
-        II D E A B C $X3 14
-        II C D E A B $X7 5
-        II B C D E A $X15 6
-        II A B C D E $X14 8
-        II E A B C D $X5 6
-        II D E A B C $X6 5
-        II C D E A B $X2 12
-        
-        JJ B C D E A $X4 9
-        JJ A B C D E $X0 15
-        JJ E A B C D $X5 5
-        JJ D E A B C $X9 11
-        JJ C D E A B $X7 6
-        JJ B C D E A $X12 8
-        JJ A B C D E $X2 13
-        JJ E A B C D $X10 12
-        JJ D E A B C $X14 5
-        JJ C D E A B $X1 12
-        JJ B C D E A $X3 13
-        JJ A B C D E $X8 14
-        JJ E A B C D $X11 11
-        JJ D E A B C $X6 8
-        JJ C D E A B $X15 5
-        JJ B C D E A $X13 6
-        
-        JJJ AA BB CC DD EE $X5 8
-        JJJ EE AA BB CC DD $X14 9
-        JJJ DD EE AA BB CC $X7 9
-        JJJ CC DD EE AA BB $X0 11
-        JJJ BB CC DD EE AA $X9 13
-        JJJ AA BB CC DD EE $X2 15
-        JJJ EE AA BB CC DD $X11 15
-        JJJ DD EE AA BB CC $X4 5
-        JJJ CC DD EE AA BB $X13 7
-        JJJ BB CC DD EE AA $X6 7
-        JJJ AA BB CC DD EE $X15 8
-        JJJ EE AA BB CC DD $X8 11
-        JJJ DD EE AA BB CC $X1 14
-        JJJ CC DD EE AA BB $X10 14
-        JJJ BB CC DD EE AA $X3 12
-        JJJ AA BB CC DD EE $X12 6
-        
-        III EE AA BB CC DD $X6 9
-        III DD EE AA BB CC $X11 13
-        III CC DD EE AA BB $X3 15
-        III BB CC DD EE AA $X7 7
-        III AA BB CC DD EE $X0 12
-        III EE AA BB CC DD $X13 8
-        III DD EE AA BB CC $X5 9
-        III CC DD EE AA BB $X10 11
-        III BB CC DD EE AA $X14 7
-        III AA BB CC DD EE $X15 7
-        III EE AA BB CC DD $X8 12
-        III DD EE AA BB CC $X12 7
-        III CC DD EE AA BB $X4 6
-        III BB CC DD EE AA $X9 15
-        III AA BB CC DD EE $X1 13
-        III EE AA BB CC DD $X2 11
-        
-        HHH DD EE AA BB CC $X15 9
-        HHH CC DD EE AA BB $X5 7
-        HHH BB CC DD EE AA $X1 15
-        HHH AA BB CC DD EE $X3 11
-        HHH EE AA BB CC DD $X7 8
-        HHH DD EE AA BB CC $X14 6
-        HHH CC DD EE AA BB $X6 6
-        HHH BB CC DD EE AA $X9 14
-        HHH AA BB CC DD EE $X11 12
-        HHH EE AA BB CC DD $X8 13
-        HHH DD EE AA BB CC $X12 5
-        HHH CC DD EE AA BB $X2 14
-        HHH BB CC DD EE AA $X10 13
-        HHH AA BB CC DD EE $X0 13
-        HHH EE AA BB CC DD $X4 7
-        HHH DD EE AA BB CC $X13 5
-        
-        GGG CC DD EE AA BB $X8 15
-        GGG BB CC DD EE AA $X6 5
-        GGG AA BB CC DD EE $X4 8
-        GGG EE AA BB CC DD $X1 11
-        GGG DD EE AA BB CC $X3 14
-        GGG CC DD EE AA BB $X11 14
-        GGG BB CC DD EE AA $X15 6
-        GGG AA BB CC DD EE $X0 14
-        GGG EE AA BB CC DD $X5 6
-        GGG DD EE AA BB CC $X12 9
-        GGG CC DD EE AA BB $X2 12
-        GGG BB CC DD EE AA $X13 9
-        GGG AA BB CC DD EE $X9 12
-        GGG EE AA BB CC DD $X7 5
-        GGG DD EE AA BB CC $X10 15
-        GGG CC DD EE AA BB $X14 8
-        
-        FFF BB CC DD EE AA $X12 8
-        FFF AA BB CC DD EE $X15 5
-        FFF EE AA BB CC DD $X10 12
-        FFF DD EE AA BB CC $X4 9
-        FFF CC DD EE AA BB $X1 12
-        FFF BB CC DD EE AA $X5 5
-        FFF AA BB CC DD EE $X8 14
-        FFF EE AA BB CC DD $X7 6
-        FFF DD EE AA BB CC $X6 8
-        FFF CC DD EE AA BB $X2 13
-        FFF BB CC DD EE AA $X13 6
-        FFF AA BB CC DD EE $X14 5
-        FFF EE AA BB CC DD $X0 15
-        FFF DD EE AA BB CC $X3 13
-        FFF CC DD EE AA BB $X9 11
-        FFF BB CC DD EE AA $X11 11
-
-        # Then perform the following additions to combine the results.
-        set DD       [expr {$state(B) + $C + $DD}]
-        set state(B) [expr {$state(C) + $D + $EE}]
-        set state(C) [expr {$state(D) + $E + $AA}]
-        set state(D) [expr {$state(E) + $A + $BB}]
-        set state(E) [expr {$state(A) + $B + $CC}]
-        set state(A) $DD
-    }
-
-    return
-}
-
-proc ::ripemd::ripemd160::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::ripemd::ripemd160::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {0xFF & $v}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}]
-}
-
-#  F(x,y,z) = x ^ y ^ z
-proc ::ripemd::ripemd160::F {X Y Z} {
-    return [expr {$X ^ $Y ^ $Z}]
-}
-# G(x,y,z) = (x & y) | (~x & z)
-proc ::ripemd::ripemd160::G {X Y Z} {
-    return [expr {($X & $Y) | (~$X & $Z)}]
-}
-# H(x,y,z) = (x | ~y) ^ z
-proc ::ripemd::ripemd160::H {X Y Z} {
-    return [expr {($X | ~$Y) ^ $Z}]
-}
-# I(x,y,z) = (x & z) | (y & ~z)
-proc ::ripemd::ripemd160::I {X Y Z} {
-    return [expr {($X & $Z) | ($Y & ~$Z)}]
-}
-# J(x,y,z) = x ^ (y | ~z)
-proc ::ripemd::ripemd160::J {X Y Z} {
-    return [expr {($X ^ ($Y | ~$Z))}]
-}
-
-proc ::ripemd::ripemd160::FF {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + ($B ^ $C ^ $D) + $x}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::GG {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B & $C) | (~$B & $D)) + $x + 0x5a827999}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::HH {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B | ~$C) ^ $D) + $x + 0x6ed9eba1}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::II {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B & $D)|($C & ~$D)) + $x + 0x8f1bbcdc}] $s]
-    incr A $E
-    set C [<<< $C 10]
-
-}
-
-proc ::ripemd::ripemd160::JJ {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + ($B ^ ($C | ~$D)) + $x + 0xa953fd4e}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-
-proc ::ripemd::ripemd160::FFF {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + ($B ^ $C ^ $D) + $x}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::GGG {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B & $C) | (~$B & $D)) + $x + 0x7a6d76e9}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::HHH {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B | ~$C) ^ $D) + $x + 0x6d703ef3}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-proc ::ripemd::ripemd160::III {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + (($B & $D)|($C & ~$D)) + $x + 0x5c4dd124}] $s]
-    incr A $E
-    set C [<<< $C 10]
-
-}
-
-proc ::ripemd::ripemd160::JJJ {a b c d e x s} {
-    upvar $a A $b B $c C $d D $e E
-    set A [<<< [expr {$A + ($B ^ ($C | ~$D)) + $x + 0x50a28be6}] $s]
-    incr A $E
-    set C [<<< $C 10]
-}
-
-# 32bit rotate-left
-proc ::ripemd::ripemd160::<<< {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-# -------------------------------------------------------------------------
-# Inline the algorithm functions
-#
-# On my test system inlining the functions like this improves
-#   time {ripmd::ripmd160 [string repeat a 100]} 100
-# from 28ms per iteration to 13ms per iteration.
-#
-# This means that the functions above (F - J, FF - JJ and FFF-JJJ) are
-# not actually required for the code to operate. However, they provide
-# a readable way to document what is going on so have been left in.
-#
-namespace eval ::ripemd::ripemd160 {
-
-    # Inline function FF and FFF
-    set Split {(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+)}
-    
-    regsub -all -line \
-        "^\\s+FFF?\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + ($\2 ^ $\3 ^ $\4) + \6}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-    
-    # Inline function GG
-    regsub -all -line \
-        "^\\s+GG\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 \& $\3) | (~$\2 \& $\4)) + \6 \
-                                + 0x5a827999}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function GGG
-    regsub -all -line \
-        "^\\s+GGG\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 \& $\3) | (~$\2 \& $\4)) + \6 \
-                                + 0x7a6d76e9}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function HH
-    regsub -all -line \
-        "^\\s+HH\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 | ~$\3) ^ $\4) + \6 \
-                                + 0x6ed9eba1}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function HHH
-    regsub -all -line \
-        "^\\s+HHH\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 | ~$\3) ^ $\4) + \6 \
-                                + 0x6d703ef3}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function II
-    regsub -all -line \
-        "^\\s+II\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 \& $\4) | ($\3 \& ~$\4)) + \6 \
-                                + 0x8f1bbcdc}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function III
-    regsub -all -line \
-        "^\\s+III\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + (($\2 \& $\4) | ($\3 \& ~$\4)) + \6 \
-                                + 0x5c4dd124}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function JJ
-    regsub -all -line \
-        "^\\s+JJ\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + ($\2 ^ ($\3 | ~$\4)) + \6 \
-                                + 0xa953fd4e}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline function JJJ
-    regsub -all -line \
-        "^\\s+JJJ\\s+$Split$" \
-        $RIPEMD160Hash_body \
-        {set \1 [<<< [expr {$\1 + ($\2 ^ ($\3 | ~$\4)) + \6 \
-                                + 0x50a28be6}] \7];\
-             incr \1 $\5; set \3 [<<< $\3 10]} \
-        RIPEMD160Hash_body
-
-    # Inline simple <<<
-    regsub -all -line \
-        {\[<<< (\$\S+)\s+(\d+)\]$} \
-        $RIPEMD160Hash_body \
-        {[expr {(((\1 << \2) \
-                      | ((\1 >> (32 - \2)) \
-                             \& (0x7FFFFFFF >> (31 - \2))))) \
-                    \& 0xFFFFFFFF}]} \
-        RIPEMD160Hash_body
-}
-
-# -------------------------------------------------------------------------
-
-# Define the hashing procedure with inline functions.
-proc ::ripemd::ripemd160::RIPEMD160Hash {token msg} \
-    $::ripemd::ripemd160::RIPEMD160Hash_body
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd160::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::ripemd::ripemd160::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        #critcl {
-        #    if {![catch {package require tcllibc}]
-        #        || ![catch {package require sha1c}]} {
-        #        set r [expr {[info command ::sha1::sha1c] != {}}]
-        #    }
-        #}
-        cryptkit {
-            if {![catch {package require cryptkit}]} {
-                set r [expr {![catch {cryptkit::cryptInit}]}]
-            }
-        }
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::ripemd160 aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::ripemd::ripemd160::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::ripemd::ripemd160::Chunk {token channel {chunksize 4096}} {
-    # FRINK: nocheck
-    variable $token
-    upvar 0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    RIPEMD160Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd160::ripemd160 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"ripemd160 ?-hex? -filename file | string\""
-        }
-        set tok [RIPEMD160Init]
-        RIPEMD160Update $tok [lindex $args 0]
-        set r [RIPEMD160Final $tok]
-
-    } else {
-
-        set tok [RIPEMD160Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [RIPEMD160Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::ripemd::ripemd160::hmac160 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -key       { set opts(-key) [Pop args 1] }
-            -hex       { set opts(-hex) 1 }
-            -file*     { set opts(-filename) [Pop args 1] }
-            -channel   { set opts(-channel) [Pop args 1] }
-            -chunksize { set opts(-chunksize) [Pop args 1] }
-            default {
-                if {[llength $args] == 1} { break }
-                if {[string compare $option "--"] == 0} { Pop args; break }
-                set err [join [lsort [array names opts]] ", "]
-                return -code error "bad option $option:\
-                    must be one of $err"
-            }
-        }
-        Pop args
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac160 ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac160 ?-hex? -key key -filename file | string\""
-        }
-        set tok [RIPEHMAC160Init $opts(-key)]
-        RIPEHMAC160Update $tok [lindex $args 0]
-        set r [RIPEHMAC160Final $tok]
-
-    } else {
-
-        set tok [RIPEHMAC160Init $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        vwait [subst $tok](reading)
-        set r [RIPEHMAC160Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-namespace eval ::ripemd {
-
-    namespace import -force [namespace current]::ripemd160::*
-
-    namespace export ripemd160 hmac160 \
-        RIPEMD160Init RIPEMD160Update RIPEMD160Final \
-        RIPEHMAC160Init RIPEHMAC160Update RIPEHMAC160Final
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::ripemd::ripemd160 {
-    foreach e {cryptkit trf} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide ripemd160 $::ripemd::ripemd160::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sasl/gtoken.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sasl/gtoken.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,94 +1,0 @@
-# gtoken.tcl - Copyright (C) 2006 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This is an implementation of Google's X-GOOGLE-TOKEN authentication 
-# mechanism. This actually passes the login details to the Google
-# accounts server which gives us a short lived token that may be passed 
-# over an insecure link.
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.2
-package require SASL
-package require http
-package require tls
-
-namespace eval ::SASL {
-    namespace eval XGoogleToken {
-        variable version 1.0.1
-        variable rcsid {$Id: gtoken.tcl,v 1.4 2007/08/26 00:36:45 patthoyts Exp $}
-        variable URLa https://www.google.com/accounts/ClientAuth
-        variable URLb https://www.google.com/accounts/IssueAuthToken
-
-        # Should use autoproxy and register autoproxy::tls_socket
-        # Leave to application author?
-        if {![info exists ::http::urlTypes(https)]} {
-            http::register https 443 tls::socket
-        }
-    }
-}
-
-proc ::SASL::XGoogleToken::client {context challenge args} {
-    upvar #0 $context ctx
-    variable URLa
-    variable URLb
-    set reply ""
-    set err ""
-
-    if {$ctx(step) != 0} {
-        return -code error "unexpected state: X-GOOGLE-TOKEN has only 1 step"
-    }
-    set username [eval $ctx(callback) [list $context username]]
-    set password [eval $ctx(callback) [list $context password]]
-    set query [http::formatQuery Email $username Passwd $password \
-                   PersistentCookie false source googletalk]
-    set tok [http::geturl $URLa -query $query -timeout 30000]
-    if {[http::status $tok] eq "ok"} {
-        foreach line [split [http::data $tok] \n] {
-            array set g [split $line =]
-        }
-        if {![info exists g(Error)]} {
-            set query [http::formatQuery SID $g(SID) LSID $g(LSID) \
-                           service mail Session true]
-            set tok2 [http::geturl $URLb -query $query -timeout 30000]
-
-            if {[http::status $tok2] eq "ok"} {
-                set reply "\0$username\0[http::data $tok2]"
-            } else {
-                set err [http::error $tok2]
-            }
-            http::cleanup $tok2
-       } else {
-           set err "Invalid username or password"
-       }
-    } else {
-        set err [http::error $tok]
-    }
-    http::cleanup $tok
-    
-    if {[string length $err] > 0} {
-        return -code error $err
-    } else {
-        set ctx(response) $reply
-        incr ctx(step)
-    }
-    return 0
-}
-
-# -------------------------------------------------------------------------
-
-# Register this SASL mechanism with the Tcllib SASL package.
-#
-if {[llength [package provide SASL]] != 0} {
-    ::SASL::register X-GOOGLE-TOKEN 40 ::SASL::XGoogleToken::client
-}
-
-package provide SASL::XGoogleToken $::SASL::XGoogleToken::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-# indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sasl/ntlm.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sasl/ntlm.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,377 +1,0 @@
-# ntlm.tcl - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This is an implementation of Microsoft's NTLM authentication mechanism.
-#
-# References:
-#    http://www.innovation.ch/java/ntlm.html
-#    http://davenport.sourceforge.net/ntlm.html
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.2;                # tcl minimum version
-package require SASL 1.0;               # tcllib 1.7
-package require des 1.0;                # tcllib 1.8
-package require md4;                    # tcllib 1.4
-
-namespace eval ::SASL {
-    namespace eval NTLM {
-        variable version 1.1.1
-        variable rcsid {$Id: ntlm.tcl,v 1.8 2007/08/26 00:36:45 patthoyts Exp $}
-        array set NTLMFlags {
-            unicode        0x00000001
-            oem            0x00000002
-            req_target     0x00000004
-            unknown        0x00000008
-            sign           0x00000010
-            seal           0x00000020
-            datagram       0x00000040
-            lmkey          0x00000080
-            netware        0x00000100
-            ntlm           0x00000200
-            unknown        0x00000400
-            unknown        0x00000800
-            domain         0x00001000
-            server         0x00002000
-            share          0x00004000
-            NTLM2          0x00008000
-            targetinfo     0x00800000
-            128bit         0x20000000
-            keyexch        0x40000000
-            56bit          0x80000000
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-proc ::SASL::NTLM::NTLM {context challenge args} {
-    upvar #0 $context ctx
-    incr ctx(step)
-    switch -exact -- $ctx(step) {
-        
-        1 {
-            set ctx(realm) [eval [linsert $ctx(callback) end $context realm]]
-            set ctx(hostname) [eval [linsert $ctx(callback) end $context hostname]]
-            set ctx(response)   [CreateGreeting $ctx(realm) $ctx(hostname)]
-            set result 1
-        }
-
-        2 {
-            array set params [Decode $challenge]
-            set user [eval [linsert $ctx(callback) end $context username]]
-            set pass [eval [linsert $ctx(callback) end $context password]]
-            if {[info exists params(domain)]} {
-                set ctx(realm) $params(domain)
-            }
-            set ctx(response) [CreateResponse \
-                                   $ctx(realm) $ctx(hostname) \
-                                   $user $pass $params(nonce) $params(flags)]
-            Decode $ctx(response)
-            set result 0
-        }
-        default {
-            return -code error "invalid state \"$ctx(step)"
-        }
-    }
-    return $result
-}
-
-# -------------------------------------------------------------------------
-# NTLM client implementation
-# -------------------------------------------------------------------------
-
-# The NMLM greeting. This is sent by the client to the server to initiate
-# the challenge response handshake.
-# This message contains the hostname (not domain qualified) and the 
-# NT domain name for authentication.
-#
-proc ::SASL::NTLM::CreateGreeting {domainname hostname {flags {}}} {
-    set domain [encoding convertto ascii $domainname]
-    set host [encoding convertto ascii $hostname]
-    set d_len [string length $domain]
-    set h_len [string length $host]
-    set d_off [expr {32 + $h_len}]
-    if {[llength $flags] == 0} {
-        set flags {unicode oem ntlm server domain req_target}
-    }
-    set msg [binary format a8iississi \
-                 "NTLMSSP\x00" 1 [Flags $flags] \
-                 $d_len $d_len $d_off \
-                 $h_len $h_len 32]
-    append msg $host $domain
-    return $msg
-}
-
-# Create a NTLM server challenge. This is sent by a server in response to
-# a client type 1 message. The content of the type 2 message is variable
-# and depends upon the flags set by the client and server choices.
-#
-proc ::SASL::NTLM::CreateChallenge {domainname} {
-    SASL::md5_init
-    set target  [encoding convertto ascii $domainname]
-    set t_len   [string length $target]
-    set nonce   [string range [binary format h* [SASL::CreateNonce]] 0 7]
-    set pad     [string repeat \0 8]
-    set context [string repeat \0 8]
-    set msg [binary format a8issii \
-                 "NTLMSSP\x00" 2 \
-                 $t_len $t_len 48 \
-                 [Flags {ntlm unicode}]]
-    append msg $nonce $pad $context $pad $target
-    return $msg
-}
-
-# Compose the final client response. This contains the encoded username
-# and password, along with the server nonce value.
-#
-proc ::SASL::NTLM::CreateResponse {domainname hostname username passwd nonce flags} {
-    set lm_resp [LMhash $passwd $nonce]
-    set nt_resp [NThash $passwd $nonce]
-
-    set domain  [string toupper $domainname]
-    set host    [string toupper $hostname]
-    set user    $username
-    set unicode [expr {$flags & 0x00000001}]
-
-    if {$unicode} {
-      set domain [to_unicode_le $domain]
-      set host   [to_unicode_le $host]
-      set user   [to_unicode_le $user]
-    }
-
-    set l_len [string length $lm_resp]; # LM response length
-    set n_len [string length $nt_resp]; # NT response length
-    set d_len [string length $domain];  # Domain name length
-    set h_len [string length $host];    # Host name length
-    set u_len [string length $user];    # User name length
-    set s_len 0 ;                       # Session key length
-
-    # The offsets to strings appended to the structure
-    set d_off [expr {0x40}];            # Fixed offset to Domain buffer
-    set u_off [expr {$d_off + $d_len}]; # Offset to user buffer 
-    set h_off [expr {$u_off + $u_len}]; # Offset to host buffer
-    set l_off [expr {$h_off + $h_len}]; # Offset to LM hash
-    set n_off [expr {$l_off + $l_len}]; # Offset to NT hash
-    set s_off [expr {$n_off + $n_len}]; # Offset to Session key
-
-    set msg [binary format a8is4s4s4s4s4s4i \
-                 "NTLMSSP\x00" 3 \
-                 [list $l_len $l_len $l_off 0] \
-                 [list $n_len $n_len $n_off 0] \
-                 [list $d_len $d_len $d_off 0] \
-                 [list $u_len $u_len $u_off 0] \
-                 [list $h_len $h_len $h_off 0] \
-                 [list $s_len $s_len $s_off 0] \
-                 $flags]
-    append msg $domain $user $host $lm_resp $nt_resp
-    return $msg
-}
-
-proc ::SASL::NTLM::Debug {msg} {
-    array set d [Decode $msg]
-    if {[info exists d(flags)]}  { 
-        set d(flags) [list [format 0x%08x $d(flags)] [decodeflags $d(flags)]] 
-    }
-    if {[info exists d(nonce)]}  { set d(nonce) [base64::encode $d(nonce)] }
-    if {[info exists d(lmhash)]} { set d(lmhash) [base64::encode $d(lmhash)] }
-    if {[info exists d(nthash)]} { set d(nthash) [base64::encode $d(nthash)] }
-    return [array get d]
-}
-
-proc ::SASL::NTLM::Decode {msg} {
-    #puts [Debug $msg]
-    binary scan $msg a7ci protocol zero type
-    
-    switch -exact -- $type {
-        1 {
-            binary scan $msg @12ississi flags dlen dlen2 doff hlen hlen2 hoff
-            binary scan $msg @${hoff}a${hlen} host
-            binary scan $msg @${doff}a${dlen} domain
-            return [list type $type flags [format 0x%08x $flags] \
-                        domain $domain host $host]
-        }
-        2 {
-            binary scan $msg @12ssiia8a8 dlen dlen2 doff flags nonce pad
-            set domain {}; binary scan $msg @${doff}a${dlen} domain
-            set unicode [expr {$flags & 0x00000001}]
-            if {$unicode} {
-                set domain [from_unicode_le $domain]
-            }
-
-            binary scan $nonce H* nonce_h
-            binary scan $pad   H* pad_h
-            return [list type $type flags [format 0x%08x $flags] \
-                        domain $domain nonce $nonce]
-        }
-        3 {
-            binary scan $msg @12ssissississississii \
-                lmlen lmlen2 lmoff \
-                ntlen ntlen2 ntoff \
-                dlen  dlen2  doff  \
-                ulen  ulen2  uoff \
-                hlen  hlen2  hoff \
-                slen  slen2  soff \
-                flags
-            set domain {}; binary scan $msg @${doff}a${dlen} domain
-            set user {};   binary scan $msg @${uoff}a${ulen} user
-            set host {};   binary scan $msg @${hoff}a${hlen} host
-            set unicode [expr {$flags & 0x00000001}]
-            if {$unicode} {
-                set domain [from_unicode_le $domain]
-                set user   [from_unicode_le $user]
-                set host   [from_unicode_le $host]
-            }
-            binary scan $msg @${ntoff}a${ntlen} ntdata
-            binary scan $msg @${lmoff}a${lmlen} lmdata
-            binary scan $ntdata H* ntdata_h
-            binary scan $lmdata H* lmdata_h
-            return [list type $type flags [format 0x%08x $flags]\
-                        domain $domain host $host user $user \
-                        lmhash $lmdata nthash $ntdata]
-        }
-        default {
-            return -code error "invalid NTLM data: type not recognised"
-        }
-    }
-}
-
-proc ::SASL::NTLM::decodeflags {value} {
-    variable NTLMFlags
-    set result {}
-    foreach {flag mask} [array get NTLMFlags] {
-        if {$value & ($mask & 0xffffffff)} {
-            lappend result $flag
-        }
-    }
-    return $result
-}
-
-proc ::SASL::NTLM::Flags {flags} {
-    variable NTLMFlags
-    set result 0
-    foreach flag $flags {
-        if {![info exists NTLMFlags($flag)]} {
-            return -code error "invalid ntlm flag \"$flag\""
-        }
-        set result [expr {$result | $NTLMFlags($flag)}]
-    }
-    return $result
-}
-
-# Convert a string to unicode in little endian byte order.
-proc ::SASL::NTLM::to_unicode_le {str} {
-    set result [encoding convertto unicode $str]
-    if {[string equal $::tcl_platform(byteOrder) "bigEndian"]} {
-        set r {} ; set n 0
-        while {[binary scan $result @${n}cc a b] == 2} {
-            append r [binary format cc $b $a]
-            incr n 2
-        }
-        set result $r
-    }
-    return $result
-}
-
-# Convert a little-endian unicode string to utf-8.
-proc ::SASL::NTLM::from_unicode_le {str} {
-    if {[string equal $::tcl_platform(byteOrder) "bigEndian"]} {
-        set r {} ; set n 0
-        while {[binary scan $str @${n}cc a b] == 2} {
-            append r [binary format cc $b $a]
-            incr n 2
-        }
-        set str $r
-    }
-    return [encoding convertfrom unicode $str]
-}
-
-proc ::SASL::NTLM::LMhash {password nonce} {
-    set magic "\x4b\x47\x53\x21\x40\x23\x24\x25"
-    set hash ""
-    set password [string range [string toupper $password][string repeat \0 14] 0 13]
-    foreach key [CreateDesKeys $password] {
-        append hash [DES::des -dir encrypt -weak -mode ecb -key $key $magic]
-    }
-
-    append hash [string repeat \0 5]
-    set res ""
-    foreach key [CreateDesKeys $hash] {
-        append res [DES::des -dir encrypt -weak -mode ecb -key $key $nonce]
-    }
-
-    return $res
-}
-
-proc ::SASL::NTLM::NThash {password nonce} {
-    set pass [to_unicode_le $password]
-    set hash [md4::md4 $pass]
-    append hash [string repeat \x00 5]
-
-    set res ""
-    foreach key [CreateDesKeys $hash] {
-        append res [DES::des -dir encrypt -weak -mode ecb -key $key $nonce]
-    }
-
-    return $res
-}
-
-# Convert a password into a 56 bit DES key according to the NTLM specs.
-# We do NOT fix the parity of each byte. If we did, then bit 0 of each
-# byte should be adjusted to give the byte odd parity.
-#
-proc ::SASL::NTLM::CreateDesKeys {key} {
-    # pad to 7 byte boundary with nuls.
-    set mod [expr {[string length $key] % 7}]
-    if {$mod != 0} {
-        append key [string repeat "\0" [expr {7 - $mod}]]
-    }
-    set len [string length $key]
-    set r ""
-    for {set n 0} {$n < $len} {incr n 7} {
-        binary scan $key @${n}c7 bytes
-        set b {}
-        lappend b [expr {  [lindex $bytes 0] & 0xFF}]
-        lappend b [expr {(([lindex $bytes 0] & 0x01) << 7) | (([lindex $bytes 1] >> 1) & 0x7F)}]
-        lappend b [expr {(([lindex $bytes 1] & 0x03) << 6) | (([lindex $bytes 2] >> 2) & 0x3F)}]
-        lappend b [expr {(([lindex $bytes 2] & 0x07) << 5) | (([lindex $bytes 3] >> 3) & 0x1F)}]
-        lappend b [expr {(([lindex $bytes 3] & 0x0F) << 4) | (([lindex $bytes 4] >> 4) & 0x0F)}]
-        lappend b [expr {(([lindex $bytes 4] & 0x1F) << 3) | (([lindex $bytes 5] >> 5) & 0x07)}]
-        lappend b [expr {(([lindex $bytes 5] & 0x3F) << 2) | (([lindex $bytes 6] >> 6) & 0x03)}]
-        lappend b [expr {(([lindex $bytes 6] & 0x7F) << 1)}]
-        lappend r [binary format c* $b]
-    }
-    return $r;
-}
-
-# This is slower than the above in Tcl 8.4.9
-proc ::SASL::NTLM::CreateDesKeys2 {key} {
-    # pad to 7 byte boundary with nuls.
-    append key [string repeat "\0" [expr {7 - ([string length $key] % 7)}]]
-    binary scan $key B* bin
-    set len [string length $bin]
-    set r ""
-    for {set n 0} {$n < $len} {incr n} {
-        append r [string range $bin $n [incr n  6]] 0
-    }
-    # needs spliting into 8 byte keys.
-    return [binary format B* $r]
-}
-
-# -------------------------------------------------------------------------
-
-# Register this SASL mechanism with the Tcllib SASL package.
-#
-if {[llength [package provide SASL]] != 0} {
-    ::SASL::register NTLM 50 ::SASL::NTLM::NTLM
-}
-
-package provide SASL::NTLM $::SASL::NTLM::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-# indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sasl/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sasl/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,10 +1,0 @@
-# pkgIndex.tcl                                                -*- tcl -*-
-# Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-# $Id: pkgIndex.tcl,v 1.10 2007/08/26 00:36:45 patthoyts Exp $
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded SASL 1.3.1 [list source [file join $dir sasl.tcl]]
-package ifneeded SASL::NTLM 1.1.1 [list source [file join $dir ntlm.tcl]]
-package ifneeded SASL::XGoogleToken 1.0.1 [list source [file join $dir gtoken.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sasl/sasl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sasl/sasl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,668 +1,0 @@
-# sasl.tcl - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This is an implementation of a general purpose SASL library for use in
-# Tcl scripts. 
-#
-# References:
-#    Myers, J., "Simple Authentication and Security Layer (SASL)", 
-#      RFC 2222, October 1997.
-#    Rose, M.T., "TclSASL", "http://beepcore-tcl.sourceforge.net/tclsasl.html"
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.2
-
-namespace eval ::SASL {
-    variable version 1.3.1
-    variable rcsid {$Id: sasl.tcl,v 1.11 2006/10/02 21:21:57 patthoyts Exp $}
-
-    variable uid
-    if {![info exists uid]} { set uid 0 }
-
-    variable mechanisms
-    if {![info exists mechanisms]} {
-        set mechanisms [list]
-    }
-}
-
-# SASL::mechanisms --
-#
-#	Return a list of available SASL mechanisms. By default only the
-#	client implementations are given but if type is set to server then
-#	the list of available server mechanisms is returned.
-#	No mechanism with a preference value less than 'minimum' will be
-#	returned.
-#	The list is sorted by the security preference with the most secure
-#	mechanisms given first.
-#
-proc ::SASL::mechanisms {{type client} {minimum 0}} {
-    variable mechanisms
-    set r [list]
-    foreach mech $mechanisms {
-        if {[lindex $mech 0] < $minimum} { continue }
-        switch -exact -- $type {
-            client {
-                if {[string length [lindex $mech 2]] > 0} {
-                    lappend r [lindex $mech 1]
-                }
-            }
-            server {
-                if {[string length [lindex $mech 3]] > 0} {
-                    lappend r [lindex $mech 1]
-                }
-            }
-            default {
-                return -code error "invalid type \"$type\":\
-                    must be either client or server"
-            }
-        }
-    }
-    return $r
-}
-
-# SASL::register --
-#
-#	Register a new SASL mechanism with a security preference. Higher
-#	preference values are chosen before lower valued mechanisms.
-#	If no server implementation is available then an empty string 
-#	should be provided for the serverproc parameter.
-#
-proc ::SASL::register {mechanism preference clientproc {serverproc {}}} {
-    variable mechanisms
-    set ndx [lsearch -regexp $mechanisms $mechanism]
-    set mech [list $preference $mechanism $clientproc $serverproc]
-    if {$ndx == -1} {
-        lappend mechanisms $mech
-    } else {
-        set mechanisms [lreplace $mechanisms $ndx $ndx $mech]
-    }
-    set mechanisms [lsort -index 0 -decreasing -integer $mechanisms]
-    return
-}
-
-# SASL::uid --
-#
-#	Return a unique integer.
-#
-proc ::SASL::uid {} {
-    variable uid
-    return [incr uid]
-}
-
-# SASL::response --
-#
-#	Get the reponse string from the SASL state.
-#
-proc ::SASL::response {context} {
-    upvar #0 $context ctx
-    return $ctx(response)
-}
-
-# SASL::reset --
-#
-#	Reset the SASL state. This permits the same instance to be reused
-#	for a new round of authentication.
-#
-proc ::SASL::reset {context} {
-    upvar #0 $context ctx
-    array set ctx [list step 0 response "" valid false count 0]
-    return $context
-}
-
-# SASL::cleanup --
-#
-#	Free any resources used with the SASL state.
-#
-proc ::SASL::cleanup {context} {
-    if {[info exists $context]} {
-        unset $context
-    }
-    return
-}
-
-# SASL::new --
-#
-#	Create a new SASL instance. 
-#
-proc ::SASL::new {args} {
-    set context [namespace current]::[uid]
-    upvar #0 $context ctx
-    array set ctx [list mech {} callback {} proc {} service smtp server {} \
-                       step 0 response "" valid false type client count 0]
-    eval [linsert $args 0 [namespace origin configure] $context]
-    return $context
-}
-
-# SASL::configure --
-#
-#	Configure the SASL state.
-#
-proc ::SASL::configure {context args} {
-    variable mechanisms
-    upvar #0 $context ctx
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -exact -- $option {
-            -service {
-                set ctx(service) [Pop args 1]
-            }
-            -server - -serverFQDN {
-                set ctx(server) [Pop args 1]
-            }
-            -mech - -mechanism {
-                set mech [string toupper [Pop args 1]]
-                set ctx(proc) {}
-                foreach m $mechanisms {
-                    if {[string equal [lindex $m 1] $mech]} {
-                        set ctx(mech) $mech
-                        if {[string equal $ctx(type) "server"]} {
-                            set ctx(proc) [lindex $m 3]
-                        } else {
-                            set ctx(proc) [lindex $m 2]
-                        }
-                        break
-                    }
-                }
-                if {[string equal $ctx(proc) {}]} {
-                    return -code error "mechanism \"$mech\" not available:\
-                        must be one of those given by \[sasl::mechanisms\]"
-                }
-            }
-            -callback - -callbacks {
-                set ctx(callback) [Pop args 1]
-            }
-            -type {
-                set type [Pop args 1]
-                if {[lsearch -exact {server client} $type] != -1} {
-                    set ctx(type) $type
-                    if {![string equal $ctx(mech) ""]} {
-                        configure $context -mechanism $ctx(mech)
-                    }
-                } else {
-                    return -code error "bad value \"$type\":\
-                        must be either client or server"
-                }
-            }
-            default {
-                return -code error "bad option \"$option\":\
-                    must be one of -mechanism, -service, -server -type\
-                    or -callbacks"
-            }
-        }
-        Pop args
-    }
-        
-}
-
-proc ::SASL::step {context challenge args} {
-    upvar #0 $context ctx
-    incr ctx(count)
-    return [eval [linsert $args 0 $ctx(proc) $context $challenge]]
-}
-
-
-proc ::SASL::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-proc ::SASL::md5_init {} {
-    variable md5_inited
-    if {[info exists md5_inited]} {return} else {set md5_inited 1}
-    # Deal with either version of md5. We'd like version 2 but someone
-    # may have already loaded version 1.
-    set md5major [lindex [split [package require md5] .] 0]
-    if {$md5major < 2} {
-        # md5 v1, no options, and returns a hex string ready for us.
-        proc ::SASL::md5_hex {data} { return [::md5::md5 $data] }
-        proc ::SASL::md5_bin {data} { return [binary format H* [::md5::md5 $data]] }
-        proc ::SASL::hmac_hex {pass data} { return [::md5::hmac $pass $data] }
-        proc ::SASL::hmac_bin {pass data} { return [binary format H* [::md5::hmac $pass $data]] }
-    } else {
-        # md5 v2 requires -hex to return hash as hex-encoded non-binary string.
-        proc ::SASL::md5_hex {data} { return [string tolower [::md5::md5 -hex $data]] }
-        proc ::SASL::md5_bin {data} { return [::md5::md5 $data] }
-        proc ::SASL::hmac_hex {pass data} { return [::md5::hmac -hex -key $pass $data] }
-        proc ::SASL::hmac_bin {pass data} { return [::md5::hmac -key $pass $data] }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# CRAM-MD5 SASL MECHANISM
-#
-# 	Implementation of the Challenge-Response Authentication Mechanism
-#	(RFC2195).
-#
-# Comments:
-#	This mechanism passes a server generated string containing
-#	a timestamp and has the client generate an MD5 HMAC using the
-#	shared secret as the key and the server string as the data.
-#	The downside of this protocol is that the server must have access
-#	to the plaintext password.
-#
-proc ::SASL::CRAM-MD5:client {context challenge args} {
-    upvar #0 $context ctx
-    md5_init
-    if {$ctx(step) != 0} {
-        return -code error "unexpected state: CRAM-MD5 has only 1 step"
-    }
-    if {[string length $challenge] == 0} {
-        set ctx(response) ""
-        return 1
-    }
-    set password [eval $ctx(callback) [list $context password]]
-    set username [eval $ctx(callback) [list $context username]]
-    set reply [hmac_hex $password $challenge]
-    set reply "$username [string tolower $reply]"
-    set ctx(response) $reply
-    incr ctx(step)
-    return 0
-}
-
-proc ::SASL::CRAM-MD5:server {context clientrsp args} {
-    upvar #0 $context ctx
-    md5_init
-    incr ctx(step)
-    switch -exact -- $ctx(step) {
-        1 {
-            set ctx(realm) [eval $ctx(callback) [list $context realm]]
-            set ctx(response) "<[pid].[clock seconds]@$ctx(realm)>"
-            return 1
-        }
-        2 {
-            foreach {user hash} $clientrsp break
-            set hash [string tolower $hash]
-            set pass [eval $ctx(callback) [list $context password $user $ctx(realm)]]
-            set check [hmac_bin $pass $ctx(response)]
-            binary scan $check H* cx
-            if {[string equal $cx $hash]} {
-                return 0
-            } else {
-                return -code error "authentication failed"
-            }
-        }
-        default {
-            return -code error "invalid state"
-        }
-    }
-}
-
-::SASL::register CRAM-MD5 30 ::SASL::CRAM-MD5:client ::SASL::CRAM-MD5:server
-
-# -------------------------------------------------------------------------
-# PLAIN SASL MECHANISM
-#
-# 	Implementation of the single step login SASL mechanism (RFC2595).
-#
-# Comments:
-#	A single step mechanism in which the authorization ID, the
-#	authentication ID and password are all transmitted in plain
-#	text. This should not be used unless the channel is secured by
-#	some other means (such as SSL/TLS).
-#
-proc ::SASL::PLAIN:client {context challenge args} {
-    upvar #0 $context ctx
-    incr ctx(step)
-    set authzid  [eval $ctx(callback) [list $context login]]
-    set username [eval $ctx(callback) [list $context username]]
-    set password [eval $ctx(callback) [list $context password]]
-    set ctx(response) "$authzid\x00$username\x00$password"
-    return 0
-}
-
-proc ::SASL::PLAIN:server {context clientrsp args} {
-    upvar \#0 $context ctx
-    if {[string length $clientrsp] < 1} {
-        set ctx(response) ""
-        return 1
-    } else {
-        foreach {authzid authid pass} [split $clientrsp \0] break
-        set realm [eval $ctx(callback) [list $context realm]]
-        set check [eval $ctx(callback) [list $context password $authid $realm]]
-        if {[string equal $pass $check]} {
-            return 0
-        } else {
-            return -code error "authentication failed"
-        }
-    }
-}
-
-::SASL::register PLAIN 10 ::SASL::PLAIN:client ::SASL::PLAIN:server
-
-# -------------------------------------------------------------------------
-# LOGIN SASL MECHANISM
-#
-# 	Implementation of the two step login SASL mechanism.
-#
-# Comments:
-#	This is an unofficial but widely deployed SASL mechanism somewhat
-#	akin to the PLAIN mechanism. Both the authentication ID and password
-#	are transmitted in plain text in response to server prompts.
-#
-#	NOT RECOMMENDED for use in new protocol implementations.
-#
-proc ::SASL::LOGIN:client {context challenge args} {
-    upvar #0 $context ctx
-    if {$ctx(step) == 0 && [string length $challenge] == 0} {
-        set ctx(response) ""
-        return 1
-    }
-    incr ctx(step)
-    switch -exact -- $ctx(step) {
-        1 {
-            set ctx(response) [eval $ctx(callback) [list $context username]]
-            set r 1
-        }
-        2 {
-            set ctx(response) [eval $ctx(callback) [list $context password]]
-            set r 0
-        }
-        default {
-            return -code error "unexpected state \"$ctx(step)\":\
-                LOGIN has only 2 steps"
-        }
-    }
-    return $r
-}
-
-proc ::SASL::LOGIN:server {context clientrsp args} {
-    upvar #0 $context ctx
-    incr ctx(step)
-    switch -exact -- $ctx(step) {
-        1 {
-            set ctx(response) "Username:"
-            return 1
-        }
-        2 {
-            set ctx(username) $clientrsp
-            set ctx(response) "Password:"
-            return 1
-        }
-        3 {
-            set user $ctx(username)
-            set realm [eval $ctx(callback) [list $context realm]]
-            set pass [eval $ctx(callback) [list $context password $user $realm]]
-            if {[string equal $clientrsp $pass]} {
-                return 0
-            } else {
-                return -code error "authentication failed"
-            }
-        }
-        default {
-            return -code error "invalid state"
-        }
-    }
-}
-
-::SASL::register LOGIN 20 ::SASL::LOGIN:client ::SASL::LOGIN:server
-
-# -------------------------------------------------------------------------
-# ANONYMOUS SASL MECHANISM
-#
-# 	Implementation of the ANONYMOUS SASL mechanism (RFC2245).
-#
-# Comments:
-#
-# 
-proc ::SASL::ANONYMOUS:client {context challenge args} {
-    upvar #0 $context ctx
-    set user  [eval $ctx(callback) [list $context username]]
-    set realm [eval $ctx(callback) [list $context realm]]
-    set ctx(response) $user@$realm
-    return 0
-}
-
-proc ::SASL::ANONYMOUS:server {context clientrsp args} {
-    upvar #0 $context ctx
-    set ctx(response) ""
-    if {[string length $clientrsp] < 1} {
-        if {$ctx(count) > 2} {
-            return -code error "authentication failed"
-        }
-        return 1
-    } else {
-        set ctx(trace) $clientrsp
-        return 0
-    }
-}
-
-::SASL::register ANONYMOUS 5 ::SASL::ANONYMOUS:client ::SASL::ANONYMOUS:server
-
-# -------------------------------------------------------------------------
-
-# DIGEST-MD5 SASL MECHANISM
-#
-# 	Implementation of the DIGEST-MD5 SASL mechanism (RFC2831).
-#
-# Comments:
-#
-proc ::SASL::DIGEST-MD5:client {context challenge args} {
-    variable digest_md5_noncecount
-    upvar #0 $context ctx
-    md5_init
-    if {$ctx(step) == 0 && [string length $challenge] == 0} {
-        set ctx(response) ""
-        return 1
-    }
-    incr ctx(step)
-    set result 0
-    switch -exact -- $ctx(step) {
-        1 {
-            array set params [DigestParameters $challenge]
-            
-            if {![info exists digest_md5_noncecount]} {
-                set digest_md5_noncecount 0
-            }
-            set nonce $params(nonce)
-            set cnonce [CreateNonce]
-            set noncecount [format %08u [incr digest_md5_noncecount]]
-            set qop auth
-            
-            set username [eval $ctx(callback) [list $context username]]
-            set password [eval $ctx(callback) [list $context password]]
-            if {[info exists params(realm)]} {
-                set realm $params(realm)
-            } else {
-                set realm [eval $ctx(callback) [list $context realm]]
-            }
-            
-            set uri "$ctx(service)/$realm"
-            set R [DigestResponse $username $realm $password $uri \
-                       $qop $nonce $noncecount $cnonce]
-            
-            set ctx(response) "username=\"$username\",realm=\"$realm\",nonce=\"$nonce\",nc=\"$noncecount\",cnonce=\"$cnonce\",digest-uri=\"$uri\",response=\"$R\",qop=$qop"
-            set result 1
-        }
-        
-        2 {
-            set ctx(response) ""
-            set result 0
-        }
-        default {
-            return -code error "invalid state"
-        }
-    }
-    return $result
-}
-
-proc ::SASL::DIGEST-MD5:server {context challenge args} {
-    variable digest_md5_noncecount
-    upvar #0 $context ctx
-    md5_init
-    incr ctx(step)
-    set result 0
-    switch -exact -- $ctx(step) {
-        1 {
-            set realm [eval $ctx(callback) [list $context realm]]
-            set ctx(nonce) [CreateNonce]
-            set ctx(response) "realm=\"$realm\",nonce=\"$ctx(nonce)\",qop=\"auth\",charset=utf-8,algorithm=md5-sess"
-            set result 1
-        }
-        2 {
-            array set params [DigestParameters $challenge]
-            set realm [eval $ctx(callback) [list $context realm]]
-            set password [eval $ctx(callback)\
-                              [list $context password $params(username) $realm]]
-            set uri "$ctx(service)/$realm"
-            set R [DigestResponse $params(username) $realm $password \
-                       $uri auth $ctx(nonce) $params(nc) $params(cnonce)]
-            if {[string equal $R $params(response)]} {
-                set R2 [DigestResponse $params(username) $realm $password \
-                        $uri auth $ctx(nonce) $params(nc) $params(cnonce)]
-                set ctx(response) "rspauth=$R2"
-                set ctx(nc) $params(nc)
-                set result 1
-            } else {
-                return -code error "authentication failed"
-            }
-        }
-        3 {
-            set ctx(response) ""
-            set result 0
-        }
-        default {
-            return -code error "invalid state"
-        }
-    }
-    return $result
-}
-
-# RFC 2831 2.1
-# Char categories as per spec...
-# Build up a regexp for splitting the challenge into key value pairs.
-proc ::SASL::DigestParameters {challenge} {
-    set sep "\\\]\\\[\\\\()<>@,;:\\\"\\\?=\\\{\\\} \t"
-    set tok {0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\-\|\~\!\#\$\%\&\*\+\.\^\_\`}
-    set sqot {(?:\'(?:\\.|[^\'\\])*\')}
-    set dqot {(?:\"(?:\\.|[^\"\\])*\")}
-    set parameters {}
-    regsub -all "(\[${tok}\]+)=(${dqot}|(?:\[${tok}\]+))(?:\[${sep}\]+|$)" $challenge {\1 \2 } parameters
-    return $parameters
-}
-
-# RFC 2831 2.1.2.1
-#
-proc ::SASL::DigestResponse {user realm pass uri qop nonce noncecount cnonce} {
-    set A1 [md5_bin "$user:$realm:$pass"]
-    set A2 "AUTHENTICATE:$uri"
-    if {![string equal $qop "auth"]} {
-        append A2 :[string repeat 0 32]
-    }
-    set A1h [md5_hex "${A1}:$nonce:$cnonce"]
-    set A2h [md5_hex $A2]
-    set R   [md5_hex $A1h:$nonce:$noncecount:$cnonce:$qop:$A2h]
-    return $R
-}
-
-# RFC 2831 2.1.2.2
-#
-proc ::SASL::DigestResponse2 {user realm pass uri qop nonce noncecount cnonce} {
-    set A1 [md5_bin "$user:$realm:$pass"]
-    set A2 ":$uri"
-    if {![string equal $qop "auth"]} {
-        append A2 :[string repeat 0 32]
-    }
-    set A1h [md5_hex "${A1}:$nonce:$cnonce"]
-    set A2h [md5_hex $A2]
-    set R   [md5_hex $A1h:$nonce:$noncecount:$cnonce:$qop:$A2h]
-    return $R
-}
-
-# Get 16 random bytes for a nonce value. If we can use /dev/random, do so
-# otherwise we hash some values.
-#
-proc ::SASL::CreateNonce {} {
-    set bytes {}
-    if {[file readable /dev/urandom]} {
-        catch {
-            set f [open /dev/urandom r]
-            fconfigure $f -translation binary -buffering none
-            set bytes [read $f 16]
-            close $f
-        }
-    }
-    if {[string length $bytes] < 1} {
-        set bytes [md5_bin [clock seconds]:[pid]:[expr {rand()}]]
-    }
-    return [binary scan $bytes h* r; set r]
-}
-
-::SASL::register DIGEST-MD5 40 \
-    ::SASL::DIGEST-MD5:client ::SASL::DIGEST-MD5:server
-
-# -------------------------------------------------------------------------
-
-# OTP SASL MECHANISM
-#
-# 	Implementation of the OTP SASL mechanism (RFC2444).
-#
-# Comments:
-#
-#	RFC 2289: A One-Time Password System
-#	RFC 2444: OTP SASL Mechanism
-#	RFC 2243: OTP Extended Responses
-#	Client initializes with authid\0authzid
-#	Server responds with extended OTP responses 
-# 	eg: otp-md5 498 bi32123 ext
-#	Client responds with otp result as:
-#	 hex:xxxxxxxxxxxxxxxx
-# 	or
-#	 word:WWWW WWW WWWW WWWW WWWW
-#
-#	To support changing the otp sequence the extended commands have:
-#	  init-hex:<current>:<new params>:<new>
-#	eg: init-hex:xxxxxxxxxxxx:md5 499 seed987:xxxxxxxxxxxxxx
-#	or init-word
-
-proc ::SASL::OTP:client {context challenge args} {
-    upvar #0 $context ctx
-    package require otp
-    incr ctx(step)
-    switch -exact -- $ctx(step) {
-        1 {
-            set authzid  [eval $ctx(callback) [list $context login]]
-            set username [eval $ctx(callback) [list $context username]]
-            set ctx(response) "$authzid\x00$username"
-            set cont 1
-        }
-        2 {
-            foreach {type count seed ext} $challenge break
-            set type [lindex [split $type -] 1]
-            if {[lsearch -exact {md4 md5 sha1 rmd160} $type] == -1} {
-                return -code error "unsupported digest algorithm \"$type\":\
-                    must be one of md4, md5, sha1 or rmd160"
-            }
-            set challenge [lrange $challenge 3 end]
-            set password [eval $ctx(callback) [list $context password]]
-            set otp [::otp::otp-$type -word -seed $seed \
-                         -count $count $password]
-            if {[string match "ext*" $ext]} {
-                set otp word:$otp
-            }
-            set ctx(response) $otp
-            set cont 0
-        }
-        default {
-            return -code error "unexpected state \"$ctx(step)\":\
-               the SASL OTP mechanism only has 2 steps"
-        }
-    }
-    return $cont
-}
-
-::SASL::register OTP 45 ::SASL::OTP:client
-
-# -------------------------------------------------------------------------
-
-package provide SASL $::SASL::version
-
-# -------------------------------------------------------------------------
-#
-# Local variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded sha256 1.0.2 [list source [file join $dir sha256.tcl]]
-package ifneeded sha1   2.0.3 [list source [file join $dir sha1.tcl]]
-package ifneeded sha1   1.1.0 [list source [file join $dir sha1v1.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,817 +1,0 @@
-# sha1.tcl - 
-#
-# Copyright (C) 2001 Don Libes <libes@nist.gov>
-# Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# SHA1 defined by FIPS 180-1, "The SHA1 Message-Digest Algorithm"
-# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
-#
-# This is an implementation of SHA1 based upon the example code given in
-# FIPS 180-1 and upon the tcllib MD4 implementation and taking some ideas
-# and methods from the earlier tcllib sha1 version by Don Libes.
-#
-# This implementation permits incremental updating of the hash and 
-# provides support for external compiled implementations either using
-# critcl (sha1c) or Trf.
-#
-# ref: http://www.itl.nist.gov/fipspubs/fip180-1.htm
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: sha1.tcl,v 1.21 2007/05/03 21:41:10 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: sha1c.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::sha1 {
-    variable  version 2.0.3
-    variable  rcsid {$Id: sha1.tcl,v 1.21 2007/05/03 21:41:10 andreas_kupries Exp $}
-
-    variable  accel
-    array set accel {tcl 0 critcl 0 cryptkit 0 trf 0}
-    variable  loaded {}
-    variable  active
-    array set active {tcl 0 critcl 0 cryptkit 0 trf 0}
-
-    namespace export sha1 hmac SHA1Init SHA1Update SHA1Final
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-# Management of sha1 implementations.
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::sha1::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        tcl {
-            # Already present (this file)
-            set r 1
-        }
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require sha1c}]} {
-                set r [expr {[info command ::sha1::sha1c] != {}}]
-            }
-        }
-        cryptkit {
-            if {![catch {package require cryptkit}]} {
-                set r [expr {![catch {cryptkit::cryptInit}]}]
-            }
-        }
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::sha1 aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($name) $r
-    return $r
-}
-
-# ::sha1::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::sha1::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::sha1::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::sha1::KnownImplementations {} {
-    return {critcl cryptkit trf tcl}
-}
-
-proc ::sha1::Names {} {
-    return {
-	critcl   {tcllibc based}
-        cryptkit {cryptkit based}
-        trf      {Trf based}
-	tcl      {pure Tcl}
-    }
-}
-
-# ::sha1::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::sha1::SwitchTo {key} {
-    variable accel
-    variable active
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    if {![string equal $loaded ""]} {
-        set active($loaded) 0
-    }
-    if {![string equal $key ""]} {
-        set active($key) 1
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# -------------------------------------------------------------------------
-
-# SHA1Init --
-#
-#   Create and initialize an SHA1 state variable. This will be
-#   cleaned up when we call SHA1Final
-#
-
-proc ::sha1::SHA1Init {} {
-    variable active
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # FIPS 180-1: 7 - Initialize the hash state
-    array set state \
-        [list \
-             A [expr {int(0x67452301)}] \
-             B [expr {int(0xEFCDAB89)}] \
-             C [expr {int(0x98BADCFE)}] \
-             D [expr {int(0x10325476)}] \
-             E [expr {int(0xC3D2E1F0)}] \
-             n 0 i "" ]
-    if {$active(cryptkit)} {
-        cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_SHA
-    } elseif {$active(trf)} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::sha1 -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-# SHA1Update --
-#
-#   This is called to add more data into the hash. You may call this
-#   as many times as you require. Note that passing in "ABC" is equivalent
-#   to passing these letters in as separate calls -- hence this proc 
-#   permits hashing of chunked data
-#
-#   If we have a C-based implementation available, then we will use
-#   it here in preference to the pure-Tcl implementation.
-#
-proc ::sha1::SHA1Update {token data} {
-    variable active
-    upvar #0 $token state
-
-    if {$active(critcl)} {
-        if {[info exists state(sha1c)]} {
-            set state(sha1c) [sha1c $data $state(sha1c)]
-        } else {
-            set state(sha1c) [sha1c $data]
-        }
-        return
-    } elseif {[info exists state(ckctx)]} {
-        if {[string length $data] > 0} {
-            cryptkit::cryptEncrypt $state(ckctx) $data
-        }
-        return
-    } elseif {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA1Transform $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-# SHA1Final --
-#
-#    This procedure is used to close the current hash and returns the
-#    hash data. Once this procedure has been called the hash context
-#    is freed and cannot be used again.
-#
-#    Note that the output is 160 bits represented as binary data.
-#
-proc ::sha1::SHA1Final {token} {
-    upvar #0 $token state
-
-    # Check for either of the C-compiled versions.
-    if {[info exists state(sha1c)]} {
-        set r $state(sha1c)
-        unset state
-        return $r
-    } elseif {[info exists state(ckctx)]} {
-        cryptkit::cryptEncrypt $state(ckctx) ""
-        cryptkit::cryptGetAttributeString $state(ckctx) \
-            CRYPT_CTXINFO_HASHVALUE r 20
-        cryptkit::cryptDestroyContext $state(ckctx)
-        # If nothing was hashed, we get no r variable set!
-        if {[info exists r]} {
-            unset state
-            return $r
-        }
-    } elseif {[info exists state(trf)]} {
-        close $state(trf)
-        set r $state(trfwrite)
-        unset state
-        return $r
-    }
-
-    # Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # Append length in bits as big-endian wide int.
-    set dlen [expr {8 * $state(n)}]
-    append state(i) [binary format II 0 $dlen]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA1Transform $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-
-# HMACInit --
-#
-#    This is equivalent to the SHA1Init procedure except that a key is
-#    added into the algorithm
-#
-proc ::sha1::HMACInit {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the SHA1 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [SHA1Init]
-        SHA1Update $tok $K
-        set K [SHA1Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [SHA1Init]
-    SHA1Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-# HMACUpdate --
-#
-#    Identical to calling SHA1Update
-#
-proc ::sha1::HMACUpdate {token data} {
-    SHA1Update $token $data
-    return
-}
-
-# HMACFinal --
-#
-#    This is equivalent to the SHA1Final procedure. The hash context is
-#    closed and the binary representation of the hash result is returned.
-#
-proc ::sha1::HMACFinal {token} {
-    upvar #0 $token state
-
-    set tok [SHA1Init];                 # init the outer hashing function
-    SHA1Update $tok $state(Ko);         # prepare with the outer pad.
-    SHA1Update $tok [SHA1Final $token]; # hash the inner result
-    return [SHA1Final $tok]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  This is the core SHA1 algorithm. It is a lot like the MD4 algorithm but
-#  includes an extra round and a set of constant modifiers throughout.
-#
-set ::sha1::SHA1Transform_body {
-    upvar #0 $token state
-
-    # FIPS 180-1: 7a: Process Message in 16-Word Blocks
-    binary scan $msg I* blocks
-    set blockLen [llength $blocks]
-    for {set i 0} {$i < $blockLen} {incr i 16} {
-        set W [lrange $blocks $i [expr {$i+15}]]
-        
-        # FIPS 180-1: 7b: Expand the input into 80 words
-        # For t = 16 to 79 
-        #   let Wt = (Wt-3 ^ Wt-8 ^ Wt-14 ^ Wt-16) <<< 1
-        set t3  12
-        set t8   7
-        set t14  1
-        set t16 -1
-        for {set t 16} {$t < 80} {incr t} {
-            set x [expr {[lindex $W [incr t3]] ^ [lindex $W [incr t8]] ^ \
-                             [lindex $W [incr t14]] ^ [lindex $W [incr t16]]}]
-            lappend W [expr {int(($x << 1) | (($x >> 31) & 1))}]
-        }
-        
-        # FIPS 180-1: 7c: Copy hash state.
-        set A $state(A)
-        set B $state(B)
-        set C $state(C)
-        set D $state(D)
-        set E $state(E)
-
-        # FIPS 180-1: 7d: Do permutation rounds
-        # For t = 0 to 79 do
-        #   TEMP = (A<<<5) + ft(B,C,D) + E + Wt + Kt;
-        #   E = D; D = C; C = S30(B); B = A; A = TEMP;
-
-        # Round 1: ft(B,C,D) = (B & C) | (~B & D) ( 0 <= t <= 19)
-        for {set t 0} {$t < 20} {incr t} {
-            set TEMP [F1 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Round 2: ft(B,C,D) = (B ^ C ^ D) ( 20 <= t <= 39)
-        for {} {$t < 40} {incr t} {
-            set TEMP [F2 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Round 3: ft(B,C,D) = ((B & C) | (B & D) | (C & D)) ( 40 <= t <= 59)
-        for {} {$t < 60} {incr t} {
-            set TEMP [F3 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-         }
-
-        # Round 4: ft(B,C,D) = (B ^ C ^ D) ( 60 <= t <= 79)
-        for {} {$t < 80} {incr t} {
-            set TEMP [F4 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Then perform the following additions. (That is, increment each
-        # of the four registers by the value it had before this block
-        # was started.)
-        incr state(A) $A
-        incr state(B) $B
-        incr state(C) $C
-        incr state(D) $D
-        incr state(E) $E
-    }
-
-    return
-}
-
-proc ::sha1::F1 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
-               + ($D ^ ($B & ($C ^ $D))) + $E + $W + 0x5a827999) & 0xffffffff}
-}
-
-proc ::sha1::F2 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
-               + ($B ^ $C ^ $D) + $E + $W + 0x6ed9eba1) & 0xffffffff}
-}
-
-proc ::sha1::F3 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
-               + (($B & $C) | ($D & ($B | $C))) + $E + $W + 0x8f1bbcdc) & 0xffffffff}
-}
-
-proc ::sha1::F4 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
-               + ($B ^ $C ^ $D) + $E + $W + 0xca62c1d6) & 0xffffffff}
-}
-
-proc ::sha1::rotl32 {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-
-# -------------------------------------------------------------------------
-# 
-# In order to get this code to go as fast as possible while leaving
-# the main code readable we can substitute the above function bodies
-# into the transform procedure. This inlines the code for us an avoids
-# a procedure call overhead within the loops.
-#
-# We can do some minor tweaking to improve speed on Tcl < 8.5 where we
-# know our arithmetic is limited to 64 bits. On > 8.5 we may have 
-# unconstrained integer arithmetic and must avoid letting it run away.
-#
-
-regsub -all -line \
-    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body \
-    {[expr {(rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {rotl32\(\$A,5\)} \
-    $::sha1::SHA1Transform_body_tmp \
-    {((($A << 5) \& 0xffffffff) | (($A >> 27) \& 0x1f))} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[rotl32 \$B 30\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {int(($B << 30) | (($B >> 2) \& 0x3fffffff))}]} \
-    ::sha1::SHA1Transform_body_tmp
-#
-# Version 2 avoids a few truncations to 32 bits in non-essential places.
-#
-regsub -all -line \
-    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body \
-    {[expr {rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {rotl32\(\$A,5\)} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {(($A << 5) | (($A >> 27) \& 0x1f))} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[rotl32 \$B 30\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {($B << 30) | (($B >> 2) \& 0x3fffffff)}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-if {[package vsatisfies [package provide Tcl] 8.5]} {
-    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp
-} else {
-    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp2
-}
-
-unset ::sha1::SHA1Transform_body_tmp
-unset ::sha1::SHA1Transform_body_tmp2
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::sha1::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {0xFF & $v}]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::sha1::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::sha1::Chunk {token channel {chunksize 4096}} {
-    upvar #0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    SHA1Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::sha1 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] == 1} {
-        set opts(-hex) 1
-    } else {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [concat -bin [array names opts]]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"sha1 ?-hex? -filename file | string\""
-        }
-        set tok [SHA1Init]
-        SHA1Update $tok [lindex $args 0]
-        set r [SHA1Final $tok]
-
-    } else {
-
-        set tok [SHA1Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [SHA1Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::hmac {args} {
-    array set opts {-hex 1 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] != 2} {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -key       { set opts(-key) [Pop args 1] }
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [array names opts]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {[llength $args] == 2} {
-        set opts(-key) [Pop args]
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac ?-hex? -key key -filename file | string\""
-        }
-        set tok [HMACInit $opts(-key)]
-        HMACUpdate $tok [lindex $args 0]
-        set r [HMACFinal $tok]
-
-    } else {
-
-        set tok [HMACInit $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [HMACFinal $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::sha1 {
-    variable e {}
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-}
-
-package provide sha1 $::sha1::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,122 +1,0 @@
-# sha1c.tcl - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# Wrapper for the Secure Hashing Algorithm (SHA1)
-#
-# $Id: sha1c.tcl,v 1.4 2006/10/13 06:23:28 andreas_kupries Exp $
-
-package require critcl;                 # needs critcl
-package provide sha1c 2.0.3
-
-critcl::cheaders sha1.h;                # NetBSD SHA1 implementation
-critcl::csources sha1.c;                # NetBSD SHA1 implementation
-
-if {$tcl_platform(byteOrder) eq "littleEndian"} {
-    set byteOrder 1234
-} else {
-    set byteOrder 4321
-}
-critcl::cheaders -DTCL_BYTE_ORDER=$byteOrder
-
-namespace eval ::sha1 {
-
-    critcl::ccode {
-        #include "sha1.h"
-        #include <stdlib.h>
-        #include <assert.h>
-        
-        static
-        Tcl_ObjType sha1_type; /* fast internal access representation */
-        
-        static void 
-        sha1_free_rep(Tcl_Obj* obj)
-        {
-            SHA1_CTX* mp = (SHA1_CTX*) obj->internalRep.otherValuePtr;
-            free(mp);
-        }
-        
-        static void
-        sha1_dup_rep(Tcl_Obj* obj, Tcl_Obj* dup)
-        {
-            SHA1_CTX* mp = (SHA1_CTX*) obj->internalRep.otherValuePtr;
-            dup->internalRep.otherValuePtr = malloc(sizeof *mp);
-            memcpy(dup->internalRep.otherValuePtr, mp, sizeof *mp);
-            dup->typePtr = &sha1_type;
-        }
-        
-        static void
-        sha1_string_rep(Tcl_Obj* obj)
-        {
-            unsigned char buf[20];
-            Tcl_Obj* temp;
-            char* str;
-            SHA1_CTX dup = *(SHA1_CTX*) obj->internalRep.otherValuePtr;
-            
-            SHA1Final(buf, &dup);
-            
-            /* convert via a byte array to properly handle null bytes */
-            temp = Tcl_NewByteArrayObj(buf, sizeof buf);
-            Tcl_IncrRefCount(temp);
-            
-            str = Tcl_GetStringFromObj(temp, &obj->length);
-            obj->bytes = Tcl_Alloc(obj->length + 1);
-            memcpy(obj->bytes, str, obj->length + 1);
-            
-            Tcl_DecrRefCount(temp);
-        }
-        
-        static int
-        sha1_from_any(Tcl_Interp* ip, Tcl_Obj* obj)
-        {
-            assert(0);
-            return TCL_ERROR;
-        }
-        
-        static
-        Tcl_ObjType sha1_type = {
-            "sha1c", sha1_free_rep, sha1_dup_rep, sha1_string_rep,
-            sha1_from_any
-        };
-    }
-    
-    critcl::ccommand sha1c {dummy ip objc objv} {
-        SHA1_CTX* mp;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        if (objc < 2 || objc > 3) {
-            Tcl_WrongNumArgs(ip, 1, objv, "data ?context?");
-            return TCL_ERROR;
-        }
-        
-        if (objc == 3) {
-            if (objv[2]->typePtr != &sha1_type 
-                && sha1_from_any(ip, objv[2]) != TCL_OK)
-            return TCL_ERROR;
-            obj = objv[2];
-            if (Tcl_IsShared(obj))
-            obj = Tcl_DuplicateObj(obj);
-        } else {
-            obj = Tcl_NewObj();
-            mp = (SHA1_CTX*) malloc(sizeof *mp);
-            SHA1Init(mp);
-            
-            if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
-            obj->typePtr->freeIntRepProc(obj);
-            
-            obj->internalRep.otherValuePtr = mp;
-            obj->typePtr = &sha1_type;
-        }
-        
-        Tcl_SetObjResult(ip, obj);
-        Tcl_IncrRefCount(obj); //!! huh?
-        
-        Tcl_InvalidateStringRep(obj);
-        mp = (SHA1_CTX*) obj->internalRep.otherValuePtr;
-        
-        data = Tcl_GetByteArrayFromObj(objv[1], &size);
-        SHA1Update(mp, data, size);
-        
-        return TCL_OK;
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1v1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha1v1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,713 +1,0 @@
-# sha1.tcl - 
-#
-# Copyright (C) 2001 Don Libes <libes@nist.gov>
-# Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# SHA1 defined by FIPS 180-1, "The SHA1 Message-Digest Algorithm"
-# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
-#
-# This is an implementation of SHA1 based upon the example code given in
-# FIPS 180-1 and upon the tcllib MD4 implementation and taking some ideas
-# and methods from the earlier tcllib sha1 version by Don Libes.
-#
-# This implementation permits incremental updating of the hash and 
-# provides support for external compiled implementations either using
-# critcl (sha1c) or Trf.
-#
-# ref: http://www.itl.nist.gov/fipspubs/fip180-1.htm
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-# $Id: sha1v1.tcl,v 1.1 2006/03/12 22:46:13 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: sha1c.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::sha1 {
-    variable version 1.1.0
-    variable rcsid {$Id: sha1v1.tcl,v 1.1 2006/03/12 22:46:13 andreas_kupries Exp $}
-    variable accel
-    array set accel {critcl 0 cryptkit 0 trf 0}
-
-    namespace export sha1 hmac SHA1Init SHA1Update SHA1Final
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# SHA1Init --
-#
-#   Create and initialize an SHA1 state variable. This will be
-#   cleaned up when we call SHA1Final
-#
-proc ::sha1::SHA1Init {} {
-    variable accel
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token state
-
-    # FIPS 180-1: 7 - Initialize the hash state
-    array set state \
-        [list \
-             A [expr {int(0x67452301)}] \
-             B [expr {int(0xEFCDAB89)}] \
-             C [expr {int(0x98BADCFE)}] \
-             D [expr {int(0x10325476)}] \
-             E [expr {int(0xC3D2E1F0)}] \
-             n 0 i "" ]
-    if {$accel(cryptkit)} {
-        cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_SHA
-    } elseif {$accel(trf)} {
-        set s {}
-        switch -exact -- $::tcl_platform(platform) {
-            windows { set s [open NUL w] }
-            unix    { set s [open /dev/null w] }
-        }
-        if {$s != {}} {
-            fconfigure $s -translation binary -buffering none
-            ::sha1 -attach $s -mode write \
-                -read-type variable \
-                -read-destination [subst $token](trfread) \
-                -write-type variable \
-                -write-destination [subst $token](trfwrite)
-            array set state [list trfread 0 trfwrite 0 trf $s]
-        }
-    }
-    return $token
-}
-
-# SHA1Update --
-#
-#   This is called to add more data into the hash. You may call this
-#   as many times as you require. Note that passing in "ABC" is equivalent
-#   to passing these letters in as separate calls -- hence this proc 
-#   permits hashing of chunked data
-#
-#   If we have a C-based implementation available, then we will use
-#   it here in preference to the pure-Tcl implementation.
-#
-proc ::sha1::SHA1Update {token data} {
-    variable accel
-    upvar #0 $token state
-
-    if {$accel(critcl)} {
-        if {[info exists state(sha1c)]} {
-            set state(sha1c) [sha1c $data $state(sha1c)]
-        } else {
-            set state(sha1c) [sha1c $data]
-        }
-        return
-    } elseif {[info exists state(ckctx)]} {
-        if {[string length $data] > 0} {
-            cryptkit::cryptEncrypt $state(ckctx) $data
-        }
-        return
-    } elseif {[info exists state(trf)]} {
-        puts -nonewline $state(trf) $data
-        return
-    }
-
-    # Update the state values
-    incr state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA1Transform $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-# SHA1Final --
-#
-#    This procedure is used to close the current hash and returns the
-#    hash data. Once this procedure has been called the hash context
-#    is freed and cannot be used again.
-#
-#    Note that the output is 160 bits represented as binary data.
-#
-proc ::sha1::SHA1Final {token} {
-    upvar #0 $token state
-
-    # Check for either of the C-compiled versions.
-    if {[info exists state(sha1c)]} {
-        set r $state(sha1c)
-        unset state
-        return $r
-    } elseif {[info exists state(ckctx)]} {
-        cryptkit::cryptEncrypt $state(ckctx) ""
-        cryptkit::cryptGetAttributeString $state(ckctx) \
-            CRYPT_CTXINFO_HASHVALUE r 20
-        cryptkit::cryptDestroyContext $state(ckctx)
-        # If nothing was hashed, we get no r variable set!
-        if {[info exists r]} {
-            unset state
-            return $r
-        }
-    } elseif {[info exists state(trf)]} {
-        close $state(trf)
-        set r $state(trfwrite)
-        unset state
-        return $r
-    }
-
-    # Padding
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # Append length in bits as big-endian wide int.
-    set dlen [expr {8 * $state(n)}]
-    append state(i) [binary format II 0 $dlen]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA1Transform $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-
-# HMACInit --
-#
-#    This is equivalent to the SHA1Init procedure except that a key is
-#    added into the algorithm
-#
-proc ::sha1::HMACInit {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the SHA1 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [SHA1Init]
-        SHA1Update $tok $K
-        set K [SHA1Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [SHA1Init]
-    SHA1Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-# HMACUpdate --
-#
-#    Identical to calling SHA1Update
-#
-proc ::sha1::HMACUpdate {token data} {
-    SHA1Update $token $data
-    return
-}
-
-# HMACFinal --
-#
-#    This is equivalent to the SHA1Final procedure. The hash context is
-#    closed and the binary representation of the hash result is returned.
-#
-proc ::sha1::HMACFinal {token} {
-    upvar #0 $token state
-
-    set tok [SHA1Init];                 # init the outer hashing function
-    SHA1Update $tok $state(Ko);         # prepare with the outer pad.
-    SHA1Update $tok [SHA1Final $token]; # hash the inner result
-    return [SHA1Final $tok]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  This is the core SHA1 algorithm. It is a lot like the MD4 algorithm but
-#  includes an extra round and a set of constant modifiers throughout.
-#
-set ::sha1::SHA1Transform_body {
-    upvar #0 $token state
-
-    # FIPS 180-1: 7a: Process Message in 16-Word Blocks
-    binary scan $msg I* blocks
-    set blockLen [llength $blocks]
-    for {set i 0} {$i < $blockLen} {incr i 16} {
-        set W [lrange $blocks $i [expr {$i+15}]]
-        
-        # FIPS 180-1: 7b: Expand the input into 80 words
-        # For t = 16 to 79 
-        #   let Wt = (Wt-3 ^ Wt-8 ^ Wt-14 ^ Wt-16) <<< 1
-        set t3  12
-        set t8   7
-        set t14  1
-        set t16 -1
-        for {set t 16} {$t < 80} {incr t} {
-            set x [expr {[lindex $W [incr t3]] ^ [lindex $W [incr t8]] ^ \
-                             [lindex $W [incr t14]] ^ [lindex $W [incr t16]]}]
-            lappend W [expr {int(($x << 1) | (($x >> 31) & 1))}]
-        }
-        
-        # FIPS 180-1: 7c: Copy hash state.
-        set A $state(A)
-        set B $state(B)
-        set C $state(C)
-        set D $state(D)
-        set E $state(E)
-
-        # FIPS 180-1: 7d: Do permutation rounds
-        # For t = 0 to 79 do
-        #   TEMP = (A<<<5) + ft(B,C,D) + E + Wt + Kt;
-        #   E = D; D = C; C = S30(B); B = A; A = TEMP;
-
-        # Round 1: ft(B,C,D) = (B & C) | (~B & D) ( 0 <= t <= 19)
-        for {set t 0} {$t < 20} {incr t} {
-            set TEMP [F1 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Round 2: ft(B,C,D) = (B ^ C ^ D) ( 20 <= t <= 39)
-        for {} {$t < 40} {incr t} {
-            set TEMP [F2 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Round 3: ft(B,C,D) = ((B & C) | (B & D) | (C & D)) ( 40 <= t <= 59)
-        for {} {$t < 60} {incr t} {
-            set TEMP [F3 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-         }
-
-        # Round 4: ft(B,C,D) = (B ^ C ^ D) ( 60 <= t <= 79)
-        for {} {$t < 80} {incr t} {
-            set TEMP [F4 $A $B $C $D $E [lindex $W $t]]
-            set E $D
-            set D $C
-            set C [rotl32 $B 30]
-            set B $A
-            set A $TEMP
-        }
-
-        # Then perform the following additions. (That is, increment each
-        # of the four registers by the value it had before this block
-        # was started.)
-        incr state(A) $A
-        incr state(B) $B
-        incr state(C) $C
-        incr state(D) $D
-        incr state(E) $E
-    }
-
-    return
-}
-
-proc ::sha1::F1 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
-               + ($D ^ ($B & ($C ^ $D))) + $E + $W + 0x5a827999) & 0xffffffff}
-}
-
-proc ::sha1::F2 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
-               + ($B ^ $C ^ $D) + $E + $W + 0x6ed9eba1) & 0xffffffff}
-}
-
-proc ::sha1::F3 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
-               + (($B & $C) | ($D & ($B | $C))) + $E + $W + 0x8f1bbcdc) & 0xffffffff}
-}
-
-proc ::sha1::F4 {A B C D E W} {
-    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
-               + ($B ^ $C ^ $D) + $E + $W + 0xca62c1d6) & 0xffffffff}
-}
-
-proc ::sha1::rotl32 {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-
-# -------------------------------------------------------------------------
-# 
-# In order to get this code to go as fast as possible while leaving
-# the main code readable we can substitute the above function bodies
-# into the transform procedure. This inlines the code for us an avoids
-# a procedure call overhead within the loops.
-#
-# We can do some minor tweaking to improve speed on Tcl < 8.5 where we
-# know our arithmetic is limited to 64 bits. On > 8.5 we may have 
-# unconstrained integer arithmetic and must avoid letting it run away.
-#
-
-regsub -all -line \
-    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body \
-    {[expr {(rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6) \& 0xffffffff}]} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {rotl32\(\$A,5\)} \
-    $::sha1::SHA1Transform_body_tmp \
-    {((($A << 5) \& 0xffffffff) | (($A >> 27) \& 0x1f))} \
-    ::sha1::SHA1Transform_body_tmp
-
-regsub -all -line \
-    {\[rotl32 \$B 30\]} \
-    $::sha1::SHA1Transform_body_tmp \
-    {[expr {int(($B << 30) | (($B >> 2) \& 0x3fffffff))}]} \
-    ::sha1::SHA1Transform_body_tmp
-#
-# Version 2 avoids a few truncations to 32 bits in non-essential places.
-#
-regsub -all -line \
-    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body \
-    {[expr {rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {rotl32\(\$A,5\)} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {(($A << 5) | (($A >> 27) \& 0x1f))} \
-    ::sha1::SHA1Transform_body_tmp2
-
-regsub -all -line \
-    {\[rotl32 \$B 30\]} \
-    $::sha1::SHA1Transform_body_tmp2 \
-    {[expr {($B << 30) | (($B >> 2) \& 0x3fffffff)}]} \
-    ::sha1::SHA1Transform_body_tmp2
-
-if {[package vsatisfies [package provide Tcl] 8.5]} {
-    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp
-} else {
-    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp2
-}
-
-unset ::sha1::SHA1Transform_body_tmp
-unset ::sha1::SHA1Transform_body_tmp2
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::sha1::bytes {v} { 
-    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
-    format %c%c%c%c \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {0xFF & $v}]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::sha1::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require sha1c}]} {
-                set r [expr {[info command ::sha1::sha1c] != {}}]
-            }
-        }
-        cryptkit {
-            if {![catch {package require cryptkit}]} {
-                set r [expr {![catch {cryptkit::cryptInit}]}]
-            }
-        }
-        trf {
-            if {![catch {package require Trf}]} {
-                set r [expr {![catch {::sha1 aa} msg]}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::sha1::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::sha1::Chunk {token channel {chunksize 4096}} {
-    upvar #0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    SHA1Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::sha1 {args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] == 1} {
-        set opts(-hex) 1
-    } else {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [concat -bin [array names opts]]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"sha1 ?-hex? -filename file | string\""
-        }
-        set tok [SHA1Init]
-        SHA1Update $tok [lindex $args 0]
-        set r [SHA1Final $tok]
-
-    } else {
-
-        set tok [SHA1Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [SHA1Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha1::hmac {args} {
-    array set opts {-hex 1 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] != 2} {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -key       { set opts(-key) [Pop args 1] }
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [array names opts]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {[llength $args] == 2} {
-        set opts(-key) [Pop args]
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac ?-hex? -key key -filename file | string\""
-        }
-        set tok [HMACInit $opts(-key)]
-        HMACUpdate $tok [lindex $args 0]
-        set r [HMACFinal $tok]
-
-    } else {
-
-        set tok [HMACInit $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [HMACFinal $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::sha1 {
-    foreach e {critcl cryptkit trf} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide sha1 $::sha1::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
-
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha256.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha256.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,837 +1,0 @@
-# sha256.tcl - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# SHA1 defined by FIPS 180-2, "The Secure Hash Standard"
-# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
-#
-# This is an implementation of the secure hash algorithms specified in the
-# FIPS 180-2 document.
-#
-# This implementation permits incremental updating of the hash and 
-# provides support for external compiled implementations using critcl.
-#
-# This implementation permits incremental updating of the hash and 
-# provides support for external compiled implementations either using
-# critcl (sha256c).
-#
-# Ref: http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
-#      http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
-#
-# -------------------------------------------------------------------------
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# -------------------------------------------------------------------------
-#
-
-# @mdgen EXCLUDE: sha256c.tcl
-
-package require Tcl 8.2;                # tcl minimum version
-
-namespace eval ::sha2 {
-    variable version 1.0.2
-    variable rcsid {$Id: sha256.tcl,v 1.6 2007/05/03 21:41:10 andreas_kupries Exp $}
-
-    variable  accel
-    array set accel {tcl 0 critcl 0}
-    variable  loaded {}
-
-    namespace export sha256 hmac \
-            SHA256Init SHA256Update SHA256Final
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 0
-    }
-
-    variable K
-    if {![info exists K]} {
-        # FIPS 180-2: 4.2.2 SHA-256 constants
-        set K [list \
-                   0x428a2f98 0x71374491 0xb5c0fbcf 0xe9b5dba5 \
-                   0x3956c25b 0x59f111f1 0x923f82a4 0xab1c5ed5 \
-                   0xd807aa98 0x12835b01 0x243185be 0x550c7dc3 \
-                   0x72be5d74 0x80deb1fe 0x9bdc06a7 0xc19bf174 \
-                   0xe49b69c1 0xefbe4786 0x0fc19dc6 0x240ca1cc \
-                   0x2de92c6f 0x4a7484aa 0x5cb0a9dc 0x76f988da \
-                   0x983e5152 0xa831c66d 0xb00327c8 0xbf597fc7 \
-                   0xc6e00bf3 0xd5a79147 0x06ca6351 0x14292967 \
-                   0x27b70a85 0x2e1b2138 0x4d2c6dfc 0x53380d13 \
-                   0x650a7354 0x766a0abb 0x81c2c92e 0x92722c85 \
-                   0xa2bfe8a1 0xa81a664b 0xc24b8b70 0xc76c51a3 \
-                   0xd192e819 0xd6990624 0xf40e3585 0x106aa070 \
-                   0x19a4c116 0x1e376c08 0x2748774c 0x34b0bcb5 \
-                   0x391c0cb3 0x4ed8aa4a 0x5b9cca4f 0x682e6ff3 \
-                   0x748f82ee 0x78a5636f 0x84c87814 0x8cc70208 \
-                   0x90befffa 0xa4506ceb 0xbef9a3f7 0xc67178f2 \
-                  ]
-    }
-    
-}
-
-# -------------------------------------------------------------------------
-# Management of sha256 implementations.
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::sha2::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        tcl {
-            # Already present (this file)
-            set r 1
-        }
-        critcl {
-            if {![catch {package require tcllibc}]
-                || ![catch {package require sha256c}]} {
-                set r [expr {[info command ::sha2::sha256c_update] != {}}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($name) $r
-    return $r
-}
-
-# ::sha2::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::sha2::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::sha2::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::sha2::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-proc ::sha2::Names {} {
-    return {
-	critcl   {tcllibc based}
-	tcl      {pure Tcl}
-    }
-}
-
-# ::sha2::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::sha2::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-        foreach c {
-            SHA256Init   SHA224Init
-            SHA256Final  SHA224Final
-            SHA256Update
-        } {
-            rename ::sha2::$c ::sha2::${c}-${loaded}
-        }
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-        foreach c {
-            SHA256Init   SHA224Init
-            SHA256Final  SHA224Final
-            SHA256Update
-        } {
-            rename ::sha2::${c}-${key} ::sha2::$c
-        }
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# -------------------------------------------------------------------------
-
-# SHA256Init --
-#
-#   Create and initialize an SHA256 state variable. This will be
-#   cleaned up when we call SHA256Final
-#
-
-proc ::sha2::SHA256Init-tcl {} {
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token tok
-
-    # FIPS 180-2: 5.3.2 Setting the initial hash value
-    array set tok \
-            [list \
-            A [expr {int(0x6a09e667)}] \
-            B [expr {int(0xbb67ae85)}] \
-            C [expr {int(0x3c6ef372)}] \
-            D [expr {int(0xa54ff53a)}] \
-            E [expr {int(0x510e527f)}] \
-            F [expr {int(0x9b05688c)}] \
-            G [expr {int(0x1f83d9ab)}] \
-            H [expr {int(0x5be0cd19)}] \
-            n 0 i "" v 256]
-    return $token
-}
-
-proc ::sha2::SHA256Init-critcl {} {
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token tok
-
-    # FIPS 180-2: 5.3.2 Setting the initial hash value
-    set tok(sha256c) [sha256c_init256]
-    return $token
-}
-
-# SHA256Update --
-#
-#   This is called to add more data into the hash. You may call this
-#   as many times as you require. Note that passing in "ABC" is equivalent
-#   to passing these letters in as separate calls -- hence this proc 
-#   permits hashing of chunked data
-#
-#   If we have a C-based implementation available, then we will use
-#   it here in preference to the pure-Tcl implementation.
-#
-
-proc ::sha2::SHA256Update-tcl {token data} {
-    upvar #0 $token state
-
-    # Update the state values
-    incr   state(n) [string length $data]
-    append state(i) $data
-
-    # Calculate the hash for any complete blocks
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA256Transform $token [string range $state(i) $n [incr n 64]]
-    }
-
-    # Adjust the state for the blocks completed.
-    set state(i) [string range $state(i) $n end]
-    return
-}
-
-proc ::sha2::SHA256Update-critcl {token data} {
-    upvar #0 $token state
-
-    set state(sha256c) [sha256c_update $data $state(sha256c)]
-    return
-}
-
-# SHA256Final --
-#
-#    This procedure is used to close the current hash and returns the
-#    hash data. Once this procedure has been called the hash context
-#    is freed and cannot be used again.
-#
-#    Note that the output is 256 bits represented as binary data.
-#
-
-proc ::sha2::SHA256Final-tcl {token} {
-    upvar #0 $token state
-    SHA256Penultimate $token
-    
-    # Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)][bytes $state(F)][bytes $state(G)][bytes $state(H)]
-    unset state
-    return $r
-}
-
-proc ::sha2::SHA256Final-critcl {token} {
-    upvar #0 $token state
-    set r $state(sha256c)
-    unset  state
-    return $r
-}
-
-# SHA256Penultimate --
-#
-#
-proc ::sha2::SHA256Penultimate {token} {
-    upvar #0 $token state
-
-    # FIPS 180-2: 5.1.1: Padding the message
-    #
-    set len [string length $state(i)]
-    set pad [expr {56 - ($len % 64)}]
-    if {$len % 64 > 56} {
-        incr pad 64
-    }
-    if {$pad == 0} {
-        incr pad 64
-    }
-    append state(i) [binary format a$pad \x80]
-
-    # Append length in bits as big-endian wide int.
-    set dlen [expr {8 * $state(n)}]
-    append state(i) [binary format II 0 $dlen]
-
-    # Calculate the hash for the remaining block.
-    set len [string length $state(i)]
-    for {set n 0} {($n + 64) <= $len} {} {
-        SHA256Transform $token [string range $state(i) $n [incr n 64]]
-    }
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha2::SHA224Init-tcl {} {
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token tok
-
-    # FIPS 180-2 (change notice 1) (1): SHA-224 initialization values
-    array set tok \
-            [list \
-            A [expr {int(0xc1059ed8)}] \
-            B [expr {int(0x367cd507)}] \
-            C [expr {int(0x3070dd17)}] \
-            D [expr {int(0xf70e5939)}] \
-            E [expr {int(0xffc00b31)}] \
-            F [expr {int(0x68581511)}] \
-            G [expr {int(0x64f98fa7)}] \
-            H [expr {int(0xbefa4fa4)}] \
-            n 0 i "" v 224]
-    return $token
-}
-
-proc ::sha2::SHA224Init-critcl {} {
-    variable uid
-    set token [namespace current]::[incr uid]
-    upvar #0 $token tok
-
-    # FIPS 180-2 (change notice 1) (1): SHA-224 initialization values
-    set tok(sha256c) [sha256c_init224]
-    return $token
-}
-
-interp alias {} ::sha2::SHA224Update {} ::sha2::SHA256Update
-
-proc ::sha2::SHA224Final-tcl {token} {
-    upvar #0 $token state
-    SHA256Penultimate $token
-    
-    # Output
-    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)][bytes $state(F)][bytes $state(G)]
-    unset state
-    return $r
-}
-
-proc ::sha2::SHA224Final-critcl {token} {
-    upvar #0 $token state
-    # Trim result down to 224 bits (by 4 bytes).
-    # See output below, A..G, not A..H
-    set r [string range $state(sha256c) 0 end-4]
-    unset state
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# HMAC Hashed Message Authentication (RFC 2104)
-#
-# hmac = H(K xor opad, H(K xor ipad, text))
-#
-
-# HMACInit --
-#
-#    This is equivalent to the SHA1Init procedure except that a key is
-#    added into the algorithm
-#
-proc ::sha2::HMACInit {K} {
-
-    # Key K is adjusted to be 64 bytes long. If K is larger, then use
-    # the SHA1 digest of K and pad this instead.
-    set len [string length $K]
-    if {$len > 64} {
-        set tok [SHA256Init]
-        SHA256Update $tok $K
-        set K [SHA256Final $tok]
-        set len [string length $K]
-    }
-    set pad [expr {64 - $len}]
-    append K [string repeat \0 $pad]
-
-    # Cacluate the padding buffers.
-    set Ki {}
-    set Ko {}
-    binary scan $K i16 Ks
-    foreach k $Ks {
-        append Ki [binary format i [expr {$k ^ 0x36363636}]]
-        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
-    }
-
-    set tok [SHA256Init]
-    SHA256Update $tok $Ki;                 # initialize with the inner pad
-    
-    # preserve the Ko value for the final stage.
-    # FRINK: nocheck
-    set [subst $tok](Ko) $Ko
-
-    return $tok
-}
-
-# HMACUpdate --
-#
-#    Identical to calling SHA256Update
-#
-proc ::sha2::HMACUpdate {token data} {
-    SHA256Update $token $data
-    return
-}
-
-# HMACFinal --
-#
-#    This is equivalent to the SHA256Final procedure. The hash context is
-#    closed and the binary representation of the hash result is returned.
-#
-proc ::sha2::HMACFinal {token} {
-    upvar #0 $token state
-
-    set tok [SHA256Init];                 # init the outer hashing function
-    SHA256Update $tok $state(Ko);         # prepare with the outer pad.
-    SHA256Update $tok [SHA256Final $token]; # hash the inner result
-    return [SHA256Final $tok]
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  This is the core SHA1 algorithm. It is a lot like the MD4 algorithm but
-#  includes an extra round and a set of constant modifiers throughout.
-#
-set ::sha2::SHA256Transform_body {
-    variable K
-    upvar #0 $token state
-
-    # FIPS 180-2: 6.2.2 SHA-256 Hash computation.
-    binary scan $msg I* blocks
-    set blockLen [llength $blocks]
-    for {set i 0} {$i < $blockLen} {incr i 16} {
-        set W [lrange $blocks $i [expr {$i+15}]]
-
-        # FIPS 180-2: 6.2.2 (1) Prepare the message schedule
-        # For t = 16 to 64 
-        #   let Wt = (sigma1(Wt-2) + Wt-7 + sigma0(Wt-15) + Wt-16)
-        set t2  13
-        set t7   8
-        set t15  0
-        set t16 -1
-        for {set t 16} {$t < 64} {incr t} {
-            lappend W [expr {[sigma1 [lindex $W [incr t2]]] \
-                                 + [lindex $W [incr t7]] \
-                                 + [sigma0 [lindex $W [incr t15]]] \
-                                 + [lindex $W [incr t16]]}]
-        }
-        
-        # FIPS 180-2: 6.2.2 (2) Initialise the working variables
-        set A $state(A)
-        set B $state(B)
-        set C $state(C)
-        set D $state(D)
-        set E $state(E)
-        set F $state(F)
-        set G $state(G)
-        set H $state(H)
-
-        # FIPS 180-2: 6.2.2 (3) Do permutation rounds
-        # For t = 0 to 63 do
-        #   T1 = h + SIGMA1(e) + Ch(e,f,g) + Kt + Wt
-        #   T2 = SIGMA0(a) + Maj(a,b,c)
-        #   h = g; g = f;  f = e;  e = d + T1;  d = c;  c = b; b = a;
-        #   a = T1 + T2
-        #
-        for {set t 0} {$t < 64} {incr t} {
-            set T1 [expr {($H + [SIGMA1 $E] + [Ch $E $F $G] 
-                          + [lindex $K $t] + [lindex $W $t]) & 0xffffffff}]
-            set T2 [expr {([SIGMA0 $A] + [Maj $A $B $C]) & 0xffffffff}]
-            set H $G
-            set G $F
-            set F $E
-            set E [expr {($D + $T1) & 0xffffffff}]
-            set D $C
-            set C $B
-            set B $A
-            set A [expr {($T1 + $T2) & 0xffffffff}]
-        }
-
-        # FIPS 180-2: 6.2.2 (4) Compute the intermediate hash
-        incr state(A) $A
-        incr state(B) $B
-        incr state(C) $C
-        incr state(D) $D
-        incr state(E) $E
-        incr state(F) $F
-        incr state(G) $G
-        incr state(H) $H
-    }
-
-    return
-}
-
-# -------------------------------------------------------------------------
-
-# FIPS 180-2: 4.1.2 equation 4.2
-proc ::sha2::Ch {x y z} {
-    return [expr {($x & $y) ^ (~$x & $z)}]
-}
-
-# FIPS 180-2: 4.1.2 equation 4.3
-proc ::sha2::Maj {x y z} {
-    return [expr {($x & $y) ^ ($x & $z) ^ ($y & $z)}]
-}
-
-# FIPS 180-2: 4.1.2 equation 4.4
-#  (x >>> 2) ^ (x >>> 13) ^ (x >>> 22)
-proc ::sha2::SIGMA0 {x} {
-    return [expr {[>>> $x 2] ^ [>>> $x 13] ^ [>>> $x 22]}]
-}
-
-# FIPS 180-2: 4.1.2 equation 4.5
-#  (x >>> 6) ^ (x >>> 11) ^ (x >>> 25)
-proc ::sha2::SIGMA1 {x} {
-    return [expr {[>>> $x 6] ^ [>>> $x 11] ^ [>>> $x 25]}]
-}
-
-# FIPS 180-2: 4.1.2 equation 4.6
-#  s0 = (x >>> 7)  ^ (x >>> 18) ^ (x >> 3)
-proc ::sha2::sigma0 {x} {
-    #return [expr {[>>> $x 7] ^ [>>> $x 18] ^ (($x >> 3) & 0x1fffffff)}]
-    return [expr {((($x<<25) | (($x>>7) & (0x7FFFFFFF>>6))) \
-                 ^ (($x<<14) | (($x>>18) & (0x7FFFFFFF>>17))) & 0xFFFFFFFF) \
-                 ^ (($x>>3) & 0x1fffffff)}]
-}
-
-# FIPS 180-2: 4.1.2 equation 4.7
-#  s1 = (x >>> 17) ^ (x >>> 19) ^ (x >> 10)
-proc ::sha2::sigma1 {x} {
-    #return [expr {[>>> $x 17] ^ [>>> $x 19] ^ (($x >> 10) & 0x003fffff)}]
-    return [expr {((($x<<15) | (($x>>17) & (0x7FFFFFFF>>16))) \
-                 ^ (($x<<13) | (($x>>19) & (0x7FFFFFFF>>18))) & 0xFFFFFFFF) \
-                 ^ (($x >> 10) & 0x003fffff)}]
-}
-
-# 32bit rotate-right
-proc ::sha2::>>> {v n} {
-    return [expr {(($v << (32 - $n)) \
-                       | (($v >> $n) & (0x7FFFFFFF >> ($n - 1)))) \
-                      & 0xFFFFFFFF}]
-}
-
-# 32bit rotate-left
-proc ::sha2::<<< {v n} {
-    return [expr {((($v << $n) \
-                        | (($v >> (32 - $n)) \
-                               & (0x7FFFFFFF >> (31 - $n))))) \
-                      & 0xFFFFFFFF}]
-}
-
-# -------------------------------------------------------------------------
-# We speed up the SHA256Transform code while maintaining readability in the
-# source code by substituting inline for a number of functions.
-# The idea is to reduce the number of [expr] calls.
-
-# Inline the Ch function
-regsub -all -line \
-    {\[Ch (\$[ABCDEFGH]) (\$[ABCDEFGH]) (\$[ABCDEFGH])\]} \
-    $::sha2::SHA256Transform_body \
-    {((\1 \& \2) ^ ((~\1) \& \3))} \
-    ::sha2::SHA256Transform_body
-
-# Inline the Maj function
-regsub -all -line \
-    {\[Maj (\$[ABCDEFGH]) (\$[ABCDEFGH]) (\$[ABCDEFGH])\]} \
-    $::sha2::SHA256Transform_body \
-    {((\1 \& \2) ^ (\1 \& \3) ^ (\2 \& \3))} \
-    ::sha2::SHA256Transform_body
-
-
-# Inline the SIGMA0 function
-regsub -all -line \
-    {\[SIGMA0 (\$[ABCDEFGH])\]} \
-    $::sha2::SHA256Transform_body \
-    {((((\1<<30) | ((\1>>2) \& (0x7FFFFFFF>>1))) \& 0xFFFFFFFF) \
-          ^ (((\1<<19) | ((\1>>13) \& (0x7FFFFFFF>>12))) \& 0xFFFFFFFF) \
-          ^ (((\1<<10) | ((\1>>22) \& (0x7FFFFFFF>>21))) \& 0xFFFFFFFF) \
-          )} \
-    ::sha2::SHA256Transform_body
-
-# Inline the SIGMA1 function
-regsub -all -line \
-    {\[SIGMA1 (\$[ABCDEFGH])\]} \
-    $::sha2::SHA256Transform_body \
-    {((((\1<<26) | ((\1>>6) \& (0x7FFFFFFF>>5))) \& 0xFFFFFFFF) \
-          ^ (((\1<<21) | ((\1>>11) \& (0x7FFFFFFF>>10))) \& 0xFFFFFFFF) \
-          ^ (((\1<<7) | ((\1>>25) \& (0x7FFFFFFF>>24))) \& 0xFFFFFFFF) \
-          )} \
-    ::sha2::SHA256Transform_body
-
-proc ::sha2::SHA256Transform {token msg} $::sha2::SHA256Transform_body
-
-# -------------------------------------------------------------------------
-
-# Convert a integer value into a binary string in big-endian order.
-proc ::sha2::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
-proc ::sha2::bytes {v} { 
-    #format %c%c%c%c [byte 3 $v] [byte 2 $v] [byte 1 $v] [byte 0 $v]
-    format %c%c%c%c \
-        [expr {((0xFF000000 & $v) >> 24) & 0xFF}] \
-        [expr {(0xFF0000 & $v) >> 16}] \
-        [expr {(0xFF00 & $v) >> 8}] \
-        [expr {0xFF & $v}]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha2::Hex {data} {
-    binary scan $data H* result
-    return $result
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::sha2::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# fileevent handler for chunked file hashing.
-#
-proc ::sha2::Chunk {token channel {chunksize 4096}} {
-    upvar #0 $token state
-    
-    if {[eof $channel]} {
-        fileevent $channel readable {}
-        set state(reading) 0
-    }
-        
-    SHA256Update $token [read $channel $chunksize]
-}
-
-# -------------------------------------------------------------------------
-
-proc ::sha2::_sha256 {ver args} {
-    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] == 1} {
-        set opts(-hex) 1
-    } else {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [concat -bin [array names opts]]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args: should be\
-                \"[namespace current]::sha$ver ?-hex|-bin? -filename file\
-                | -channel channel | string\""
-        }
-        set tok [SHA${ver}Init]
-        SHA${ver}Update $tok [lindex $args 0]
-        set r [SHA${ver}Final $tok]
-
-    } else {
-
-        set tok [SHA${ver}Init]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [SHA${ver}Final $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-interp alias {} ::sha2::sha256 {} ::sha2::_sha256 256
-interp alias {} ::sha2::sha224 {} ::sha2::_sha256 224
-
-# -------------------------------------------------------------------------
-
-proc ::sha2::hmac {args} {
-    array set opts {-hex 1 -filename {} -channel {} -chunksize 4096}
-    if {[llength $args] != 2} {
-        while {[string match -* [set option [lindex $args 0]]]} {
-            switch -glob -- $option {
-                -key       { set opts(-key) [Pop args 1] }
-                -hex       { set opts(-hex) 1 }
-                -bin       { set opts(-hex) 0 }
-                -file*     { set opts(-filename) [Pop args 1] }
-                -channel   { set opts(-channel) [Pop args 1] }
-                -chunksize { set opts(-chunksize) [Pop args 1] }
-                default {
-                    if {[llength $args] == 1} { break }
-                    if {[string compare $option "--"] == 0} { Pop args; break }
-                    set err [join [lsort [array names opts]] ", "]
-                    return -code error "bad option $option:\
-                    must be one of $err"
-                }
-            }
-            Pop args
-        }
-    }
-
-    if {[llength $args] == 2} {
-        set opts(-key) [Pop args]
-    }
-
-    if {![info exists opts(-key)]} {
-        return -code error "wrong # args:\
-            should be \"hmac ?-hex? -key key -filename file | string\""
-    }
-
-    if {$opts(-filename) != {}} {
-        set opts(-channel) [open $opts(-filename) r]
-        fconfigure $opts(-channel) -translation binary
-    }
-
-    if {$opts(-channel) == {}} {
-
-        if {[llength $args] != 1} {
-            return -code error "wrong # args:\
-                should be \"hmac ?-hex? -key key -filename file | string\""
-        }
-        set tok [HMACInit $opts(-key)]
-        HMACUpdate $tok [lindex $args 0]
-        set r [HMACFinal $tok]
-
-    } else {
-
-        set tok [HMACInit $opts(-key)]
-        # FRINK: nocheck
-        set [subst $tok](reading) 1
-        fileevent $opts(-channel) readable \
-            [list [namespace origin Chunk] \
-                 $tok $opts(-channel) $opts(-chunksize)]
-        # FRINK: nocheck
-        vwait [subst $tok](reading)
-        set r [HMACFinal $tok]
-
-        # If we opened the channel - we should close it too.
-        if {$opts(-filename) != {}} {
-            close $opts(-channel)
-        }
-    }
-    
-    if {$opts(-hex)} {
-        set r [Hex $r]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::sha2 {
-    variable e {}
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-}
-
-package provide sha256 $::sha2::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha256c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/sha1/sha256c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,176 +1,0 @@
-# sha256c.tcl
-# - Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-# - Copyright (C) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#   (Rewriting the sha1c wrapper to 256).
-#
-# Wrapper for the Secure Hashing Algorithm (SHA256)
-#
-# $Id: sha256c.tcl,v 1.2 2006/11/04 15:25:34 patthoyts Exp $
-
-package require critcl;        # needs critcl
-package provide sha256c 1.0.2
-			       
-critcl::cheaders sha256.h;     # FreeBSD SHA256 implementation
-critcl::csources sha256.c;     # FreeBSD SHA256 implementation
-
-if {$tcl_platform(byteOrder) eq "littleEndian"} {
-    set byteOrder 1234
-} else {
-    set byteOrder 4321
-}
-critcl::cheaders -DTCL_BYTE_ORDER=$byteOrder
-
-namespace eval ::sha2 {
-    # Supporting code for the main command.
-    catch {
-        critcl::debug memory symbols
-    }
-
-    critcl::ccode {
-        #include "sha256.h"
-        #include <stdlib.h>
-        #include <assert.h>
-        
-        static
-        Tcl_ObjType sha256_type; /* fast internal access representation */
-        
-        static void 
-        sha256_free_rep(Tcl_Obj* obj)
-        {
-            SHA256_CTX* mp = (SHA256_CTX*) obj->internalRep.otherValuePtr;
-            free(mp);
-        }
-        
-        static void
-        sha256_dup_rep(Tcl_Obj* obj, Tcl_Obj* dup)
-        {
-            SHA256_CTX* mp = (SHA256_CTX*) obj->internalRep.otherValuePtr;
-            dup->internalRep.otherValuePtr = malloc(sizeof *mp);
-            memcpy(dup->internalRep.otherValuePtr, mp, sizeof *mp);
-            dup->typePtr = &sha256_type;
-        }
-        
-        static void
-        sha256_string_rep(Tcl_Obj* obj)
-        {
-            unsigned char buf[SHA256_HASH_SIZE];
-            Tcl_Obj* temp;
-            char* str;
-            SHA256_CTX dup = *(SHA256_CTX*) obj->internalRep.otherValuePtr;
-            
-            SHA256Final(&dup, buf);
-            
-            /* convert via a byte array to properly handle null bytes */
-            temp = Tcl_NewByteArrayObj(buf, sizeof buf);
-            Tcl_IncrRefCount(temp);
-            
-            str = Tcl_GetStringFromObj(temp, &obj->length);
-            obj->bytes = Tcl_Alloc(obj->length + 1);
-            memcpy(obj->bytes, str, obj->length + 1);
-            
-            Tcl_DecrRefCount(temp);
-        }
-        
-        static int
-        sha256_from_any(Tcl_Interp* ip, Tcl_Obj* obj)
-        {
-            assert(0);
-            return TCL_ERROR;
-        }
-        
-        static
-        Tcl_ObjType sha256_type = {
-            "sha256c", sha256_free_rep, sha256_dup_rep, sha256_string_rep,
-            sha256_from_any
-        };
-    }
-    
-    critcl::ccommand sha256c_init256 {dummy ip objc objv} {
-        SHA256_CTX* mp;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        if (objc > 1) {
-            Tcl_WrongNumArgs(ip, 1, objv, "");
-            return TCL_ERROR;
-        }
-        
-	obj = Tcl_NewObj();
-	mp = (SHA256_CTX*) malloc(sizeof *mp);
-	SHA256Init(mp);
-            
-	if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL) {
-	    obj->typePtr->freeIntRepProc(obj);
-	}
-            
-	obj->internalRep.otherValuePtr = mp;
-	obj->typePtr = &sha256_type;
-        
-        Tcl_SetObjResult(ip, obj);
-        Tcl_IncrRefCount(obj); /* !! huh? */
-        Tcl_InvalidateStringRep(obj);        
-        return TCL_OK;
-    }
-
-    critcl::ccommand sha256c_init224 {dummy ip objc objv} {
-        SHA256_CTX* mp;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        if (objc > 1) {
-            Tcl_WrongNumArgs(ip, 1, objv, "");
-            return TCL_ERROR;
-        }
-        
-	obj = Tcl_NewObj();
-	mp = (SHA256_CTX*) malloc(sizeof *mp);
-	SHA224Init(mp);
-            
-	if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL) {
-	    obj->typePtr->freeIntRepProc(obj);
-	}
-            
-	obj->internalRep.otherValuePtr = mp;
-	obj->typePtr = &sha256_type;
-        
-        Tcl_SetObjResult(ip, obj);
-        Tcl_IncrRefCount(obj); /* !! huh? */
-        Tcl_InvalidateStringRep(obj);        
-        return TCL_OK;
-    }
-
-    critcl::ccommand sha256c_update {dummy ip objc objv} {
-        SHA256_CTX* mp;
-        unsigned char* data;
-        int size;
-        Tcl_Obj* obj;
-        
-        if (objc != 3) {
-            Tcl_WrongNumArgs(ip, 1, objv, "data context");
-            return TCL_ERROR;
-        }
-        
-	if (objv[2]->typePtr != &sha256_type 
-	    && sha256_from_any(ip, objv[2]) != TCL_OK) {
-	    return TCL_ERROR;
-	}
-
-	obj = objv[2];
-	if (Tcl_IsShared(obj)) {
-	    obj = Tcl_DuplicateObj(obj);
-	}
-        
-        Tcl_SetObjResult(ip, obj);
-        Tcl_IncrRefCount(obj); /* !! huh? */
-        
-        Tcl_InvalidateStringRep(obj);
-        mp = (SHA256_CTX*) obj->internalRep.otherValuePtr;
-        
-        data = Tcl_GetByteArrayFromObj(objv[1], &size);
-        SHA256Update(mp, data, size);
-        
-        return TCL_OK;
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/smtpd/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/smtpd/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded smtpd 1.4.0 [list source [file join $dir smtpd.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/smtpd/smtpd.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/smtpd/smtpd.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,925 +1,0 @@
-# smtpd.tcl - Copyright (C) 2001 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# This provides a minimal implementation of the Simple Mail Tranfer Protocol
-# as per RFC821 and RFC2821 (http://www.normos.org/ietf/rfc/rfc821.txt) and
-# is designed for use during local testing of SMTP client software.
-#
-# -------------------------------------------------------------------------
-# This software is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the file 'license.terms' for
-# more details.
-# -------------------------------------------------------------------------
-
-package require Tcl 8.3;                # tcl minimum version
-package require logger;                 # tcllib 1.3
-package require mime;                   # tcllib
-
-# @mdgen EXCLUDE: clients/mail-test.tcl
-
-namespace eval ::smtpd {
-    variable rcsid {$Id: smtpd.tcl,v 1.20 2005/12/09 18:27:17 andreas_kupries Exp $}
-    variable version 1.4.0
-    variable stopped
-
-    namespace export start stop configure
-
-    variable commands
-    if {![info exists commands]} {
-        set commands {EHLO HELO MAIL RCPT DATA RSET NOOP QUIT HELP}
-        # non-minimal commands HELP VRFY EXPN VERB ETRN DSN 
-    }
-
-    variable extensions
-    if {! [info exists extensions]} {
-        array set extensions {
-            8BITMIME {}
-            SIZE     0
-        }
-    }
-
-    variable options
-    if {! [info exists options]} {
-        array set options {
-            serveraddr         {}
-            deliverMIME        {}
-            deliver            {}
-            validate_host      {}
-            validate_sender    {}
-            validate_recipient {}
-            usetls             0
-            tlsopts            {}
-        }
-    }
-    variable tlsopts {-cadir -cafile -certfile -cipher 
-        -command -keyfile -password -request -require -ssl2 -ssl3 -tls1}
-
-    variable log
-    if {![info exists log]} {
-        set log [logger::init smtpd]
-        ${log}::setlevel warn
-        proc ${log}::stdoutcmd {level text} {
-            variable service
-            puts "\[[clock format [clock seconds] -format {%H:%M:%S}]\
-                $service $level\] $text"
-        }
-    }
-    
-    variable Help
-    if {![info exists Help]} {
-        array set Help {
-            {}   {{Topics:} {   HELO MAIL DATA RSET NOOP QUIT} 
-                {For more information use "HELP <topic>".}}
-            HELO {{HELO <hostname>} {   Introduce yourself.}}
-            MAIL {{MAIL FROM: <sender> [ <parameters> ]}
-                {   Specify the sender of the message.}
-                {   If using ESMTP there may be additional parameters of the}
-                {   form NAME=VALUE.}}
-            DATA {{DATA} {   Send your mail message.} 
-                {   End with a line containing a single dot.}}
-            RSET {{RSET} {   Reset the session.}}
-            NOOP {{NOOP} {   Command ignored by server.}}
-            QUIT {{QUIT} {   Exit SMTP session}}
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Obtain configuration options for the server.
-#
-proc ::smtpd::cget {option} {
-    variable options
-    variable tlsopts
-    variable log
-    set optname [string trimleft $option -]
-    if { [string equal option -loglevel] } {
-        return [${log}::currentloglevel]
-    } elseif { [info exists options($optname)] } {
-        return $options($optname)
-    } elseif {[lsearch -exact $tlsopts -$optname] != -1} {
-        set ndx [lsearch -exact $options(tlsopts) -$optname]
-        if {$ndx != -1} {
-            return [lindex $options(tlsopts) [incr ndx]]
-        }
-        return {}
-    } else {
-        return -code error "unknown option \"-$optname\": \
-            must be one of -[join [array names options] {, -}]"
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Configure server options. These include validation of hosts or users
-#   and a procedure to handle delivery of incoming mail. The -deliver
-#   procedure must handle mail because the server may release all session
-#   resources once the deliver proc has completed.
-#   An example might be to exec procmail to deliver the mail to users.
-#
-proc ::smtpd::configure {args} {
-    variable options
-    variable commands
-    variable extensions
-    variable log
-    variable tlsopts
-
-    if {[llength $args] == 0} {
-        set r [list -loglevel [${log}::currentloglevel]]
-        foreach {opt value} [array get options] {
-            lappend r -$opt $value
-        }
-        lappend r -
-        return $r
-    }
-
-    while {[string match -* [set option [lindex $args 0]]]} {
-        switch -glob -- $option {
-            -loglevel           {${log}::setlevel [Pop args 1]}
-            -deliverMIME        {set options(deliverMIME) [Pop args 1]}
-            -deliver            {set options(deliver) [Pop args 1]}
-            -validate_host      {set options(validate_host) [Pop args 1]}
-            -validate_sender    {set options(validate_sender) [Pop args 1]}
-            -validate_recipient {set options(validate_recipient) [Pop args 1]}
-            -usetls             {
-                set usetls [Pop args 1]
-                if {$usetls && ![catch {package require tls}]} {
-                    set options(usetls) 1
-                    set extensions(STARTTLS) {}
-                    lappend commands STARTTLS
-                }
-            }
-            --                  { Pop args; break }
-            default {
-                set failed 1
-                if {[lsearch $tlsopts $option] != -1} {
-                    set options(tlsopts) \
-                        [concat $options(tlsopts) $option [Pop args 1]]
-                    set failed 0
-                }
-                set msg "unknown option: \"$option\":\
-                           must be one of -deliverMIME, -deliver,\
-                           -validate_host, -validate_recipient,\
-                           -validate_sender or an option suitable\
-                           to tls::init"
-                if {$failed} {
-                    return -code error $msg
-                }
-            }
-        }
-        Pop args
-    }
-    return {}
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Start the server on the given interface and port.
-#
-proc ::smtpd::start {{myaddr {}} {port 25}} {
-    variable options
-    variable stopped
-    
-    if {[info exists options(socket)]} {
-        return -code error \
-            "smtpd service already running on socket $options(socket)"
-    }
-
-    if {$myaddr != {}} {
-        set options(serveraddr) $myaddr
-        set myaddr "-myaddr $myaddr"
-    } else {
-        if {$options(serveraddr) == {}} {
-            set options(serveraddr) [info hostname]
-        }
-    }
-
-    set options(socket) [eval socket \
-                             -server [namespace current]::accept $myaddr $port]
-    set stopped 0
-    Log notice "smtpd service started on $options(socket)"
-    return $options(socket)
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Stop a running server. Do nothing if the server isn't running.
-#
-proc ::smtpd::stop {} {
-    variable options
-    variable stopped
-    if {[info exists options(socket)]} {
-        close $options(socket)
-        set stopped 1
-        Log notice "smtpd service stopped"
-        unset options(socket)
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Accept a new connection and setup a fileevent handler to process the new
-#   session. Performs a host id validation step before allowing access.
-#
-proc ::smtpd::accept {channel client_addr client_port} {
-    variable options
-    variable version
-    upvar [namespace current]::state_$channel State
-
-    # init state array
-    catch {unset State}
-    initializeState $channel
-    set State(access) allowed
-    set State(client_addr) $client_addr
-    set State(client_port) $client_port
-    set accepted true
-
-    # configure the data channel
-    fconfigure $channel -buffering line -translation crlf -encoding ascii
-    fileevent $channel readable [list [namespace current]::service $channel]
-
-    # check host access permissions
-    if {[cget -validate_host] != {}} {
-        if {[catch {eval [cget -validate_host] $client_addr} msg] } {
-            Log notice "access denied for $client_addr:$client_port: $msg"
-            Puts $channel "550 Access denied: $msg"
-            set State(access) denied
-            set accepted false
-        }
-    }
-    
-    if {$accepted} {
-        # Accept the connection
-        Log notice "connect from $client_addr:$client_port on $channel"
-        Puts $channel "220 $options(serveraddr) tcllib smtpd $version; [timestamp]"
-    }
-    
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Initialize the channel state array. Called by accept and RSET.
-#
-proc ::smtpd::initializeState {channel} {
-    upvar [namespace current]::state_$channel State
-    set State(indata) 0
-    set State(to) {}
-    set State(from) {}
-    set State(data) {}
-    set State(options) {}
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Access the state of a connected session using the channel name as part
-#   of the state array name. Called with no value, it returns the current
-#   value of the item (or {} if not defined).
-#
-proc ::smtpd::state {channel args} {
-    if {[llength $args] == 0} {
-        return [array get [namespace current]::state_$channel]
-    }
-
-    set arrname [namespace current]::[subst state_$channel]
-
-    if {[llength $args] == 1} {
-        set r {}
-        if {[info exists [subst $arrname]($args)]} {
-            # FRINK: nocheck
-            set r [set [subst $arrname]($args)]
-        }
-        return $r
-    }
-
-    foreach {name value} $args {
-        # FRINK: nocheck
-        set [namespace current]::[subst state_$channel]($name) $value
-    }
-    return {}
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Pop the nth element off a list. Used in options processing.
-#
-proc ::smtpd::Pop {varname {nth 0}} {
-    upvar $varname args
-    set r [lindex $args $nth]
-    set args [lreplace $args $nth $nth]
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Wrapper to call our log procedure.
-#
-proc ::smtpd::Log {level text} {
-    variable log
-    ${log}::${level} $text
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Safe puts.
-#   If the client closes the channel, then puts will throw an error. Lets
-#   terminate the session if this occurs.
-proc ::smtpd::Puts {channel args} {
-    if {[catch {uplevel puts $channel $args} msg]} {
-        Log error $msg
-        catch {
-            close $channel
-            # FRINK: nocheck
-            unset -- [namespace current]::state_$channel
-        }
-    }
-    return $msg
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Perform the chat with a connected client. This procedure accepts input on
-#   the connected socket and executes commands according to the state of the
-#   session.
-#
-proc ::smtpd::service {channel} {
-    variable commands
-    variable options
-    upvar [namespace current]::state_$channel State
-
-    if {[eof $channel]} {
-        close $channel
-        return
-    }
-
-    if {[catch {gets $channel cmdline} msg]} {
-        close $channel
-        Log error $msg
-        return
-    }
-
-    if { $cmdline == "" && [eof $channel] } {
-        Log warn "client has closed the channel"
-        return
-    }
-
-    Log debug "received: $cmdline"
-
-    # If we are handling a DATA section, keep looking for the end of data.
-    if {$State(indata)} {
-        if {$cmdline == "."} {
-            set State(indata) 0
-            fconfigure $channel -translation crlf
-            if {[catch {deliver $channel} err]} {
-                # permit delivery handler to return SMTP errors in errorCode
-                if {[regexp {\d{3}} $::errorCode]} {
-                    Puts $channel "$::errorCode $err"
-                } else {
-                    Puts $channel "554 Transaction failed: $err"
-                }
-            } else {
-                Puts $channel "250 [state $channel id]\
-                        Message accepted for delivery"
-            }
-        } else {
-            # RFC 2821 section 4.5.2: Transparency
-            if {[string match {..*} $cmdline]} {
-                set cmdline [string range $cmdline 1 end]
-            }
-            lappend State(data) $cmdline
-        }
-        return
-    }
-
-    # Process SMTP commands (case insensitive)
-    set cmd [string toupper [lindex [split $cmdline] 0]]
-    if {[lsearch $commands $cmd] != -1} {
-        if {[info proc $cmd] == {}} {
-            Puts $channel "500 $cmd not implemented"
-        } else {
-            # If access denied then client can only issue QUIT.
-            if {$State(access) == "denied" && $cmd != "QUIT" } {
-                Puts $channel "503 bad sequence of commands"
-            } else {
-                set r [eval $cmd $channel [list $cmdline]]
-            }
-        }
-    } else {
-        Puts $channel "500 Invalid command"
-    }
-
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#  Generate a random ASCII character for use in mail identifiers.
-#
-proc ::smtpd::uidchar {} {
-    set c .
-    while {! [string is alnum $c]} {
-        set n [expr {int(rand() * 74 + 48)}]
-        set c [format %c $n]
-    }
-    return $c
-}
-
-# Description:
-#  Generate a unique random identifier using only ASCII alphanumeric chars.
-#
-proc ::smtpd::uid {} {
-    set r {}
-    for {set cn 0} {$cn < 12} {incr cn} {
-        append r [uidchar]
-    }
-    return $r
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Calculate the local offset from GMT in hours for use in the timestamp
-#
-proc ::smtpd::gmtoffset {} {
-    set now [clock seconds]
-    set local [clock format $now -format "%j %H" -gmt false]
-    set zulu  [clock format $now -format "%j %H" -gmt true]
-    set lh [expr {([scan [lindex $local 0] %d] * 24) \
-                      + [scan [lindex $local 1] %d]}]
-    set zh [expr {([scan [lindex $zulu 0] %d] * 24) \
-                      + [scan [lindex $zulu 1] %d]}]
-    set off [expr {$lh - $zh}]
-    set off [format "%+03d00" $off]
-    return $off
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Generate a standard SMTP compliant timestamp. That is a local time but with
-#   the timezone represented as an offset.
-#
-proc ::smtpd::timestamp {} {
-    set ts [clock format [clock seconds] \
-                -format "%a, %d %b %Y %H:%M:%S" -gmt false]
-    append ts " " [gmtoffset]
-    return $ts
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Get the servers ip address (from http://purl.org/mini/tcl/526.html)
-#
-proc ::smtpd::server_ip {} {
-    set me [socket -server xxx -myaddr [info hostname] 0]
-    set ip [lindex [fconfigure $me -sockname] 0]
-    close $me
-    return $ip
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   deliver is called once a mail transaction is completed and there is
-#   no deliver procedure defined
-#   The configured -deliverMIME procedure is called with a MIME token.
-#   If no such callback is defined then try the -deliver option and use
-#   the old API.
-#
-proc ::smtpd::deliver {channel} {
-    set deliverMIME [cget deliverMIME]
-    if { $deliverMIME != {} \
-            && [state $channel from] != {} \
-            && [state $channel to] != {} \
-            && [state $channel data] != {} } {
-        
-        # create a MIME token from the mail message.        
-        set tok [mime::initialize -string \
-                [join [state $channel data] "\n"]]
-#        mime::setheader $tok "From" [state $channel from]
-#        foreach recipient [state $channel to] {
-#            mime::setheader $tok "To" $recipient -mode append
-#        }
-        
-        # catch and rethrow any errors.
-        set err [catch {eval $deliverMIME [list $tok]} msg]
-        mime::finalize $tok -subordinates all
-        if {$err} {
-            Log debug "error in deliver: $msg"
-            return -code error -errorcode $::errorCode \
-                    -errorinfo $::errorInfo $msg
-        }        
-        
-    } else {
-        # Try the old interface
-        deliver_old $channel
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Deliver is called once a mail transaction is completed (defined as the
-#   completion of a DATA command). The configured -deliver procedure is called
-#   with the sender, list of recipients and the text of the mail.
-#
-proc ::smtpd::deliver_old {channel} {
-    set deliver [cget deliver]
-    if { $deliver != {} \
-             && [state $channel from] != {} \
-             && [state $channel to] != {} \
-             && [state $channel data] != {} } {
-        if {[catch {$deliver [state $channel from] \
-                        [state $channel to] \
-                        [state $channel data]} msg]} {
-            Log debug "error in deliver: $msg"
-            return -code error -errorcode $::errorCode \
-                    -errorinfo $::errorInfo $msg
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-proc ::smtpd::split_address {address} {
-    set start [string first < $address]
-    set end [string last > $address]
-    set addr [string range $address $start $end]
-    incr end
-    set opts [string trim [string range $address $end end]]
-    return [list $addr $opts]
-}
-
-# -------------------------------------------------------------------------
-# The SMTP Commands
-# -------------------------------------------------------------------------
-# Description:
-#   Initiate an SMTP session
-# Reference:
-#   RFC2821 4.1.1.1
-#
-proc ::smtpd::HELO {channel line} {
-    variable options
-
-    if {[state $channel domain] != {}} {
-        Puts $channel "503 bad sequence of commands"
-        Log debug "HELO received out of sequence."
-        return
-    }
-
-    set r [regexp -nocase {^HELO\s+([-\w\.]+)\s*$} $line -> domain]
-    if {$r == 0} {
-        Puts $channel "501 Syntax error in parameters or arguments"
-        Log debug "HELO received \"$line\""
-        return
-    }
-    Puts $channel "250 $options(serveraddr) Hello $domain\
-                     \[[state $channel client_addr]\], pleased to meet you"
-    state $channel domain $domain
-    Log debug "HELO on $channel from $domain"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Initiate an ESMTP session
-# Reference:
-#   RFC2821 4.1.1.1
-proc ::smtpd::EHLO {channel line} {
-    variable options
-    variable extensions
-
-    if {[state $channel domain] != {}} {
-        Puts $channel "503 bad sequence of commands"
-        Log debug "EHLO received out of sequence."
-        return
-    }
-
-    set r [regexp -nocase {^EHLO\s+([-\w\.]+)\s*$} $line -> domain]
-    if {$r == 0} {
-        Puts $channel "501 Syntax error in parameters or arguments"
-        Log debug "EHLO received \"$line\""
-        return
-    }
-    Puts $channel "250-$options(serveraddr) Hello $domain\
-                     \[[state $channel client_addr]\], pleased to meet you"
-    foreach {extn opts} [array get extensions] {
-        Puts $channel [string trimright "250-$extn $opts"]
-    }
-    Puts $channel "250 Ready for mail."
-    state $channel domain $domain
-    Log debug "EHLO on $channel from $domain"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-# Reference:
-#   RFC2821 4.1.1.2
-#
-proc ::smtpd::MAIL {channel line} {
-    set r [regexp -nocase {^MAIL FROM:\s*(.*)} $line -> from]
-    if {$r == 0} {
-        Puts $channel "501 Syntax error in parameters or arguments"
-        Log debug "MAIL received \"$line\""
-        return
-    }
-    if {[catch {
-        set from [split_address $from]
-        set opts [lindex $from 1]
-        set from [lindex $from 0]
-        eval array set addr [mime::parseaddress $from]
-        # RFC2821 3.7: we must accept null return path addresses.
-        if {[string equal "<>" $from]} {
-            set addr(error) {}
-        }
-    } msg]} {
-        set addr(error) $msg
-    }
-    if {$addr(error) != {} } {
-        Log debug "MAIL failed $addr(error)"
-        Puts $channel "501 Syntax error in parameters or arguments"
-        return
-    }
-
-    if {[cget -validate_sender] != {}} {
-        if {[catch {eval [cget -validate_sender] $addr(address)}]} {
-            # this user has been denied
-            Log info "MAIL denied user $addr(address)"
-            Puts $channel "553 Requested action not taken:\
-                            mailbox name not allowed"
-            return
-        }
-    }
-
-    Log debug "MAIL FROM: $addr(address)"
-    state $channel from $from
-    state $channel options $opts
-    Puts $channel "250 OK"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Specify a recipient for this mail. This command may be executed multiple
-#   times to contruct a list of recipients. If a -validate_recipient 
-#   procedure is configured then this is used. An error from the validation
-#   procedure indicates an invalid or unacceptable mailbox.
-# Reference:
-#   RFC2821 4.1.1.3
-# Notes:
-#   The postmaster mailbox MUST be supported. (RFC2821: 4.5.1)
-#
-proc ::smtpd::RCPT {channel line} {
-    set r [regexp -nocase {^RCPT TO:\s*(.*)} $line -> to]
-    if {$r == 0} {
-        Puts $channel "501 Syntax error in parameters or arguments"
-        Log debug "RCPT received \"$line\""
-        return
-    }
-    if {[catch {
-        set to [split_address $to]
-        set opts [lindex $to 1]
-        set to [lindex $to 0]
-        eval array set addr [mime::parseaddress $to]
-    } msg]} {
-        set addr(error) $msg
-    }
-
-    if {$addr(error) != {}} {
-        Log debug "RCPT failed $addr(error)"
-        Puts $channel "501 Syntax error in parameters or arguments"
-        return
-    }
-
-    if {[string match -nocase "postmaster" $addr(local)]} {
-        # we MUST support this recipient somehow as mail.
-        Log notice "RCPT to postmaster"
-    } else {
-        if {[cget -validate_recipient] != {}} {
-            if {[catch {eval [cget -validate_recipient] $addr(address)}]} {
-                # this recipient has been denied
-                Log info "RCPT denied mailbox $addr(address)"
-                Puts $channel "553 Requested action not taken:\
-                            mailbox name not allowed"
-                return
-            }
-        }
-    }
-
-    Log debug "RCPT TO: $addr(address)"
-    set recipients {}
-    catch {set recipients [state $channel to]}
-    lappend recipients $to
-    state $channel to $recipients
-    Puts $channel "250 OK"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Begin accepting data for the mail payload. A line containing a single 
-#   period marks the end of the data and the server will then deliver the
-#   mail. RCPT and MAIL commands must have been executed before the DATA
-#   command.
-# Reference:
-#   RFC2821 4.1.1.4
-# Notes:
-#   The DATA section is the only part of the protocol permitted to use non-
-#   ASCII characters and non-CRLF line endings and some clients take
-#   advantage of this. Therefore we change the translation option on the
-#   channel and reset it once the DATA command is completed. See the
-#   'service' procedure for the handling of DATA lines.
-#   We also insert trace information as per RFC2821:4.4
-#
-proc ::smtpd::DATA {channel line} {
-    variable version
-    upvar [namespace current]::state_$channel State
-    Log debug "DATA"
-    if { $State(from) == {}} {
-        Puts $channel "503 bad sequence: no sender specified"
-    } elseif { $State(to) == {}} {
-        Puts $channel "503 bad sequence: no recipient specified"
-    } else {
-        Puts $channel "354 Enter mail, end with \".\" on a line by itself"
-        set State(id) [uid]
-        set State(indata) 1
-
-        lappend trace "Return-Path: $State(from)"
-        lappend trace "Received: from [state $channel domain]\
-                   \[[state $channel client_addr]\]"
-        lappend trace "\tby [info hostname] with tcllib smtpd ($version)"
-        if {[info exists State(tls)] && $State(tls)} {
-            catch {
-                array set t [::tls::status $channel]
-                lappend trace "\t(version=TLS1/SSL3 cipher=$t(cipher) bits=$t(sbits) verify=NO)"
-            }
-        }
-        lappend trace "\tid $State(id); [timestamp]"
-        set State(data) $trace
-        fconfigure $channel -translation auto ;# naughty: RFC2821:2.3.7
-    }
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Reset the server state for this connection.
-# Reference:
-#   RFC2821 4.1.1.5
-#
-proc ::smtpd::RSET {channel line} {
-    upvar [namespace current]::state_$channel State
-    Log debug "RSET on $channel"
-    if {[catch {initializeState $channel} msg]} {
-        Log warn "RSET: $msg"
-    }
-    Puts $channel "250 OK"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Verify the existence of a mailbox on the server
-# Reference:
-#   RFC2821 4.1.1.6
-#
-#proc ::smtpd::VRFY {channel line} {
-#    # VRFY SP String CRLF
-#}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Expand a mailing list.
-# Reference:
-#   RFC2821 4.1.1.7
-#
-#proc ::smtpd::EXPN {channel line} {
-#    # EXPN SP String CRLF
-#}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Return a help message.
-# Reference:
-#   RFC2821 4.1.1.8
-#
-proc ::smtpd::HELP {channel line} {
-    variable Help
-    set cmd {}
-    regexp {^HELP\s*(\w+)?} $line -> cmd
-    if {[info exists Help($cmd)]} {
-        foreach line $Help($cmd) {
-            Puts $channel "214-$line"
-        }
-        Puts $channel "214 End of HELP"
-    } else {
-        Puts $channel "504 HELP topic \"$cmd\" unknown."
-    }
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Perform no action.
-# Reference:
-#   RFC2821 4.1.1.9
-#
-proc ::smtpd::NOOP {channel line} {
-    set str {}
-    regexp -nocase {^NOOP (.*)$} -> str
-    Log debug "NOOP: $str"
-    Puts $channel "250 OK"
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Terminate a session and close the transmission channel.
-# Reference:
-#   RFC2821 4.1.1.10
-# Notes:
-#   The server is only permitted to close the channel once it has received 
-#   a QUIT message.
-#
-proc ::smtpd::QUIT {channel line} {
-    variable options
-    upvar [namespace current]::state_$channel State
-
-    Log debug "QUIT on $channel"
-    Puts $channel "221 $options(serveraddr) Service closing transmission channel"
-    close $channel
-        
-    # cleanup the session state array.
-    unset State
-    return
-}
-
-# -------------------------------------------------------------------------
-# Description:
-#   Implement support for secure mail transactions using the TLS package.
-# Reference:
-#   RFC3207
-# Notes:
-#
-proc ::smtpd::STARTTLS {channel line} {
-    variable options
-    upvar [namespace current]::state_$channel State
-    
-    Log debug "$line on $channel"
-    if {![string equal $line STARTTLS]} {
-        Puts $channel "501 Syntax error (no parameters allowed)"
-        return
-    }
-
-    if {[lsearch -exact $options(tlsopts) -certfile] == -1
-        || [lsearch -exact $options(tlsopts) -keyfile] == -1} {
-        Puts $channel "454 TLS not available due to temporary reason"
-        return
-    }
-    
-    set import [linsert $options(tlsopts) 0 ::tls::import $channel -server 1]
-    Puts $channel "220 Ready to start TLS"
-    if {[catch $import msg]} {
-        Puts $channel "454 TLS not available due to temporary reason"
-    } else {
-        set State(domain) {};           #  RFC3207:4.2
-        set State(tls) 1
-    }
-    return
-}
-
-# -------------------------------------------------------------------------
-# Logging callback for use with tls - you must specify this when configuring
-# smtpd if you wan to use it.
-#
-proc ::smtpd::tlscallback {option args} {
-    switch -exact -- $option {
-        "error" {
-            foreach {chan msg} $args break
-            Log error "TLS error '$msg'"
-        } 
-        "verify" {
-            foreach {chan depth cert rc err} $args break
-            if {$rc ne "1"} {
-                Log error "TLS verify/$depth Bad cert '$err' (rc=$rc)"
-            } else {
-                array set c $cert
-                Log notice "TLS verify/$depth: $c(subject)"
-            }
-            return $rc
-        }
-        "info" {
-            foreach {chan major minor state msg} $args break
-            if {$msg ne ""} { append state ": $msg" }
-            Log debug "TLS ${major}.${minor} $state"
-        }
-        default  {
-            Log warn "bad option \"$option\" in smtpd::callback"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-package provide smtpd $smtpd::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/main1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/main1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3981 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#	main1.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#       Snit's Not Incr Tcl, a simple object system in Pure Tcl.
-#
-#       Snit 1.x Compiler and Run-Time Library, Tcl 8.4 and later
-#
-#       Copyright (C) 2003-2006 by William H. Duquette
-#       This code is licensed as described in license.txt.
-#
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-# Namespace
-
-namespace eval ::snit:: {
-    namespace export \
-        compile type widget widgetadaptor typemethod method macro
-}
-
-#-----------------------------------------------------------------------
-# Some Snit variables
-
-namespace eval ::snit:: {
-    variable reservedArgs {type selfns win self}
-
-    # Widget classes which can be hulls (must have -class)
-    variable hulltypes {
-	toplevel tk::toplevel
-	frame tk::frame ttk::frame
-	labelframe tk::labelframe ttk::labelframe
-    }
-}
-
-#-----------------------------------------------------------------------
-# Snit Type Implementation template
-
-namespace eval ::snit:: {
-    # Template type definition: All internal and user-visible Snit
-    # implementation code.
-    #
-    # The following placeholders will automatically be replaced with
-    # the client's code, in two passes:
-    #
-    # First pass:
-    # %COMPILEDDEFS%  The compiled type definition.
-    #
-    # Second pass:
-    # %TYPE%          The fully qualified type name.
-    # %IVARDECS%      Instance variable declarations
-    # %TVARDECS%      Type variable declarations
-    # %TCONSTBODY%    Type constructor body
-    # %INSTANCEVARS%  The compiled instance variable initialization code.
-    # %TYPEVARS%      The compiled type variable initialization code.
-
-    # This is the overall type template.
-    variable typeTemplate
-
-    # This is the normal type proc
-    variable nominalTypeProc
-
-    # This is the "-hastypemethods no" type proc
-    variable simpleTypeProc
-}
-
-set ::snit::typeTemplate {
-
-    #-------------------------------------------------------------------
-    # The type's namespace definition and the user's type variables
-
-    namespace eval %TYPE% {%TYPEVARS%
-    }
-
-    #----------------------------------------------------------------
-    # Commands for use in methods, typemethods, etc.
-    #
-    # These are implemented as aliases into the Snit runtime library.
-
-    interp alias {} %TYPE%::installhull  {} ::snit::RT.installhull %TYPE%
-    interp alias {} %TYPE%::install      {} ::snit::RT.install %TYPE%
-    interp alias {} %TYPE%::typevariable {} ::variable
-    interp alias {} %TYPE%::variable     {} ::snit::RT.variable
-    interp alias {} %TYPE%::mytypevar    {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::typevarname  {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::myvar        {} ::snit::RT.myvar
-    interp alias {} %TYPE%::varname      {} ::snit::RT.myvar
-    interp alias {} %TYPE%::codename     {} ::snit::RT.codename %TYPE%
-    interp alias {} %TYPE%::myproc       {} ::snit::RT.myproc %TYPE%
-    interp alias {} %TYPE%::mymethod     {} ::snit::RT.mymethod
-    interp alias {} %TYPE%::mytypemethod {} ::snit::RT.mytypemethod %TYPE%
-    interp alias {} %TYPE%::from         {} ::snit::RT.from %TYPE%
-
-    #-------------------------------------------------------------------
-    # Snit's internal variables
-
-    namespace eval %TYPE% {
-        # Array: General Snit Info
-        #
-        # ns:                The type's namespace
-        # hasinstances:      T or F, from pragma -hasinstances.
-        # simpledispatch:    T or F, from pragma -hasinstances.
-        # canreplace:        T or F, from pragma -canreplace.
-        # counter:           Count of instances created so far.
-        # widgetclass:       Set by widgetclass statement.
-        # hulltype:          Hull type (frame or toplevel) for widgets only.
-        # exceptmethods:     Methods explicitly not delegated to *
-        # excepttypemethods: Methods explicitly not delegated to *
-        # tvardecs:          Type variable declarations--for dynamic methods
-        # ivardecs:          Instance variable declarations--for dyn. methods
-        typevariable Snit_info
-        set Snit_info(ns)      %TYPE%::
-        set Snit_info(hasinstances) 1
-        set Snit_info(simpledispatch) 0
-        set Snit_info(canreplace) 0
-        set Snit_info(counter) 0
-        set Snit_info(widgetclass) {}
-        set Snit_info(hulltype) frame
-        set Snit_info(exceptmethods) {}
-        set Snit_info(excepttypemethods) {}
-        set Snit_info(tvardecs) {%TVARDECS%}
-        set Snit_info(ivardecs) {%IVARDECS%}
-
-        # Array: Public methods of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_typemethodInfo
-        array unset Snit_typemethodInfo
-
-        # Array: Public methods of instances of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_methodInfo
-        array unset Snit_methodInfo
-
-        # Array: option information.  See dictionary.txt.
-        typevariable Snit_optionInfo
-        array unset Snit_optionInfo
-        set Snit_optionInfo(local)     {}
-        set Snit_optionInfo(delegated) {}
-        set Snit_optionInfo(starcomp)  {}
-        set Snit_optionInfo(except)    {}
-    }
-
-    #----------------------------------------------------------------
-    # Compiled Procs
-    #
-    # These commands are created or replaced during compilation:
-
-
-    # Snit_instanceVars selfns
-    #
-    # Initializes the instance variables, if any.  Called during
-    # instance creation.
-
-    proc %TYPE%::Snit_instanceVars {selfns} {
-        %INSTANCEVARS%
-    }
-
-    # Type Constructor
-    proc %TYPE%::Snit_typeconstructor {type} {
-        %TVARDECS%
-        %TCONSTBODY%
-    }
-
-    #----------------------------------------------------------------
-    # Default Procs
-    #
-    # These commands might be replaced during compilation:
-
-    # Snit_destructor type selfns win self
-    #
-    # Default destructor for the type.  By default, it does
-    # nothing.  It's replaced by any user destructor.
-    # For types, it's called by method destroy; for widgettypes,
-    # it's called by a destroy event handler.
-
-    proc %TYPE%::Snit_destructor {type selfns win self} { }
-
-    #----------------------------------------------------------
-    # Compiled Definitions
-
-    %COMPILEDDEFS%
-
-    #----------------------------------------------------------
-    # Finally, call the Type Constructor
-
-    %TYPE%::Snit_typeconstructor %TYPE%
-}
-
-#-----------------------------------------------------------------------
-# Type procs
-#
-# These procs expect the fully-qualified type name to be
-# substituted in for %TYPE%.
-
-# This is the nominal type proc.  It supports typemethods and
-# delegated typemethods.
-set ::snit::nominalTypeProc {
-    # Type dispatcher function.  Note: This function lives
-    # in the parent of the %TYPE% namespace!  All accesses to
-    # %TYPE% variables and methods must be qualified!
-    proc %TYPE% {{method ""} args} {
-        # First, if there's no method, and no args, and there's a create
-        # method, and this isn't a widget, then method is "create" and
-        # "args" is %AUTO%.
-        if {"" == $method && [llength $args] == 0} {
-            ::variable %TYPE%::Snit_info
-
-            if {$Snit_info(hasinstances) && !$Snit_info(isWidget)} {
-                set method create
-                lappend args %AUTO%
-            } else {
-                error "wrong \# args: should be \"%TYPE% method args\""
-            }
-        }
-
-        # Next, retrieve the command.
-	variable %TYPE%::Snit_typemethodCache
-        while 1 {
-            if {[catch {set Snit_typemethodCache($method)} commandRec]} {
-                set commandRec [::snit::RT.CacheTypemethodCommand %TYPE% $method]
-
-                if {[llength $commandRec] == 0} {
-                    return -code error  "\"%TYPE% $method\" is not defined"
-                }
-            }
-
-            # If we've got a real command, break.
-            if {[lindex $commandRec 0] == 0} {
-                break
-            }
-
-            # Otherwise, we need to look up again...if we can.
-            if {[llength $args] == 0} {
-                return -code error \
-                 "wrong number args: should be \"%TYPE% $method method args\""
-            }
-
-            lappend method [lindex $args 0]
-            set args [lrange $args 1 end]
-        }
-
-        set command [lindex $commandRec 1]
-
-        # Pass along the return code unchanged.
-        set retval [catch {uplevel 1 $command $args} result]
-
-        if {$retval} {
-            if {$retval == 1} {
-                global errorInfo
-                global errorCode
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return -code $retval $result
-            }
-        }
-
-        return $result
-    }
-}
-
-# This is the simplified type proc for when there are no typemethods
-# except create.  In this case, it doesn't take a method argument;
-# the method is always "create".
-set ::snit::simpleTypeProc {
-    # Type dispatcher function.  Note: This function lives
-    # in the parent of the %TYPE% namespace!  All accesses to
-    # %TYPE% variables and methods must be qualified!
-    proc %TYPE% {args} {
-        ::variable %TYPE%::Snit_info
-
-        # FIRST, if the are no args, the single arg is %AUTO%
-        if {[llength $args] == 0} {
-            if {$Snit_info(isWidget)} {
-                error "wrong \# args: should be \"%TYPE% name args\""
-            }
-
-            lappend args %AUTO%
-        }
-
-        # NEXT, we're going to call the create method.
-        # Pass along the return code unchanged.
-        if {$Snit_info(isWidget)} {
-            set command [list ::snit::RT.widget.typemethod.create %TYPE%]
-        } else {
-            set command [list ::snit::RT.type.typemethod.create %TYPE%]
-        }
-
-        set retval [catch {uplevel 1 $command $args} result]
-
-        if {$retval} {
-            if {$retval == 1} {
-                global errorInfo
-                global errorCode
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return -code $retval $result
-            }
-        }
-
-        return $result
-    }
-}
-
-#-----------------------------------------------------------------------
-# Instance procs
-#
-# The following must be substituted into these proc bodies:
-#
-# %SELFNS%       The instance namespace
-# %WIN%          The original instance name
-# %TYPE%         The fully-qualified type name
-#
-
-# Nominal instance proc body: supports method caching and delegation.
-#
-# proc $instanceName {method args} ....
-set ::snit::nominalInstanceProc {
-    set self [set %SELFNS%::Snit_instance]
-
-    while {1} {
-        if {[catch {set %SELFNS%::Snit_methodCache($method)} commandRec]} {
-            set commandRec [snit::RT.CacheMethodCommand %TYPE% %SELFNS% %WIN% $self $method]
-
-            if {[llength $commandRec] == 0} {
-                return -code error \
-                    "\"$self $method\" is not defined"
-            }
-        }
-
-        # If we've got a real command, break.
-        if {[lindex $commandRec 0] == 0} {
-            break
-        }
-
-        # Otherwise, we need to look up again...if we can.
-        if {[llength $args] == 0} {
-            return -code error \
-                "wrong number args: should be \"$self $method method args\""
-        }
-
-        lappend method [lindex $args 0]
-        set args [lrange $args 1 end]
-    }
-
-    set command [lindex $commandRec 1]
-
-    # Pass along the return code unchanged.
-    set retval [catch {uplevel 1 $command $args} result]
-
-    if {$retval} {
-        if {$retval == 1} {
-            global errorInfo
-            global errorCode
-            return -code error -errorinfo $errorInfo \
-                -errorcode $errorCode $result
-        } else {
-            return -code $retval $result
-        }
-    }
-
-    return $result
-}
-
-# Simplified method proc body: No delegation allowed; no support for
-# upvar or exotic return codes or hierarchical methods.  Designed for
-# max speed for simple types.
-#
-# proc $instanceName {method args} ....
-
-set ::snit::simpleInstanceProc {
-    set self [set %SELFNS%::Snit_instance]
-
-    if {[lsearch -exact ${%TYPE%::Snit_methods} $method] == -1} {
-	set optlist [join ${%TYPE%::Snit_methods} ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$method\": must be $optlist"
-    }
-
-    eval [linsert $args 0 \
-              %TYPE%::Snit_method$method %TYPE% %SELFNS% %WIN% $self]
-}
-
-
-#=======================================================================
-# Snit Type Definition
-#
-# These are the procs used to define Snit types, widgets, and
-# widgetadaptors.
-
-
-#-----------------------------------------------------------------------
-# Snit Compilation Variables
-#
-# The following variables are used while Snit is compiling a type,
-# and are disposed afterwards.
-
-namespace eval ::snit:: {
-    # The compiler variable contains the name of the slave interpreter
-    # used to compile type definitions.
-    variable compiler ""
-
-    # The compile array accumulates information about the type or
-    # widgettype being compiled.  It is cleared before and after each
-    # compilation.  It has these indices:
-    #
-    # type:                  The name of the type being compiled, for use
-    #                        in compilation procs.
-    # defs:                  Compiled definitions, both standard and client.
-    # which:                 type, widget, widgetadaptor
-    # instancevars:          Instance variable definitions and initializations.
-    # ivprocdec:             Instance variable proc declarations.
-    # tvprocdec:             Type variable proc declarations.
-    # typeconstructor:       Type constructor body.
-    # widgetclass:           The widgetclass, for snit::widgets, only
-    # hasoptions:            False, initially; set to true when first
-    #                        option is defined.
-    # localoptions:          Names of local options.
-    # delegatedoptions:      Names of delegated options.
-    # localmethods:          Names of locally defined methods.
-    # delegatesmethods:      no if no delegated methods, yes otherwise.
-    # hashierarchic       :  no if no hierarchic methods, yes otherwise.
-    # components:            Names of defined components.
-    # typecomponents:        Names of defined typecomponents.
-    # typevars:              Typevariable definitions and initializations.
-    # varnames:              Names of instance variables
-    # typevarnames           Names of type variables
-    # hasconstructor         False, initially; true when constructor is
-    #                        defined.
-    # resource-$opt          The option's resource name
-    # class-$opt             The option's class
-    # -default-$opt          The option's default value
-    # -validatemethod-$opt   The option's validate method
-    # -configuremethod-$opt  The option's configure method
-    # -cgetmethod-$opt       The option's cget method.
-    # -hastypeinfo           The -hastypeinfo pragma
-    # -hastypedestroy        The -hastypedestroy pragma
-    # -hastypemethods        The -hastypemethods pragma
-    # -hasinfo               The -hasinfo pragma
-    # -hasinstances          The -hasinstances pragma
-    # -simpledispatch        The -simpledispatch pragma
-    # -canreplace            The -canreplace pragma
-    variable compile
-
-    # This variable accumulates method dispatch information; it has
-    # the same structure as the %TYPE%::Snit_methodInfo array, and is
-    # used to initialize it.
-    variable methodInfo
-
-    # This variable accumulates typemethod dispatch information; it has
-    # the same structure as the %TYPE%::Snit_typemethodInfo array, and is
-    # used to initialize it.
-    variable typemethodInfo
-
-    # The following variable lists the reserved type definition statement
-    # names, e.g., the names you can't use as macros.  It's built at
-    # compiler definition time using "info commands".
-    variable reservedwords {}
-}
-
-#-----------------------------------------------------------------------
-# type compilation commands
-#
-# The type and widgettype commands use a slave interpreter to compile
-# the type definition.  These are the procs
-# that are aliased into it.
-
-# Initialize the compiler
-proc ::snit::Comp.Init {} {
-    variable compiler
-    variable reservedwords
-
-    if {"" == $compiler} {
-        # Create the compiler's interpreter
-        set compiler [interp create]
-
-        # Initialize the interpreter
-	$compiler eval {
-            # Load package information
-            # TBD: see if this can be moved outside.
-	    # @mdgen NODEP: ::snit::__does_not_exist__
-            catch {package require ::snit::__does_not_exist__}
-
-            # Protect some Tcl commands our type definitions
-            # will shadow.
-            rename proc _proc
-            rename variable _variable
-        }
-
-        # Define compilation aliases.
-        $compiler alias pragma          ::snit::Comp.statement.pragma
-        $compiler alias widgetclass     ::snit::Comp.statement.widgetclass
-        $compiler alias hulltype        ::snit::Comp.statement.hulltype
-        $compiler alias constructor     ::snit::Comp.statement.constructor
-        $compiler alias destructor      ::snit::Comp.statement.destructor
-        $compiler alias option          ::snit::Comp.statement.option
-        $compiler alias oncget          ::snit::Comp.statement.oncget
-        $compiler alias onconfigure     ::snit::Comp.statement.onconfigure
-        $compiler alias method          ::snit::Comp.statement.method
-        $compiler alias typemethod      ::snit::Comp.statement.typemethod
-        $compiler alias typeconstructor ::snit::Comp.statement.typeconstructor
-        $compiler alias proc            ::snit::Comp.statement.proc
-        $compiler alias typevariable    ::snit::Comp.statement.typevariable
-        $compiler alias variable        ::snit::Comp.statement.variable
-        $compiler alias typecomponent   ::snit::Comp.statement.typecomponent
-        $compiler alias component       ::snit::Comp.statement.component
-        $compiler alias delegate        ::snit::Comp.statement.delegate
-        $compiler alias expose          ::snit::Comp.statement.expose
-
-        # Get the list of reserved words
-        set reservedwords [$compiler eval {info commands}]
-    }
-}
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::Comp.Compile {which type body} {
-    variable typeTemplate
-    variable nominalTypeProc
-    variable simpleTypeProc
-    variable compile
-    variable compiler
-    variable methodInfo
-    variable typemethodInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $type]} {
-        # Get caller's namespace;
-        # append :: if not global namespace.
-        set ns [uplevel 2 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set type "$ns$type"
-    }
-
-    # NEXT, create and initialize the compiler, if needed.
-    Comp.Init
-
-    # NEXT, initialize the class data
-    array unset methodInfo
-    array unset typemethodInfo
-
-    array unset compile
-    set compile(type) $type
-    set compile(defs) {}
-    set compile(which) $which
-    set compile(hasoptions) no
-    set compile(localoptions) {}
-    set compile(instancevars) {}
-    set compile(typevars) {}
-    set compile(delegatedoptions) {}
-    set compile(ivprocdec) {}
-    set compile(tvprocdec) {}
-    set compile(typeconstructor) {}
-    set compile(widgetclass) {}
-    set compile(hulltype) {}
-    set compile(localmethods) {}
-    set compile(delegatesmethods) no
-    set compile(hashierarchic) no
-    set compile(components) {}
-    set compile(typecomponents) {}
-    set compile(varnames) {}
-    set compile(typevarnames) {}
-    set compile(hasconstructor) no
-    set compile(-hastypedestroy) yes
-    set compile(-hastypeinfo) yes
-    set compile(-hastypemethods) yes
-    set compile(-hasinfo) yes
-    set compile(-hasinstances) yes
-    set compile(-simpledispatch) no
-    set compile(-canreplace) no
-
-    set isWidget [string match widget* $which]
-    set isWidgetAdaptor [string match widgetadaptor $which]
-
-    # NEXT, Evaluate the type's definition in the class interpreter.
-    $compiler eval $body
-
-    # NEXT, Add the standard definitions
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidget) $isWidget\n"
-
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidgetAdaptor) $isWidgetAdaptor\n"
-
-    # Indicate whether the type can create instances that replace
-    # existing commands.
-    append compile(defs) "\nset %TYPE%::Snit_info(canreplace) $compile(-canreplace)\n"
-
-
-    # Check pragmas for conflict.
-
-    if {!$compile(-hastypemethods) && !$compile(-hasinstances)} {
-        error "$which $type has neither typemethods nor instances"
-    }
-
-    if {$compile(-simpledispatch) && $compile(delegatesmethods)} {
-        error "$which $type requests -simpledispatch but delegates methods."
-    }
-
-    if {$compile(-simpledispatch) && $compile(hashierarchic)} {
-        error "$which $type requests -simpledispatch but defines hierarchical methods."
-    }
-
-    # If there are typemethods, define the standard typemethods and
-    # the nominal type proc.  Otherwise define the simple type proc.
-    if {$compile(-hastypemethods)} {
-        # Add the info typemethod unless the pragma forbids it.
-        if {$compile(-hastypeinfo)} {
-            Comp.statement.delegate typemethod info \
-                using {::snit::RT.typemethod.info %t}
-        }
-
-        # Add the destroy typemethod unless the pragma forbids it.
-        if {$compile(-hastypedestroy)} {
-            Comp.statement.delegate typemethod destroy \
-                using {::snit::RT.typemethod.destroy %t}
-        }
-
-        # Add the nominal type proc.
-        append compile(defs) $nominalTypeProc
-    } else {
-        # Add the simple type proc.
-        append compile(defs) $simpleTypeProc
-    }
-
-    # Add standard methods/typemethods that only make sense if the
-    # type has instances.
-    if {$compile(-hasinstances)} {
-        # If we're using simple dispatch, remember that.
-        if {$compile(-simpledispatch)} {
-            append compile(defs) "\nset %TYPE%::Snit_info(simpledispatch) 1\n"
-        }
-
-        # Add the info method unless the pragma forbids it.
-        if {$compile(-hasinfo)} {
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method info \
-                    using {::snit::RT.method.info %t %n %w %s}
-            } else {
-                Comp.statement.method info {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.info $type $selfns $win $self]
-                }
-            }
-        }
-
-        # Add the option handling stuff if there are any options.
-        if {$compile(hasoptions)} {
-            Comp.statement.variable options
-
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method cget \
-                    using {::snit::RT.method.cget %t %n %w %s}
-                Comp.statement.delegate method configurelist \
-                    using {::snit::RT.method.configurelist %t %n %w %s}
-                Comp.statement.delegate method configure \
-                    using {::snit::RT.method.configure %t %n %w %s}
-            } else {
-                Comp.statement.method cget {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.cget $type $selfns $win $self]
-                }
-                Comp.statement.method configurelist {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.configurelist $type $selfns $win $self]
-                }
-                Comp.statement.method configure {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.configure $type $selfns $win $self]
-                }
-            }
-        }
-
-        # Add a default constructor, if they haven't already defined one.
-        # If there are options, it will configure args; otherwise it
-        # will do nothing.
-        if {!$compile(hasconstructor)} {
-            if {$compile(hasoptions)} {
-                Comp.statement.constructor {args} {
-                    $self configurelist $args
-                }
-            } else {
-                Comp.statement.constructor {} {}
-            }
-        }
-
-        if {!$isWidget} {
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method destroy \
-                    using {::snit::RT.method.destroy %t %n %w %s}
-            } else {
-                Comp.statement.method destroy {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.destroy $type $selfns $win $self]
-                }
-            }
-
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.type.typemethod.create %t}
-        } else {
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.widget.typemethod.create %t}
-        }
-
-        # Save the list of method names, for -simpledispatch; otherwise,
-        # save the method info.
-        if {$compile(-simpledispatch)} {
-            append compile(defs) \
-                "\nset %TYPE%::Snit_methods [list $compile(localmethods)]\n"
-        } else {
-            append compile(defs) \
-                "\narray set %TYPE%::Snit_methodInfo [list [array get methodInfo]]\n"
-        }
-
-    } else {
-        append compile(defs) "\nset %TYPE%::Snit_info(hasinstances) 0\n"
-    }
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the type's locally defined options; add this information to
-    # the compiled definition.
-    Comp.SaveOptionInfo
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the typemethods; save the typemethod info.
-    append compile(defs) \
-        "\narray set %TYPE%::Snit_typemethodInfo [list [array get typemethodInfo]]\n"
-
-    # NEXT, if this is a widget define the hull component if it isn't
-    # already defined.
-    if {$isWidget} {
-        Comp.DefineComponent hull
-    }
-
-    # NEXT, substitute the compiled definition into the type template
-    # to get the type definition script.
-    set defscript [Expand $typeTemplate \
-                       %COMPILEDDEFS% $compile(defs)]
-
-    # NEXT, substitute the defined macros into the type definition script.
-    # This is done as a separate step so that the compile(defs) can
-    # contain the macros defined below.
-
-    set defscript [Expand $defscript \
-                       %TYPE%         $type \
-                       %IVARDECS%     $compile(ivprocdec) \
-                       %TVARDECS%     $compile(tvprocdec) \
-                       %TCONSTBODY%   $compile(typeconstructor) \
-                       %INSTANCEVARS% $compile(instancevars) \
-                       %TYPEVARS%     $compile(typevars) \
-		       ]
-
-    array unset compile
-
-    return [list $type $defscript]
-}
-
-# Information about locally-defined options is accumulated during
-# compilation, but not added to the compiled definition--the option
-# statement can appear multiple times, so it's easier this way.
-# This proc fills in Snit_optionInfo with the accumulated information.
-#
-# It also computes the option's resource and class names if needed.
-#
-# Note that the information for delegated options was put in
-# Snit_optionInfo during compilation.
-
-proc ::snit::Comp.SaveOptionInfo {} {
-    variable compile
-
-    foreach option $compile(localoptions) {
-        if {"" == $compile(resource-$option)} {
-            set compile(resource-$option) [string range $option 1 end]
-        }
-
-        if {"" == $compile(class-$option)} {
-            set compile(class-$option) [Capitalize $compile(resource-$option)]
-        }
-
-        # NOTE: Don't verify that the validate, configure, and cget
-        # values name real methods; the methods might be defined outside
-        # the typedefinition using snit::method.
-
-        Mappend compile(defs) {
-            # Option %OPTION%
-            lappend %TYPE%::Snit_optionInfo(local) %OPTION%
-
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%)   1
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%)  %RESOURCE%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%)     %CLASS%
-            set %TYPE%::Snit_optionInfo(default-%OPTION%)   %DEFAULT%
-            set %TYPE%::Snit_optionInfo(validate-%OPTION%)  %VALIDATE%
-            set %TYPE%::Snit_optionInfo(configure-%OPTION%) %CONFIGURE%
-            set %TYPE%::Snit_optionInfo(cget-%OPTION%)      %CGET%
-            set %TYPE%::Snit_optionInfo(readonly-%OPTION%)  %READONLY%
-            set %TYPE%::Snit_optionInfo(typespec-%OPTION%)  %TYPESPEC%
-        }   %OPTION%    $option                                   \
-            %RESOURCE%  $compile(resource-$option)                \
-            %CLASS%     $compile(class-$option)                   \
-            %DEFAULT%   [list $compile(-default-$option)]         \
-            %VALIDATE%  [list $compile(-validatemethod-$option)]  \
-            %CONFIGURE% [list $compile(-configuremethod-$option)] \
-            %CGET%      [list $compile(-cgetmethod-$option)]      \
-            %READONLY%  $compile(-readonly-$option)               \
-            %TYPESPEC%  [list $compile(-type-$option)]
-    }
-}
-
-
-# Evaluates a compiled type definition, thus making the type available.
-proc ::snit::Comp.Define {compResult} {
-    # The compilation result is a list containing the fully qualified
-    # type name and a script to evaluate to define the type.
-    set type [lindex $compResult 0]
-    set defscript [lindex $compResult 1]
-
-    # Execute the type definition script.
-    # Consider using namespace eval %TYPE%.  See if it's faster.
-    if {[catch {eval $defscript} result]} {
-        namespace delete $type
-        catch {rename $type ""}
-        error $result
-    }
-
-    return $type
-}
-
-# Sets pragma options which control how the type is defined.
-proc ::snit::Comp.statement.pragma {args} {
-    variable compile
-
-    set errRoot "Error in \"pragma...\""
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -hastypeinfo    -
-            -hastypedestroy -
-            -hastypemethods -
-            -hasinstances   -
-            -simpledispatch -
-            -hasinfo        -
-            -canreplace     {
-                if {![string is boolean -strict $val]} {
-                    error "$errRoot, \"$opt\" requires a boolean value"
-                }
-                set compile($opt) $val
-            }
-            default {
-                error "$errRoot, unknown pragma"
-            }
-        }
-    }
-}
-
-# Defines a widget's option class name.
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.widgetclass {name} {
-    variable compile
-
-    # First, widgetclass can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "widgetclass cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, validate the option name.  We'll require that it begin
-    # with an uppercase letter.
-    set initial [string index $name 0]
-    if {![string is upper $initial]} {
-        error "widgetclass \"$name\" does not begin with an uppercase letter"
-    }
-
-    if {"" != $compile(widgetclass)} {
-        error "too many widgetclass statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(widgetclass) %WIDGETCLASS%
-    } %WIDGETCLASS% [list $name]
-
-    set compile(widgetclass) $name
-}
-
-# Defines a widget's hull type.
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.hulltype {name} {
-    variable compile
-    variable hulltypes
-
-    # First, hulltype can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "hulltype cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, it must be one of the valid hulltypes (frame, toplevel, ...)
-    if {[lsearch -exact $hulltypes [string trimleft $name :]] == -1} {
-        error "invalid hulltype \"$name\", should be one of\
-		[join $hulltypes {, }]"
-    }
-
-    if {"" != $compile(hulltype)} {
-        error "too many hulltype statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(hulltype) %HULLTYPE%
-    } %HULLTYPE% $name
-
-    set compile(hulltype) $name
-}
-
-# Defines a constructor.
-proc ::snit::Comp.statement.constructor {arglist body} {
-    variable compile
-
-    CheckArgs "constructor" $arglist
-
-    # Next, add a magic reference to self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n$body"
-
-    set compile(hasconstructor) yes
-    append compile(defs) "proc %TYPE%::Snit_constructor [list $arglist] [list $body]\n"
-}
-
-# Defines a destructor.
-proc ::snit::Comp.statement.destructor {body} {
-    variable compile
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n$body"
-
-    append compile(defs) "proc %TYPE%::Snit_destructor {type selfns win self} [list $body]\n\n"
-}
-
-# Defines a type option.  The option value can be a triple, specifying
-# the option's -name, resource name, and class name.
-proc ::snit::Comp.statement.option {optionDef args} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"option [list $optionDef]...\""
-
-    # Next, validate the option name.
-    if {![Comp.OptionNameIsValid $option]} {
-        error "$errRoot, badly named option \"$option\""
-    }
-
-    if {[Contains $option $compile(delegatedoptions)]} {
-        error "$errRoot, cannot define \"$option\" locally, it has been delegated"
-    }
-
-    if {![Contains $option $compile(localoptions)]} {
-        # Remember that we've seen this one.
-        set compile(hasoptions) yes
-        lappend compile(localoptions) $option
-
-        # Initialize compilation info for this option.
-        set compile(resource-$option)         ""
-        set compile(class-$option)            ""
-        set compile(-default-$option)         ""
-        set compile(-validatemethod-$option)  ""
-        set compile(-configuremethod-$option) ""
-        set compile(-cgetmethod-$option)      ""
-        set compile(-readonly-$option)        0
-        set compile(-type-$option)            ""
-    }
-
-    # NEXT, see if we have a resource name.  If so, make sure it
-    # isn't being redefined differently.
-    if {"" != $resourceName} {
-        if {"" == $compile(resource-$option)} {
-            # If it's undefined, just save the value.
-            set compile(resource-$option) $resourceName
-        } elseif {![string equal $resourceName $compile(resource-$option)]} {
-            # It's been redefined differently.
-            error "$errRoot, resource name redefined from \"$compile(resource-$option)\" to \"$resourceName\""
-        }
-    }
-
-    # NEXT, see if we have a class name.  If so, make sure it
-    # isn't being redefined differently.
-    if {"" != $className} {
-        if {"" == $compile(class-$option)} {
-            # If it's undefined, just save the value.
-            set compile(class-$option) $className
-        } elseif {![string equal $className $compile(class-$option)]} {
-            # It's been redefined differently.
-            error "$errRoot, class name redefined from \"$compile(class-$option)\" to \"$className\""
-        }
-    }
-
-    # NEXT, handle the args; it's not an error to redefine these.
-    if {[llength $args] == 1} {
-        set compile(-default-$option) [lindex $args 0]
-    } else {
-        foreach {optopt val} $args {
-            switch -exact -- $optopt {
-                -default         -
-                -validatemethod  -
-                -configuremethod -
-                -cgetmethod      {
-                    set compile($optopt-$option) $val
-                }
-                -type {
-                    set compile($optopt-$option) $val
-                    
-                    if {[llength $val] == 1} {
-                        # The type spec *is* the validation object
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) [list $val]\n"
-                    } else {
-                        # Compilation the creation of the validation object
-                        set cmd [linsert $val 1 %TYPE%::Snit_TypeObj_%AUTO%]
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) \[$cmd\]\n"
-                    }
-                }
-                -readonly        {
-                    if {![string is boolean -strict $val]} {
-                        error "$errRoot, -readonly requires a boolean, got \"$val\""
-                    }
-                    set compile($optopt-$option) $val
-                }
-                default {
-                    error "$errRoot, unknown option definition option \"$optopt\""
-                }
-            }
-        }
-    }
-}
-
-# 1 if the option name is valid, 0 otherwise.
-proc ::snit::Comp.OptionNameIsValid {option} {
-    if {![string match {-*} $option] || [string match {*[A-Z ]*} $option]} {
-        return 0
-    }
-
-    return 1
-}
-
-# Defines an option's cget handler
-proc ::snit::Comp.statement.oncget {option body} {
-    variable compile
-
-    set errRoot "Error in \"oncget $option...\""
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "$errRoot, option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "$errRoot, option \"$option\" unknown"
-    }
-
-    Comp.statement.method _cget$option {_option} $body
-    Comp.statement.option $option -cgetmethod _cget$option
-}
-
-# Defines an option's configure handler.
-proc ::snit::Comp.statement.onconfigure {option arglist body} {
-    variable compile
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "onconfigure $option: option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "onconfigure $option: option \"$option\" unknown"
-    }
-
-    if {[llength $arglist] != 1} {
-        error \
-       "onconfigure $option handler should have one argument, got \"$arglist\""
-    }
-
-    CheckArgs "onconfigure $option" $arglist
-
-    # Next, add a magic reference to the option name
-    set arglist [concat _option $arglist]
-
-    Comp.statement.method _configure$option $arglist $body
-    Comp.statement.option $option -configuremethod _configure$option
-}
-
-# Defines an instance method.
-proc ::snit::Comp.statement.method {method arglist body} {
-    variable compile
-    variable methodInfo
-
-    # FIRST, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 0 ::snit::methodInfo \
-        "Error in \"method [list $method]...\""
-
-    if {[llength $method] > 1} {
-        set compile(hashierarchic) yes
-    }
-
-    # Remeber this method
-    lappend compile(localmethods) $method
-
-    CheckArgs "method [list $method]" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script.
-    if {[llength $method] == 1} {
-        set methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_method%METHOD% %ARGLIST% %BODY%
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body]
-    } else {
-        set methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_hmethod%JMETHOD% %ARGLIST% %BODY%
-        } %JMETHOD% [join $method _] %ARGLIST% [list $arglist] \
-            %BODY% [list $body]
-    }
-}
-
-# Check for name collisions; save prefix information.
-#
-# method	The name of the method or typemethod.
-# delFlag       1 if delegated, 0 otherwise.
-# infoVar       The fully qualified name of the array containing
-#               information about the defined methods.
-# errRoot       The root string for any error messages.
-
-proc ::snit::Comp.CheckMethodName {method delFlag infoVar errRoot} {
-    upvar $infoVar methodInfo
-
-    # FIRST, make sure the method name is a valid Tcl list.
-    if {[catch {lindex $method 0}]} {
-        error "$errRoot, the name \"$method\" must have list syntax."
-    }
-
-    # NEXT, check whether we can define it.
-    if {![catch {set methodInfo($method)} data]} {
-        # We can't redefine methods with submethods.
-        if {[lindex $data 0] == 1} {
-            error "$errRoot, \"$method\" has submethods."
-        }
-
-        # You can't delegate a method that's defined locally,
-        # and you can't define a method locally if it's been delegated.
-        if {$delFlag && "" == [lindex $data 2]} {
-            error "$errRoot, \"$method\" has been defined locally."
-        } elseif {!$delFlag && "" != [lindex $data 2]} {
-            error "$errRoot, \"$method\" has been delegated"
-        }
-    }
-
-    # Handle hierarchical case.
-    if {[llength $method] > 1} {
-        set prefix {}
-        set tokens $method
-        while {[llength $tokens] > 1} {
-            lappend prefix [lindex $tokens 0]
-            set tokens [lrange $tokens 1 end]
-
-            if {![catch {set methodInfo($prefix)} result]} {
-                # Prefix is known.  If it's not a prefix, throw an
-                # error.
-                if {[lindex $result 0] == 0} {
-                    error "$errRoot, \"$prefix\" has no submethods."
-                }
-            }
-
-            set methodInfo($prefix) [list 1]
-        }
-    }
-}
-
-# Defines a typemethod method.
-proc ::snit::Comp.statement.typemethod {method arglist body} {
-    variable compile
-    variable typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined
-    # typemethods.
-    Comp.CheckMethodName $method 0 ::snit::typemethodInfo \
-        "Error in \"typemethod [list $method]...\""
-
-    CheckArgs "typemethod $method" $arglist
-
-    # First, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "%TVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script
-    if {[llength $method] == 1} {
-        set typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_typemethod%METHOD% %ARGLIST% %BODY%
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body]
-    } else {
-        set typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_htypemethod%JMETHOD% %ARGLIST% %BODY%
-        } %JMETHOD% [join $method _] \
-            %ARGLIST% [list $arglist] %BODY% [list $body]
-    }
-}
-
-
-# Defines a type constructor.
-proc ::snit::Comp.statement.typeconstructor {body} {
-    variable compile
-
-    if {"" != $compile(typeconstructor)} {
-        error "too many typeconstructors"
-    }
-
-    set compile(typeconstructor) $body
-}
-
-# Defines a static proc in the type's namespace.
-proc ::snit::Comp.statement.proc {proc arglist body} {
-    variable compile
-
-    # If "ns" is defined, the proc can see instance variables.
-    if {[lsearch -exact $arglist selfns] != -1} {
-        # Next, add instance variable declarations to body:
-        set body "%IVARDECS%\n$body"
-    }
-
-    # The proc can always see typevariables.
-    set body "%TVARDECS%\n$body"
-
-    append compile(defs) "
-
-        # Proc $proc
-        proc [list %TYPE%::$proc $arglist $body]
-    "
-}
-
-# Defines a static variable in the type's namespace.
-proc ::snit::Comp.statement.typevariable {name args} {
-    variable compile
-
-    set errRoot "Error in \"typevariable $name...\""
-
-    set len [llength $args]
-
-    if {$len > 2 ||
-        ($len == 2 && "-array" != [lindex $args 0])} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(varnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already an instance variable"
-    }
-
-    lappend compile(typevarnames) $name
-
-    if {$len == 1} {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name [lindex $args 0]]"
-    } elseif {$len == 2} {
-        append compile(typevars) \
-            "\n\t    [list ::variable $name]"
-        append compile(typevars) \
-            "\n\t    [list array set $name [lindex $args 1]]"
-    } else {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name]"
-    }
-
-    append compile(tvprocdec) "\n\t    typevariable ${name}"
-}
-
-# Defines an instance variable; the definition will go in the
-# type's create typemethod.
-proc ::snit::Comp.statement.variable {name args} {
-    variable compile
-
-    set errRoot "Error in \"variable $name...\""
-
-    set len [llength $args]
-
-    if {$len > 2 ||
-        ($len == 2 && "-array" != [lindex $args 0])} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(typevarnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already a typevariable"
-    }
-
-    lappend compile(varnames) $name
-
-    if {$len == 1} {
-        append compile(instancevars) \
-            "\nset \${selfns}::$name [list [lindex $args 0]]\n"
-    } elseif {$len == 2} {
-        append compile(instancevars) \
-            "\narray set \${selfns}::$name [list [lindex $args 1]]\n"
-    }
-
-    append  compile(ivprocdec) "\n\t    "
-    Mappend compile(ivprocdec) {::variable ${selfns}::%N} %N $name
-}
-
-# Defines a typecomponent, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-
-proc ::snit::Comp.statement.typecomponent {component args} {
-    variable compile
-
-    set errRoot "Error in \"typecomponent $component...\""
-
-    # FIRST, define the component
-    Comp.DefineTypecomponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "typecomponent $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "typecomponent $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.
-    if {"" != $publicMethod} {
-        Comp.statement.delegate typemethod [list $publicMethod *] to $component
-    }
-
-    # NEXT, if "-inherit 1" is specified, delegate typemethod * to
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate typemethod "*" to $component
-    }
-
-}
-
-
-# Defines a name to be a typecomponent
-#
-# The name becomes a typevariable; in addition, it gets a
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineTypecomponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(varnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already an instance variable"
-    }
-
-    if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(typecomponents) $component
-
-        # Make it a type variable with no initial value
-        Comp.statement.typevariable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(typevars) {
-            trace add variable %COMP% write \
-                [list ::snit::RT.TypecomponentTrace [list %TYPE%] %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-}
-
-# Defines a component, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-#
-# TBD: Ideally, it should be possible to call this statement multiple
-# times, possibly changing the option values.  To do that, I'd need
-# to cache the option values and not act on them until *after* I'd
-# read the entire type definition.
-
-proc ::snit::Comp.statement.component {component args} {
-    variable compile
-
-    set errRoot "Error in \"component $component...\""
-
-    # FIRST, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "component $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "component $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.
-    if {"" != $publicMethod} {
-        Comp.statement.delegate method [list $publicMethod *] to $component
-    }
-
-    # NEXT, if -inherit is specified, delegate method/option * to
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate method "*" to $component
-        Comp.statement.delegate option "*" to $component
-    }
-}
-
-
-# Defines a name to be a component
-#
-# The name becomes an instance variable; in addition, it gets a
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineComponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(typevarnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already a typevariable"
-    }
-
-    if {[lsearch -exact $compile(components) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(components) $component
-
-        # Make it an instance variable with no initial value
-        Comp.statement.variable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(instancevars) {
-            trace add variable ${selfns}::%COMP% write \
-                [list ::snit::RT.ComponentTrace [list %TYPE%] $selfns %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-}
-
-# Creates a delegated method, typemethod, or option.
-proc ::snit::Comp.statement.delegate {what name args} {
-    # FIRST, dispatch to correct handler.
-    switch $what {
-        typemethod { Comp.DelegatedTypemethod $name $args }
-        method     { Comp.DelegatedMethod     $name $args }
-        option     { Comp.DelegatedOption     $name $args }
-        default {
-            error "Error in \"delegate $what $name...\", \"$what\"?"
-        }
-    }
-
-    if {([llength $args] % 2) != 0} {
-        error "Error in \"delegate $what $name...\", invalid syntax"
-    }
-}
-
-# Creates a delegated typemethod delegating it to a particular
-# typecomponent or an arbitrary command.
-#
-# method    The name of the method
-# arglist       Delegation options
-
-proc ::snit::Comp.DelegatedTypemethod {method arglist} {
-    variable compile
-    variable typemethodInfo
-
-    set errRoot "Error in \"delegate typemethod [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component && "" == $pattern} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $methodTail && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {"*" != $methodTail && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"*\""
-    }
-
-    if {"" != $pattern && "" != $target} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {"*" == $token} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, define the component
-    if {"" != $component} {
-        Comp.DefineTypecomponent $component $errRoot
-    }
-
-    # NEXT, define the pattern.
-    if {"" == $pattern} {
-        if {"*" == $methodTail} {
-            set pattern "%c %m"
-        } elseif {"" != $target} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::typemethodInfo $errRoot
-
-    set typemethodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(excepttypemethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-}
-
-
-# Creates a delegated method delegating it to a particular
-# component or command.
-#
-# method        The name of the method
-# arglist       Delegation options.
-
-proc ::snit::Comp.DelegatedMethod {method arglist} {
-    variable compile
-    variable methodInfo
-
-    set errRoot "Error in \"delegate method [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component && "" == $pattern} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $methodTail && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {"*" != $methodTail && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"*\""
-    }
-
-    if {"" != $pattern && "" != $target} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {"*" == $token} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, we delegate some methods
-    set compile(delegatesmethods) yes
-
-    # NEXT, define the component.  Allow typecomponents.
-    if {"" != $component} {
-        if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-            Comp.DefineComponent $component $errRoot
-        }
-    }
-
-    # NEXT, define the pattern.
-    if {"" == $pattern} {
-        if {"*" == $methodTail} {
-            set pattern "%c %m"
-        } elseif {"" != $target} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::methodInfo $errRoot
-
-    # NEXT, save the method info.
-    set methodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(exceptmethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-}
-
-# Creates a delegated option, delegating it to a particular
-# component and, optionally, to a particular option of that
-# component.
-#
-# optionDef     The option definition
-# args          definition arguments.
-
-proc ::snit::Comp.DelegatedOption {optionDef arglist} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"delegate option [list $optionDef]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $option && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"delegate option *\""
-    }
-
-    if {"*" != $option && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"delegate option *\""
-    }
-
-    # Next, validate the option name
-
-    if {"*" != $option} {
-        if {![Comp.OptionNameIsValid $option]} {
-            error "$errRoot, badly named option \"$option\""
-        }
-    }
-
-    if {[Contains $option $compile(localoptions)]} {
-        error "$errRoot, \"$option\" has been defined locally"
-    }
-
-    if {[Contains $option $compile(delegatedoptions)]} {
-        error "$errRoot, \"$option\" is multiply delegated"
-    }
-
-    # NEXT, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # Next, define the target option, if not specified.
-    if {![string equal $option "*"] &&
-        [string equal $target ""]} {
-        set target $option
-    }
-
-    # NEXT, save the delegation data.
-    set compile(hasoptions) yes
-
-    if {![string equal $option "*"]} {
-        lappend compile(delegatedoptions) $option
-
-        # Next, compute the resource and class names, if they aren't
-        # already defined.
-
-        if {"" == $resourceName} {
-            set resourceName [string range $option 1 end]
-        }
-
-        if {"" == $className} {
-            set className [Capitalize $resourceName]
-        }
-
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%) 0
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%) %RES%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%) %CLASS%
-            lappend %TYPE%::Snit_optionInfo(delegated) %OPTION%
-            set %TYPE%::Snit_optionInfo(target-%OPTION%) [list %COMP% %TARGET%]
-            lappend %TYPE%::Snit_optionInfo(delegated-%COMP%) %OPTION%
-        }   %OPTION% $option \
-            %COMP% $component \
-            %TARGET% $target \
-            %RES% $resourceName \
-            %CLASS% $className
-    } else {
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(starcomp) %COMP%
-            set %TYPE%::Snit_optionInfo(except) %EXCEPT%
-        } %COMP% $component %EXCEPT% [list $exceptions]
-    }
-}
-
-# Exposes a component, effectively making the component's command an
-# instance method.
-#
-# component     The logical name of the delegate
-# "as"          sugar; if not "", must be "as"
-# methodname    The desired method name for the component's command, or ""
-
-proc ::snit::Comp.statement.expose {component {"as" ""} {methodname ""}} {
-    variable compile
-
-
-    # FIRST, define the component
-    Comp.DefineComponent $component
-
-    # NEXT, define the method just as though it were in the type
-    # definition.
-    if {[string equal $methodname ""]} {
-        set methodname $component
-    }
-
-    Comp.statement.method $methodname args [Expand {
-        if {[llength $args] == 0} {
-            return $%COMPONENT%
-        }
-
-        if {[string equal $%COMPONENT% ""]} {
-            error "undefined component \"%COMPONENT%\""
-        }
-
-
-        set cmd [linsert $args 0 $%COMPONENT%]
-        return [uplevel 1 $cmd]
-    } %COMPONENT% $component]
-}
-
-
-
-#-----------------------------------------------------------------------
-# Public commands
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::compile {which type body} {
-    return [Comp.Compile $which $type $body]
-}
-
-proc ::snit::type {type body} {
-    return [Comp.Define [Comp.Compile type $type $body]]
-}
-
-proc ::snit::widget {type body} {
-    return [Comp.Define [Comp.Compile widget $type $body]]
-}
-
-proc ::snit::widgetadaptor {type body} {
-    return [Comp.Define [Comp.Compile widgetadaptor $type $body]]
-}
-
-proc ::snit::typemethod {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_info           Snit_info
-    upvar ${type}::Snit_typemethodInfo Snit_typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined
-    # typemethods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_typemethodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::typemethod $type $method" $arglist
-
-    # Next, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "$Snit_info(tvardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-        uplevel 1 [list proc ${type}::Snit_typemethod$method $arglist $body]
-    } else {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_htypemethod$suffix $arglist $body]
-    }
-}
-
-proc ::snit::method {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-    upvar ${type}::Snit_info        Snit_info
-
-    # FIRST, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_methodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::method $type $method" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "$Snit_info(tvardecs)$Snit_info(ivardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        uplevel 1 [list proc ${type}::Snit_method$method $arglist $body]
-    } else {
-        set Snit_methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_hmethod$suffix $arglist $body]
-    }
-}
-
-# Defines a proc within the compiler; this proc can call other
-# type definition statements, and thus can be used for meta-programming.
-proc ::snit::macro {name arglist body} {
-    variable compiler
-    variable reservedwords
-
-    # FIRST, make sure the compiler is defined.
-    Comp.Init
-
-    # NEXT, check the macro name against the reserved words
-    if {[lsearch -exact $reservedwords $name] != -1} {
-        error "invalid macro name \"$name\""
-    }
-
-    # NEXT, see if the name has a namespace; if it does, define the
-    # namespace.
-    set ns [namespace qualifiers $name]
-
-    if {"" != $ns} {
-        $compiler eval "namespace eval $ns {}"
-    }
-
-    # NEXT, define the macro
-    $compiler eval [list _proc $name $arglist $body]
-}
-
-#-----------------------------------------------------------------------
-# Utility Functions
-#
-# These are utility functions used while compiling Snit types.
-
-# Builds a template from a tagged list of text blocks, then substitutes
-# all symbols in the mapTable, returning the expanded template.
-proc ::snit::Expand {template args} {
-    return [string map $args $template]
-}
-
-# Expands a template and appends it to a variable.
-proc ::snit::Mappend {varname template args} {
-    upvar $varname myvar
-
-    append myvar [string map $args $template]
-}
-
-# Checks argument list against reserved args
-proc ::snit::CheckArgs {which arglist} {
-    variable reservedArgs
-
-    foreach name $reservedArgs {
-        if {[Contains $name $arglist]} {
-            error "$which's arglist may not contain \"$name\" explicitly"
-        }
-    }
-}
-
-# Returns 1 if a value is in a list, and 0 otherwise.
-proc ::snit::Contains {value list} {
-    if {[lsearch -exact $list $value] != -1} {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-# Capitalizes the first letter of a string.
-proc ::snit::Capitalize {text} {
-    return [string toupper $text 0]
-}
-
-# Converts an arbitrary white-space-delimited string into a list
-# by splitting on white-space and deleting empty tokens.
-
-proc ::snit::Listify {str} {
-    set result {}
-    foreach token [split [string trim $str]] {
-        if {[string length $token] > 0} {
-            lappend result $token
-        }
-    }
-
-    return $result
-}
-
-
-#=======================================================================
-# Snit Runtime Library
-#
-# These are procs used by Snit types and widgets at runtime.
-
-#-----------------------------------------------------------------------
-# Object Creation
-
-# Creates a new instance of the snit::type given its name and the args.
-#
-# type		The snit::type
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.type.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace;
-        # append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-
-    # NEXT, if %AUTO% appears in the name, generate a unique
-    # command name.  Otherwise, ensure that the name isn't in use.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    } elseif {!$Snit_info(canreplace) && [llength [info commands $name]]} {
-        error "command \"$name\" already exists"
-    }
-
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns {}
-
-    # NEXT, install the dispatcher
-    RT.MakeInstanceCommand $type $selfns $name
-
-    # Initialize the options to their defaults.
-    upvar ${selfns}::options options
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-
-    # Initialize the instance vars to their defaults.
-    # selfns must be defined, as it is used implicitly.
-    ${type}::Snit_instanceVars $selfns
-
-    # Execute the type's constructor.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-
-        set theInfo $errorInfo
-        set theCode $errorCode
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-# Creates a new instance of the snit::widget or snit::widgetadaptor
-# given its name and the args.
-#
-# type		The snit::widget or snit::widgetadaptor
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.widget.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, if %AUTO% appears in the name, generate a unique
-    # command name.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    }
-
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns { }
-
-    # NEXT, Initialize the widget's own options to their defaults.
-    upvar ${selfns}::options options
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-
-    # Initialize the instance vars to their defaults.
-    ${type}::Snit_instanceVars $selfns
-
-    # NEXT, if this is a normal widget (not a widget adaptor) then create a
-    # frame as its hull.  We set the frame's -class to the user's widgetclass,
-    # or, if none, search for -class in the args list, otherwise default to
-    # the basename of the $type with an initial upper case letter.
-    if {!$Snit_info(isWidgetAdaptor)} {
-        # FIRST, determine the class name
-	set wclass $Snit_info(widgetclass)
-        if {$Snit_info(widgetclass) eq ""} {
-	    set idx [lsearch -exact $args -class]
-	    if {$idx >= 0 && ($idx%2 == 0)} {
-		# -class exists and is in the -option position
-		set wclass [lindex $args [expr {$idx+1}]]
-		set args [lreplace $args $idx [expr {$idx+1}]]
-	    } else {
-		set wclass [::snit::Capitalize [namespace tail $type]]
-	    }
-	}
-
-        # NEXT, create the widget
-        set self $name
-        package require Tk
-        ${type}::installhull using $Snit_info(hulltype) -class $wclass
-
-        # NEXT, let's query the option database for our
-        # widget, now that we know that it exists.
-        foreach opt $Snit_optionInfo(local) {
-            set dbval [RT.OptionDbGet $type $name $opt]
-
-            if {"" != $dbval} {
-                set options($opt) $dbval
-            }
-        }
-    }
-
-    # Execute the type's constructor, and verify that it
-    # has a hull.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-
-        ::snit::RT.Component $type $selfns hull
-
-        # Prepare to call the object's destructor when the
-        # <Destroy> event is received.  Use a Snit-specific bindtag
-        # so that the widget name's tag is unencumbered.
-
-        bind Snit$type$name <Destroy> [::snit::Expand {
-            ::snit::RT.DestroyObject %TYPE% %NS% %W
-        } %TYPE% $type %NS% $selfns]
-
-        # Insert the bindtag into the list of bindtags right
-        # after the widget name.
-        set taglist [bindtags $name]
-        set ndx [lsearch -exact $taglist $name]
-        incr ndx
-        bindtags $name [linsert $taglist $ndx Snit$type$name]
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-
-        set theInfo $errorInfo
-        set theCode $errorCode
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-
-# RT.MakeInstanceCommand type selfns instance
-#
-# type        The object type
-# selfns      The instance namespace
-# instance    The instance name
-#
-# Creates the instance proc.
-
-proc ::snit::RT.MakeInstanceCommand {type selfns instance} {
-    variable ${type}::Snit_info
-
-    # FIRST, remember the instance name.  The Snit_instance variable
-    # allows the instance to figure out its current name given the
-    # instance namespace.
-    upvar ${selfns}::Snit_instance Snit_instance
-    set Snit_instance $instance
-
-    # NEXT, qualify the proc name if it's a widget.
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-
-    # NEXT, install the new proc
-    if {!$Snit_info(simpledispatch)} {
-        set instanceProc $::snit::nominalInstanceProc
-    } else {
-        set instanceProc $::snit::simpleInstanceProc
-    }
-
-    proc $procname {method args} \
-        [string map \
-             [list %SELFNS% $selfns %WIN% $instance %TYPE% $type] \
-             $instanceProc]
-
-    # NEXT, add the trace.
-    trace add command $procname {rename delete} \
-        [list ::snit::RT.InstanceTrace $type $selfns $instance]
-}
-
-# This proc is called when the instance command is renamed.
-# If op is delete, then new will always be "", so op is redundant.
-#
-# type		The fully-qualified type name
-# selfns	The instance namespace
-# win		The original instance/tk window name.
-# old		old instance command name
-# new		new instance command name
-# op		rename or delete
-#
-# If the op is delete, we need to clean up the object; otherwise,
-# we need to track the change.
-#
-# NOTE: In Tcl 8.4.2 there's a bug: errors in rename and delete
-# traces aren't propagated correctly.  Instead, they silently
-# vanish.  Add a catch to output any error message.
-
-proc ::snit::RT.InstanceTrace {type selfns win old new op} {
-    variable ${type}::Snit_info
-
-    # Note to developers ...
-    # For Tcl 8.4.0, errors thrown in trace handlers vanish silently.
-    # Therefore we catch them here and create some output to help in
-    # debugging such problems.
-
-    if {[catch {
-        # FIRST, clean up if necessary
-        if {"" == $new} {
-            if {$Snit_info(isWidget)} {
-                destroy $win
-            } else {
-                ::snit::RT.DestroyObject $type $selfns $win
-            }
-        } else {
-            # Otherwise, track the change.
-            variable ${selfns}::Snit_instance
-            set Snit_instance [uplevel 1 [list namespace which -command $new]]
-
-            # Also, clear the instance caches, as many cached commands
-            # might be invalid.
-            RT.ClearInstanceCaches $selfns
-        }
-    } result]} {
-        global errorInfo
-        # Pop up the console on Windows wish, to enable stdout.
-        # This clobbers errorInfo on unix, so save it so we can print it.
-        set ei $errorInfo
-        catch {console show}
-        puts "Error in ::snit::RT.InstanceTrace $type $selfns $win $old $new $op:"
-        puts $ei
-    }
-}
-
-# Calls the instance constructor and handles related housekeeping.
-proc ::snit::RT.ConstructInstance {type selfns instance arglist} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_iinfo
-
-    # Track whether we are constructed or not.
-    set Snit_iinfo(constructed) 0
-
-    # Call the user's constructor
-    eval [linsert $arglist 0 \
-              ${type}::Snit_constructor $type $selfns $instance $instance]
-
-    set Snit_iinfo(constructed) 1
-
-    # Validate the initial set of options (including defaults)
-    foreach option $Snit_optionInfo(local) {
-        set value [set ${selfns}::options($option)]
-
-        if {"" != $Snit_optionInfo(typespec-$option)} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option default: $result"
-            }
-        }
-    }
-
-    # Unset the configure cache for all -readonly options.
-    # This ensures that the next time anyone tries to
-    # configure it, an error is thrown.
-    foreach opt $Snit_optionInfo(local) {
-        if {$Snit_optionInfo(readonly-$opt)} {
-            unset -nocomplain ${selfns}::Snit_configureCache($opt)
-        }
-    }
-
-    return
-}
-
-# Returns a unique command name.
-#
-# REQUIRE: type is a fully qualified name.
-# REQUIRE: name contains "%AUTO%"
-# PROMISE: the returned command name is unused.
-proc ::snit::RT.UniqueName {countervar type name} {
-    upvar $countervar counter
-    while 1 {
-        # FIRST, bump the counter and define the %AUTO% instance name;
-        # then substitute it into the specified name.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set auto "[namespace tail $type]$counter"
-        set candidate [Expand $name %AUTO% $auto]
-        if {![llength [info commands $candidate]]} {
-            return $candidate
-        }
-    }
-}
-
-# Returns a unique instance namespace, fully qualified.
-#
-# countervar     The name of a counter variable
-# type           The instance's type
-#
-# REQUIRE: type is fully qualified
-# PROMISE: The returned namespace name is unused.
-
-proc ::snit::RT.UniqueInstanceNamespace {countervar type} {
-    upvar $countervar counter
-    while 1 {
-        # FIRST, bump the counter and define the namespace name.
-        # Then see if it already exists.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set ins "${type}::Snit_inst${counter}"
-        if {![namespace exists $ins]} {
-            return $ins
-        }
-    }
-}
-
-# Retrieves an option's value from the option database.
-# Returns "" if no value is found.
-proc ::snit::RT.OptionDbGet {type self opt} {
-    variable ${type}::Snit_optionInfo
-
-    return [option get $self \
-                $Snit_optionInfo(resource-$opt) \
-                $Snit_optionInfo(class-$opt)]
-}
-
-#-----------------------------------------------------------------------
-# Object Destruction
-
-# Implements the standard "destroy" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-
-proc ::snit::RT.method.destroy {type selfns win self} {
-    variable ${selfns}::Snit_iinfo
-
-    # Can't destroy the object if it isn't complete constructed.
-    if {!$Snit_iinfo(constructed)} {
-        return -code error "Called 'destroy' method in constructor"
-    }
-
-    # Calls Snit_cleanup, which (among other things) calls the
-    # user's destructor.
-    ::snit::RT.DestroyObject $type $selfns $win
-}
-
-# This is the function that really cleans up; it's automatically
-# called when any instance is destroyed, e.g., by "$object destroy"
-# for types, and by the <Destroy> event for widgets.
-#
-# type		The fully-qualified type name.
-# selfns	The instance namespace
-# win		The original instance command name.
-
-proc ::snit::RT.DestroyObject {type selfns win} {
-    variable ${type}::Snit_info
-
-    # If the variable Snit_instance doesn't exist then there's no
-    # instance command for this object -- it's most likely a
-    # widgetadaptor. Consequently, there are some things that
-    # we don't need to do.
-    if {[info exists ${selfns}::Snit_instance]} {
-        upvar ${selfns}::Snit_instance instance
-
-        # First, remove the trace on the instance name, so that we
-        # don't call RT.DestroyObject recursively.
-        RT.RemoveInstanceTrace $type $selfns $win $instance
-
-        # Next, call the user's destructor
-        ${type}::Snit_destructor $type $selfns $win $instance
-
-        # Next, if this isn't a widget, delete the instance command.
-        # If it is a widget, get the hull component's name, and rename
-        # it back to the widget name
-
-        # Next, delete the hull component's instance command,
-        # if there is one.
-        if {$Snit_info(isWidget)} {
-            set hullcmd [::snit::RT.Component $type $selfns hull]
-
-            catch {rename $instance ""}
-
-            # Clear the bind event
-            bind Snit$type$win <Destroy> ""
-
-            if {[llength [info commands $hullcmd]]} {
-                # FIRST, rename the hull back to its original name.
-                # If the hull is itself a megawidget, it will have its
-                # own cleanup to do, and it might not do it properly
-                # if it doesn't have the right name.
-                rename $hullcmd ::$instance
-
-                # NEXT, destroy it.
-                destroy $instance
-            }
-        } else {
-            catch {rename $instance ""}
-        }
-    }
-
-    # Next, delete the instance's namespace.  This kills any
-    # instance variables.
-    namespace delete $selfns
-
-    return
-}
-
-# Remove instance trace
-#
-# type           The fully qualified type name
-# selfns         The instance namespace
-# win            The original instance name/Tk window name
-# instance       The current instance name
-
-proc ::snit::RT.RemoveInstanceTrace {type selfns win instance} {
-    variable ${type}::Snit_info
-
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-
-    # NEXT, remove any trace on this name
-    catch {
-        trace remove command $procname {rename delete} \
-            [list ::snit::RT.InstanceTrace $type $selfns $win]
-    }
-}
-
-#-----------------------------------------------------------------------
-# Typecomponent Management and Method Caching
-
-# Typecomponent trace; used for write trace on typecomponent
-# variables.  Saves the new component object name, provided
-# that certain conditions are met.  Also clears the typemethod
-# cache.
-
-proc ::snit::RT.TypecomponentTrace {type component n1 n2 op} {
-    upvar ${type}::Snit_info Snit_info
-    upvar ${type}::${component} cvar
-    upvar ${type}::Snit_typecomponents Snit_typecomponents
-
-    # Save the new component value.
-    set Snit_typecomponents($component) $cvar
-
-    # Clear the typemethod cache.
-    # TBD: can we unset just the elements related to
-    # this component?
-    unset -nocomplain -- ${type}::Snit_typemethodCache
-}
-
-# Generates and caches the command for a typemethod.
-#
-# type		The type
-# method	The name of the typemethod to call.
-#
-# The return value is one of the following lists:
-#
-#    {}              There's no such method.
-#    {1}             The method has submethods; look again.
-#    {0 <command>}   Here's the command to execute.
-
-proc snit::RT.CacheTypemethodCommand {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-    upvar ${type}::Snit_typecomponents  Snit_typecomponents
-    upvar ${type}::Snit_typemethodCache Snit_typemethodCache
-    upvar ${type}::Snit_info            Snit_info
-
-    # FIRST, get the pattern data and the typecomponent name.
-    set implicitCreate 0
-    set instanceName ""
-
-    set starredMethod [lreplace $method end end *]
-    set methodTail [lindex $method end]
-
-    if {[info exists Snit_typemethodInfo($method)]} {
-        set key $method
-    } elseif {[info exists Snit_typemethodInfo($starredMethod)]} {
-        if {[lsearch -exact $Snit_info(excepttypemethods) $methodTail] == -1} {
-            set key $starredMethod
-        } else {
-            return [list ]
-        }
-    } elseif {$Snit_info(hasinstances)} {
-        # Assume the unknown name is an instance name to create, unless
-        # this is a widget and the style of the name is wrong, or the
-        # name mimics a standard typemethod.
-
-        if {[set ${type}::Snit_info(isWidget)] &&
-            ![string match ".*" $method]} {
-            return [list ]
-        }
-
-        # Without this check, the call "$type info" will redefine the
-        # standard "::info" command, with disastrous results.  Since it's
-        # a likely thing to do if !-typeinfo, put in an explicit check.
-        if {"info" == $method || "destroy" == $method} {
-            return [list ]
-        }
-
-        set implicitCreate 1
-        set instanceName $method
-        set key create
-        set method create
-    } else {
-        return [list ]
-    }
-
-    foreach {flag pattern compName} $Snit_typemethodInfo($key) {}
-
-    if {$flag == 1} {
-        return [list 1]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $method \
-                     %m [lindex $method end] \
-                     %j [join $method _]]
-
-    if {"" != $compName} {
-        if {![info exists Snit_typecomponents($compName)]} {
-            error "$type delegates typemethod \"$method\" to undefined typecomponent \"$compName\""
-        }
-
-        lappend subList %c [list $Snit_typecomponents($compName)]
-    }
-
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    if {$implicitCreate} {
-        # In this case, $method is the name of the instance to
-        # create.  Don't cache, as we usually won't do this one
-        # again.
-        lappend command $instanceName
-    } else {
-        set Snit_typemethodCache($method) [list 0 $command]
-    }
-
-    return [list 0 $command]
-}
-
-
-#-----------------------------------------------------------------------
-# Component Management and Method Caching
-
-# Retrieves the object name given the component name.
-proc ::snit::RT.Component {type selfns name} {
-    variable ${selfns}::Snit_components
-
-    if {[catch {set Snit_components($name)} result]} {
-        variable ${selfns}::Snit_instance
-
-        error "component \"$name\" is undefined in $type $Snit_instance"
-    }
-
-    return $result
-}
-
-# Component trace; used for write trace on component instance
-# variables.  Saves the new component object name, provided
-# that certain conditions are met.  Also clears the method
-# cache.
-
-proc ::snit::RT.ComponentTrace {type selfns component n1 n2 op} {
-    upvar ${type}::Snit_info Snit_info
-    upvar ${selfns}::${component} cvar
-    upvar ${selfns}::Snit_components Snit_components
-
-    # If they try to redefine the hull component after
-    # it's been defined, that's an error--but only if
-    # this is a widget or widget adaptor.
-    if {"hull" == $component &&
-        $Snit_info(isWidget) &&
-        [info exists Snit_components($component)]} {
-        set cvar $Snit_components($component)
-        error "The hull component cannot be redefined"
-    }
-
-    # Save the new component value.
-    set Snit_components($component) $cvar
-
-    # Clear the instance caches.
-    # TBD: can we unset just the elements related to
-    # this component?
-    RT.ClearInstanceCaches $selfns
-}
-
-# Generates and caches the command for a method.
-#
-# type:		The instance's type
-# selfns:	The instance's private namespace
-# win:          The instance's original name (a Tk widget name, for
-#               snit::widgets.
-# self:         The instance's current name.
-# method:	The name of the method to call.
-#
-# The return value is one of the following lists:
-#
-#    {}              There's no such method.
-#    {1}             The method has submethods; look again.
-#    {0 <command>}   Here's the command to execute.
-
-proc ::snit::RT.CacheMethodCommand {type selfns win self method} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_methodInfo
-    variable ${type}::Snit_typecomponents
-    variable ${selfns}::Snit_components
-    variable ${selfns}::Snit_methodCache
-
-    # FIRST, get the pattern data and the component name.
-    set starredMethod [lreplace $method end end *]
-    set methodTail [lindex $method end]
-
-    if {[info exists Snit_methodInfo($method)]} {
-        set key $method
-    } elseif {[info exists Snit_methodInfo($starredMethod)] &&
-              [lsearch -exact $Snit_info(exceptmethods) $methodTail] == -1} {
-        set key $starredMethod
-    } else {
-        return [list ]
-    }
-
-    foreach {flag pattern compName} $Snit_methodInfo($key) {}
-
-    if {$flag == 1} {
-        return [list 1]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $method \
-                     %m [lindex $method end] \
-                     %j [join $method _] \
-                     %n [list $selfns] \
-                     %w [list $win] \
-                     %s [list $self]]
-
-    if {"" != $compName} {
-        if {[info exists Snit_components($compName)]} {
-            set compCmd $Snit_components($compName)
-        } elseif {[info exists Snit_typecomponents($compName)]} {
-            set compCmd $Snit_typecomponents($compName)
-        } else {
-            error "$type $self delegates method \"$method\" to undefined component \"$compName\""
-        }
-
-        lappend subList %c [list $compCmd]
-    }
-
-    # Note: The cached command will executed faster if it's
-    # already a list.
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    set commandRec [list 0 $command]
-
-    set Snit_methodCache($method) $commandRec
-
-    return $commandRec
-}
-
-
-# Looks up a method's command.
-#
-# type:		The instance's type
-# selfns:	The instance's private namespace
-# win:          The instance's original name (a Tk widget name, for
-#               snit::widgets.
-# self:         The instance's current name.
-# method:	The name of the method to call.
-# errPrefix:    Prefix for any error method
-proc ::snit::RT.LookupMethodCommand {type selfns win self method errPrefix} {
-    set commandRec [snit::RT.CacheMethodCommand \
-                        $type $selfns $win $self \
-                        $method]
-
-
-    if {[llength $commandRec] == 0} {
-        return -code error \
-            "$errPrefix, \"$self $method\" is not defined"
-    } elseif {[lindex $commandRec 0] == 1} {
-        return -code error \
-            "$errPrefix, wrong number args: should be \"$self\" $method method args"
-    }
-
-    return  [lindex $commandRec 1]
-}
-
-
-# Clears all instance command caches
-proc ::snit::RT.ClearInstanceCaches {selfns} {
-    unset -nocomplain -- ${selfns}::Snit_methodCache
-    unset -nocomplain -- ${selfns}::Snit_cgetCache
-    unset -nocomplain -- ${selfns}::Snit_configureCache
-    unset -nocomplain -- ${selfns}::Snit_validateCache
-}
-
-
-#-----------------------------------------------------------------------
-# Component Installation
-
-# Implements %TYPE%::installhull.  The variables self and selfns
-# must be defined in the caller's context.
-#
-# Installs the named widget as the hull of a
-# widgetadaptor.  Once the widget is hijacked, its new name
-# is assigned to the hull component.
-
-proc ::snit::RT.installhull {type {using "using"} {widgetType ""} args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-    upvar self self
-    upvar selfns selfns
-    upvar ${selfns}::hull hull
-    upvar ${selfns}::options options
-
-    # FIRST, make sure we can do it.
-    if {!$Snit_info(isWidget)} {
-        error "installhull is valid only for snit::widgetadaptors"
-    }
-
-    if {[info exists ${selfns}::Snit_instance]} {
-        error "hull already installed for $type $self"
-    }
-
-    # NEXT, has it been created yet?  If not, create it using
-    # the specified arguments.
-    if {"using" == $using} {
-        # FIRST, create the widget
-        set cmd [linsert $args 0 $widgetType $self]
-        set obj [uplevel 1 $cmd]
-
-        # NEXT, for each option explicitly delegated to the hull
-        # that doesn't appear in the usedOpts list, get the
-        # option database value and apply it--provided that the
-        # real option name and the target option name are different.
-        # (If they are the same, then the option database was
-        # already queried as part of the normal widget creation.)
-        #
-        # Also, we don't need to worry about implicitly delegated
-        # options, as the option and target option names must be
-        # the same.
-        if {[info exists Snit_optionInfo(delegated-hull)]} {
-
-            # FIRST, extract all option names from args
-            set usedOpts {}
-            set ndx [lsearch -glob $args "-*"]
-            foreach {opt val} [lrange $args $ndx end] {
-                lappend usedOpts $opt
-            }
-
-            foreach opt $Snit_optionInfo(delegated-hull) {
-                set target [lindex $Snit_optionInfo(target-$opt) 1]
-
-                if {"$target" == $opt} {
-                    continue
-                }
-
-                set result [lsearch -exact $usedOpts $target]
-
-                if {$result != -1} {
-                    continue
-                }
-
-                set dbval [RT.OptionDbGet $type $self $opt]
-                $obj configure $target $dbval
-            }
-        }
-    } else {
-        set obj $using
-
-        if {![string equal $obj $self]} {
-            error \
-                "hull name mismatch: \"$obj\" != \"$self\""
-        }
-    }
-
-    # NEXT, get the local option defaults.
-    foreach opt $Snit_optionInfo(local) {
-        set dbval [RT.OptionDbGet $type $self $opt]
-
-        if {"" != $dbval} {
-            set options($opt) $dbval
-        }
-    }
-
-
-    # NEXT, do the magic
-    set i 0
-    while 1 {
-        incr i
-        set newName "::hull${i}$self"
-        if {![llength [info commands $newName]]} {
-            break
-        }
-    }
-
-    rename ::$self $newName
-    RT.MakeInstanceCommand $type $selfns $self
-
-    # Note: this relies on RT.ComponentTrace to do the dirty work.
-    set hull $newName
-
-    return
-}
-
-# Implements %TYPE%::install.
-#
-# Creates a widget and installs it as the named component.
-# It expects self and selfns to be defined in the caller's context.
-
-proc ::snit::RT.install {type compName "using" widgetType winPath args} {
-    variable ${type}::Snit_optionInfo
-    variable ${type}::Snit_info
-    upvar self self
-    upvar selfns selfns
-    upvar ${selfns}::$compName comp
-    upvar ${selfns}::hull hull
-
-    # We do the magic option database stuff only if $self is
-    # a widget.
-    if {$Snit_info(isWidget)} {
-        if {"" == $hull} {
-            error "tried to install \"$compName\" before the hull exists"
-        }
-
-        # FIRST, query the option database and save the results
-        # into args.  Insert them before the first option in the
-        # list, in case there are any non-standard parameters.
-        #
-        # Note: there might not be any delegated options; if so,
-        # don't bother.
-
-        if {[info exists Snit_optionInfo(delegated-$compName)]} {
-            set ndx [lsearch -glob $args "-*"]
-
-            foreach opt $Snit_optionInfo(delegated-$compName) {
-                set dbval [RT.OptionDbGet $type $self $opt]
-
-                if {"" != $dbval} {
-                    set target [lindex $Snit_optionInfo(target-$opt) 1]
-                    set args [linsert $args $ndx $target $dbval]
-                }
-            }
-        }
-    }
-
-    # NEXT, create the component and save it.
-    set cmd [concat [list $widgetType $winPath] $args]
-    set comp [uplevel 1 $cmd]
-
-    # NEXT, handle the option database for "delegate option *",
-    # in widgets only.
-    if {$Snit_info(isWidget) && [string equal $Snit_optionInfo(starcomp) $compName]} {
-        # FIRST, get the list of option specs from the widget.
-        # If configure doesn't work, skip it.
-        if {[catch {$comp configure} specs]} {
-            return
-        }
-
-        # NEXT, get the set of explicitly used options from args
-        set usedOpts {}
-        set ndx [lsearch -glob $args "-*"]
-        foreach {opt val} [lrange $args $ndx end] {
-            lappend usedOpts $opt
-        }
-
-        # NEXT, "delegate option *" matches all options defined
-        # by this widget that aren't defined by the widget as a whole,
-        # and that aren't excepted.  Plus, we skip usedOpts.  So build
-        # a list of the options it can't match.
-        set skiplist [concat \
-                          $usedOpts \
-                          $Snit_optionInfo(except) \
-                          $Snit_optionInfo(local) \
-                          $Snit_optionInfo(delegated)]
-
-        # NEXT, loop over all of the component's options, and set
-        # any not in the skip list for which there is an option
-        # database value.
-        foreach spec $specs {
-            # Skip aliases
-            if {[llength $spec] != 5} {
-                continue
-            }
-
-            set opt [lindex $spec 0]
-
-            if {[lsearch -exact $skiplist $opt] != -1} {
-                continue
-            }
-
-            set res [lindex $spec 1]
-            set cls [lindex $spec 2]
-
-            set dbvalue [option get $self $res $cls]
-
-            if {"" != $dbvalue} {
-                $comp configure $opt $dbvalue
-            }
-        }
-    }
-
-    return
-}
-
-
-#-----------------------------------------------------------------------
-# Method/Variable Name Qualification
-
-# Implements %TYPE%::variable.  Requires selfns.
-proc ::snit::RT.variable {varname} {
-    upvar selfns selfns
-
-    if {![string match "::*" $varname]} {
-        uplevel 1 [list upvar 1 ${selfns}::$varname $varname]
-    } else {
-        # varname is fully qualified; let the standard
-        # "variable" command handle it.
-        uplevel 1 [list ::variable $varname]
-    }
-}
-
-# Fully qualifies a typevariable name.
-#
-# This is used to implement the mytypevar command.
-
-proc ::snit::RT.mytypevar {type name} {
-    return ${type}::$name
-}
-
-# Fully qualifies an instance variable name.
-#
-# This is used to implement the myvar command.
-proc ::snit::RT.myvar {name} {
-    upvar selfns selfns
-    return ${selfns}::$name
-}
-
-# Use this like "list" to convert a proc call into a command
-# string to pass to another object (e.g., as a -command).
-# Qualifies the proc name properly.
-#
-# This is used to implement the "myproc" command.
-
-proc ::snit::RT.myproc {type procname args} {
-    set procname "${type}::$procname"
-    return [linsert $args 0 $procname]
-}
-
-# DEPRECATED
-proc ::snit::RT.codename {type name} {
-    return "${type}::$name"
-}
-
-# Use this like "list" to convert a typemethod call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the type command at the beginning.
-#
-# This is used to implement the "mytypemethod" command.
-
-proc ::snit::RT.mytypemethod {type args} {
-    return [linsert $args 0 $type]
-}
-
-# Use this like "list" to convert a method call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the code at the beginning to call the right object, even if
-# the object's name has changed.  Requires that selfns be defined
-# in the calling context, eg. can only be called in instance
-# code.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.mymethod {args} {
-    upvar selfns selfns
-    return [linsert $args 0 ::snit::RT.CallInstance ${selfns}]
-}
-
-# Calls an instance method for an object given its
-# instance namespace and remaining arguments (the first of which
-# will be the method name.
-#
-# selfns		The instance namespace
-# args			The arguments
-#
-# Uses the selfns to determine $self, and calls the method
-# in the normal way.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.CallInstance {selfns args} {
-    upvar ${selfns}::Snit_instance self
-
-    set retval [catch {uplevel 1 [linsert $args 0 $self]} result]
-
-    if {$retval} {
-        if {$retval == 1} {
-            global errorInfo
-            global errorCode
-            return -code error -errorinfo $errorInfo \
-                -errorcode $errorCode $result
-        } else {
-            return -code $retval $result
-        }
-    }
-
-    return $result
-}
-
-# Looks for the named option in the named variable.  If found,
-# it and its value are removed from the list, and the value
-# is returned.  Otherwise, the default value is returned.
-# If the option is undelegated, it's own default value will be
-# used if none is specified.
-#
-# Implements the "from" command.
-
-proc ::snit::RT.from {type argvName option {defvalue ""}} {
-    variable ${type}::Snit_optionInfo
-    upvar $argvName argv
-
-    set ioption [lsearch -exact $argv $option]
-
-    if {$ioption == -1} {
-        if {"" == $defvalue &&
-            [info exists Snit_optionInfo(default-$option)]} {
-            return $Snit_optionInfo(default-$option)
-        } else {
-            return $defvalue
-        }
-    }
-
-    set ivalue [expr {$ioption + 1}]
-    set value [lindex $argv $ivalue]
-
-    set argv [lreplace $argv $ioption $ivalue]
-
-    return $value
-}
-
-#-----------------------------------------------------------------------
-# Type Destruction
-
-# Implements the standard "destroy" typemethod:
-# Destroys a type completely.
-#
-# type		The snit type
-
-proc ::snit::RT.typemethod.destroy {type} {
-    variable ${type}::Snit_info
-
-    # FIRST, destroy all instances
-    foreach selfns [namespace children $type] {
-        if {![namespace exists $selfns]} {
-            continue
-        }
-        upvar ${selfns}::Snit_instance obj
-
-        if {$Snit_info(isWidget)} {
-            destroy $obj
-        } else {
-            if {[llength [info commands $obj]]} {
-                $obj destroy
-            }
-        }
-    }
-
-    # NEXT, destroy the type's data.
-    namespace delete $type
-
-    # NEXT, get rid of the type command.
-    rename $type ""
-}
-
-
-
-#-----------------------------------------------------------------------
-# Option Handling
-
-# Implements the standard "cget" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.method.cget {type selfns win self option} {
-    if {[catch {set ${selfns}::Snit_cgetCache($option)} command]} {
-        set command [snit::RT.CacheCgetCommand $type $selfns $win $self $option]
-
-        if {[llength $command] == 0} {
-            return -code error "unknown option \"$option\""
-        }
-    }
-
-    uplevel 1 $command
-}
-
-# Retrieves and caches the command that implements "cget" for the
-# specified option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.CacheCgetCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_cgetCache
-
-    if {[info exists Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.  If it has a cget method defined,
-            # use it; otherwise just return the value.
-
-            if {"" == $Snit_optionInfo(cget-$option)} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(cget-$option) \
-                                 "can't cget $option"]
-
-                lappend command $option
-            }
-
-            set Snit_cgetCache($option) $command
-            return $command
-        }
-
-        # Explicitly delegated option; get target
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {"" != $Snit_optionInfo(starcomp) &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated; get target.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-
-    # Get the component's object.
-    set obj [RT.Component $type $selfns $comp]
-
-    set command [list $obj cget $target]
-    set Snit_cgetCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configurelist" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# optionlist    A list of options and their values.
-
-proc ::snit::RT.method.configurelist {type selfns win self optionlist} {
-    variable ${type}::Snit_optionInfo
-
-    foreach {option value} $optionlist {
-        # FIRST, get the configure command, caching it if need be.
-        if {[catch {set ${selfns}::Snit_configureCache($option)} command]} {
-            set command [snit::RT.CacheConfigureCommand \
-                             $type $selfns $win $self $option]
-
-            if {[llength $command] == 0} {
-                return -code error "unknown option \"$option\""
-            }
-        }
-
-        # NEXT, if we have a type-validation object, use it.
-        # TBD: Should test (islocal-$option) here, but islocal
-        # isn't defined for implicitly delegated options.
-        if {[info exists Snit_optionInfo(typeobj-$option)]
-            && "" != $Snit_optionInfo(typeobj-$option)} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option value: $result"
-            }
-        }
-
-        # NEXT, the caching the configure command also cached the
-        # validate command, if any.  If we have one, run it.
-        set valcommand [set ${selfns}::Snit_validateCache($option)]
-
-        if {[llength $valcommand]} {
-            lappend valcommand $value
-            uplevel 1 $valcommand
-        }
-
-        # NEXT, configure the option with the value.
-        lappend command $value
-        uplevel 1 $command
-    }
-
-    return
-}
-
-# Retrieves and caches the command that stores the named option.
-# Also stores the command that validates the name option if any;
-# If none, the validate command is "", so that the cache is always
-# populated.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        An option name
-
-proc ::snit::RT.CacheConfigureCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_configureCache
-    variable ${selfns}::Snit_validateCache
-
-    if {[info exist Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.
-
-            # If it's readonly, it throws an error if we're already
-            # constructed.
-            if {$Snit_optionInfo(readonly-$option)} {
-                if {[set ${selfns}::Snit_iinfo(constructed)]} {
-                    error "option $option can only be set at instance creation"
-                }
-            }
-
-            # If it has a validate method, cache that for later.
-            if {"" != $Snit_optionInfo(validate-$option)} {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(validate-$option) \
-                                 "can't validate $option"]
-
-                lappend command $option
-                set Snit_validateCache($option) $command
-            } else {
-                set Snit_validateCache($option) ""
-            }
-
-            # If it has a configure method defined,
-            # cache it; otherwise, just set the value.
-
-            if {"" == $Snit_optionInfo(configure-$option)} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(configure-$option) \
-                                 "can't configure $option"]
-
-                lappend command $option
-            }
-
-            set Snit_configureCache($option) $command
-            return $command
-        }
-
-        # Delegated option: get target.
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {$Snit_optionInfo(starcomp) != "" &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-
-    # There is no validate command in this case; save an empty string.
-    set Snit_validateCache($option) ""
-
-    # Get the component's object
-    set obj [RT.Component $type $selfns $comp]
-
-    set command [list $obj configure $target]
-    set Snit_configureCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configure" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# args          A list of options and their values, possibly empty.
-
-proc ::snit::RT.method.configure {type selfns win self args} {
-    # If two or more arguments, set values as usual.
-    if {[llength $args] >= 2} {
-        ::snit::RT.method.configurelist $type $selfns $win $self $args
-        return
-    }
-
-    # If zero arguments, acquire data for each known option
-    # and return the list
-    if {[llength $args] == 0} {
-        set result {}
-        foreach opt [RT.method.info.options $type $selfns $win $self] {
-            # Refactor this, so that we don't need to call via $self.
-            lappend result [RT.GetOptionDbSpec \
-                                $type $selfns $win $self $opt]
-        }
-
-        return $result
-    }
-
-    # They want it for just one.
-    set opt [lindex $args 0]
-
-    return [RT.GetOptionDbSpec $type $selfns $win $self $opt]
-}
-
-
-# Retrieves the option database spec for a single option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of an option
-#
-# TBD: This is a bad name.  What it's returning is the
-# result of the configure query.
-
-proc ::snit::RT.GetOptionDbSpec {type selfns win self opt} {
-    variable ${type}::Snit_optionInfo
-
-    upvar ${selfns}::Snit_components Snit_components
-    upvar ${selfns}::options         options
-
-    if {[info exists options($opt)]} {
-        # This is a locally-defined option.  Just build the
-        # list and return it.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-        set def $Snit_optionInfo(default-$opt)
-
-        return [list $opt $res $cls $def \
-                    [RT.method.cget $type $selfns $win $self $opt]]
-    } elseif {[info exists Snit_optionInfo(target-$opt)]} {
-        # This is an explicitly delegated option.  The only
-        # thing we don't have is the default.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-
-        # Get the default
-        set logicalName [lindex $Snit_optionInfo(target-$opt) 0]
-        set comp $Snit_components($logicalName)
-        set target [lindex $Snit_optionInfo(target-$opt) 1]
-
-        if {[catch {$comp configure $target} result]} {
-            set defValue {}
-        } else {
-            set defValue [lindex $result 3]
-        }
-
-        return [list $opt $res $cls $defValue [$self cget $opt]]
-    } elseif {"" != $Snit_optionInfo(starcomp) &&
-              [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-        set logicalName $Snit_optionInfo(starcomp)
-        set target $opt
-        set comp $Snit_components($logicalName)
-
-        if {[catch {set value [$comp cget $target]} result]} {
-            error "unknown option \"$opt\""
-        }
-
-        if {![catch {$comp configure $target} result]} {
-            # Replace the delegated option name with the local name.
-            return [::snit::Expand $result $target $opt]
-        }
-
-        # configure didn't work; return simple form.
-        return [list $opt "" "" "" $value]
-    } else {
-        error "unknown option \"$opt\""
-    }
-}
-
-#-----------------------------------------------------------------------
-# Type Introspection
-
-# Implements the standard "info" typemethod.
-#
-# type		The snit type
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.typemethod.info {type command args} {
-    global errorInfo
-    global errorCode
-
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        typevars    -
-        typemethods -
-        instances {
-            # TBD: it should be possible to delete this error
-            # handling.
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 \
-			       ::snit::RT.typemethod.info.$command $type]
-            } result]
-
-            if {$errflag} {
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            error "\"$type info $command\" is not defined"
-        }
-    }
-}
-
-
-# Returns a list of the type's typevariables whose names match a
-# pattern, excluding Snit internal variables.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typevars {type {pattern *}} {
-    set result {}
-    foreach name [info vars "${type}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-
-    return $result
-}
-
-# Returns a list of the type's methods whose names match a
-# pattern.  If "delegate typemethod *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typemethods {type {pattern *}} {
-    variable ${type}::Snit_typemethodInfo
-    variable ${type}::Snit_typemethodCache
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_typemethodInfo $pattern] {
-        if {[lindex $Snit_typemethodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    if {[info exists Snit_typemethodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        foreach name [array names Snit_typemethodCache $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $type info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.args {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 1 end]
-}
-
-# $type info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.body {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $type info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.default {type method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# Returns a list of the type's instances whose names match
-# a pattern.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match
-#               Defaults to *
-#
-# REQUIRE: type is fully qualified.
-
-proc ::snit::RT.typemethod.info.instances {type {pattern *}} {
-    set result {}
-
-    foreach selfns [namespace children $type] {
-        upvar ${selfns}::Snit_instance instance
-
-        if {[string match $pattern $instance]} {
-            lappend result $instance
-        }
-    }
-
-    return $result
-}
-
-#-----------------------------------------------------------------------
-# Instance Introspection
-
-# Implements the standard "info" method.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.method.info {type selfns win self command args} {
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        type        -
-        vars        -
-        options     -
-        methods     -
-        typevars    -
-        typemethods {
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 ::snit::RT.method.info.$command \
-			       $type $selfns $win $self]
-            } result]
-
-            if {$errflag} {
-                global errorInfo
-                return -code error -errorinfo $errorInfo $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            # error "\"$self info $command\" is not defined"
-            return -code error "\"$self info $command\" is not defined"
-        }
-    }
-}
-
-# $self info type
-#
-# Returns the instance's type
-proc ::snit::RT.method.info.type {type selfns win self} {
-    return $type
-}
-
-# $self info typevars
-#
-# Returns the instance's type's typevariables
-proc ::snit::RT.method.info.typevars {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typevars $type $pattern]
-}
-
-# $self info typemethods
-#
-# Returns the instance's type's typemethods
-proc ::snit::RT.method.info.typemethods {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typemethods $type $pattern]
-}
-
-# Returns a list of the instance's methods whose names match a
-# pattern.  If "delegate method *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# selfns        The instance namespace
-# win		The original instance name
-# self          The current instance name
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.method.info.methods {type selfns win self {pattern *}} {
-    variable ${type}::Snit_methodInfo
-    variable ${selfns}::Snit_methodCache
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_methodInfo $pattern] {
-        if {[lindex $Snit_methodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    if {[info exists Snit_methodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        foreach name [array names Snit_methodCache $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $self info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.args {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 4 end]
-}
-
-# $self info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.body {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $self info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.default {type selfns win self method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# $self info vars
-#
-# Returns the instance's instance variables
-proc ::snit::RT.method.info.vars {type selfns win self {pattern *}} {
-    set result {}
-    foreach name [info vars "${selfns}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-
-    return $result
-}
-
-# $self info options
-#
-# Returns a list of the names of the instance's options
-proc ::snit::RT.method.info.options {type selfns win self {pattern *}} {
-    variable ${type}::Snit_optionInfo
-
-    # First, get the local and explicitly delegated options
-    set result [concat $Snit_optionInfo(local) $Snit_optionInfo(delegated)]
-
-    # If "configure" works as for Tk widgets, add the resulting
-    # options to the list.  Skip excepted options
-    if {"" != $Snit_optionInfo(starcomp)} {
-        upvar ${selfns}::Snit_components Snit_components
-        set logicalName $Snit_optionInfo(starcomp)
-        set comp $Snit_components($logicalName)
-
-        if {![catch {$comp configure} records]} {
-            foreach record $records {
-                set opt [lindex $record 0]
-                if {[lsearch -exact $result $opt] == -1 &&
-                    [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-                    lappend result $opt
-                }
-            }
-        }
-    }
-
-    # Next, apply the pattern
-    set names {}
-
-    foreach name $result {
-        if {[string match $pattern $name]} {
-            lappend names $name
-        }
-    }
-
-    return $names
-}
-
-proc ::snit::RT.body {body} {
-    regsub -all ".*# END snit method prolog\n" $body {} body
-    return $body
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/main1_83.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/main1_83.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4005 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#	main1_83.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#       Snit's Not Incr Tcl, a simple object system in Pure Tcl.
-#
-#       Snit 1.x Compiler and Run-Time Library, Tcl 8.3 and later
-#
-#       Copyright (C) 2003-2006 by William H. Duquette
-#       This code is licensed as described in license.txt.
-#
-#-----------------------------------------------------------------------
-# Back-port to Tcl8.3 by Kenneth Green (kmg)
-# Modified by Andreas Kupries.
-# Further modified by Will Duquette 12 Aug 2006
-#
-# Local changes marked with "#kmg-tcl83"
-#
-# Global changes:
-#  " trace add variable " -> "trace variable "
-#  " write " -> "w" in all calls to 'trace variable'
-#  " unset -nocomplain "  -> "::snit83::unset -nocomplain"
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-# Namespace
-
-namespace eval ::snit:: {
-    namespace export \
-        compile type widget widgetadaptor typemethod method macro
-}
-
-#-----------------------------------------------------------------------
-# Some Snit variables
-
-namespace eval ::snit:: {
-    variable reservedArgs {type selfns win self}
-
-    # Widget classes which can be hulls (must have -class)
-    variable hulltypes {
-	toplevel tk::toplevel
-	frame tk::frame ttk::frame
-	labelframe tk::labelframe ttk::labelframe
-    }
-}
-
-#-----------------------------------------------------------------------
-# Snit Type Implementation template
-
-namespace eval ::snit:: {
-    # Template type definition: All internal and user-visible Snit
-    # implementation code.
-    #
-    # The following placeholders will automatically be replaced with
-    # the client's code, in two passes:
-    #
-    # First pass:
-    # %COMPILEDDEFS%  The compiled type definition.
-    #
-    # Second pass:
-    # %TYPE%          The fully qualified type name.
-    # %IVARDECS%      Instance variable declarations
-    # %TVARDECS%      Type variable declarations
-    # %TCONSTBODY%    Type constructor body
-    # %INSTANCEVARS%  The compiled instance variable initialization code.
-    # %TYPEVARS%      The compiled type variable initialization code.
-
-    # This is the overall type template.
-    variable typeTemplate
-
-    # This is the normal type proc
-    variable nominalTypeProc
-
-    # This is the "-hastypemethods no" type proc
-    variable simpleTypeProc
-}
-
-set ::snit::typeTemplate {
-
-    #-------------------------------------------------------------------
-    # The type's namespace definition and the user's type variables
-
-    namespace eval %TYPE% {%TYPEVARS%
-    }
-
-    #----------------------------------------------------------------
-    # Commands for use in methods, typemethods, etc.
-    #
-    # These are implemented as aliases into the Snit runtime library.
-
-    interp alias {} %TYPE%::installhull  {} ::snit::RT.installhull %TYPE%
-    interp alias {} %TYPE%::install      {} ::snit::RT.install %TYPE%
-    interp alias {} %TYPE%::typevariable {} ::variable
-    interp alias {} %TYPE%::variable     {} ::snit::RT.variable
-    interp alias {} %TYPE%::mytypevar    {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::typevarname  {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::myvar        {} ::snit::RT.myvar
-    interp alias {} %TYPE%::varname      {} ::snit::RT.myvar
-    interp alias {} %TYPE%::codename     {} ::snit::RT.codename %TYPE%
-    interp alias {} %TYPE%::myproc       {} ::snit::RT.myproc %TYPE%
-    interp alias {} %TYPE%::mymethod     {} ::snit::RT.mymethod
-    interp alias {} %TYPE%::mytypemethod {} ::snit::RT.mytypemethod %TYPE%
-    interp alias {} %TYPE%::from         {} ::snit::RT.from %TYPE%
-
-    #-------------------------------------------------------------------
-    # Snit's internal variables
-
-    namespace eval %TYPE% {
-        # Array: General Snit Info
-        #
-        # ns:                The type's namespace
-        # hasinstances:      T or F, from pragma -hasinstances.
-        # simpledispatch:    T or F, from pragma -hasinstances.
-        # canreplace:        T or F, from pragma -canreplace.
-        # counter:           Count of instances created so far.
-        # widgetclass:       Set by widgetclass statement.
-        # hulltype:          Hull type (frame or toplevel) for widgets only.
-        # exceptmethods:     Methods explicitly not delegated to *
-        # excepttypemethods: Methods explicitly not delegated to *
-        # tvardecs:          Type variable declarations--for dynamic methods
-        # ivardecs:          Instance variable declarations--for dyn. methods
-        typevariable Snit_info
-        set Snit_info(ns)      %TYPE%::
-        set Snit_info(hasinstances) 1
-        set Snit_info(simpledispatch) 0
-        set Snit_info(canreplace) 0
-        set Snit_info(counter) 0
-        set Snit_info(widgetclass) {}
-        set Snit_info(hulltype) frame
-        set Snit_info(exceptmethods) {}
-        set Snit_info(excepttypemethods) {}
-        set Snit_info(tvardecs) {%TVARDECS%}
-        set Snit_info(ivardecs) {%IVARDECS%}
-
-        # Array: Public methods of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_typemethodInfo
-        array unset Snit_typemethodInfo
-
-        # Array: Public methods of instances of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_methodInfo
-        array unset Snit_methodInfo
-
-        # Array: option information.  See dictionary.txt.
-        typevariable Snit_optionInfo
-        array unset Snit_optionInfo
-        set Snit_optionInfo(local)     {}
-        set Snit_optionInfo(delegated) {}
-        set Snit_optionInfo(starcomp)  {}
-        set Snit_optionInfo(except)    {}
-    }
-
-    #----------------------------------------------------------------
-    # Compiled Procs
-    #
-    # These commands are created or replaced during compilation:
-
-
-    # Snit_instanceVars selfns
-    #
-    # Initializes the instance variables, if any.  Called during
-    # instance creation.
-
-    proc %TYPE%::Snit_instanceVars {selfns} {
-        %INSTANCEVARS%
-    }
-
-    # Type Constructor
-    proc %TYPE%::Snit_typeconstructor {type} {
-        %TVARDECS%
-        %TCONSTBODY%
-    }
-
-    #----------------------------------------------------------------
-    # Default Procs
-    #
-    # These commands might be replaced during compilation:
-
-    # Snit_destructor type selfns win self
-    #
-    # Default destructor for the type.  By default, it does
-    # nothing.  It's replaced by any user destructor.
-    # For types, it's called by method destroy; for widgettypes,
-    # it's called by a destroy event handler.
-
-    proc %TYPE%::Snit_destructor {type selfns win self} { }
-
-    #----------------------------------------------------------
-    # Compiled Definitions
-
-    %COMPILEDDEFS%
-
-    #----------------------------------------------------------
-    # Finally, call the Type Constructor
-
-    %TYPE%::Snit_typeconstructor %TYPE%
-}
-
-#-----------------------------------------------------------------------
-# Type procs
-#
-# These procs expect the fully-qualified type name to be
-# substituted in for %TYPE%.
-
-# This is the nominal type proc.  It supports typemethods and
-# delegated typemethods.
-set ::snit::nominalTypeProc {
-    # Type dispatcher function.  Note: This function lives
-    # in the parent of the %TYPE% namespace!  All accesses to
-    # %TYPE% variables and methods must be qualified!
-    proc %TYPE% {{method ""} args} {
-        # First, if there's no method, and no args, and there's a create
-        # method, and this isn't a widget, then method is "create" and
-        # "args" is %AUTO%.
-        if {"" == $method && [llength $args] == 0} {
-            ::variable %TYPE%::Snit_info
-
-            if {$Snit_info(hasinstances) && !$Snit_info(isWidget)} {
-                set method create
-                lappend args %AUTO%
-            } else {
-                error "wrong \# args: should be \"%TYPE% method args\""
-            }
-        }
-
-        # Next, retrieve the command.
-	variable %TYPE%::Snit_typemethodCache
-        while 1 {
-            if {[catch {set Snit_typemethodCache($method)} commandRec]} {
-                set commandRec [::snit::RT.CacheTypemethodCommand %TYPE% $method]
-
-                if {[llength $commandRec] == 0} {
-                    return -code error  "\"%TYPE% $method\" is not defined"
-                }
-            }
-
-            # If we've got a real command, break.
-            if {[lindex $commandRec 0] == 0} {
-                break
-            }
-
-            # Otherwise, we need to look up again...if we can.
-            if {[llength $args] == 0} {
-                return -code error \
-                 "wrong number args: should be \"%TYPE% $method method args\""
-            }
-
-            lappend method [lindex $args 0]
-            set args [lrange $args 1 end]
-        }
-
-        set command [lindex $commandRec 1]
-
-        # Pass along the return code unchanged.
-        set retval [catch {uplevel 1 $command $args} result]
-
-        if {$retval} {
-            if {$retval == 1} {
-                global errorInfo
-                global errorCode
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return -code $retval $result
-            }
-        }
-
-        return $result
-    }
-}
-
-# This is the simplified type proc for when there are no typemethods
-# except create.  In this case, it doesn't take a method argument;
-# the method is always "create".
-set ::snit::simpleTypeProc {
-    # Type dispatcher function.  Note: This function lives
-    # in the parent of the %TYPE% namespace!  All accesses to
-    # %TYPE% variables and methods must be qualified!
-    proc %TYPE% {args} {
-        ::variable %TYPE%::Snit_info
-
-        # FIRST, if the are no args, the single arg is %AUTO%
-        if {[llength $args] == 0} {
-            if {$Snit_info(isWidget)} {
-                error "wrong \# args: should be \"%TYPE% name args\""
-            }
-
-            lappend args %AUTO%
-        }
-
-        # NEXT, we're going to call the create method.
-        # Pass along the return code unchanged.
-        if {$Snit_info(isWidget)} {
-            set command [list ::snit::RT.widget.typemethod.create %TYPE%]
-        } else {
-            set command [list ::snit::RT.type.typemethod.create %TYPE%]
-        }
-
-        set retval [catch {uplevel 1 $command $args} result]
-
-        if {$retval} {
-            if {$retval == 1} {
-                global errorInfo
-                global errorCode
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return -code $retval $result
-            }
-        }
-
-        return $result
-    }
-}
-
-#-----------------------------------------------------------------------
-# Instance procs
-#
-# The following must be substituted into these proc bodies:
-#
-# %SELFNS%       The instance namespace
-# %WIN%          The original instance name
-# %TYPE%         The fully-qualified type name
-#
-
-# Nominal instance proc body: supports method caching and delegation.
-#
-# proc $instanceName {method args} ....
-set ::snit::nominalInstanceProc {
-    set self [set %SELFNS%::Snit_instance]
-
-    while {1} {
-        if {[catch {set %SELFNS%::Snit_methodCache($method)} commandRec]} {
-            set commandRec [snit::RT.CacheMethodCommand %TYPE% %SELFNS% %WIN% $self $method]
-
-            if {[llength $commandRec] == 0} {
-                return -code error \
-                    "\"$self $method\" is not defined"
-            }
-        }
-
-        # If we've got a real command, break.
-        if {[lindex $commandRec 0] == 0} {
-            break
-        }
-
-        # Otherwise, we need to look up again...if we can.
-        if {[llength $args] == 0} {
-            return -code error \
-                "wrong number args: should be \"$self $method method args\""
-        }
-
-        lappend method [lindex $args 0]
-        set args [lrange $args 1 end]
-    }
-
-    set command [lindex $commandRec 1]
-
-    # Pass along the return code unchanged.
-    set retval [catch {uplevel 1 $command $args} result]
-
-    if {$retval} {
-        if {$retval == 1} {
-            global errorInfo
-            global errorCode
-            return -code error -errorinfo $errorInfo \
-                -errorcode $errorCode $result
-        } else {
-            return -code $retval $result
-        }
-    }
-
-    return $result
-}
-
-# Simplified method proc body: No delegation allowed; no support for
-# upvar or exotic return codes or hierarchical methods.  Designed for
-# max speed for simple types.
-#
-# proc $instanceName {method args} ....
-
-set ::snit::simpleInstanceProc {
-    set self [set %SELFNS%::Snit_instance]
-
-    if {[lsearch -exact ${%TYPE%::Snit_methods} $method] == -1} {
-	set optlist [join ${%TYPE%::Snit_methods} ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$method\": must be $optlist"
-    }
-
-    eval [linsert $args 0 \
-              %TYPE%::Snit_method$method %TYPE% %SELFNS% %WIN% $self]
-}
-
-
-#=======================================================================
-# Snit Type Definition
-#
-# These are the procs used to define Snit types, widgets, and
-# widgetadaptors.
-
-
-#-----------------------------------------------------------------------
-# Snit Compilation Variables
-#
-# The following variables are used while Snit is compiling a type,
-# and are disposed afterwards.
-
-namespace eval ::snit:: {
-    # The compiler variable contains the name of the slave interpreter
-    # used to compile type definitions.
-    variable compiler ""
-
-    # The compile array accumulates information about the type or
-    # widgettype being compiled.  It is cleared before and after each
-    # compilation.  It has these indices:
-    #
-    # type:                  The name of the type being compiled, for use
-    #                        in compilation procs.
-    # defs:                  Compiled definitions, both standard and client.
-    # which:                 type, widget, widgetadaptor
-    # instancevars:          Instance variable definitions and initializations.
-    # ivprocdec:             Instance variable proc declarations.
-    # tvprocdec:             Type variable proc declarations.
-    # typeconstructor:       Type constructor body.
-    # widgetclass:           The widgetclass, for snit::widgets, only
-    # hasoptions:            False, initially; set to true when first
-    #                        option is defined.
-    # localoptions:          Names of local options.
-    # delegatedoptions:      Names of delegated options.
-    # localmethods:          Names of locally defined methods.
-    # delegatesmethods:      no if no delegated methods, yes otherwise.
-    # hashierarchic       :  no if no hierarchic methods, yes otherwise.
-    # components:            Names of defined components.
-    # typecomponents:        Names of defined typecomponents.
-    # typevars:              Typevariable definitions and initializations.
-    # varnames:              Names of instance variables
-    # typevarnames           Names of type variables
-    # hasconstructor         False, initially; true when constructor is
-    #                        defined.
-    # resource-$opt          The option's resource name
-    # class-$opt             The option's class
-    # -default-$opt          The option's default value
-    # -validatemethod-$opt   The option's validate method
-    # -configuremethod-$opt  The option's configure method
-    # -cgetmethod-$opt       The option's cget method.
-    # -hastypeinfo           The -hastypeinfo pragma
-    # -hastypedestroy        The -hastypedestroy pragma
-    # -hastypemethods        The -hastypemethods pragma
-    # -hasinfo               The -hasinfo pragma
-    # -hasinstances          The -hasinstances pragma
-    # -simpledispatch        The -simpledispatch pragma
-    # -canreplace            The -canreplace pragma
-    variable compile
-
-    # This variable accumulates method dispatch information; it has
-    # the same structure as the %TYPE%::Snit_methodInfo array, and is
-    # used to initialize it.
-    variable methodInfo
-
-    # This variable accumulates typemethod dispatch information; it has
-    # the same structure as the %TYPE%::Snit_typemethodInfo array, and is
-    # used to initialize it.
-    variable typemethodInfo
-
-    # The following variable lists the reserved type definition statement
-    # names, e.g., the names you can't use as macros.  It's built at
-    # compiler definition time using "info commands".
-    variable reservedwords {}
-}
-
-#-----------------------------------------------------------------------
-# type compilation commands
-#
-# The type and widgettype commands use a slave interpreter to compile
-# the type definition.  These are the procs
-# that are aliased into it.
-
-# Initialize the compiler
-proc ::snit::Comp.Init {} {
-    variable compiler
-    variable reservedwords
-
-    if {"" == $compiler} {
-        # Create the compiler's interpreter
-        set compiler [interp create]
-
-        # Initialize the interpreter
-	$compiler eval {
-            # Load package information
-            # TBD: see if this can be moved outside.
-	    # @mdgen NODEP: ::snit::__does_not_exist__
-            catch {package require ::snit::__does_not_exist__}
-
-            # Protect some Tcl commands our type definitions
-            # will shadow.
-            rename proc _proc
-            rename variable _variable
-        }
-
-        # Define compilation aliases.
-        $compiler alias pragma          ::snit::Comp.statement.pragma
-        $compiler alias widgetclass     ::snit::Comp.statement.widgetclass
-        $compiler alias hulltype        ::snit::Comp.statement.hulltype
-        $compiler alias constructor     ::snit::Comp.statement.constructor
-        $compiler alias destructor      ::snit::Comp.statement.destructor
-        $compiler alias option          ::snit::Comp.statement.option
-        $compiler alias oncget          ::snit::Comp.statement.oncget
-        $compiler alias onconfigure     ::snit::Comp.statement.onconfigure
-        $compiler alias method          ::snit::Comp.statement.method
-        $compiler alias typemethod      ::snit::Comp.statement.typemethod
-        $compiler alias typeconstructor ::snit::Comp.statement.typeconstructor
-        $compiler alias proc            ::snit::Comp.statement.proc
-        $compiler alias typevariable    ::snit::Comp.statement.typevariable
-        $compiler alias variable        ::snit::Comp.statement.variable
-        $compiler alias typecomponent   ::snit::Comp.statement.typecomponent
-        $compiler alias component       ::snit::Comp.statement.component
-        $compiler alias delegate        ::snit::Comp.statement.delegate
-        $compiler alias expose          ::snit::Comp.statement.expose
-
-        # Get the list of reserved words
-        set reservedwords [$compiler eval {info commands}]
-    }
-}
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::Comp.Compile {which type body} {
-    variable typeTemplate
-    variable nominalTypeProc
-    variable simpleTypeProc
-    variable compile
-    variable compiler
-    variable methodInfo
-    variable typemethodInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $type]} {
-        # Get caller's namespace;
-        # append :: if not global namespace.
-        set ns [uplevel 2 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set type "$ns$type"
-    }
-
-    # NEXT, create and initialize the compiler, if needed.
-    Comp.Init
-
-    # NEXT, initialize the class data
-    array unset methodInfo
-    array unset typemethodInfo
-
-    array unset compile
-    set compile(type) $type
-    set compile(defs) {}
-    set compile(which) $which
-    set compile(hasoptions) no
-    set compile(localoptions) {}
-    set compile(instancevars) {}
-    set compile(typevars) {}
-    set compile(delegatedoptions) {}
-    set compile(ivprocdec) {}
-    set compile(tvprocdec) {}
-    set compile(typeconstructor) {}
-    set compile(widgetclass) {}
-    set compile(hulltype) {}
-    set compile(localmethods) {}
-    set compile(delegatesmethods) no
-    set compile(hashierarchic) no
-    set compile(components) {}
-    set compile(typecomponents) {}
-    set compile(varnames) {}
-    set compile(typevarnames) {}
-    set compile(hasconstructor) no
-    set compile(-hastypedestroy) yes
-    set compile(-hastypeinfo) yes
-    set compile(-hastypemethods) yes
-    set compile(-hasinfo) yes
-    set compile(-hasinstances) yes
-    set compile(-simpledispatch) no
-    set compile(-canreplace) no
-
-    set isWidget [string match widget* $which]
-    set isWidgetAdaptor [string match widgetadaptor $which]
-
-    # NEXT, Evaluate the type's definition in the class interpreter.
-    $compiler eval $body
-
-    # NEXT, Add the standard definitions
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidget) $isWidget\n"
-
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidgetAdaptor) $isWidgetAdaptor\n"
-
-    # Indicate whether the type can create instances that replace
-    # existing commands.
-    append compile(defs) "\nset %TYPE%::Snit_info(canreplace) $compile(-canreplace)\n"
-
-
-    # Check pragmas for conflict.
-
-    if {!$compile(-hastypemethods) && !$compile(-hasinstances)} {
-        error "$which $type has neither typemethods nor instances"
-    }
-
-    if {$compile(-simpledispatch) && $compile(delegatesmethods)} {
-        error "$which $type requests -simpledispatch but delegates methods."
-    }
-
-    if {$compile(-simpledispatch) && $compile(hashierarchic)} {
-        error "$which $type requests -simpledispatch but defines hierarchical methods."
-    }
-
-    # If there are typemethods, define the standard typemethods and
-    # the nominal type proc.  Otherwise define the simple type proc.
-    if {$compile(-hastypemethods)} {
-        # Add the info typemethod unless the pragma forbids it.
-        if {$compile(-hastypeinfo)} {
-            Comp.statement.delegate typemethod info \
-                using {::snit::RT.typemethod.info %t}
-        }
-
-        # Add the destroy typemethod unless the pragma forbids it.
-        if {$compile(-hastypedestroy)} {
-            Comp.statement.delegate typemethod destroy \
-                using {::snit::RT.typemethod.destroy %t}
-        }
-
-        # Add the nominal type proc.
-        append compile(defs) $nominalTypeProc
-    } else {
-        # Add the simple type proc.
-        append compile(defs) $simpleTypeProc
-    }
-
-    # Add standard methods/typemethods that only make sense if the
-    # type has instances.
-    if {$compile(-hasinstances)} {
-        # If we're using simple dispatch, remember that.
-        if {$compile(-simpledispatch)} {
-            append compile(defs) "\nset %TYPE%::Snit_info(simpledispatch) 1\n"
-        }
-
-        # Add the info method unless the pragma forbids it.
-        if {$compile(-hasinfo)} {
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method info \
-                    using {::snit::RT.method.info %t %n %w %s}
-            } else {
-                Comp.statement.method info {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.info $type $selfns $win $self]
-                }
-            }
-        }
-
-        # Add the option handling stuff if there are any options.
-        if {$compile(hasoptions)} {
-            Comp.statement.variable options
-
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method cget \
-                    using {::snit::RT.method.cget %t %n %w %s}
-                Comp.statement.delegate method configurelist \
-                    using {::snit::RT.method.configurelist %t %n %w %s}
-                Comp.statement.delegate method configure \
-                    using {::snit::RT.method.configure %t %n %w %s}
-            } else {
-                Comp.statement.method cget {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.cget $type $selfns $win $self]
-                }
-                Comp.statement.method configurelist {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.configurelist $type $selfns $win $self]
-                }
-                Comp.statement.method configure {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.configure $type $selfns $win $self]
-                }
-            }
-        }
-
-        # Add a default constructor, if they haven't already defined one.
-        # If there are options, it will configure args; otherwise it
-        # will do nothing.
-        if {!$compile(hasconstructor)} {
-            if {$compile(hasoptions)} {
-                Comp.statement.constructor {args} {
-                    $self configurelist $args
-                }
-            } else {
-                Comp.statement.constructor {} {}
-            }
-        }
-
-        if {!$isWidget} {
-            if {!$compile(-simpledispatch)} {
-                Comp.statement.delegate method destroy \
-                    using {::snit::RT.method.destroy %t %n %w %s}
-            } else {
-                Comp.statement.method destroy {args} {
-                    eval [linsert $args 0 \
-                              ::snit::RT.method.destroy $type $selfns $win $self]
-                }
-            }
-
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.type.typemethod.create %t}
-        } else {
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.widget.typemethod.create %t}
-        }
-
-        # Save the list of method names, for -simpledispatch; otherwise,
-        # save the method info.
-        if {$compile(-simpledispatch)} {
-            append compile(defs) \
-                "\nset %TYPE%::Snit_methods [list $compile(localmethods)]\n"
-        } else {
-            append compile(defs) \
-                "\narray set %TYPE%::Snit_methodInfo [list [array get methodInfo]]\n"
-        }
-
-    } else {
-        append compile(defs) "\nset %TYPE%::Snit_info(hasinstances) 0\n"
-    }
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the type's locally defined options; add this information to
-    # the compiled definition.
-    Comp.SaveOptionInfo
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the typemethods; save the typemethod info.
-    append compile(defs) \
-        "\narray set %TYPE%::Snit_typemethodInfo [list [array get typemethodInfo]]\n"
-
-    # NEXT, if this is a widget define the hull component if it isn't
-    # already defined.
-    if {$isWidget} {
-        Comp.DefineComponent hull
-    }
-
-    # NEXT, substitute the compiled definition into the type template
-    # to get the type definition script.
-    set defscript [Expand $typeTemplate \
-                       %COMPILEDDEFS% $compile(defs)]
-
-    # NEXT, substitute the defined macros into the type definition script.
-    # This is done as a separate step so that the compile(defs) can
-    # contain the macros defined below.
-
-    set defscript [Expand $defscript \
-                       %TYPE%         $type \
-                       %IVARDECS%     $compile(ivprocdec) \
-                       %TVARDECS%     $compile(tvprocdec) \
-                       %TCONSTBODY%   $compile(typeconstructor) \
-                       %INSTANCEVARS% $compile(instancevars) \
-                       %TYPEVARS%     $compile(typevars) \
-		       ]
-
-    array unset compile
-
-    return [list $type $defscript]
-}
-
-# Information about locally-defined options is accumulated during
-# compilation, but not added to the compiled definition--the option
-# statement can appear multiple times, so it's easier this way.
-# This proc fills in Snit_optionInfo with the accumulated information.
-#
-# It also computes the option's resource and class names if needed.
-#
-# Note that the information for delegated options was put in
-# Snit_optionInfo during compilation.
-
-proc ::snit::Comp.SaveOptionInfo {} {
-    variable compile
-
-    foreach option $compile(localoptions) {
-        if {"" == $compile(resource-$option)} {
-            set compile(resource-$option) [string range $option 1 end]
-        }
-
-        if {"" == $compile(class-$option)} {
-            set compile(class-$option) [Capitalize $compile(resource-$option)]
-        }
-
-        # NOTE: Don't verify that the validate, configure, and cget
-        # values name real methods; the methods might be defined outside
-        # the typedefinition using snit::method.
-
-        Mappend compile(defs) {
-            # Option %OPTION%
-            lappend %TYPE%::Snit_optionInfo(local) %OPTION%
-
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%)   1
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%)  %RESOURCE%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%)     %CLASS%
-            set %TYPE%::Snit_optionInfo(default-%OPTION%)   %DEFAULT%
-            set %TYPE%::Snit_optionInfo(validate-%OPTION%)  %VALIDATE%
-            set %TYPE%::Snit_optionInfo(configure-%OPTION%) %CONFIGURE%
-            set %TYPE%::Snit_optionInfo(cget-%OPTION%)      %CGET%
-            set %TYPE%::Snit_optionInfo(readonly-%OPTION%)  %READONLY%
-            set %TYPE%::Snit_optionInfo(typespec-%OPTION%)  %TYPESPEC%
-        }   %OPTION%    $option                                   \
-            %RESOURCE%  $compile(resource-$option)                \
-            %CLASS%     $compile(class-$option)                   \
-            %DEFAULT%   [list $compile(-default-$option)]         \
-            %VALIDATE%  [list $compile(-validatemethod-$option)]  \
-            %CONFIGURE% [list $compile(-configuremethod-$option)] \
-            %CGET%      [list $compile(-cgetmethod-$option)]      \
-            %READONLY%  $compile(-readonly-$option)               \
-            %TYPESPEC%  [list $compile(-type-$option)]
-    }
-}
-
-
-# Evaluates a compiled type definition, thus making the type available.
-proc ::snit::Comp.Define {compResult} {
-    # The compilation result is a list containing the fully qualified
-    # type name and a script to evaluate to define the type.
-    set type [lindex $compResult 0]
-    set defscript [lindex $compResult 1]
-
-    # Execute the type definition script.
-    # Consider using namespace eval %TYPE%.  See if it's faster.
-    if {[catch {eval $defscript} result]} {
-        namespace delete $type
-        catch {rename $type ""}
-        error $result
-    }
-
-    return $type
-}
-
-# Sets pragma options which control how the type is defined.
-proc ::snit::Comp.statement.pragma {args} {
-    variable compile
-
-    set errRoot "Error in \"pragma...\""
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -hastypeinfo    -
-            -hastypedestroy -
-            -hastypemethods -
-            -hasinstances   -
-            -simpledispatch -
-            -hasinfo        -
-            -canreplace     {
-                if {![string is boolean -strict $val]} {
-                    error "$errRoot, \"$opt\" requires a boolean value"
-                }
-                set compile($opt) $val
-            }
-            default {
-                error "$errRoot, unknown pragma"
-            }
-        }
-    }
-}
-
-# Defines a widget's option class name.
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.widgetclass {name} {
-    variable compile
-
-    # First, widgetclass can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "widgetclass cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, validate the option name.  We'll require that it begin
-    # with an uppercase letter.
-    set initial [string index $name 0]
-    if {![string is upper $initial]} {
-        error "widgetclass \"$name\" does not begin with an uppercase letter"
-    }
-
-    if {"" != $compile(widgetclass)} {
-        error "too many widgetclass statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(widgetclass) %WIDGETCLASS%
-    } %WIDGETCLASS% [list $name]
-
-    set compile(widgetclass) $name
-}
-
-# Defines a widget's hull type.
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.hulltype {name} {
-    variable compile
-    variable hulltypes
-
-    # First, hulltype can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "hulltype cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, it must be one of the valid hulltypes (frame, toplevel, ...)
-    if {[lsearch -exact $hulltypes [string trimleft $name :]] == -1} {
-        error "invalid hulltype \"$name\", should be one of\
-		[join $hulltypes {, }]"
-    }
-
-    if {"" != $compile(hulltype)} {
-        error "too many hulltype statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(hulltype) %HULLTYPE%
-    } %HULLTYPE% $name
-
-    set compile(hulltype) $name
-}
-
-# Defines a constructor.
-proc ::snit::Comp.statement.constructor {arglist body} {
-    variable compile
-
-    CheckArgs "constructor" $arglist
-
-    # Next, add a magic reference to self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n$body"
-
-    set compile(hasconstructor) yes
-    append compile(defs) "proc %TYPE%::Snit_constructor [list $arglist] [list $body]\n"
-}
-
-# Defines a destructor.
-proc ::snit::Comp.statement.destructor {body} {
-    variable compile
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n$body"
-
-    append compile(defs) "proc %TYPE%::Snit_destructor {type selfns win self} [list $body]\n\n"
-}
-
-# Defines a type option.  The option value can be a triple, specifying
-# the option's -name, resource name, and class name.
-proc ::snit::Comp.statement.option {optionDef args} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"option [list $optionDef]...\""
-
-    # Next, validate the option name.
-    if {![Comp.OptionNameIsValid $option]} {
-        error "$errRoot, badly named option \"$option\""
-    }
-
-    if {[Contains $option $compile(delegatedoptions)]} {
-        error "$errRoot, cannot define \"$option\" locally, it has been delegated"
-    }
-
-    if {![Contains $option $compile(localoptions)]} {
-        # Remember that we've seen this one.
-        set compile(hasoptions) yes
-        lappend compile(localoptions) $option
-
-        # Initialize compilation info for this option.
-        set compile(resource-$option)         ""
-        set compile(class-$option)            ""
-        set compile(-default-$option)         ""
-        set compile(-validatemethod-$option)  ""
-        set compile(-configuremethod-$option) ""
-        set compile(-cgetmethod-$option)      ""
-        set compile(-readonly-$option)        0
-        set compile(-type-$option)            ""
-    }
-
-    # NEXT, see if we have a resource name.  If so, make sure it
-    # isn't being redefined differently.
-    if {"" != $resourceName} {
-        if {"" == $compile(resource-$option)} {
-            # If it's undefined, just save the value.
-            set compile(resource-$option) $resourceName
-        } elseif {![string equal $resourceName $compile(resource-$option)]} {
-            # It's been redefined differently.
-            error "$errRoot, resource name redefined from \"$compile(resource-$option)\" to \"$resourceName\""
-        }
-    }
-
-    # NEXT, see if we have a class name.  If so, make sure it
-    # isn't being redefined differently.
-    if {"" != $className} {
-        if {"" == $compile(class-$option)} {
-            # If it's undefined, just save the value.
-            set compile(class-$option) $className
-        } elseif {![string equal $className $compile(class-$option)]} {
-            # It's been redefined differently.
-            error "$errRoot, class name redefined from \"$compile(class-$option)\" to \"$className\""
-        }
-    }
-
-    # NEXT, handle the args; it's not an error to redefine these.
-    if {[llength $args] == 1} {
-        set compile(-default-$option) [lindex $args 0]
-    } else {
-        foreach {optopt val} $args {
-            switch -exact -- $optopt {
-                -default         -
-                -validatemethod  -
-                -configuremethod -
-                -cgetmethod      {
-                    set compile($optopt-$option) $val
-                }
-                -type {
-                    set compile($optopt-$option) $val
-                    
-                    if {[llength $val] == 1} {
-                        # The type spec *is* the validation object
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) [list $val]\n"
-                    } else {
-                        # Compilation the creation of the validation object
-                        set cmd [linsert $val 1 %TYPE%::Snit_TypeObj_%AUTO%]
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) \[$cmd\]\n"
-                    }
-                }
-                -readonly        {
-                    if {![string is boolean -strict $val]} {
-                        error "$errRoot, -readonly requires a boolean, got \"$val\""
-                    }
-                    set compile($optopt-$option) $val
-                }
-                default {
-                    error "$errRoot, unknown option definition option \"$optopt\""
-                }
-            }
-        }
-    }
-}
-
-# 1 if the option name is valid, 0 otherwise.
-proc ::snit::Comp.OptionNameIsValid {option} {
-    if {![string match {-*} $option] || [string match {*[A-Z ]*} $option]} {
-        return 0
-    }
-
-    return 1
-}
-
-# Defines an option's cget handler
-proc ::snit::Comp.statement.oncget {option body} {
-    variable compile
-
-    set errRoot "Error in \"oncget $option...\""
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "$errRoot, option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "$errRoot, option \"$option\" unknown"
-    }
-
-    Comp.statement.method _cget$option {_option} $body
-    Comp.statement.option $option -cgetmethod _cget$option
-}
-
-# Defines an option's configure handler.
-proc ::snit::Comp.statement.onconfigure {option arglist body} {
-    variable compile
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "onconfigure $option: option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "onconfigure $option: option \"$option\" unknown"
-    }
-
-    if {[llength $arglist] != 1} {
-        error \
-       "onconfigure $option handler should have one argument, got \"$arglist\""
-    }
-
-    CheckArgs "onconfigure $option" $arglist
-
-    # Next, add a magic reference to the option name
-    set arglist [concat _option $arglist]
-
-    Comp.statement.method _configure$option $arglist $body
-    Comp.statement.option $option -configuremethod _configure$option
-}
-
-# Defines an instance method.
-proc ::snit::Comp.statement.method {method arglist body} {
-    variable compile
-    variable methodInfo
-
-    # FIRST, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 0 ::snit::methodInfo \
-        "Error in \"method [list $method]...\""
-
-    if {[llength $method] > 1} {
-        set compile(hashierarchic) yes
-    }
-
-    # Remeber this method
-    lappend compile(localmethods) $method
-
-    CheckArgs "method [list $method]" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%%IVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script.
-    if {[llength $method] == 1} {
-        set methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_method%METHOD% %ARGLIST% %BODY%
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body]
-    } else {
-        set methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_hmethod%JMETHOD% %ARGLIST% %BODY%
-        } %JMETHOD% [join $method _] %ARGLIST% [list $arglist] \
-            %BODY% [list $body]
-    }
-}
-
-# Check for name collisions; save prefix information.
-#
-# method	The name of the method or typemethod.
-# delFlag       1 if delegated, 0 otherwise.
-# infoVar       The fully qualified name of the array containing
-#               information about the defined methods.
-# errRoot       The root string for any error messages.
-
-proc ::snit::Comp.CheckMethodName {method delFlag infoVar errRoot} {
-    upvar $infoVar methodInfo
-
-    # FIRST, make sure the method name is a valid Tcl list.
-    if {[catch {lindex $method 0}]} {
-        error "$errRoot, the name \"$method\" must have list syntax."
-    }
-
-    # NEXT, check whether we can define it.
-    if {![catch {set methodInfo($method)} data]} {
-        # We can't redefine methods with submethods.
-        if {[lindex $data 0] == 1} {
-            error "$errRoot, \"$method\" has submethods."
-        }
-
-        # You can't delegate a method that's defined locally,
-        # and you can't define a method locally if it's been delegated.
-        if {$delFlag && "" == [lindex $data 2]} {
-            error "$errRoot, \"$method\" has been defined locally."
-        } elseif {!$delFlag && "" != [lindex $data 2]} {
-            error "$errRoot, \"$method\" has been delegated"
-        }
-    }
-
-    # Handle hierarchical case.
-    if {[llength $method] > 1} {
-        set prefix {}
-        set tokens $method
-        while {[llength $tokens] > 1} {
-            lappend prefix [lindex $tokens 0]
-            set tokens [lrange $tokens 1 end]
-
-            if {![catch {set methodInfo($prefix)} result]} {
-                # Prefix is known.  If it's not a prefix, throw an
-                # error.
-                if {[lindex $result 0] == 0} {
-                    error "$errRoot, \"$prefix\" has no submethods."
-                }
-            }
-
-            set methodInfo($prefix) [list 1]
-        }
-    }
-}
-
-# Defines a typemethod method.
-proc ::snit::Comp.statement.typemethod {method arglist body} {
-    variable compile
-    variable typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined
-    # typemethods.
-    Comp.CheckMethodName $method 0 ::snit::typemethodInfo \
-        "Error in \"typemethod [list $method]...\""
-
-    CheckArgs "typemethod $method" $arglist
-
-    # First, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "%TVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script
-    if {[llength $method] == 1} {
-        set typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_typemethod%METHOD% %ARGLIST% %BODY%
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body]
-    } else {
-        set typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_htypemethod%JMETHOD% %ARGLIST% %BODY%
-        } %JMETHOD% [join $method _] \
-            %ARGLIST% [list $arglist] %BODY% [list $body]
-    }
-}
-
-
-# Defines a type constructor.
-proc ::snit::Comp.statement.typeconstructor {body} {
-    variable compile
-
-    if {"" != $compile(typeconstructor)} {
-        error "too many typeconstructors"
-    }
-
-    set compile(typeconstructor) $body
-}
-
-# Defines a static proc in the type's namespace.
-proc ::snit::Comp.statement.proc {proc arglist body} {
-    variable compile
-
-    # If "ns" is defined, the proc can see instance variables.
-    if {[lsearch -exact $arglist selfns] != -1} {
-        # Next, add instance variable declarations to body:
-        set body "%IVARDECS%\n$body"
-    }
-
-    # The proc can always see typevariables.
-    set body "%TVARDECS%\n$body"
-
-    append compile(defs) "
-
-        # Proc $proc
-        proc [list %TYPE%::$proc $arglist $body]
-    "
-}
-
-# Defines a static variable in the type's namespace.
-proc ::snit::Comp.statement.typevariable {name args} {
-    variable compile
-
-    set errRoot "Error in \"typevariable $name...\""
-
-    set len [llength $args]
-
-    if {$len > 2 ||
-        ($len == 2 && "-array" != [lindex $args 0])} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(varnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already an instance variable"
-    }
-
-    lappend compile(typevarnames) $name
-
-    if {$len == 1} {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name [lindex $args 0]]"
-    } elseif {$len == 2} {
-        append compile(typevars) \
-            "\n\t    [list ::variable $name]"
-        append compile(typevars) \
-            "\n\t    [list array set $name [lindex $args 1]]"
-    } else {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name]"
-    }
-
-    append compile(tvprocdec) "\n\t    typevariable ${name}"
-}
-
-# Defines an instance variable; the definition will go in the
-# type's create typemethod.
-proc ::snit::Comp.statement.variable {name args} {
-    variable compile
-
-    set errRoot "Error in \"variable $name...\""
-
-    set len [llength $args]
-
-    if {$len > 2 ||
-        ($len == 2 && "-array" != [lindex $args 0])} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(typevarnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already a typevariable"
-    }
-
-    lappend compile(varnames) $name
-
-    if {$len == 1} {
-        append compile(instancevars) \
-            "\nset \${selfns}::$name [list [lindex $args 0]]\n"
-    } elseif {$len == 2} {
-        append compile(instancevars) \
-            "\narray set \${selfns}::$name [list [lindex $args 1]]\n"
-    }
-
-    append  compile(ivprocdec) "\n\t    "
-    Mappend compile(ivprocdec) {::variable ${selfns}::%N} %N $name
-}
-
-# Defines a typecomponent, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-
-proc ::snit::Comp.statement.typecomponent {component args} {
-    variable compile
-
-    set errRoot "Error in \"typecomponent $component...\""
-
-    # FIRST, define the component
-    Comp.DefineTypecomponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "typecomponent $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "typecomponent $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.
-    if {"" != $publicMethod} {
-        Comp.statement.delegate typemethod [list $publicMethod *] to $component
-    }
-
-    # NEXT, if "-inherit 1" is specified, delegate typemethod * to
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate typemethod "*" to $component
-    }
-
-}
-
-
-# Defines a name to be a typecomponent
-#
-# The name becomes a typevariable; in addition, it gets a
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineTypecomponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(varnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already an instance variable"
-    }
-
-    if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(typecomponents) $component
-
-        # Make it a type variable with no initial value
-        Comp.statement.typevariable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(typevars) {
-            trace variable %COMP% w \
-                [list ::snit::RT.TypecomponentTrace [list %TYPE%] %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-}
-
-# Defines a component, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-#
-# TBD: Ideally, it should be possible to call this statement multiple
-# times, possibly changing the option values.  To do that, I'd need
-# to cache the option values and not act on them until *after* I'd
-# read the entire type definition.
-
-proc ::snit::Comp.statement.component {component args} {
-    variable compile
-
-    set errRoot "Error in \"component $component...\""
-
-    # FIRST, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "component $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "component $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.
-    if {"" != $publicMethod} {
-        Comp.statement.delegate method [list $publicMethod *] to $component
-    }
-
-    # NEXT, if -inherit is specified, delegate method/option * to
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate method "*" to $component
-        Comp.statement.delegate option "*" to $component
-    }
-}
-
-
-# Defines a name to be a component
-#
-# The name becomes an instance variable; in addition, it gets a
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineComponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(typevarnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already a typevariable"
-    }
-
-    if {[lsearch -exact $compile(components) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(components) $component
-
-        # Make it an instance variable with no initial value
-        Comp.statement.variable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(instancevars) {
-            trace variable ${selfns}::%COMP% w \
-                [list ::snit::RT.ComponentTrace [list %TYPE%] $selfns %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-}
-
-# Creates a delegated method, typemethod, or option.
-proc ::snit::Comp.statement.delegate {what name args} {
-    # FIRST, dispatch to correct handler.
-    switch $what {
-        typemethod { Comp.DelegatedTypemethod $name $args }
-        method     { Comp.DelegatedMethod     $name $args }
-        option     { Comp.DelegatedOption     $name $args }
-        default {
-            error "Error in \"delegate $what $name...\", \"$what\"?"
-        }
-    }
-
-    if {([llength $args] % 2) != 0} {
-        error "Error in \"delegate $what $name...\", invalid syntax"
-    }
-}
-
-# Creates a delegated typemethod delegating it to a particular
-# typecomponent or an arbitrary command.
-#
-# method    The name of the method
-# arglist       Delegation options
-
-proc ::snit::Comp.DelegatedTypemethod {method arglist} {
-    variable compile
-    variable typemethodInfo
-
-    set errRoot "Error in \"delegate typemethod [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component && "" == $pattern} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $methodTail && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {"*" != $methodTail && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"*\""
-    }
-
-    if {"" != $pattern && "" != $target} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {"*" == $token} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, define the component
-    if {"" != $component} {
-        Comp.DefineTypecomponent $component $errRoot
-    }
-
-    # NEXT, define the pattern.
-    if {"" == $pattern} {
-        if {"*" == $methodTail} {
-            set pattern "%c %m"
-        } elseif {"" != $target} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::typemethodInfo $errRoot
-
-    set typemethodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(excepttypemethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-}
-
-
-# Creates a delegated method delegating it to a particular
-# component or command.
-#
-# method        The name of the method
-# arglist       Delegation options.
-
-proc ::snit::Comp.DelegatedMethod {method arglist} {
-    variable compile
-    variable methodInfo
-
-    set errRoot "Error in \"delegate method [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component && "" == $pattern} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $methodTail && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {"*" != $methodTail && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"*\""
-    }
-
-    if {"" != $pattern && "" != $target} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {"*" == $token} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, we delegate some methods
-    set compile(delegatesmethods) yes
-
-    # NEXT, define the component.  Allow typecomponents.
-    if {"" != $component} {
-        if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-            Comp.DefineComponent $component $errRoot
-        }
-    }
-
-    # NEXT, define the pattern.
-    if {"" == $pattern} {
-        if {"*" == $methodTail} {
-            set pattern "%c %m"
-        } elseif {"" != $target} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::methodInfo $errRoot
-
-    # NEXT, save the method info.
-    set methodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(exceptmethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-}
-
-# Creates a delegated option, delegating it to a particular
-# component and, optionally, to a particular option of that
-# component.
-#
-# optionDef     The option definition
-# args          definition arguments.
-
-proc ::snit::Comp.DelegatedOption {optionDef arglist} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"delegate option [list $optionDef]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {"" == $component} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {"*" == $option && "" != $target} {
-        error "$errRoot, cannot specify \"as\" with \"delegate option *\""
-    }
-
-    if {"*" != $option && "" != $exceptions} {
-        error "$errRoot, can only specify \"except\" with \"delegate option *\""
-    }
-
-    # Next, validate the option name
-
-    if {"*" != $option} {
-        if {![Comp.OptionNameIsValid $option]} {
-            error "$errRoot, badly named option \"$option\""
-        }
-    }
-
-    if {[Contains $option $compile(localoptions)]} {
-        error "$errRoot, \"$option\" has been defined locally"
-    }
-
-    if {[Contains $option $compile(delegatedoptions)]} {
-        error "$errRoot, \"$option\" is multiply delegated"
-    }
-
-    # NEXT, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # Next, define the target option, if not specified.
-    if {![string equal $option "*"] &&
-        [string equal $target ""]} {
-        set target $option
-    }
-
-    # NEXT, save the delegation data.
-    set compile(hasoptions) yes
-
-    if {![string equal $option "*"]} {
-        lappend compile(delegatedoptions) $option
-
-        # Next, compute the resource and class names, if they aren't
-        # already defined.
-
-        if {"" == $resourceName} {
-            set resourceName [string range $option 1 end]
-        }
-
-        if {"" == $className} {
-            set className [Capitalize $resourceName]
-        }
-
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%) 0
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%) %RES%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%) %CLASS%
-            lappend %TYPE%::Snit_optionInfo(delegated) %OPTION%
-            set %TYPE%::Snit_optionInfo(target-%OPTION%) [list %COMP% %TARGET%]
-            lappend %TYPE%::Snit_optionInfo(delegated-%COMP%) %OPTION%
-        }   %OPTION% $option \
-            %COMP% $component \
-            %TARGET% $target \
-            %RES% $resourceName \
-            %CLASS% $className
-    } else {
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(starcomp) %COMP%
-            set %TYPE%::Snit_optionInfo(except) %EXCEPT%
-        } %COMP% $component %EXCEPT% [list $exceptions]
-    }
-}
-
-# Exposes a component, effectively making the component's command an
-# instance method.
-#
-# component     The logical name of the delegate
-# "as"          sugar; if not "", must be "as"
-# methodname    The desired method name for the component's command, or ""
-
-proc ::snit::Comp.statement.expose {component {"as" ""} {methodname ""}} {
-    variable compile
-
-
-    # FIRST, define the component
-    Comp.DefineComponent $component
-
-    # NEXT, define the method just as though it were in the type
-    # definition.
-    if {[string equal $methodname ""]} {
-        set methodname $component
-    }
-
-    Comp.statement.method $methodname args [Expand {
-        if {[llength $args] == 0} {
-            return $%COMPONENT%
-        }
-
-        if {[string equal $%COMPONENT% ""]} {
-            error "undefined component \"%COMPONENT%\""
-        }
-
-
-        set cmd [linsert $args 0 $%COMPONENT%]
-        return [uplevel 1 $cmd]
-    } %COMPONENT% $component]
-}
-
-
-
-#-----------------------------------------------------------------------
-# Public commands
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::compile {which type body} {
-    return [Comp.Compile $which $type $body]
-}
-
-proc ::snit::type {type body} {
-    return [Comp.Define [Comp.Compile type $type $body]]
-}
-
-proc ::snit::widget {type body} {
-    return [Comp.Define [Comp.Compile widget $type $body]]
-}
-
-proc ::snit::widgetadaptor {type body} {
-    return [Comp.Define [Comp.Compile widgetadaptor $type $body]]
-}
-
-proc ::snit::typemethod {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_info           Snit_info
-    upvar ${type}::Snit_typemethodInfo Snit_typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined
-    # typemethods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_typemethodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::typemethod $type $method" $arglist
-
-    # Next, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "$Snit_info(tvardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-        uplevel 1 [list proc ${type}::Snit_typemethod$method $arglist $body]
-    } else {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_htypemethod$suffix $arglist $body]
-    }
-}
-
-proc ::snit::method {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-    upvar ${type}::Snit_info        Snit_info
-
-    # FIRST, check the method name against previously defined
-    # methods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_methodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::method $type $method" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "$Snit_info(tvardecs)$Snit_info(ivardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        uplevel 1 [list proc ${type}::Snit_method$method $arglist $body]
-    } else {
-        set Snit_methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_hmethod$suffix $arglist $body]
-    }
-}
-
-# Defines a proc within the compiler; this proc can call other
-# type definition statements, and thus can be used for meta-programming.
-proc ::snit::macro {name arglist body} {
-    variable compiler
-    variable reservedwords
-
-    # FIRST, make sure the compiler is defined.
-    Comp.Init
-
-    # NEXT, check the macro name against the reserved words
-    if {[lsearch -exact $reservedwords $name] != -1} {
-        error "invalid macro name \"$name\""
-    }
-
-    # NEXT, see if the name has a namespace; if it does, define the
-    # namespace.
-    set ns [namespace qualifiers $name]
-
-    if {"" != $ns} {
-        $compiler eval "namespace eval $ns {}"
-    }
-
-    # NEXT, define the macro
-    $compiler eval [list _proc $name $arglist $body]
-}
-
-#-----------------------------------------------------------------------
-# Utility Functions
-#
-# These are utility functions used while compiling Snit types.
-
-# Builds a template from a tagged list of text blocks, then substitutes
-# all symbols in the mapTable, returning the expanded template.
-proc ::snit::Expand {template args} {
-    return [string map $args $template]
-}
-
-# Expands a template and appends it to a variable.
-proc ::snit::Mappend {varname template args} {
-    upvar $varname myvar
-
-    append myvar [string map $args $template]
-}
-
-# Checks argument list against reserved args
-proc ::snit::CheckArgs {which arglist} {
-    variable reservedArgs
-
-    foreach name $reservedArgs {
-        if {[Contains $name $arglist]} {
-            error "$which's arglist may not contain \"$name\" explicitly"
-        }
-    }
-}
-
-# Returns 1 if a value is in a list, and 0 otherwise.
-proc ::snit::Contains {value list} {
-    if {[lsearch -exact $list $value] != -1} {
-        return 1
-    } else {
-        return 0
-    }
-}
-
-# Capitalizes the first letter of a string.
-proc ::snit::Capitalize {text} {
-    set first [string index $text 0]
-    set rest [string range $text 1 end]
-    return "[string toupper $first]$rest"
-}
-
-# Converts an arbitrary white-space-delimited string into a list
-# by splitting on white-space and deleting empty tokens.
-
-proc ::snit::Listify {str} {
-    set result {}
-    foreach token [split [string trim $str]] {
-        if {[string length $token] > 0} {
-            lappend result $token
-        }
-    }
-
-    return $result
-}
-
-
-#=======================================================================
-# Snit Runtime Library
-#
-# These are procs used by Snit types and widgets at runtime.
-
-#-----------------------------------------------------------------------
-# Object Creation
-
-# Creates a new instance of the snit::type given its name and the args.
-#
-# type		The snit::type
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.type.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace;
-        # append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-
-    # NEXT, if %AUTO% appears in the name, generate a unique
-    # command name.  Otherwise, ensure that the name isn't in use.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    } elseif {$Snit_info(canreplace) && [llength [info commands $name]]} {
-
-	#kmg-tcl83
-	#
-	# Had to add this elseif branch to pass test rename-1.5
-	#
-        # Allowed to replace so must first destroy the prior instance
-
-        $name destroy
-    } elseif {!$Snit_info(canreplace) && [llength [info commands $name]]} {
-        error "command \"$name\" already exists"
-    }
-
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns {}
-
-    # NEXT, install the dispatcher
-    RT.MakeInstanceCommand $type $selfns $name
-
-    # Initialize the options to their defaults.
-    upvar ${selfns}::options options
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-
-    # Initialize the instance vars to their defaults.
-    # selfns must be defined, as it is used implicitly.
-    ${type}::Snit_instanceVars $selfns
-
-    # Execute the type's constructor.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-
-        set theInfo $errorInfo
-        set theCode $errorCode
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-# Creates a new instance of the snit::widget or snit::widgetadaptor
-# given its name and the args.
-#
-# type		The snit::widget or snit::widgetadaptor
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.widget.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, if %AUTO% appears in the name, generate a unique
-    # command name.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    }
-
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns { }
-
-    # NEXT, Initialize the widget's own options to their defaults.
-    upvar ${selfns}::options options
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-
-    # Initialize the instance vars to their defaults.
-    ${type}::Snit_instanceVars $selfns
-
-    # NEXT, if this is a normal widget (not a widget adaptor) then create a
-    # frame as its hull.  We set the frame's -class to the user's widgetclass,
-    # or, if none, search for -class in the args list, otherwise default to
-    # the basename of the $type with an initial upper case letter.
-    if {!$Snit_info(isWidgetAdaptor)} {
-        # FIRST, determine the class name
-	set wclass $Snit_info(widgetclass)
-        if {$Snit_info(widgetclass) == ""} {
-	    set idx [lsearch -exact $args -class]
-	    if {$idx >= 0 && ($idx%2 == 0)} {
-		# -class exists and is in the -option position
-		set wclass [lindex $args [expr {$idx+1}]]
-		set args [lreplace $args $idx [expr {$idx+1}]]
-	    } else {
-		set wclass [::snit::Capitalize [namespace tail $type]]
-	    }
-	}
-
-        # NEXT, create the widget
-        set self $name
-        package require Tk
-        ${type}::installhull using $Snit_info(hulltype) -class $wclass
-
-        # NEXT, let's query the option database for our
-        # widget, now that we know that it exists.
-        foreach opt $Snit_optionInfo(local) {
-            set dbval [RT.OptionDbGet $type $name $opt]
-
-            if {"" != $dbval} {
-                set options($opt) $dbval
-            }
-        }
-    }
-
-    # Execute the type's constructor, and verify that it
-    # has a hull.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-
-        ::snit::RT.Component $type $selfns hull
-
-        # Prepare to call the object's destructor when the
-        # <Destroy> event is received.  Use a Snit-specific bindtag
-        # so that the widget name's tag is unencumbered.
-
-        bind Snit$type$name <Destroy> [::snit::Expand {
-            ::snit::RT.DestroyObject %TYPE% %NS% %W
-        } %TYPE% $type %NS% $selfns]
-
-        # Insert the bindtag into the list of bindtags right
-        # after the widget name.
-        set taglist [bindtags $name]
-        set ndx [lsearch -exact $taglist $name]
-        incr ndx
-        bindtags $name [linsert $taglist $ndx Snit$type$name]
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-
-        set theInfo $errorInfo
-        set theCode $errorCode
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-
-# RT.MakeInstanceCommand type selfns instance
-#
-# type        The object type
-# selfns      The instance namespace
-# instance    The instance name
-#
-# Creates the instance proc.
-
-proc ::snit::RT.MakeInstanceCommand {type selfns instance} {
-    variable ${type}::Snit_info
-
-    # FIRST, remember the instance name.  The Snit_instance variable
-    # allows the instance to figure out its current name given the
-    # instance namespace.
-    upvar ${selfns}::Snit_instance Snit_instance
-    set Snit_instance $instance
-
-    # NEXT, qualify the proc name if it's a widget.
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-
-    # NEXT, install the new proc
-    if {!$Snit_info(simpledispatch)} {
-        set instanceProc $::snit::nominalInstanceProc
-    } else {
-        set instanceProc $::snit::simpleInstanceProc
-    }
-
-    proc $procname {method args} \
-        [string map \
-             [list %SELFNS% $selfns %WIN% $instance %TYPE% $type] \
-             $instanceProc]
-
-    #kmg-tcl83
-    # NEXT, add the trace.
-    ::snit83::traceAddCommand $procname {rename delete} \
-        [list ::snit::RT.InstanceTrace $type $selfns $instance]
-}
-
-# This proc is called when the instance command is renamed.
-# If op is delete, then new will always be "", so op is redundant.
-#
-# type		The fully-qualified type name
-# selfns	The instance namespace
-# win		The original instance/tk window name.
-# old		old instance command name
-# new		new instance command name
-# op		rename or delete
-#
-# If the op is delete, we need to clean up the object; otherwise,
-# we need to track the change.
-#
-# NOTE: In Tcl 8.4.2 there's a bug: errors in rename and delete
-# traces aren't propagated correctly.  Instead, they silently
-# vanish.  Add a catch to output any error message.
-
-proc ::snit::RT.InstanceTrace {type selfns win old new op} {
-    variable ${type}::Snit_info
-
-    # Note to developers ...
-    # For Tcl 8.4.0, errors thrown in trace handlers vanish silently.
-    # Therefore we catch them here and create some output to help in
-    # debugging such problems.
-
-    if {[catch {
-        # FIRST, clean up if necessary
-        if {"" == $new} {
-            if {$Snit_info(isWidget)} {
-                destroy $win
-            } else {
-                ::snit::RT.DestroyObject $type $selfns $win
-            }
-        } else {
-            # Otherwise, track the change.
-            variable ${selfns}::Snit_instance
-            set Snit_instance [uplevel 1 [list namespace which -command $new]]
-
-            # Also, clear the instance caches, as many cached commands
-            # might be invalid.
-            RT.ClearInstanceCaches $selfns
-        }
-    } result]} {
-        global errorInfo
-        # Pop up the console on Windows wish, to enable stdout.
-        # This clobbers errorInfo on unix, so save it so we can print it.
-        set ei $errorInfo
-        catch {console show}
-        puts "Error in ::snit::RT.InstanceTrace $type $selfns $win $old $new $op:"
-        puts $ei
-    }
-}
-
-# Calls the instance constructor and handles related housekeeping.
-proc ::snit::RT.ConstructInstance {type selfns instance arglist} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_iinfo
-
-    # Track whether we are constructed or not.
-    set Snit_iinfo(constructed) 0
-
-    # Call the user's constructor
-    eval [linsert $arglist 0 \
-              ${type}::Snit_constructor $type $selfns $instance $instance]
-
-    set Snit_iinfo(constructed) 1
-
-    # Validate the initial set of options (including defaults)
-    foreach option $Snit_optionInfo(local) {
-        set value [set ${selfns}::options($option)]
-
-        if {"" != $Snit_optionInfo(typespec-$option)} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option default: $result"
-            }
-        }
-    }
-
-    # Unset the configure cache for all -readonly options.
-    # This ensures that the next time anyone tries to
-    # configure it, an error is thrown.
-    foreach opt $Snit_optionInfo(local) {
-        if {$Snit_optionInfo(readonly-$opt)} {
-            ::snit83::unset -nocomplain ${selfns}::Snit_configureCache($opt)
-        }
-    }
-
-    return
-}
-
-# Returns a unique command name.
-#
-# REQUIRE: type is a fully qualified name.
-# REQUIRE: name contains "%AUTO%"
-# PROMISE: the returned command name is unused.
-proc ::snit::RT.UniqueName {countervar type name} {
-    upvar $countervar counter
-    while 1 {
-        # FIRST, bump the counter and define the %AUTO% instance name;
-        # then substitute it into the specified name.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set auto "[namespace tail $type]$counter"
-        set candidate [Expand $name %AUTO% $auto]
-        if {![llength [info commands $candidate]]} {
-            return $candidate
-        }
-    }
-}
-
-# Returns a unique instance namespace, fully qualified.
-#
-# countervar     The name of a counter variable
-# type           The instance's type
-#
-# REQUIRE: type is fully qualified
-# PROMISE: The returned namespace name is unused.
-
-proc ::snit::RT.UniqueInstanceNamespace {countervar type} {
-    upvar $countervar counter
-    while 1 {
-        # FIRST, bump the counter and define the namespace name.
-        # Then see if it already exists.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set ins "${type}::Snit_inst${counter}"
-        if {![namespace exists $ins]} {
-            return $ins
-        }
-    }
-}
-
-# Retrieves an option's value from the option database.
-# Returns "" if no value is found.
-proc ::snit::RT.OptionDbGet {type self opt} {
-    variable ${type}::Snit_optionInfo
-
-    return [option get $self \
-                $Snit_optionInfo(resource-$opt) \
-                $Snit_optionInfo(class-$opt)]
-}
-
-#-----------------------------------------------------------------------
-# Object Destruction
-
-# Implements the standard "destroy" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-
-proc ::snit::RT.method.destroy {type selfns win self} {
-    variable ${selfns}::Snit_iinfo
-
-    # Can't destroy the object if it isn't complete constructed.
-    if {!$Snit_iinfo(constructed)} {
-        return -code error "Called 'destroy' method in constructor"
-    }
-
-    # Calls Snit_cleanup, which (among other things) calls the
-    # user's destructor.
-    ::snit::RT.DestroyObject $type $selfns $win
-}
-
-# This is the function that really cleans up; it's automatically
-# called when any instance is destroyed, e.g., by "$object destroy"
-# for types, and by the <Destroy> event for widgets.
-#
-# type		The fully-qualified type name.
-# selfns	The instance namespace
-# win		The original instance command name.
-
-proc ::snit::RT.DestroyObject {type selfns win} {
-    variable ${type}::Snit_info
-
-    # If the variable Snit_instance doesn't exist then there's no
-    # instance command for this object -- it's most likely a
-    # widgetadaptor. Consequently, there are some things that
-    # we don't need to do.
-    if {[info exists ${selfns}::Snit_instance]} {
-        upvar ${selfns}::Snit_instance instance
-
-        # First, remove the trace on the instance name, so that we
-        # don't call RT.DestroyObject recursively.
-        RT.RemoveInstanceTrace $type $selfns $win $instance
-
-        # Next, call the user's destructor
-        ${type}::Snit_destructor $type $selfns $win $instance
-
-        # Next, if this isn't a widget, delete the instance command.
-        # If it is a widget, get the hull component's name, and rename
-        # it back to the widget name
-
-        # Next, delete the hull component's instance command,
-        # if there is one.
-        if {$Snit_info(isWidget)} {
-            set hullcmd [::snit::RT.Component $type $selfns hull]
-
-            catch {rename $instance ""}
-
-            # Clear the bind event
-            bind Snit$type$win <Destroy> ""
-
-            if {[llength [info commands $hullcmd]]} {
-                # FIRST, rename the hull back to its original name.
-                # If the hull is itself a megawidget, it will have its
-                # own cleanup to do, and it might not do it properly
-                # if it doesn't have the right name.
-                rename $hullcmd ::$instance
-
-                # NEXT, destroy it.
-                destroy $instance
-            }
-        } else {
-            catch {rename $instance ""}
-        }
-    }
-
-    # Next, delete the instance's namespace.  This kills any
-    # instance variables.
-    namespace delete $selfns
-
-    return
-}
-
-# Remove instance trace
-#
-# type           The fully qualified type name
-# selfns         The instance namespace
-# win            The original instance name/Tk window name
-# instance       The current instance name
-
-proc ::snit::RT.RemoveInstanceTrace {type selfns win instance} {
-    variable ${type}::Snit_info
-
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-
-    # NEXT, remove any trace on this name
-    catch {
-	#kmg-tcl83
-        ::snit83::traceRemoveCommand $procname {rename delete} \
-            [list ::snit::RT.InstanceTrace $type $selfns $win]
-    }
-}
-
-#-----------------------------------------------------------------------
-# Typecomponent Management and Method Caching
-
-# Typecomponent trace; used for write trace on typecomponent
-# variables.  Saves the new component object name, provided
-# that certain conditions are met.  Also clears the typemethod
-# cache.
-
-proc ::snit::RT.TypecomponentTrace {type component n1 n2 op} {
-    upvar ${type}::Snit_info Snit_info
-    upvar ${type}::${component} cvar
-    upvar ${type}::Snit_typecomponents Snit_typecomponents
-
-    # Save the new component value.
-    set Snit_typecomponents($component) $cvar
-
-    # Clear the typemethod cache.
-    # TBD: can we unset just the elements related to
-    # this component?
-    ::snit83::unset -nocomplain -- ${type}::Snit_typemethodCache
-}
-
-# Generates and caches the command for a typemethod.
-#
-# type		The type
-# method	The name of the typemethod to call.
-#
-# The return value is one of the following lists:
-#
-#    {}              There's no such method.
-#    {1}             The method has submethods; look again.
-#    {0 <command>}   Here's the command to execute.
-
-proc snit::RT.CacheTypemethodCommand {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-    upvar ${type}::Snit_typecomponents  Snit_typecomponents
-    upvar ${type}::Snit_typemethodCache Snit_typemethodCache
-    upvar ${type}::Snit_info            Snit_info
-
-    # FIRST, get the pattern data and the typecomponent name.
-    set implicitCreate 0
-    set instanceName ""
-
-    set starredMethod [lreplace $method end end *]
-    set methodTail [lindex $method end]
-
-    if {[info exists Snit_typemethodInfo($method)]} {
-        set key $method
-    } elseif {[info exists Snit_typemethodInfo($starredMethod)]} {
-        if {[lsearch -exact $Snit_info(excepttypemethods) $methodTail] == -1} {
-            set key $starredMethod
-        } else {
-            return [list ]
-        }
-    } elseif {$Snit_info(hasinstances)} {
-        # Assume the unknown name is an instance name to create, unless
-        # this is a widget and the style of the name is wrong, or the
-        # name mimics a standard typemethod.
-
-        if {[set ${type}::Snit_info(isWidget)] &&
-            ![string match ".*" $method]} {
-            return [list ]
-        }
-
-        # Without this check, the call "$type info" will redefine the
-        # standard "::info" command, with disastrous results.  Since it's
-        # a likely thing to do if !-typeinfo, put in an explicit check.
-        if {"info" == $method || "destroy" == $method} {
-            return [list ]
-        }
-
-        set implicitCreate 1
-        set instanceName $method
-        set key create
-        set method create
-    } else {
-        return [list ]
-    }
-
-    foreach {flag pattern compName} $Snit_typemethodInfo($key) {}
-
-    if {$flag == 1} {
-        return [list 1]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $method \
-                     %m [lindex $method end] \
-                     %j [join $method _]]
-
-    if {"" != $compName} {
-        if {![info exists Snit_typecomponents($compName)]} {
-            error "$type delegates typemethod \"$method\" to undefined typecomponent \"$compName\""
-        }
-
-        lappend subList %c [list $Snit_typecomponents($compName)]
-    }
-
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    if {$implicitCreate} {
-        # In this case, $method is the name of the instance to
-        # create.  Don't cache, as we usually won't do this one
-        # again.
-        lappend command $instanceName
-    } else {
-        set Snit_typemethodCache($method) [list 0 $command]
-    }
-
-    return [list 0 $command]
-}
-
-
-#-----------------------------------------------------------------------
-# Component Management and Method Caching
-
-# Retrieves the object name given the component name.
-proc ::snit::RT.Component {type selfns name} {
-    variable ${selfns}::Snit_components
-
-    if {[catch {set Snit_components($name)} result]} {
-        variable ${selfns}::Snit_instance
-
-        error "component \"$name\" is undefined in $type $Snit_instance"
-    }
-
-    return $result
-}
-
-# Component trace; used for write trace on component instance
-# variables.  Saves the new component object name, provided
-# that certain conditions are met.  Also clears the method
-# cache.
-
-proc ::snit::RT.ComponentTrace {type selfns component n1 n2 op} {
-    upvar ${type}::Snit_info Snit_info
-    upvar ${selfns}::${component} cvar
-    upvar ${selfns}::Snit_components Snit_components
-
-    # If they try to redefine the hull component after
-    # it's been defined, that's an error--but only if
-    # this is a widget or widget adaptor.
-    if {"hull" == $component &&
-        $Snit_info(isWidget) &&
-        [info exists Snit_components($component)]} {
-        set cvar $Snit_components($component)
-        error "The hull component cannot be redefined"
-    }
-
-    # Save the new component value.
-    set Snit_components($component) $cvar
-
-    # Clear the instance caches.
-    # TBD: can we unset just the elements related to
-    # this component?
-    RT.ClearInstanceCaches $selfns
-}
-
-# Generates and caches the command for a method.
-#
-# type:		The instance's type
-# selfns:	The instance's private namespace
-# win:          The instance's original name (a Tk widget name, for
-#               snit::widgets.
-# self:         The instance's current name.
-# method:	The name of the method to call.
-#
-# The return value is one of the following lists:
-#
-#    {}              There's no such method.
-#    {1}             The method has submethods; look again.
-#    {0 <command>}   Here's the command to execute.
-
-proc ::snit::RT.CacheMethodCommand {type selfns win self method} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_methodInfo
-    variable ${type}::Snit_typecomponents
-    variable ${selfns}::Snit_components
-    variable ${selfns}::Snit_methodCache
-
-    # FIRST, get the pattern data and the component name.
-    set starredMethod [lreplace $method end end *]
-    set methodTail [lindex $method end]
-
-    if {[info exists Snit_methodInfo($method)]} {
-        set key $method
-    } elseif {[info exists Snit_methodInfo($starredMethod)] &&
-              [lsearch -exact $Snit_info(exceptmethods) $methodTail] == -1} {
-        set key $starredMethod
-    } else {
-        return [list ]
-    }
-
-    foreach {flag pattern compName} $Snit_methodInfo($key) {}
-
-    if {$flag == 1} {
-        return [list 1]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $method \
-                     %m [lindex $method end] \
-                     %j [join $method _] \
-                     %n [list $selfns] \
-                     %w [list $win] \
-                     %s [list $self]]
-
-    if {"" != $compName} {
-        if {[info exists Snit_components($compName)]} {
-            set compCmd $Snit_components($compName)
-        } elseif {[info exists Snit_typecomponents($compName)]} {
-            set compCmd $Snit_typecomponents($compName)
-        } else {
-            error "$type $self delegates method \"$method\" to undefined component \"$compName\""
-        }
-
-        lappend subList %c [list $compCmd]
-    }
-
-    # Note: The cached command will executed faster if it's
-    # already a list.
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    set commandRec [list 0 $command]
-
-    set Snit_methodCache($method) $commandRec
-
-    return $commandRec
-}
-
-
-# Looks up a method's command.
-#
-# type:		The instance's type
-# selfns:	The instance's private namespace
-# win:          The instance's original name (a Tk widget name, for
-#               snit::widgets.
-# self:         The instance's current name.
-# method:	The name of the method to call.
-# errPrefix:    Prefix for any error method
-proc ::snit::RT.LookupMethodCommand {type selfns win self method errPrefix} {
-    set commandRec [snit::RT.CacheMethodCommand \
-                        $type $selfns $win $self \
-                        $method]
-
-
-    if {[llength $commandRec] == 0} {
-        return -code error \
-            "$errPrefix, \"$self $method\" is not defined"
-    } elseif {[lindex $commandRec 0] == 1} {
-        return -code error \
-            "$errPrefix, wrong number args: should be \"$self\" $method method args"
-    }
-
-    return  [lindex $commandRec 1]
-}
-
-
-# Clears all instance command caches
-proc ::snit::RT.ClearInstanceCaches {selfns} {
-    ::snit83::unset -nocomplain -- ${selfns}::Snit_methodCache
-    ::snit83::unset -nocomplain -- ${selfns}::Snit_cgetCache
-    ::snit83::unset -nocomplain -- ${selfns}::Snit_configureCache
-    ::snit83::unset -nocomplain -- ${selfns}::Snit_validateCache
-}
-
-
-#-----------------------------------------------------------------------
-# Component Installation
-
-# Implements %TYPE%::installhull.  The variables self and selfns
-# must be defined in the caller's context.
-#
-# Installs the named widget as the hull of a
-# widgetadaptor.  Once the widget is hijacked, its new name
-# is assigned to the hull component.
-
-proc ::snit::RT.installhull {type {using "using"} {widgetType ""} args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-    upvar self self
-    upvar selfns selfns
-    upvar ${selfns}::hull hull
-    upvar ${selfns}::options options
-
-    # FIRST, make sure we can do it.
-    if {!$Snit_info(isWidget)} {
-        error "installhull is valid only for snit::widgetadaptors"
-    }
-
-    if {[info exists ${selfns}::Snit_instance]} {
-        error "hull already installed for $type $self"
-    }
-
-    # NEXT, has it been created yet?  If not, create it using
-    # the specified arguments.
-    if {"using" == $using} {
-        # FIRST, create the widget
-        set cmd [linsert $args 0 $widgetType $self]
-        set obj [uplevel 1 $cmd]
-
-        # NEXT, for each option explicitly delegated to the hull
-        # that doesn't appear in the usedOpts list, get the
-        # option database value and apply it--provided that the
-        # real option name and the target option name are different.
-        # (If they are the same, then the option database was
-        # already queried as part of the normal widget creation.)
-        #
-        # Also, we don't need to worry about implicitly delegated
-        # options, as the option and target option names must be
-        # the same.
-        if {[info exists Snit_optionInfo(delegated-hull)]} {
-
-            # FIRST, extract all option names from args
-            set usedOpts {}
-            set ndx [lsearch -glob $args "-*"]
-            foreach {opt val} [lrange $args $ndx end] {
-                lappend usedOpts $opt
-            }
-
-            foreach opt $Snit_optionInfo(delegated-hull) {
-                set target [lindex $Snit_optionInfo(target-$opt) 1]
-
-                if {"$target" == $opt} {
-                    continue
-                }
-
-                set result [lsearch -exact $usedOpts $target]
-
-                if {$result != -1} {
-                    continue
-                }
-
-                set dbval [RT.OptionDbGet $type $self $opt]
-                $obj configure $target $dbval
-            }
-        }
-    } else {
-        set obj $using
-
-        if {![string equal $obj $self]} {
-            error \
-                "hull name mismatch: \"$obj\" != \"$self\""
-        }
-    }
-
-    # NEXT, get the local option defaults.
-    foreach opt $Snit_optionInfo(local) {
-        set dbval [RT.OptionDbGet $type $self $opt]
-
-        if {"" != $dbval} {
-            set options($opt) $dbval
-        }
-    }
-
-
-    # NEXT, do the magic
-    set i 0
-    while 1 {
-        incr i
-        set newName "::hull${i}$self"
-        if {![llength [info commands $newName]]} {
-            break
-        }
-    }
-
-    rename ::$self $newName
-    RT.MakeInstanceCommand $type $selfns $self
-
-    # Note: this relies on RT.ComponentTrace to do the dirty work.
-    set hull $newName
-
-    return
-}
-
-# Implements %TYPE%::install.
-#
-# Creates a widget and installs it as the named component.
-# It expects self and selfns to be defined in the caller's context.
-
-proc ::snit::RT.install {type compName "using" widgetType winPath args} {
-    variable ${type}::Snit_optionInfo
-    variable ${type}::Snit_info
-    upvar self self
-    upvar selfns selfns
-    upvar ${selfns}::$compName comp
-    upvar ${selfns}::hull hull
-
-    # We do the magic option database stuff only if $self is
-    # a widget.
-    if {$Snit_info(isWidget)} {
-        if {"" == $hull} {
-            error "tried to install \"$compName\" before the hull exists"
-        }
-
-        # FIRST, query the option database and save the results
-        # into args.  Insert them before the first option in the
-        # list, in case there are any non-standard parameters.
-        #
-        # Note: there might not be any delegated options; if so,
-        # don't bother.
-
-        if {[info exists Snit_optionInfo(delegated-$compName)]} {
-            set ndx [lsearch -glob $args "-*"]
-
-            foreach opt $Snit_optionInfo(delegated-$compName) {
-                set dbval [RT.OptionDbGet $type $self $opt]
-
-                if {"" != $dbval} {
-                    set target [lindex $Snit_optionInfo(target-$opt) 1]
-                    set args [linsert $args $ndx $target $dbval]
-                }
-            }
-        }
-    }
-
-    # NEXT, create the component and save it.
-    set cmd [concat [list $widgetType $winPath] $args]
-    set comp [uplevel 1 $cmd]
-
-    # NEXT, handle the option database for "delegate option *",
-    # in widgets only.
-    if {$Snit_info(isWidget) && [string equal $Snit_optionInfo(starcomp) $compName]} {
-        # FIRST, get the list of option specs from the widget.
-        # If configure doesn't work, skip it.
-        if {[catch {$comp configure} specs]} {
-            return
-        }
-
-        # NEXT, get the set of explicitly used options from args
-        set usedOpts {}
-        set ndx [lsearch -glob $args "-*"]
-        foreach {opt val} [lrange $args $ndx end] {
-            lappend usedOpts $opt
-        }
-
-        # NEXT, "delegate option *" matches all options defined
-        # by this widget that aren't defined by the widget as a whole,
-        # and that aren't excepted.  Plus, we skip usedOpts.  So build
-        # a list of the options it can't match.
-        set skiplist [concat \
-                          $usedOpts \
-                          $Snit_optionInfo(except) \
-                          $Snit_optionInfo(local) \
-                          $Snit_optionInfo(delegated)]
-
-        # NEXT, loop over all of the component's options, and set
-        # any not in the skip list for which there is an option
-        # database value.
-        foreach spec $specs {
-            # Skip aliases
-            if {[llength $spec] != 5} {
-                continue
-            }
-
-            set opt [lindex $spec 0]
-
-            if {[lsearch -exact $skiplist $opt] != -1} {
-                continue
-            }
-
-            set res [lindex $spec 1]
-            set cls [lindex $spec 2]
-
-            set dbvalue [option get $self $res $cls]
-
-            if {"" != $dbvalue} {
-                $comp configure $opt $dbvalue
-            }
-        }
-    }
-
-    return
-}
-
-
-#-----------------------------------------------------------------------
-# Method/Variable Name Qualification
-
-# Implements %TYPE%::variable.  Requires selfns.
-proc ::snit::RT.variable {varname} {
-    upvar selfns selfns
-
-    if {![string match "::*" $varname]} {
-        uplevel 1 [list upvar 1 ${selfns}::$varname $varname]
-    } else {
-        # varname is fully qualified; let the standard
-        # "variable" command handle it.
-        uplevel 1 [list ::variable $varname]
-    }
-}
-
-# Fully qualifies a typevariable name.
-#
-# This is used to implement the mytypevar command.
-
-proc ::snit::RT.mytypevar {type name} {
-    return ${type}::$name
-}
-
-# Fully qualifies an instance variable name.
-#
-# This is used to implement the myvar command.
-proc ::snit::RT.myvar {name} {
-    upvar selfns selfns
-    return ${selfns}::$name
-}
-
-# Use this like "list" to convert a proc call into a command
-# string to pass to another object (e.g., as a -command).
-# Qualifies the proc name properly.
-#
-# This is used to implement the "myproc" command.
-
-proc ::snit::RT.myproc {type procname args} {
-    set procname "${type}::$procname"
-    return [linsert $args 0 $procname]
-}
-
-# DEPRECATED
-proc ::snit::RT.codename {type name} {
-    return "${type}::$name"
-}
-
-# Use this like "list" to convert a typemethod call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the type command at the beginning.
-#
-# This is used to implement the "mytypemethod" command.
-
-proc ::snit::RT.mytypemethod {type args} {
-    return [linsert $args 0 $type]
-}
-
-# Use this like "list" to convert a method call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the code at the beginning to call the right object, even if
-# the object's name has changed.  Requires that selfns be defined
-# in the calling context, eg. can only be called in instance
-# code.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.mymethod {args} {
-    upvar selfns selfns
-    return [linsert $args 0 ::snit::RT.CallInstance ${selfns}]
-}
-
-# Calls an instance method for an object given its
-# instance namespace and remaining arguments (the first of which
-# will be the method name.
-#
-# selfns		The instance namespace
-# args			The arguments
-#
-# Uses the selfns to determine $self, and calls the method
-# in the normal way.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.CallInstance {selfns args} {
-    upvar ${selfns}::Snit_instance self
-
-    set retval [catch {uplevel 1 [linsert $args 0 $self]} result]
-
-    if {$retval} {
-        if {$retval == 1} {
-            global errorInfo
-            global errorCode
-            return -code error -errorinfo $errorInfo \
-                -errorcode $errorCode $result
-        } else {
-            return -code $retval $result
-        }
-    }
-
-    return $result
-}
-
-# Looks for the named option in the named variable.  If found,
-# it and its value are removed from the list, and the value
-# is returned.  Otherwise, the default value is returned.
-# If the option is undelegated, it's own default value will be
-# used if none is specified.
-#
-# Implements the "from" command.
-
-proc ::snit::RT.from {type argvName option {defvalue ""}} {
-    variable ${type}::Snit_optionInfo
-    upvar $argvName argv
-
-    set ioption [lsearch -exact $argv $option]
-
-    if {$ioption == -1} {
-        if {"" == $defvalue &&
-            [info exists Snit_optionInfo(default-$option)]} {
-            return $Snit_optionInfo(default-$option)
-        } else {
-            return $defvalue
-        }
-    }
-
-    set ivalue [expr {$ioption + 1}]
-    set value [lindex $argv $ivalue]
-
-    set argv [lreplace $argv $ioption $ivalue]
-
-    return $value
-}
-
-#-----------------------------------------------------------------------
-# Type Destruction
-
-# Implements the standard "destroy" typemethod:
-# Destroys a type completely.
-#
-# type		The snit type
-
-proc ::snit::RT.typemethod.destroy {type} {
-    variable ${type}::Snit_info
-
-    # FIRST, destroy all instances
-    foreach selfns [namespace children $type] {
-        if {![namespace exists $selfns]} {
-            continue
-        }
-        upvar ${selfns}::Snit_instance obj
-
-        if {$Snit_info(isWidget)} {
-            destroy $obj
-        } else {
-            if {[llength [info commands $obj]]} {
-                $obj destroy
-            }
-        }
-    }
-
-    # NEXT, destroy the type's data.
-    namespace delete $type
-
-    # NEXT, get rid of the type command.
-    rename $type ""
-}
-
-
-
-#-----------------------------------------------------------------------
-# Option Handling
-
-# Implements the standard "cget" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.method.cget {type selfns win self option} {
-    if {[catch {set ${selfns}::Snit_cgetCache($option)} command]} {
-        set command [snit::RT.CacheCgetCommand $type $selfns $win $self $option]
-
-        if {[llength $command] == 0} {
-            return -code error "unknown option \"$option\""
-        }
-    }
-
-    uplevel 1 $command
-}
-
-# Retrieves and caches the command that implements "cget" for the
-# specified option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.CacheCgetCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_cgetCache
-
-    if {[info exists Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.  If it has a cget method defined,
-            # use it; otherwise just return the value.
-
-            if {"" == $Snit_optionInfo(cget-$option)} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(cget-$option) \
-                                 "can't cget $option"]
-
-                lappend command $option
-            }
-
-            set Snit_cgetCache($option) $command
-            return $command
-        }
-
-        # Explicitly delegated option; get target
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {"" != $Snit_optionInfo(starcomp) &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated; get target.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-
-    # Get the component's object.
-    set obj [RT.Component $type $selfns $comp]
-
-    set command [list $obj cget $target]
-    set Snit_cgetCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configurelist" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# optionlist    A list of options and their values.
-
-proc ::snit::RT.method.configurelist {type selfns win self optionlist} {
-    variable ${type}::Snit_optionInfo
-
-    foreach {option value} $optionlist {
-        # FIRST, get the configure command, caching it if need be.
-        if {[catch {set ${selfns}::Snit_configureCache($option)} command]} {
-            set command [snit::RT.CacheConfigureCommand \
-                             $type $selfns $win $self $option]
-
-            if {[llength $command] == 0} {
-                return -code error "unknown option \"$option\""
-            }
-        }
-
-        # NEXT, if we have a type-validation object, use it.
-        # TBD: Should test (islocal-$option) here, but islocal
-        # isn't defined for implicitly delegated options.
-        if {[info exists Snit_optionInfo(typeobj-$option)]
-            && "" != $Snit_optionInfo(typeobj-$option)} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option value: $result"
-            }
-        }
-
-        # NEXT, the caching the configure command also cached the
-        # validate command, if any.  If we have one, run it.
-        set valcommand [set ${selfns}::Snit_validateCache($option)]
-
-        if {[llength $valcommand]} {
-            lappend valcommand $value
-            uplevel 1 $valcommand
-        }
-
-        # NEXT, configure the option with the value.
-        lappend command $value
-        uplevel 1 $command
-    }
-
-    return
-}
-
-# Retrieves and caches the command that stores the named option.
-# Also stores the command that validates the name option if any;
-# If none, the validate command is "", so that the cache is always
-# populated.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        An option name
-
-proc ::snit::RT.CacheConfigureCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_configureCache
-    variable ${selfns}::Snit_validateCache
-
-    if {[info exist Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.
-
-            # If it's readonly, it throws an error if we're already
-            # constructed.
-            if {$Snit_optionInfo(readonly-$option)} {
-                if {[set ${selfns}::Snit_iinfo(constructed)]} {
-                    error "option $option can only be set at instance creation"
-                }
-            }
-
-            # If it has a validate method, cache that for later.
-            if {"" != $Snit_optionInfo(validate-$option)} {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(validate-$option) \
-                                 "can't validate $option"]
-
-                lappend command $option
-                set Snit_validateCache($option) $command
-            } else {
-                set Snit_validateCache($option) ""
-            }
-
-            # If it has a configure method defined,
-            # cache it; otherwise, just set the value.
-
-            if {"" == $Snit_optionInfo(configure-$option)} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                set command [snit::RT.LookupMethodCommand \
-                                 $type $selfns $win $self \
-                                 $Snit_optionInfo(configure-$option) \
-                                 "can't configure $option"]
-
-                lappend command $option
-            }
-
-            set Snit_configureCache($option) $command
-            return $command
-        }
-
-        # Delegated option: get target.
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {$Snit_optionInfo(starcomp) != "" &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-
-    # There is no validate command in this case; save an empty string.
-    set Snit_validateCache($option) ""
-
-    # Get the component's object
-    set obj [RT.Component $type $selfns $comp]
-
-    set command [list $obj configure $target]
-    set Snit_configureCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configure" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# args          A list of options and their values, possibly empty.
-
-proc ::snit::RT.method.configure {type selfns win self args} {
-    # If two or more arguments, set values as usual.
-    if {[llength $args] >= 2} {
-        ::snit::RT.method.configurelist $type $selfns $win $self $args
-        return
-    }
-
-    # If zero arguments, acquire data for each known option
-    # and return the list
-    if {[llength $args] == 0} {
-        set result {}
-        foreach opt [RT.method.info.options $type $selfns $win $self] {
-            # Refactor this, so that we don't need to call via $self.
-            lappend result [RT.GetOptionDbSpec \
-                                $type $selfns $win $self $opt]
-        }
-
-        return $result
-    }
-
-    # They want it for just one.
-    set opt [lindex $args 0]
-
-    return [RT.GetOptionDbSpec $type $selfns $win $self $opt]
-}
-
-
-# Retrieves the option database spec for a single option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of an option
-#
-# TBD: This is a bad name.  What it's returning is the
-# result of the configure query.
-
-proc ::snit::RT.GetOptionDbSpec {type selfns win self opt} {
-    variable ${type}::Snit_optionInfo
-
-    upvar ${selfns}::Snit_components Snit_components
-    upvar ${selfns}::options         options
-
-    if {[info exists options($opt)]} {
-        # This is a locally-defined option.  Just build the
-        # list and return it.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-        set def $Snit_optionInfo(default-$opt)
-
-        return [list $opt $res $cls $def \
-                    [RT.method.cget $type $selfns $win $self $opt]]
-    } elseif {[info exists Snit_optionInfo(target-$opt)]} {
-        # This is an explicitly delegated option.  The only
-        # thing we don't have is the default.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-
-        # Get the default
-        set logicalName [lindex $Snit_optionInfo(target-$opt) 0]
-        set comp $Snit_components($logicalName)
-        set target [lindex $Snit_optionInfo(target-$opt) 1]
-
-        if {[catch {$comp configure $target} result]} {
-            set defValue {}
-        } else {
-            set defValue [lindex $result 3]
-        }
-
-        return [list $opt $res $cls $defValue [$self cget $opt]]
-    } elseif {"" != $Snit_optionInfo(starcomp) &&
-              [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-        set logicalName $Snit_optionInfo(starcomp)
-        set target $opt
-        set comp $Snit_components($logicalName)
-
-        if {[catch {set value [$comp cget $target]} result]} {
-            error "unknown option \"$opt\""
-        }
-
-        if {![catch {$comp configure $target} result]} {
-            # Replace the delegated option name with the local name.
-            return [::snit::Expand $result $target $opt]
-        }
-
-        # configure didn't work; return simple form.
-        return [list $opt "" "" "" $value]
-    } else {
-        error "unknown option \"$opt\""
-    }
-}
-
-#-----------------------------------------------------------------------
-# Type Introspection
-
-# Implements the standard "info" typemethod.
-#
-# type		The snit type
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.typemethod.info {type command args} {
-    global errorInfo
-    global errorCode
-
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        typevars    -
-        typemethods -
-        instances {
-            # TBD: it should be possible to delete this error
-            # handling.
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 \
-			       ::snit::RT.typemethod.info.$command $type]
-            } result]
-
-            if {$errflag} {
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            error "\"$type info $command\" is not defined"
-        }
-    }
-}
-
-
-# Returns a list of the type's typevariables whose names match a
-# pattern, excluding Snit internal variables.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typevars {type {pattern *}} {
-    set result {}
-    foreach name [info vars "${type}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-
-    return $result
-}
-
-# Returns a list of the type's methods whose names match a
-# pattern.  If "delegate typemethod *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typemethods {type {pattern *}} {
-    variable ${type}::Snit_typemethodInfo
-    variable ${type}::Snit_typemethodCache
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_typemethodInfo $pattern] {
-        if {[lindex $Snit_typemethodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    if {[info exists Snit_typemethodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        foreach name [array names Snit_typemethodCache $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $type info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.args {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 1 end]
-}
-
-# $type info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.body {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $type info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.default {type method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# Returns a list of the type's instances whose names match
-# a pattern.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match
-#               Defaults to *
-#
-# REQUIRE: type is fully qualified.
-
-proc ::snit::RT.typemethod.info.instances {type {pattern *}} {
-    set result {}
-
-    foreach selfns [namespace children $type] {
-        upvar ${selfns}::Snit_instance instance
-
-        if {[string match $pattern $instance]} {
-            lappend result $instance
-        }
-    }
-
-    return $result
-}
-
-#-----------------------------------------------------------------------
-# Instance Introspection
-
-# Implements the standard "info" method.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.method.info {type selfns win self command args} {
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        type        -
-        vars        -
-        options     -
-        methods     -
-        typevars    -
-        typemethods {
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 ::snit::RT.method.info.$command \
-			       $type $selfns $win $self]
-            } result]
-
-            if {$errflag} {
-                global errorInfo
-                return -code error -errorinfo $errorInfo $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            # error "\"$self info $command\" is not defined"
-            return -code error "\"$self info $command\" is not defined"
-        }
-    }
-}
-
-# $self info type
-#
-# Returns the instance's type
-proc ::snit::RT.method.info.type {type selfns win self} {
-    return $type
-}
-
-# $self info typevars
-#
-# Returns the instance's type's typevariables
-proc ::snit::RT.method.info.typevars {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typevars $type $pattern]
-}
-
-# $self info typemethods
-#
-# Returns the instance's type's typemethods
-proc ::snit::RT.method.info.typemethods {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typemethods $type $pattern]
-}
-
-# Returns a list of the instance's methods whose names match a
-# pattern.  If "delegate method *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# selfns        The instance namespace
-# win		The original instance name
-# self          The current instance name
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.method.info.methods {type selfns win self {pattern *}} {
-    variable ${type}::Snit_methodInfo
-    variable ${selfns}::Snit_methodCache
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_methodInfo $pattern] {
-        if {[lindex $Snit_methodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    if {[info exists Snit_methodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        foreach name [array names Snit_methodCache $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $self info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.args {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 4 end]
-}
-
-# $self info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.body {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $self info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.default {type selfns win self method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# $self info vars
-#
-# Returns the instance's instance variables
-proc ::snit::RT.method.info.vars {type selfns win self {pattern *}} {
-    set result {}
-    foreach name [info vars "${selfns}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-
-    return $result
-}
-
-# $self info options
-#
-# Returns a list of the names of the instance's options
-proc ::snit::RT.method.info.options {type selfns win self {pattern *}} {
-    variable ${type}::Snit_optionInfo
-
-    # First, get the local and explicitly delegated options
-    set result [concat $Snit_optionInfo(local) $Snit_optionInfo(delegated)]
-
-    # If "configure" works as for Tk widgets, add the resulting
-    # options to the list.  Skip excepted options
-    if {"" != $Snit_optionInfo(starcomp)} {
-        upvar ${selfns}::Snit_components Snit_components
-        set logicalName $Snit_optionInfo(starcomp)
-        set comp $Snit_components($logicalName)
-
-        if {![catch {$comp configure} records]} {
-            foreach record $records {
-                set opt [lindex $record 0]
-                if {[lsearch -exact $result $opt] == -1 &&
-                    [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-                    lappend result $opt
-                }
-            }
-        }
-    }
-
-    # Next, apply the pattern
-    set names {}
-
-    foreach name $result {
-        if {[string match $pattern $name]} {
-            lappend names $name
-        }
-    }
-
-    return $names
-}
-
-proc ::snit::RT.body {body} {
-    regsub -all ".*# END snit method prolog\n" $body {} body
-    return $body
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/main2.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/main2.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3882 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#	main2.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#       Snit's Not Incr Tcl, a simple object system in Pure Tcl.
-#
-#       Snit 2.x Compiler and Run-Time Library
-#
-#       Copyright (C) 2003-2006 by William H. Duquette
-#       This code is licensed as described in license.txt.
-#
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-# Namespace
-
-namespace eval ::snit:: {
-    namespace export \
-        compile type widget widgetadaptor typemethod method macro
-}
-
-#-----------------------------------------------------------------------
-# Some Snit variables
-
-namespace eval ::snit:: {
-    variable reservedArgs {type selfns win self}
-
-    # Widget classes which can be hulls (must have -class)
-    variable hulltypes {
-	toplevel tk::toplevel
-	frame tk::frame ttk::frame
-	labelframe tk::labelframe ttk::labelframe
-    }
-}
-
-#-----------------------------------------------------------------------
-# Snit Type Implementation template
-
-namespace eval ::snit:: {
-    # Template type definition: All internal and user-visible Snit
-    # implementation code.
-    #
-    # The following placeholders will automatically be replaced with
-    # the client's code, in two passes:
-    #
-    # First pass:
-    # %COMPILEDDEFS%  The compiled type definition.
-    #
-    # Second pass:
-    # %TYPE%          The fully qualified type name.
-    # %IVARDECS%      Instance variable declarations
-    # %TVARDECS%      Type variable declarations
-    # %TCONSTBODY%    Type constructor body
-    # %INSTANCEVARS%  The compiled instance variable initialization code.
-    # %TYPEVARS%      The compiled type variable initialization code.
-
-    # This is the overall type template.
-    variable typeTemplate
-
-    # This is the normal type proc
-    variable nominalTypeProc
-
-    # This is the "-hastypemethods no" type proc
-    variable simpleTypeProc
-}
-
-set ::snit::typeTemplate {
-
-    #-------------------------------------------------------------------
-    # The type's namespace definition and the user's type variables
-
-    namespace eval %TYPE% {%TYPEVARS%
-    }
-
-    #----------------------------------------------------------------
-    # Commands for use in methods, typemethods, etc.
-    #
-    # These are implemented as aliases into the Snit runtime library.
-
-    interp alias {} %TYPE%::installhull  {} ::snit::RT.installhull %TYPE%
-    interp alias {} %TYPE%::install      {} ::snit::RT.install %TYPE%
-    interp alias {} %TYPE%::typevariable {} ::variable
-    interp alias {} %TYPE%::variable     {} ::snit::RT.variable
-    interp alias {} %TYPE%::mytypevar    {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::typevarname  {} ::snit::RT.mytypevar %TYPE%
-    interp alias {} %TYPE%::myvar        {} ::snit::RT.myvar
-    interp alias {} %TYPE%::varname      {} ::snit::RT.myvar
-    interp alias {} %TYPE%::codename     {} ::snit::RT.codename %TYPE%
-    interp alias {} %TYPE%::myproc       {} ::snit::RT.myproc %TYPE%
-    interp alias {} %TYPE%::mymethod     {} ::snit::RT.mymethod 
-    interp alias {} %TYPE%::mytypemethod {} ::snit::RT.mytypemethod %TYPE%
-    interp alias {} %TYPE%::from         {} ::snit::RT.from %TYPE%
-
-    #-------------------------------------------------------------------
-    # Snit's internal variables
-
-    namespace eval %TYPE% {
-        # Array: General Snit Info
-        #
-        # ns:                The type's namespace
-        # hasinstances:      T or F, from pragma -hasinstances.
-        # simpledispatch:    T or F, from pragma -hasinstances.
-        # canreplace:        T or F, from pragma -canreplace.
-        # counter:           Count of instances created so far.
-        # widgetclass:       Set by widgetclass statement.
-        # hulltype:          Hull type (frame or toplevel) for widgets only.
-        # exceptmethods:     Methods explicitly not delegated to *
-        # excepttypemethods: Methods explicitly not delegated to *
-        # tvardecs:          Type variable declarations--for dynamic methods
-        # ivardecs:          Instance variable declarations--for dyn. methods
-        typevariable Snit_info
-        set Snit_info(ns)      %TYPE%::
-        set Snit_info(hasinstances) 1
-        set Snit_info(simpledispatch) 0
-        set Snit_info(canreplace) 0
-        set Snit_info(counter) 0
-        set Snit_info(widgetclass) {}
-        set Snit_info(hulltype) frame
-        set Snit_info(exceptmethods) {}
-        set Snit_info(excepttypemethods) {}
-        set Snit_info(tvardecs) {%TVARDECS%}
-        set Snit_info(ivardecs) {%IVARDECS%}
-
-        # Array: Public methods of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_typemethodInfo
-        array unset Snit_typemethodInfo
-
-        # Array: Public methods of instances of this type.
-        # The index is the method name, or "*".
-        # The value is [list $pattern $componentName], where
-        # $componentName is "" for normal methods.
-        typevariable Snit_methodInfo
-        array unset Snit_methodInfo
-
-        # Array: option information.  See dictionary.txt.
-        typevariable Snit_optionInfo
-        array unset Snit_optionInfo
-        set Snit_optionInfo(local)     {}
-        set Snit_optionInfo(delegated) {}
-        set Snit_optionInfo(starcomp)  {}
-        set Snit_optionInfo(except)    {}
-    }
-
-    #----------------------------------------------------------------
-    # Compiled Procs
-    #
-    # These commands are created or replaced during compilation:
-
-
-    # Snit_instanceVars selfns
-    #
-    # Initializes the instance variables, if any.  Called during
-    # instance creation.
-    
-    proc %TYPE%::Snit_instanceVars {selfns} {
-        %INSTANCEVARS%
-    }
-
-    # Type Constructor
-    proc %TYPE%::Snit_typeconstructor {type} {
-        %TVARDECS%
-        namespace path [namespace parent $type]
-        %TCONSTBODY%
-    }
-
-    #----------------------------------------------------------------
-    # Default Procs
-    #
-    # These commands might be replaced during compilation:
-
-    # Snit_destructor type selfns win self
-    #
-    # Default destructor for the type.  By default, it does
-    # nothing.  It's replaced by any user destructor.
-    # For types, it's called by method destroy; for widgettypes,
-    # it's called by a destroy event handler.
-
-    proc %TYPE%::Snit_destructor {type selfns win self} { }
-
-    #----------------------------------------------------------
-    # Compiled Definitions
-
-    %COMPILEDDEFS%
-
-    #----------------------------------------------------------
-    # Finally, call the Type Constructor
-
-    %TYPE%::Snit_typeconstructor %TYPE%
-}
-
-#-----------------------------------------------------------------------
-# Type procs
-#
-# These procs expect the fully-qualified type name to be 
-# substituted in for %TYPE%.
-
-# This is the nominal type proc.  It supports typemethods and
-# delegated typemethods.
-set ::snit::nominalTypeProc {
-    # WHD: Code for creating the type ensemble
-    namespace eval %TYPE% {
-        namespace ensemble create \
-            -unknown [list ::snit::RT.UnknownTypemethod %TYPE% ""] \
-            -prefixes 0
-    }
-}
-
-# This is the simplified type proc for when there are no typemethods
-# except create.  In this case, it doesn't take a method argument;
-# the method is always "create".
-set ::snit::simpleTypeProc {
-    # Type dispatcher function.  Note: This function lives
-    # in the parent of the %TYPE% namespace!  All accesses to 
-    # %TYPE% variables and methods must be qualified!
-    proc %TYPE% {args} {
-        ::variable %TYPE%::Snit_info
-
-        # FIRST, if the are no args, the single arg is %AUTO%
-        if {[llength $args] == 0} {
-            if {$Snit_info(isWidget)} {
-                error "wrong \# args: should be \"%TYPE% name args\""
-            }
-            
-            lappend args %AUTO%
-        }
-
-        # NEXT, we're going to call the create method.
-        # Pass along the return code unchanged.
-        if {$Snit_info(isWidget)} {
-            set command [list ::snit::RT.widget.typemethod.create %TYPE%]
-        } else {
-            set command [list ::snit::RT.type.typemethod.create %TYPE%]
-        }
-
-        set retval [catch {uplevel 1 $command $args} result]
-
-        if {$retval} {
-            if {$retval == 1} {
-                global errorInfo
-                global errorCode
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return -code $retval $result
-            }
-        }
-
-        return $result
-    }
-}
-
-#=======================================================================
-# Snit Type Definition
-#
-# These are the procs used to define Snit types, widgets, and 
-# widgetadaptors.
-
-
-#-----------------------------------------------------------------------
-# Snit Compilation Variables
-#
-# The following variables are used while Snit is compiling a type,
-# and are disposed afterwards.
-
-namespace eval ::snit:: {
-    # The compiler variable contains the name of the slave interpreter
-    # used to compile type definitions.
-    variable compiler ""
-
-    # The compile array accumulates information about the type or
-    # widgettype being compiled.  It is cleared before and after each
-    # compilation.  It has these indices:
-    #
-    # type:                  The name of the type being compiled, for use
-    #                        in compilation procs.
-    # defs:                  Compiled definitions, both standard and client.
-    # which:                 type, widget, widgetadaptor
-    # instancevars:          Instance variable definitions and initializations.
-    # ivprocdec:             Instance variable proc declarations.
-    # tvprocdec:             Type variable proc declarations.
-    # typeconstructor:       Type constructor body.
-    # widgetclass:           The widgetclass, for snit::widgets, only
-    # hasoptions:            False, initially; set to true when first
-    #                        option is defined.
-    # localoptions:          Names of local options.
-    # delegatedoptions:      Names of delegated options.
-    # localmethods:          Names of locally defined methods.
-    # delegatesmethods:      no if no delegated methods, yes otherwise.
-    # hashierarchic       :  no if no hierarchic methods, yes otherwise.
-    # components:            Names of defined components.
-    # typecomponents:        Names of defined typecomponents.
-    # typevars:              Typevariable definitions and initializations.
-    # varnames:              Names of instance variables
-    # typevarnames           Names of type variables
-    # hasconstructor         False, initially; true when constructor is
-    #                        defined.
-    # resource-$opt          The option's resource name
-    # class-$opt             The option's class
-    # -default-$opt          The option's default value
-    # -validatemethod-$opt   The option's validate method
-    # -configuremethod-$opt  The option's configure method
-    # -cgetmethod-$opt       The option's cget method.
-    # -hastypeinfo           The -hastypeinfo pragma
-    # -hastypedestroy        The -hastypedestroy pragma
-    # -hastypemethods        The -hastypemethods pragma
-    # -hasinfo               The -hasinfo pragma
-    # -hasinstances          The -hasinstances pragma
-    # -simpledispatch        The -simpledispatch pragma WHD: OBSOLETE
-    # -canreplace            The -canreplace pragma
-    variable compile
-
-    # This variable accumulates method dispatch information; it has
-    # the same structure as the %TYPE%::Snit_methodInfo array, and is
-    # used to initialize it.
-    variable methodInfo
-
-    # This variable accumulates typemethod dispatch information; it has
-    # the same structure as the %TYPE%::Snit_typemethodInfo array, and is
-    # used to initialize it.
-    variable typemethodInfo
-
-    # The following variable lists the reserved type definition statement
-    # names, e.g., the names you can't use as macros.  It's built at
-    # compiler definition time using "info commands".
-    variable reservedwords {}
-}
-
-#-----------------------------------------------------------------------
-# type compilation commands
-#
-# The type and widgettype commands use a slave interpreter to compile
-# the type definition.  These are the procs
-# that are aliased into it.
-
-# Initialize the compiler
-proc ::snit::Comp.Init {} {
-    variable compiler
-    variable reservedwords
-
-    if {$compiler eq ""} {
-        # Create the compiler's interpreter
-        set compiler [interp create]
-
-        # Initialize the interpreter
-	$compiler eval {
-            # Load package information
-            # TBD: see if this can be moved outside.
-	    # @mdgen NODEP: ::snit::__does_not_exist__
-            catch {package require ::snit::__does_not_exist__}
-
-            # Protect some Tcl commands our type definitions
-            # will shadow.
-            rename proc _proc
-            rename variable _variable
-        }
-
-        # Define compilation aliases.
-        $compiler alias pragma          ::snit::Comp.statement.pragma
-        $compiler alias widgetclass     ::snit::Comp.statement.widgetclass
-        $compiler alias hulltype        ::snit::Comp.statement.hulltype
-        $compiler alias constructor     ::snit::Comp.statement.constructor
-        $compiler alias destructor      ::snit::Comp.statement.destructor
-        $compiler alias option          ::snit::Comp.statement.option
-        $compiler alias oncget          ::snit::Comp.statement.oncget
-        $compiler alias onconfigure     ::snit::Comp.statement.onconfigure
-        $compiler alias method          ::snit::Comp.statement.method
-        $compiler alias typemethod      ::snit::Comp.statement.typemethod
-        $compiler alias typeconstructor ::snit::Comp.statement.typeconstructor
-        $compiler alias proc            ::snit::Comp.statement.proc
-        $compiler alias typevariable    ::snit::Comp.statement.typevariable
-        $compiler alias variable        ::snit::Comp.statement.variable
-        $compiler alias typecomponent   ::snit::Comp.statement.typecomponent
-        $compiler alias component       ::snit::Comp.statement.component
-        $compiler alias delegate        ::snit::Comp.statement.delegate
-        $compiler alias expose          ::snit::Comp.statement.expose
-
-        # Get the list of reserved words
-        set reservedwords [$compiler eval {info commands}]
-    }
-}
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::Comp.Compile {which type body} {
-    variable typeTemplate
-    variable nominalTypeProc
-    variable simpleTypeProc
-    variable compile
-    variable compiler
-    variable methodInfo
-    variable typemethodInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $type]} {
-        # Get caller's namespace; 
-        # append :: if not global namespace.
-        set ns [uplevel 2 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-        
-        set type "$ns$type"
-    }
-
-    # NEXT, create and initialize the compiler, if needed.
-    Comp.Init
-
-    # NEXT, initialize the class data
-    array unset methodInfo
-    array unset typemethodInfo
-
-    array unset compile
-    set compile(type) $type
-    set compile(defs) {}
-    set compile(which) $which
-    set compile(hasoptions) no
-    set compile(localoptions) {}
-    set compile(instancevars) {}
-    set compile(typevars) {}
-    set compile(delegatedoptions) {}
-    set compile(ivprocdec) {}
-    set compile(tvprocdec) {}
-    set compile(typeconstructor) {}
-    set compile(widgetclass) {}
-    set compile(hulltype) {}
-    set compile(localmethods) {}
-    set compile(delegatesmethods) no
-    set compile(hashierarchic) no
-    set compile(components) {}
-    set compile(typecomponents) {}
-    set compile(varnames) {}
-    set compile(typevarnames) {}
-    set compile(hasconstructor) no
-    set compile(-hastypedestroy) yes
-    set compile(-hastypeinfo) yes
-    set compile(-hastypemethods) yes
-    set compile(-hasinfo) yes
-    set compile(-hasinstances) yes
-    set compile(-canreplace) no
-
-    set isWidget [string match widget* $which]
-    set isWidgetAdaptor [string match widgetadaptor $which]
-
-    # NEXT, Evaluate the type's definition in the class interpreter.
-    $compiler eval $body
-
-    # NEXT, Add the standard definitions
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidget) $isWidget\n"
-
-    append compile(defs) \
-        "\nset %TYPE%::Snit_info(isWidgetAdaptor) $isWidgetAdaptor\n"
-
-    # Indicate whether the type can create instances that replace
-    # existing commands.
-    append compile(defs) "\nset %TYPE%::Snit_info(canreplace) $compile(-canreplace)\n"
-
-
-    # Check pragmas for conflict.
-    
-    if {!$compile(-hastypemethods) && !$compile(-hasinstances)} {
-        error "$which $type has neither typemethods nor instances"
-    }
-
-    # If there are typemethods, define the standard typemethods and
-    # the nominal type proc.  Otherwise define the simple type proc.
-    if {$compile(-hastypemethods)} {
-        # Add the info typemethod unless the pragma forbids it.
-        if {$compile(-hastypeinfo)} {
-            Comp.statement.delegate typemethod info \
-                using {::snit::RT.typemethod.info %t}
-        }
-
-        # Add the destroy typemethod unless the pragma forbids it.
-        if {$compile(-hastypedestroy)} {
-            Comp.statement.delegate typemethod destroy \
-                using {::snit::RT.typemethod.destroy %t}
-        }
-
-        # Add the nominal type proc.
-        append compile(defs) $nominalTypeProc
-    } else {
-        # Add the simple type proc.
-        append compile(defs) $simpleTypeProc
-    }
-
-    # Add standard methods/typemethods that only make sense if the
-    # type has instances.
-    if {$compile(-hasinstances)} {
-        # Add the info method unless the pragma forbids it.
-        if {$compile(-hasinfo)} {
-            Comp.statement.delegate method info \
-                using {::snit::RT.method.info %t %n %w %s}
-        }
-        
-        # Add the option handling stuff if there are any options.
-        if {$compile(hasoptions)} {
-            Comp.statement.variable options
-
-            Comp.statement.delegate method cget \
-                using {::snit::RT.method.cget %t %n %w %s}
-            Comp.statement.delegate method configurelist \
-                using {::snit::RT.method.configurelist %t %n %w %s}
-            Comp.statement.delegate method configure \
-                using {::snit::RT.method.configure %t %n %w %s}
-        }
-
-        # Add a default constructor, if they haven't already defined one.
-        # If there are options, it will configure args; otherwise it
-        # will do nothing.
-        if {!$compile(hasconstructor)} {
-            if {$compile(hasoptions)} {
-                Comp.statement.constructor {args} {
-                    $self configurelist $args
-                }
-            } else {
-                Comp.statement.constructor {} {}
-            }
-        }
-        
-        if {!$isWidget} {
-            Comp.statement.delegate method destroy \
-                using {::snit::RT.method.destroy %t %n %w %s}
-
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.type.typemethod.create %t}
-        } else {
-            Comp.statement.delegate typemethod create \
-                using {::snit::RT.widget.typemethod.create %t}
-        }
-
-        # Save the method info. 
-        append compile(defs) \
-            "\narray set %TYPE%::Snit_methodInfo [list [array get methodInfo]]\n"
-    } else {
-        append compile(defs) "\nset %TYPE%::Snit_info(hasinstances) 0\n"
-    }
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the type's locally defined options; add this information to
-    # the compiled definition.
-    Comp.SaveOptionInfo
-
-    # NEXT, compiling the type definition built up a set of information
-    # about the typemethods; save the typemethod info.
-    append compile(defs) \
-        "\narray set %TYPE%::Snit_typemethodInfo [list [array get typemethodInfo]]\n"
-
-    # NEXT, if this is a widget define the hull component if it isn't
-    # already defined.
-    if {$isWidget} {
-        Comp.DefineComponent hull
-    }
-
-    # NEXT, substitute the compiled definition into the type template
-    # to get the type definition script.
-    set defscript [Expand $typeTemplate \
-                       %COMPILEDDEFS% $compile(defs)]
-
-    # NEXT, substitute the defined macros into the type definition script.
-    # This is done as a separate step so that the compile(defs) can 
-    # contain the macros defined below.
-
-    set defscript [Expand $defscript \
-                       %TYPE%         $type \
-                       %IVARDECS%     $compile(ivprocdec) \
-                       %TVARDECS%     $compile(tvprocdec) \
-                       %TCONSTBODY%   $compile(typeconstructor) \
-                       %INSTANCEVARS% $compile(instancevars) \
-                       %TYPEVARS%     $compile(typevars) \
-		       ]
-
-    array unset compile
-
-    return [list $type $defscript]
-}
-
-# Information about locally-defined options is accumulated during
-# compilation, but not added to the compiled definition--the option
-# statement can appear multiple times, so it's easier this way.
-# This proc fills in Snit_optionInfo with the accumulated information.
-#
-# It also computes the option's resource and class names if needed.
-#
-# Note that the information for delegated options was put in 
-# Snit_optionInfo during compilation.
-
-proc ::snit::Comp.SaveOptionInfo {} {
-    variable compile
-
-    foreach option $compile(localoptions) {
-        if {$compile(resource-$option) eq ""} {
-            set compile(resource-$option) [string range $option 1 end]
-        }
-
-        if {$compile(class-$option) eq ""} {
-            set compile(class-$option) [Capitalize $compile(resource-$option)]
-        }
-
-        # NOTE: Don't verify that the validate, configure, and cget 
-        # values name real methods; the methods might be defined outside 
-        # the typedefinition using snit::method.
-        
-        Mappend compile(defs) {
-            # Option %OPTION%
-            lappend %TYPE%::Snit_optionInfo(local) %OPTION%
-
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%)   1
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%)  %RESOURCE%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%)     %CLASS%
-            set %TYPE%::Snit_optionInfo(default-%OPTION%)   %DEFAULT%
-            set %TYPE%::Snit_optionInfo(validate-%OPTION%)  %VALIDATE%
-            set %TYPE%::Snit_optionInfo(configure-%OPTION%) %CONFIGURE%
-            set %TYPE%::Snit_optionInfo(cget-%OPTION%)      %CGET%
-            set %TYPE%::Snit_optionInfo(readonly-%OPTION%)  %READONLY%
-            set %TYPE%::Snit_optionInfo(typespec-%OPTION%)  %TYPESPEC%
-        }   %OPTION%    $option \
-            %RESOURCE%  $compile(resource-$option) \
-            %CLASS%     $compile(class-$option) \
-            %DEFAULT%   [list $compile(-default-$option)] \
-            %VALIDATE%  [list $compile(-validatemethod-$option)] \
-            %CONFIGURE% [list $compile(-configuremethod-$option)] \
-            %CGET%      [list $compile(-cgetmethod-$option)] \
-            %READONLY%  $compile(-readonly-$option)               \
-            %TYPESPEC%  [list $compile(-type-$option)]
-    }
-}
-
-
-# Evaluates a compiled type definition, thus making the type available.
-proc ::snit::Comp.Define {compResult} {
-    # The compilation result is a list containing the fully qualified
-    # type name and a script to evaluate to define the type.
-    set type [lindex $compResult 0]
-    set defscript [lindex $compResult 1]
-
-    # Execute the type definition script.
-    # Consider using namespace eval %TYPE%.  See if it's faster.
-    if {[catch {eval $defscript} result]} {
-        namespace delete $type
-        catch {rename $type ""}
-        error $result
-    }
-
-    return $type
-}
-
-# Sets pragma options which control how the type is defined.
-proc ::snit::Comp.statement.pragma {args} {
-    variable compile
-
-    set errRoot "Error in \"pragma...\""
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -hastypeinfo    -
-            -hastypedestroy -
-            -hastypemethods -
-            -hasinstances   -
-            -simpledispatch -
-            -hasinfo        -
-            -canreplace     {
-                if {![string is boolean -strict $val]} {
-                    error "$errRoot, \"$opt\" requires a boolean value"
-                }
-                set compile($opt) $val
-            }
-            default {
-                error "$errRoot, unknown pragma"
-            }
-        }
-    }
-}
-
-# Defines a widget's option class name.  
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.widgetclass {name} {
-    variable compile
-
-    # First, widgetclass can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "widgetclass cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, validate the option name.  We'll require that it begin
-    # with an uppercase letter.
-    set initial [string index $name 0]
-    if {![string is upper $initial]} {
-        error "widgetclass \"$name\" does not begin with an uppercase letter"
-    }
-
-    if {"" != $compile(widgetclass)} {
-        error "too many widgetclass statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(widgetclass) %WIDGETCLASS%
-    } %WIDGETCLASS% [list $name]
-
-    set compile(widgetclass) $name
-}
-
-# Defines a widget's hull type.
-# This statement is only available for snit::widgets,
-# not for snit::types or snit::widgetadaptors.
-proc ::snit::Comp.statement.hulltype {name} {
-    variable compile
-    variable hulltypes
-
-    # First, hulltype can only be set for true widgets
-    if {"widget" != $compile(which)} {
-        error "hulltype cannot be set for snit::$compile(which)s"
-    }
-
-    # Next, it must be one of the valid hulltypes (frame, toplevel, ...)
-    if {[lsearch -exact $hulltypes [string trimleft $name :]] == -1} {
-        error "invalid hulltype \"$name\", should be one of\
-		[join $hulltypes {, }]"
-    }
-
-    if {"" != $compile(hulltype)} {
-        error "too many hulltype statements"
-    }
-
-    # Next, save it.
-    Mappend compile(defs) {
-        set  %TYPE%::Snit_info(hulltype) %HULLTYPE%
-    } %HULLTYPE% $name
-
-    set compile(hulltype) $name
-}
-
-# Defines a constructor.
-proc ::snit::Comp.statement.constructor {arglist body} {
-    variable compile
-
-    CheckArgs "constructor" $arglist
-
-    # Next, add a magic reference to self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%\n%IVARDECS%\n$body"
-
-    set compile(hasconstructor) yes
-    append compile(defs) "proc %TYPE%::Snit_constructor [list $arglist] [list $body]\n"
-} 
-
-# Defines a destructor.
-proc ::snit::Comp.statement.destructor {body} {
-    variable compile
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%\n%IVARDECS%\n$body"
-
-    append compile(defs) "proc %TYPE%::Snit_destructor {type selfns win self} [list $body]\n\n"
-} 
-
-# Defines a type option.  The option value can be a triple, specifying
-# the option's -name, resource name, and class name. 
-proc ::snit::Comp.statement.option {optionDef args} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"option [list $optionDef]...\""
-
-    # Next, validate the option name.
-    if {![Comp.OptionNameIsValid $option]} {
-        error "$errRoot, badly named option \"$option\""
-    }
-
-    if {$option in $compile(delegatedoptions)} {
-        error "$errRoot, cannot define \"$option\" locally, it has been delegated"
-    }
-
-    if {!($option in $compile(localoptions))} {
-        # Remember that we've seen this one.
-        set compile(hasoptions) yes
-        lappend compile(localoptions) $option
-        
-        # Initialize compilation info for this option.
-        set compile(resource-$option)         ""
-        set compile(class-$option)            ""
-        set compile(-default-$option)         ""
-        set compile(-validatemethod-$option)  ""
-        set compile(-configuremethod-$option) ""
-        set compile(-cgetmethod-$option)      ""
-        set compile(-readonly-$option)        0
-        set compile(-type-$option)            ""
-    }
-
-    # NEXT, see if we have a resource name.  If so, make sure it
-    # isn't being redefined differently.
-    if {$resourceName ne ""} {
-        if {$compile(resource-$option) eq ""} {
-            # If it's undefined, just save the value.
-            set compile(resource-$option) $resourceName
-        } elseif {$resourceName ne $compile(resource-$option)} {
-            # It's been redefined differently.
-            error "$errRoot, resource name redefined from \"$compile(resource-$option)\" to \"$resourceName\""
-        }
-    }
-
-    # NEXT, see if we have a class name.  If so, make sure it
-    # isn't being redefined differently.
-    if {$className ne ""} {
-        if {$compile(class-$option) eq ""} {
-            # If it's undefined, just save the value.
-            set compile(class-$option) $className
-        } elseif {$className ne $compile(class-$option)} {
-            # It's been redefined differently.
-            error "$errRoot, class name redefined from \"$compile(class-$option)\" to \"$className\""
-        }
-    }
-
-    # NEXT, handle the args; it's not an error to redefine these.
-    if {[llength $args] == 1} {
-        set compile(-default-$option) [lindex $args 0]
-    } else {
-        foreach {optopt val} $args {
-            switch -exact -- $optopt {
-                -default         -
-                -validatemethod  -
-                -configuremethod -
-                -cgetmethod      {
-                    set compile($optopt-$option) $val
-                }
-                -type {
-                    set compile($optopt-$option) $val
-                    
-                    if {[llength $val] == 1} {
-                        # The type spec *is* the validation object
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) [list $val]\n"
-                    } else {
-                        # Compilation the creation of the validation object
-                        set cmd [linsert $val 1 %TYPE%::Snit_TypeObj_%AUTO%]
-                        append compile(defs) \
-                            "\nset %TYPE%::Snit_optionInfo(typeobj-$option) \[$cmd\]\n"
-                    }
-                }
-                -readonly        {
-                    if {![string is boolean -strict $val]} {
-                        error "$errRoot, -readonly requires a boolean, got \"$val\""
-                    }
-                    set compile($optopt-$option) $val
-                }
-                default {
-                    error "$errRoot, unknown option definition option \"$optopt\""
-                }
-            }
-        }
-    }
-}
-
-# 1 if the option name is valid, 0 otherwise.
-proc ::snit::Comp.OptionNameIsValid {option} {
-    if {![string match {-*} $option] || [string match {*[A-Z ]*} $option]} {
-        return 0
-    }
-
-    return 1
-}
-
-# Defines an option's cget handler
-proc ::snit::Comp.statement.oncget {option body} {
-    variable compile
-
-    set errRoot "Error in \"oncget $option...\""
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "$errRoot, option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "$errRoot, option \"$option\" unknown"
-    }
-
-    Comp.statement.method _cget$option {_option} $body
-    Comp.statement.option $option -cgetmethod _cget$option
-} 
-
-# Defines an option's configure handler.
-proc ::snit::Comp.statement.onconfigure {option arglist body} {
-    variable compile
-
-    if {[lsearch -exact $compile(delegatedoptions) $option] != -1} {
-        return -code error "onconfigure $option: option \"$option\" is delegated"
-    }
-
-    if {[lsearch -exact $compile(localoptions) $option] == -1} {
-        return -code error "onconfigure $option: option \"$option\" unknown"
-    }
-
-    if {[llength $arglist] != 1} {
-        error \
-       "onconfigure $option handler should have one argument, got \"$arglist\""
-    }
-
-    CheckArgs "onconfigure $option" $arglist
-
-    # Next, add a magic reference to the option name
-    set arglist [concat _option $arglist]
-
-    Comp.statement.method _configure$option $arglist $body
-    Comp.statement.option $option -configuremethod _configure$option
-} 
-
-# Defines an instance method.
-proc ::snit::Comp.statement.method {method arglist body} {
-    variable compile
-    variable methodInfo
-
-    # FIRST, check the method name against previously defined 
-    # methods.
-    Comp.CheckMethodName $method 0 ::snit::methodInfo \
-        "Error in \"method [list $method]...\""
-
-    if {[llength $method] > 1} {
-        set compile(hashierarchic) yes
-    }
-
-    # Remeber this method
-    lappend compile(localmethods) $method
-
-    CheckArgs "method [list $method]" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "%TVARDECS%\n%IVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script.
-    if {[llength $method] == 1} {
-        set methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_method%METHOD% %ARGLIST% %BODY% 
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body] 
-    } else {
-        set methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_hmethod%JMETHOD% %ARGLIST% %BODY% 
-        } %JMETHOD% [join $method _] %ARGLIST% [list $arglist] \
-            %BODY% [list $body] 
-    }
-} 
-
-# Check for name collisions; save prefix information.
-#
-# method	The name of the method or typemethod.
-# delFlag       1 if delegated, 0 otherwise.
-# infoVar       The fully qualified name of the array containing 
-#               information about the defined methods.
-# errRoot       The root string for any error messages.
-
-proc ::snit::Comp.CheckMethodName {method delFlag infoVar errRoot} {
-    upvar $infoVar methodInfo
-
-    # FIRST, make sure the method name is a valid Tcl list.
-    if {[catch {lindex $method 0}]} {
-        error "$errRoot, the name \"$method\" must have list syntax."
-    }
-
-    # NEXT, check whether we can define it.
-    if {![catch {set methodInfo($method)} data]} {
-        # We can't redefine methods with submethods.
-        if {[lindex $data 0] == 1} {
-            error "$errRoot, \"$method\" has submethods."
-        }
-       
-        # You can't delegate a method that's defined locally,
-        # and you can't define a method locally if it's been delegated.
-        if {$delFlag && [lindex $data 2] eq ""} {
-            error "$errRoot, \"$method\" has been defined locally."
-        } elseif {!$delFlag && [lindex $data 2] ne ""} {
-            error "$errRoot, \"$method\" has been delegated"
-        }
-    }
-
-    # Handle hierarchical case.
-    if {[llength $method] > 1} {
-        set prefix {}
-        set tokens $method
-        while {[llength $tokens] > 1} {
-            lappend prefix [lindex $tokens 0]
-            set tokens [lrange $tokens 1 end]
-
-            if {![catch {set methodInfo($prefix)} result]} {
-                # Prefix is known.  If it's not a prefix, throw an
-                # error.
-                if {[lindex $result 0] == 0} {
-                    error "$errRoot, \"$prefix\" has no submethods."
-                }
-            }
-            
-            set methodInfo($prefix) [list 1]
-        }
-    }
-}
-
-# Defines a typemethod method.
-proc ::snit::Comp.statement.typemethod {method arglist body} {
-    variable compile
-    variable typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined 
-    # typemethods.
-    Comp.CheckMethodName $method 0 ::snit::typemethodInfo \
-        "Error in \"typemethod [list $method]...\""
-
-    CheckArgs "typemethod $method" $arglist
-
-    # First, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "%TVARDECS%\n# END snit method prolog\n$body"
-
-    # Next, save the definition script
-    if {[llength $method] == 1} {
-        set typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_typemethod%METHOD% %ARGLIST% %BODY%
-        } %METHOD% $method %ARGLIST% [list $arglist] %BODY% [list $body]
-    } else {
-        set typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-
-        Mappend compile(defs) {
-            proc %TYPE%::Snit_htypemethod%JMETHOD% %ARGLIST% %BODY%
-        } %JMETHOD% [join $method _] \
-            %ARGLIST% [list $arglist] %BODY% [list $body]
-    }
-} 
-
-
-# Defines a type constructor.
-proc ::snit::Comp.statement.typeconstructor {body} {
-    variable compile
-
-    if {"" != $compile(typeconstructor)} {
-        error "too many typeconstructors"
-    }
-
-    set compile(typeconstructor) $body
-} 
-
-# Defines a static proc in the type's namespace.
-proc ::snit::Comp.statement.proc {proc arglist body} {
-    variable compile
-
-    # If "ns" is defined, the proc can see instance variables.
-    if {[lsearch -exact $arglist selfns] != -1} {
-        # Next, add instance variable declarations to body:
-        set body "%IVARDECS%\n$body"
-    }
-
-    # The proc can always see typevariables.
-    set body "%TVARDECS%\n$body"
-
-    append compile(defs) "
-
-        # Proc $proc
-        proc [list %TYPE%::$proc $arglist $body]
-    "
-} 
-
-# Defines a static variable in the type's namespace.
-proc ::snit::Comp.statement.typevariable {name args} {
-    variable compile
-
-    set errRoot "Error in \"typevariable $name...\""
-
-    set len [llength $args]
-    
-    if {$len > 2 ||
-        ($len == 2 && [lindex $args 0] ne "-array")} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(varnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already an instance variable"
-    }
-
-    lappend compile(typevarnames) $name
-
-    if {$len == 1} {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name [lindex $args 0]]"
-    } elseif {$len == 2} {
-        append compile(typevars) \
-            "\n\t    [list ::variable $name]"
-        append compile(typevars) \
-            "\n\t    [list array set $name [lindex $args 1]]"
-    } else {
-        append compile(typevars) \
-		"\n\t    [list ::variable $name]"
-    }
-
-    if {$compile(tvprocdec) eq ""} {
-        set compile(tvprocdec) "\n\t"
-        append compile(tvprocdec) "namespace upvar [list $compile(type)]"
-    }
-    append compile(tvprocdec) " [list $name $name]"
-} 
-
-# Defines an instance variable; the definition will go in the
-# type's create typemethod.
-proc ::snit::Comp.statement.variable {name args} {
-    variable compile
-
-    set errRoot "Error in \"variable $name...\""
-
-    set len [llength $args]
-    
-    if {$len > 2 ||
-        ($len == 2 && [lindex $args 0] ne "-array")} {
-        error "$errRoot, too many initializers"
-    }
-
-    if {[lsearch -exact $compile(typevarnames) $name] != -1} {
-        error "$errRoot, \"$name\" is already a typevariable"
-    }
-
-    lappend compile(varnames) $name
-
-    # Add a ::variable to instancevars, so that ::variable is used
-    # at least once; ::variable makes the variable visible to
-    # [info vars] even if no value is assigned.
-    append  compile(instancevars) "\n"
-    Mappend compile(instancevars) {::variable ${selfns}::%N} %N $name 
-
-    if {$len == 1} {
-        append compile(instancevars) \
-            "\nset $name [list [lindex $args 0]]\n"
-    } elseif {$len == 2} {
-        append compile(instancevars) \
-            "\narray set $name [list [lindex $args 1]]\n"
-    } 
-
-    if {$compile(ivprocdec) eq ""} {
-        set compile(ivprocdec) "\n\t"
-        append compile(ivprocdec) {namespace upvar $selfns}
-    }
-    append compile(ivprocdec) " [list $name $name]"
-} 
-
-# Defines a typecomponent, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-
-proc ::snit::Comp.statement.typecomponent {component args} {
-    variable compile
-
-    set errRoot "Error in \"typecomponent $component...\""
-
-    # FIRST, define the component
-    Comp.DefineTypecomponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "typecomponent $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "typecomponent $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.  
-    if {$publicMethod ne ""} {
-        Comp.statement.delegate typemethod [list $publicMethod *] to $component
-    }
-
-    # NEXT, if "-inherit 1" is specified, delegate typemethod * to 
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate typemethod "*" to $component
-    }
-
-}
-
-
-# Defines a name to be a typecomponent
-# 
-# The name becomes a typevariable; in addition, it gets a 
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineTypecomponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(varnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already an instance variable"
-    }
-
-    if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(typecomponents) $component
-
-        # Make it a type variable with no initial value
-        Comp.statement.typevariable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(typevars) {
-            trace add variable %COMP% write \
-                [list ::snit::RT.TypecomponentTrace [list %TYPE%] %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-} 
-
-# Defines a component, and handles component options.
-#
-# component     The logical name of the delegate
-# args          options.
-#
-# TBD: Ideally, it should be possible to call this statement multiple
-# times, possibly changing the option values.  To do that, I'd need
-# to cache the option values and not act on them until *after* I'd
-# read the entire type definition.
-
-proc ::snit::Comp.statement.component {component args} {
-    variable compile
-
-    set errRoot "Error in \"component $component...\""
-
-    # FIRST, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # NEXT, handle the options.
-    set publicMethod ""
-    set inheritFlag 0
-
-    foreach {opt val} $args {
-        switch -exact -- $opt {
-            -public {
-                set publicMethod $val
-            }
-            -inherit {
-                set inheritFlag $val
-                if {![string is boolean $inheritFlag]} {
-    error "component $component -inherit: expected boolean value, got \"$val\""
-                }
-            }
-            default {
-                error "component $component: Invalid option \"$opt\""
-            }
-        }
-    }
-
-    # NEXT, if -public specified, define the method.  
-    if {$publicMethod ne ""} {
-        Comp.statement.delegate method [list $publicMethod *] to $component
-    }
-
-    # NEXT, if -inherit is specified, delegate method/option * to 
-    # this component.
-    if {$inheritFlag} {
-        Comp.statement.delegate method "*" to $component
-        Comp.statement.delegate option "*" to $component
-    }
-}
-
-
-# Defines a name to be a component
-# 
-# The name becomes an instance variable; in addition, it gets a 
-# write trace so that when it is set, all of the component mechanisms
-# get updated.
-#
-# component     The component name
-
-proc ::snit::Comp.DefineComponent {component {errRoot "Error"}} {
-    variable compile
-
-    if {[lsearch -exact $compile(typevarnames) $component] != -1} {
-        error "$errRoot, \"$component\" is already a typevariable"
-    }
-
-    if {[lsearch -exact $compile(components) $component] == -1} {
-        # Remember we've done this.
-        lappend compile(components) $component
-
-        # Make it an instance variable with no initial value
-        Comp.statement.variable $component ""
-
-        # Add a write trace to do the component thing.
-        Mappend compile(instancevars) {
-            trace add variable ${selfns}::%COMP% write \
-                [list ::snit::RT.ComponentTrace [list %TYPE%] $selfns %COMP%]
-        } %TYPE% $compile(type) %COMP% $component
-    }
-} 
-
-# Creates a delegated method, typemethod, or option.
-proc ::snit::Comp.statement.delegate {what name args} {
-    # FIRST, dispatch to correct handler.
-    switch $what {
-        typemethod { Comp.DelegatedTypemethod $name $args }
-        method     { Comp.DelegatedMethod     $name $args }
-        option     { Comp.DelegatedOption     $name $args }
-        default {
-            error "Error in \"delegate $what $name...\", \"$what\"?"
-        }
-    }
-
-    if {([llength $args] % 2) != 0} {
-        error "Error in \"delegate $what $name...\", invalid syntax"
-    }
-}
-
-# Creates a delegated typemethod delegating it to a particular
-# typecomponent or an arbitrary command.
-#
-# method    The name of the method
-# arglist       Delegation options
-
-proc ::snit::Comp.DelegatedTypemethod {method arglist} {
-    variable compile
-    variable typemethodInfo
-
-    set errRoot "Error in \"delegate typemethod [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {$component eq "" && $pattern eq ""} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {$methodTail eq "*" && $target ne ""} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {$methodTail ne "*" && $exceptions ne ""} {
-        error "$errRoot, can only specify \"except\" with \"*\"" 
-    }
-
-    if {$pattern ne "" && $target ne ""} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {$token eq "*"} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, define the component
-    if {$component ne ""} {
-        Comp.DefineTypecomponent $component $errRoot
-    }
-
-    # NEXT, define the pattern.
-    if {$pattern eq ""} {
-        if {$methodTail eq "*"} {
-            set pattern "%c %m"
-        } elseif {$target ne ""} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined 
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::typemethodInfo $errRoot
-
-    set typemethodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(excepttypemethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-}
-
-
-# Creates a delegated method delegating it to a particular
-# component or command.
-#
-# method        The name of the method
-# arglist       Delegation options.
-
-proc ::snit::Comp.DelegatedMethod {method arglist} {
-    variable compile
-    variable methodInfo
-
-    set errRoot "Error in \"delegate method [list $method]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-    set pattern ""
-    set methodTail [lindex $method end]
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            using  { set pattern $value    }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {$component eq "" && $pattern eq ""} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {$methodTail eq "*" && $target ne ""} {
-        error "$errRoot, cannot specify \"as\" with \"*\""
-    }
-
-    if {$methodTail ne "*" && $exceptions ne ""} {
-        error "$errRoot, can only specify \"except\" with \"*\"" 
-    }
-
-    if {$pattern ne "" && $target ne ""} {
-        error "$errRoot, cannot specify both \"as\" and \"using\""
-    }
-
-    foreach token [lrange $method 1 end-1] {
-        if {$token eq "*"} {
-            error "$errRoot, \"*\" must be the last token."
-        }
-    }
-
-    # NEXT, we delegate some methods
-    set compile(delegatesmethods) yes
-
-    # NEXT, define the component.  Allow typecomponents.
-    if {$component ne ""} {
-        if {[lsearch -exact $compile(typecomponents) $component] == -1} {
-            Comp.DefineComponent $component $errRoot
-        }
-    }
-
-    # NEXT, define the pattern.
-    if {$pattern eq ""} {
-        if {$methodTail eq "*"} {
-            set pattern "%c %m"
-        } elseif {$target ne ""} {
-            set pattern "%c $target"
-        } else {
-            set pattern "%c %m"
-        }
-    }
-
-    # Make sure the pattern is a valid list.
-    if {[catch {lindex $pattern 0} result]} {
-        error "$errRoot, the using pattern, \"$pattern\", is not a valid list"
-    }
-
-    # NEXT, check the method name against previously defined 
-    # methods.
-    Comp.CheckMethodName $method 1 ::snit::methodInfo $errRoot
-
-    # NEXT, save the method info.
-    set methodInfo($method) [list 0 $pattern $component]
-
-    if {[string equal $methodTail "*"]} {
-        Mappend compile(defs) {
-            set %TYPE%::Snit_info(exceptmethods) %EXCEPT%
-        } %EXCEPT% [list $exceptions]
-    }
-} 
-
-# Creates a delegated option, delegating it to a particular
-# component and, optionally, to a particular option of that
-# component.
-#
-# optionDef     The option definition
-# args          definition arguments.
-
-proc ::snit::Comp.DelegatedOption {optionDef arglist} {
-    variable compile
-
-    # First, get the three option names.
-    set option [lindex $optionDef 0]
-    set resourceName [lindex $optionDef 1]
-    set className [lindex $optionDef 2]
-
-    set errRoot "Error in \"delegate option [list $optionDef]...\""
-
-    # Next, parse the delegation options.
-    set component ""
-    set target ""
-    set exceptions {}
-
-    foreach {opt value} $arglist {
-        switch -exact $opt {
-            to     { set component $value  }
-            as     { set target $value     }
-            except { set exceptions $value }
-            default {
-                error "$errRoot, unknown delegation option \"$opt\""
-            }
-        }
-    }
-
-    if {$component eq ""} {
-        error "$errRoot, missing \"to\""
-    }
-
-    if {$option eq "*" && $target ne ""} {
-        error "$errRoot, cannot specify \"as\" with \"delegate option *\""
-    }
-
-    if {$option ne "*" && $exceptions ne ""} {
-        error "$errRoot, can only specify \"except\" with \"delegate option *\"" 
-    }
-
-    # Next, validate the option name
-
-    if {"*" != $option} {
-        if {![Comp.OptionNameIsValid $option]} {
-            error "$errRoot, badly named option \"$option\""
-        }
-    }
-
-    if {$option in $compile(localoptions)} {
-        error "$errRoot, \"$option\" has been defined locally"
-    }
-
-    if {$option in $compile(delegatedoptions)} {
-        error "$errRoot, \"$option\" is multiply delegated"
-    }
-
-    # NEXT, define the component
-    Comp.DefineComponent $component $errRoot
-
-    # Next, define the target option, if not specified.
-    if {![string equal $option "*"] &&
-        [string equal $target ""]} {
-        set target $option
-    }
-
-    # NEXT, save the delegation data.
-    set compile(hasoptions) yes
-
-    if {![string equal $option "*"]} {
-        lappend compile(delegatedoptions) $option
-
-        # Next, compute the resource and class names, if they aren't
-        # already defined.
-
-        if {"" == $resourceName} {
-            set resourceName [string range $option 1 end]
-        }
-
-        if {"" == $className} {
-            set className [Capitalize $resourceName]
-        }
-
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(islocal-%OPTION%) 0
-            set %TYPE%::Snit_optionInfo(resource-%OPTION%) %RES%
-            set %TYPE%::Snit_optionInfo(class-%OPTION%) %CLASS%
-            lappend %TYPE%::Snit_optionInfo(delegated) %OPTION%
-            set %TYPE%::Snit_optionInfo(target-%OPTION%) [list %COMP% %TARGET%]
-            lappend %TYPE%::Snit_optionInfo(delegated-%COMP%) %OPTION%
-        }   %OPTION% $option \
-            %COMP% $component \
-            %TARGET% $target \
-            %RES% $resourceName \
-            %CLASS% $className 
-    } else {
-        Mappend  compile(defs) {
-            set %TYPE%::Snit_optionInfo(starcomp) %COMP%
-            set %TYPE%::Snit_optionInfo(except) %EXCEPT%
-        } %COMP% $component %EXCEPT% [list $exceptions]
-    }
-} 
-
-# Exposes a component, effectively making the component's command an
-# instance method.
-#
-# component     The logical name of the delegate
-# "as"          sugar; if not "", must be "as"
-# methodname    The desired method name for the component's command, or ""
-
-proc ::snit::Comp.statement.expose {component {"as" ""} {methodname ""}} {
-    variable compile
-
-
-    # FIRST, define the component
-    Comp.DefineComponent $component
-
-    # NEXT, define the method just as though it were in the type
-    # definition.
-    if {[string equal $methodname ""]} {
-        set methodname $component
-    }
-
-    Comp.statement.method $methodname args [Expand {
-        if {[llength $args] == 0} {
-            return $%COMPONENT%
-        }
-
-        if {[string equal $%COMPONENT% ""]} {
-            error "undefined component \"%COMPONENT%\""
-        }
-
-
-        set cmd [linsert $args 0 $%COMPONENT%]
-        return [uplevel 1 $cmd]
-    } %COMPONENT% $component]
-}
-
-
-
-#-----------------------------------------------------------------------
-# Public commands
-
-# Compile a type definition, and return the results as a list of two
-# items: the fully-qualified type name, and a script that will define
-# the type when executed.
-#
-# which		type, widget, or widgetadaptor
-# type          the type name
-# body          the type definition
-proc ::snit::compile {which type body} {
-    return [Comp.Compile $which $type $body]
-}
-
-proc ::snit::type {type body} {
-    return [Comp.Define [Comp.Compile type $type $body]]
-}
-
-proc ::snit::widget {type body} {
-    return [Comp.Define [Comp.Compile widget $type $body]]
-}
-
-proc ::snit::widgetadaptor {type body} {
-    return [Comp.Define [Comp.Compile widgetadaptor $type $body]]
-}
-
-proc ::snit::typemethod {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_info           Snit_info
-    upvar ${type}::Snit_typemethodInfo Snit_typemethodInfo
-
-    # FIRST, check the typemethod name against previously defined 
-    # typemethods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_typemethodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::typemethod $type $method" $arglist
-
-    # Next, add magic reference to type.
-    set arglist [concat type $arglist]
-
-    # Next, add typevariable declarations to body:
-    set body "$Snit_info(tvardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_typemethod%m %t" ""}
-        uplevel 1 [list proc ${type}::Snit_typemethod$method $arglist $body]
-    } else {
-        set Snit_typemethodInfo($method) {0 "%t::Snit_htypemethod%j %t" ""}
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_htypemethod$suffix $arglist $body]
-    }
-}
-
-proc ::snit::method {type method arglist body} {
-    # Make sure the type exists.
-    if {![info exists ${type}::Snit_info]} {
-        error "no such type: \"$type\""
-    }
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-    upvar ${type}::Snit_info        Snit_info
-
-    # FIRST, check the method name against previously defined 
-    # methods.
-    Comp.CheckMethodName $method 0 ${type}::Snit_methodInfo \
-        "Cannot define \"$method\""
-
-    # NEXT, check the arguments
-    CheckArgs "snit::method $type $method" $arglist
-
-    # Next, add magic references to type and self.
-    set arglist [concat type selfns win self $arglist]
-
-    # Next, add variable declarations to body:
-    set body "$Snit_info(tvardecs)\n$Snit_info(ivardecs)\n$body"
-
-    # Next, define it.
-    if {[llength $method] == 1} {
-        set Snit_methodInfo($method) {0 "%t::Snit_method%m %t %n %w %s" ""}
-        uplevel 1 [list proc ${type}::Snit_method$method $arglist $body]
-    } else {
-        set Snit_methodInfo($method) {0 "%t::Snit_hmethod%j %t %n %w %s" ""}
-
-        set suffix [join $method _]
-        uplevel 1 [list proc ${type}::Snit_hmethod$suffix $arglist $body]
-    }
-}
-
-# Defines a proc within the compiler; this proc can call other
-# type definition statements, and thus can be used for meta-programming.
-proc ::snit::macro {name arglist body} {
-    variable compiler
-    variable reservedwords
-
-    # FIRST, make sure the compiler is defined.
-    Comp.Init
-
-    # NEXT, check the macro name against the reserved words
-    if {[lsearch -exact $reservedwords $name] != -1} {
-        error "invalid macro name \"$name\""
-    }
-
-    # NEXT, see if the name has a namespace; if it does, define the
-    # namespace.
-    set ns [namespace qualifiers $name]
-
-    if {$ns ne ""} {
-        $compiler eval "namespace eval $ns {}"
-    }
-
-    # NEXT, define the macro
-    $compiler eval [list _proc $name $arglist $body]
-}
-
-#-----------------------------------------------------------------------
-# Utility Functions
-#
-# These are utility functions used while compiling Snit types.
-
-# Builds a template from a tagged list of text blocks, then substitutes
-# all symbols in the mapTable, returning the expanded template.
-proc ::snit::Expand {template args} {
-    return [string map $args $template]
-}
-
-# Expands a template and appends it to a variable.
-proc ::snit::Mappend {varname template args} {
-    upvar $varname myvar
-
-    append myvar [string map $args $template]
-}
-
-# Checks argument list against reserved args 
-proc ::snit::CheckArgs {which arglist} {
-    variable reservedArgs
-    
-    foreach name $reservedArgs {
-        if {$name in $arglist} {
-            error "$which's arglist may not contain \"$name\" explicitly"
-        }
-    }
-}
-
-# Capitalizes the first letter of a string.
-proc ::snit::Capitalize {text} {
-    return [string toupper $text 0]
-}
-
-
-#=======================================================================
-# Snit Runtime Library
-#
-# These are procs used by Snit types and widgets at runtime.
-
-#-----------------------------------------------------------------------
-# Object Creation
-
-# Creates a new instance of the snit::type given its name and the args.
-#
-# type		The snit::type
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.type.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; 
-        # append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-        
-        set name "$ns$name"
-    }
-
-    # NEXT, if %AUTO% appears in the name, generate a unique 
-    # command name.  Otherwise, ensure that the name isn't in use.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    } elseif {!$Snit_info(canreplace) && [llength [info commands $name]]} {
-        error "command \"$name\" already exists"
-    }
-
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns {}
-
-    # NEXT, install the dispatcher
-    RT.MakeInstanceCommand $type $selfns $name
-
-    # Initialize the options to their defaults. 
-    namespace upvar ${selfns} options options
-
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-        
-    # Initialize the instance vars to their defaults.
-    # selfns must be defined, as it is used implicitly.
-    ${type}::Snit_instanceVars $selfns
-
-    # Execute the type's constructor.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-        
-        set theInfo $errorInfo
-        set theCode $errorCode
-
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-# Creates a new instance of the snit::widget or snit::widgetadaptor
-# given its name and the args.
-#
-# type		The snit::widget or snit::widgetadaptor
-# name		The instance name
-# args		Args to pass to the constructor
-
-proc ::snit::RT.widget.typemethod.create {type name args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-
-    # FIRST, if %AUTO% appears in the name, generate a unique 
-    # command name.
-    if {[string match "*%AUTO%*" $name]} {
-        set name [::snit::RT.UniqueName Snit_info(counter) $type $name]
-    }
-            
-    # NEXT, create the instance's namespace.
-    set selfns \
-        [::snit::RT.UniqueInstanceNamespace Snit_info(counter) $type]
-    namespace eval $selfns { }
-            
-    # NEXT, Initialize the widget's own options to their defaults.
-    namespace upvar $selfns options options
-
-    foreach opt $Snit_optionInfo(local) {
-        set options($opt) $Snit_optionInfo(default-$opt)
-    }
-
-    # Initialize the instance vars to their defaults.
-    ${type}::Snit_instanceVars $selfns
-
-    # NEXT, if this is a normal widget (not a widget adaptor) then create a
-    # frame as its hull.  We set the frame's -class to the user's widgetclass,
-    # or, if none, search for -class in the args list, otherwise default to
-    # the basename of the $type with an initial upper case letter.
-    if {!$Snit_info(isWidgetAdaptor)} {
-        # FIRST, determine the class name
-	set wclass $Snit_info(widgetclass)
-        if {$Snit_info(widgetclass) eq ""} {
-	    set idx [lsearch -exact $args -class]
-	    if {$idx >= 0 && ($idx%2 == 0)} {
-		# -class exists and is in the -option position
-		set wclass [lindex $args [expr {$idx+1}]]
-		set args [lreplace $args $idx [expr {$idx+1}]]
-	    } else {
-		set wclass [::snit::Capitalize [namespace tail $type]]
-	    }
-	}
-
-        # NEXT, create the widget
-        set self $name
-        package require Tk
-        ${type}::installhull using $Snit_info(hulltype) -class $wclass
-
-        # NEXT, let's query the option database for our
-        # widget, now that we know that it exists.
-        foreach opt $Snit_optionInfo(local) {
-            set dbval [RT.OptionDbGet $type $name $opt]
-
-            if {"" != $dbval} {
-                set options($opt) $dbval
-            }
-        }
-    }
-
-    # Execute the type's constructor, and verify that it
-    # has a hull.
-    set errcode [catch {
-        RT.ConstructInstance $type $selfns $name $args
-
-        ::snit::RT.Component $type $selfns hull
-
-        # Prepare to call the object's destructor when the
-        # <Destroy> event is received.  Use a Snit-specific bindtag
-        # so that the widget name's tag is unencumbered.
-
-        bind Snit$type$name <Destroy> [::snit::Expand {
-            ::snit::RT.DestroyObject %TYPE% %NS% %W
-        } %TYPE% $type %NS% $selfns]
-
-        # Insert the bindtag into the list of bindtags right
-        # after the widget name.
-        set taglist [bindtags $name]
-        set ndx [lsearch -exact $taglist $name]
-        incr ndx
-        bindtags $name [linsert $taglist $ndx Snit$type$name]
-    } result]
-
-    if {$errcode} {
-        global errorInfo
-        global errorCode
-
-        set theInfo $errorInfo
-        set theCode $errorCode
-        ::snit::RT.DestroyObject $type $selfns $name
-        error "Error in constructor: $result" $theInfo $theCode
-    }
-
-    # NEXT, return the object's name.
-    return $name
-}
-
-
-# RT.MakeInstanceCommand type selfns instance
-#
-# type        The object type
-# selfns      The instance namespace
-# instance    The instance name
-#
-# Creates the instance proc.
-
-proc ::snit::RT.MakeInstanceCommand {type selfns instance} {
-    variable ${type}::Snit_info
-        
-    # FIRST, remember the instance name.  The Snit_instance variable
-    # allows the instance to figure out its current name given the
-    # instance namespace.
-
-    namespace upvar $selfns Snit_instance Snit_instance
-
-    set Snit_instance $instance
-
-    # NEXT, qualify the proc name if it's a widget.
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-
-    # NEXT, install the new proc
-    # WHD: Snit 2.0 code
-
-    set unknownCmd [list ::snit::RT.UnknownMethod $type $selfns $instance ""]
-    set createCmd [list namespace ensemble create \
-                       -command $procname \
-                       -unknown $unknownCmd \
-                       -prefixes 0]
-
-    namespace eval $selfns $createCmd
-
-    # NEXT, add the trace.
-    trace add command $procname {rename delete} \
-        [list ::snit::RT.InstanceTrace $type $selfns $instance]
-}
-
-# This proc is called when the instance command is renamed.
-# If op is delete, then new will always be "", so op is redundant.
-#
-# type		The fully-qualified type name
-# selfns	The instance namespace
-# win		The original instance/tk window name.
-# old		old instance command name
-# new		new instance command name
-# op		rename or delete
-#
-# If the op is delete, we need to clean up the object; otherwise,
-# we need to track the change.
-#
-# NOTE: In Tcl 8.4.2 there's a bug: errors in rename and delete
-# traces aren't propagated correctly.  Instead, they silently
-# vanish.  Add a catch to output any error message.
-
-proc ::snit::RT.InstanceTrace {type selfns win old new op} {
-    variable ${type}::Snit_info
-
-    # Note to developers ...
-    # For Tcl 8.4.0, errors thrown in trace handlers vanish silently.
-    # Therefore we catch them here and create some output to help in
-    # debugging such problems.
-
-    if {[catch {
-        # FIRST, clean up if necessary
-        if {"" == $new} {
-            if {$Snit_info(isWidget)} {
-                destroy $win
-            } else {
-                ::snit::RT.DestroyObject $type $selfns $win
-            }
-        } else {
-            # Otherwise, track the change.
-            variable ${selfns}::Snit_instance
-            set Snit_instance [uplevel 1 [list namespace which -command $new]]
-            
-            # Also, clear the instance caches, as many cached commands
-            # might be invalid.
-            RT.ClearInstanceCaches $selfns
-        }
-    } result]} {
-        global errorInfo
-        # Pop up the console on Windows wish, to enable stdout.
-        # This clobbers errorInfo on unix, so save it so we can print it.
-        set ei $errorInfo
-        catch {console show}
-        puts "Error in ::snit::RT.InstanceTrace $type $selfns $win $old $new $op:"
-        puts $ei
-    }
-}
-
-# Calls the instance constructor and handles related housekeeping.
-proc ::snit::RT.ConstructInstance {type selfns instance arglist} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_iinfo
-
-    # Track whether we are constructed or not.
-    set Snit_iinfo(constructed) 0
-
-    # Call the user's constructor
-    eval [linsert $arglist 0 \
-              ${type}::Snit_constructor $type $selfns $instance $instance]
-
-    set Snit_iinfo(constructed) 1
-
-    # Validate the initial set of options (including defaults)
-    foreach option $Snit_optionInfo(local) {
-        set value [set ${selfns}::options($option)]
-
-        if {$Snit_optionInfo(typespec-$option) ne ""} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option default: $result"
-            }
-        }
-    }
-
-    # Unset the configure cache for all -readonly options.
-    # This ensures that the next time anyone tries to 
-    # configure it, an error is thrown.
-    foreach opt $Snit_optionInfo(local) {
-        if {$Snit_optionInfo(readonly-$opt)} {
-            unset -nocomplain ${selfns}::Snit_configureCache($opt)
-        }
-    }
-
-    return
-}
-
-# Returns a unique command name.  
-#
-# REQUIRE: type is a fully qualified name.
-# REQUIRE: name contains "%AUTO%"
-# PROMISE: the returned command name is unused.
-proc ::snit::RT.UniqueName {countervar type name} {
-    upvar $countervar counter 
-    while 1 {
-        # FIRST, bump the counter and define the %AUTO% instance name;
-        # then substitute it into the specified name.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set auto "[namespace tail $type]$counter"
-        set candidate [Expand $name %AUTO% $auto]
-        if {![llength [info commands $candidate]]} {
-            return $candidate
-        }
-    }
-}
-
-# Returns a unique instance namespace, fully qualified.
-#
-# countervar     The name of a counter variable
-# type           The instance's type
-#
-# REQUIRE: type is fully qualified
-# PROMISE: The returned namespace name is unused.
-
-proc ::snit::RT.UniqueInstanceNamespace {countervar type} {
-    upvar $countervar counter 
-    while 1 {
-        # FIRST, bump the counter and define the namespace name.
-        # Then see if it already exists.  Wrap around at
-        # 2^31 - 2 to prevent overflow problems.
-        incr counter
-        if {$counter > 2147483646} {
-            set counter 0
-        }
-        set ins "${type}::Snit_inst${counter}"
-        if {![namespace exists $ins]} {
-            return $ins
-        }
-    }
-}
-
-# Retrieves an option's value from the option database.
-# Returns "" if no value is found.
-proc ::snit::RT.OptionDbGet {type self opt} {
-    variable ${type}::Snit_optionInfo
-
-    return [option get $self \
-                $Snit_optionInfo(resource-$opt) \
-                $Snit_optionInfo(class-$opt)]
-}
-
-#-----------------------------------------------------------------------
-# Object Destruction
-
-# Implements the standard "destroy" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-
-proc ::snit::RT.method.destroy {type selfns win self} {
-    variable ${selfns}::Snit_iinfo
-
-    # Can't destroy the object if it isn't complete constructed.
-    if {!$Snit_iinfo(constructed)} {
-        return -code error "Called 'destroy' method in constructor"
-    }
-
-    # Calls Snit_cleanup, which (among other things) calls the
-    # user's destructor.
-    ::snit::RT.DestroyObject $type $selfns $win
-}
-
-# This is the function that really cleans up; it's automatically 
-# called when any instance is destroyed, e.g., by "$object destroy"
-# for types, and by the <Destroy> event for widgets.
-#
-# type		The fully-qualified type name.
-# selfns	The instance namespace
-# win		The original instance command name.
-
-proc ::snit::RT.DestroyObject {type selfns win} {
-    variable ${type}::Snit_info
-
-    # If the variable Snit_instance doesn't exist then there's no
-    # instance command for this object -- it's most likely a 
-    # widgetadaptor. Consequently, there are some things that
-    # we don't need to do.
-    if {[info exists ${selfns}::Snit_instance]} {
-        namespace upvar $selfns Snit_instance instance
-            
-        # First, remove the trace on the instance name, so that we
-        # don't call RT.DestroyObject recursively.
-        RT.RemoveInstanceTrace $type $selfns $win $instance
-            
-        # Next, call the user's destructor
-        ${type}::Snit_destructor $type $selfns $win $instance
-
-        # Next, if this isn't a widget, delete the instance command.
-        # If it is a widget, get the hull component's name, and rename
-        # it back to the widget name
-                
-        # Next, delete the hull component's instance command,
-        # if there is one.
-        if {$Snit_info(isWidget)} {
-            set hullcmd [::snit::RT.Component $type $selfns hull]
-            
-            catch {rename $instance ""}
-
-            # Clear the bind event
-            bind Snit$type$win <Destroy> ""
-
-            if {[llength [info commands $hullcmd]]} {
-                # FIRST, rename the hull back to its original name.
-                # If the hull is itself a megawidget, it will have its
-                # own cleanup to do, and it might not do it properly
-                # if it doesn't have the right name.
-                rename $hullcmd ::$instance
-
-                # NEXT, destroy it.
-                destroy $instance
-            }
-        } else {
-            catch {rename $instance ""}
-        }
-    }
-
-    # Next, delete the instance's namespace.  This kills any
-    # instance variables.
-    namespace delete $selfns
-
-    return
-}
-
-# Remove instance trace
-# 
-# type           The fully qualified type name
-# selfns         The instance namespace
-# win            The original instance name/Tk window name
-# instance       The current instance name
-
-proc ::snit::RT.RemoveInstanceTrace {type selfns win instance} {
-    variable ${type}::Snit_info
-
-    if {$Snit_info(isWidget)} {
-        set procname ::$instance
-    } else {
-        set procname $instance
-    }
-        
-    # NEXT, remove any trace on this name
-    catch {
-        trace remove command $procname {rename delete} \
-            [list ::snit::RT.InstanceTrace $type $selfns $win]
-    }
-}
-
-#-----------------------------------------------------------------------
-# Typecomponent Management and Method Caching
-
-# Typecomponent trace; used for write trace on typecomponent 
-# variables.  Saves the new component object name, provided 
-# that certain conditions are met.  Also clears the typemethod
-# cache.
-
-proc ::snit::RT.TypecomponentTrace {type component n1 n2 op} {
-    namespace upvar $type \
-        Snit_info           Snit_info \
-        $component          cvar      \
-        Snit_typecomponents Snit_typecomponents
-
-        
-    # Save the new component value.
-    set Snit_typecomponents($component) $cvar
-
-    # Clear the typemethod cache.
-    # TBD: can we unset just the elements related to
-    # this component?
-
-    # WHD: Namespace 2.0 code
-    namespace ensemble configure $type -map {}
-}
-
-# WHD: Snit 2.0 code
-#
-# RT.UnknownTypemethod type eId eCmd method args
-#
-# type		The type
-# eId           The ensemble command ID; "" for the instance itself.
-# eCmd          The ensemble command name.
-# method	The unknown method name.
-# args          The additional arguments, if any.
-#
-# This proc looks up the method relative to the specified ensemble.
-# If no method is found, it assumes that the "create" method is
-# desired, and that the "method" is the instance name.  In this case,
-# it returns the "create" typemethod command with the instance name
-# appended; this will cause the instance to be created without updating
-# the -map.  If the method is found, the method's command is created and
-# added to the -map; the function returns the empty list.
-
-proc snit::RT.UnknownTypemethod {type eId eCmd method args} {
-    namespace upvar $type \
-        Snit_typemethodInfo  Snit_typemethodInfo \
-        Snit_typecomponents  Snit_typecomponents \
-        Snit_info            Snit_info
-    
-    # FIRST, get the pattern data and the typecomponent name.
-    set implicitCreate 0
-    set instanceName ""
-
-    set fullMethod $eId
-    lappend fullMethod $method
-    set starredMethod [concat $eId *]
-    set methodTail $method
-
-    if {[info exists Snit_typemethodInfo($fullMethod)]} {
-        set key $fullMethod
-    } elseif {[info exists Snit_typemethodInfo($starredMethod)]} {
-        if {[lsearch -exact $Snit_info(excepttypemethods) $methodTail] == -1} {
-            set key $starredMethod
-        } else {
-            # WHD: The method is explicitly not delegated, so this is an error.
-            # Or should we treat it as an instance name?
-            return [list ]
-        }
-    } elseif {$Snit_info(hasinstances)} {
-        # Assume the unknown name is an instance name to create, unless
-        # this is a widget and the style of the name is wrong, or the
-        # name mimics a standard typemethod.
-
-        if {[set ${type}::Snit_info(isWidget)] && 
-            ![string match ".*" $method]} {
-            return [list ]
-        }
-
-        # Without this check, the call "$type info" will redefine the
-        # standard "::info" command, with disastrous results.  Since it's
-        # a likely thing to do if !-typeinfo, put in an explicit check.
-        if {$method eq "info" || $method eq "destroy"} {
-            return [list ]
-        }
-
-        set implicitCreate 1
-        set instanceName $method
-        set key create
-        set method create
-    } else {
-        return [list ]
-    }
-    
-    foreach {flag pattern compName} $Snit_typemethodInfo($key) {}
-
-    if {$flag == 1} {
-        # FIRST, define the ensemble command.
-        lappend eId $method
-
-        set newCmd ${type}::Snit_ten[llength $eId]_[join $eId _]
-
-        set unknownCmd [list ::snit::RT.UnknownTypemethod \
-                            $type $eId]
-
-        set createCmd [list namespace ensemble create \
-                           -command $newCmd \
-                           -unknown $unknownCmd \
-                           -prefixes 0]
-
-        namespace eval $type $createCmd
-        
-        # NEXT, add the method to the current ensemble
-        set map [namespace ensemble configure $eCmd -map]
-
-        dict append map $method $newCmd
-
-        namespace ensemble configure $eCmd -map $map
-
-        return [list ]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $fullMethod \
-                     %m [lindex $fullMethod end] \
-                     %j [join $fullMethod _]]
-    
-    if {$compName ne ""} {
-        if {![info exists Snit_typecomponents($compName)]} {
-            error "$type delegates typemethod \"$method\" to undefined typecomponent \"$compName\""
-        }
-        
-        lappend subList %c [list $Snit_typecomponents($compName)]
-    }
-
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    if {$implicitCreate} {
-        # In this case, $method is the name of the instance to
-        # create.  Don't cache, as we usually won't do this one
-        # again.
-        lappend command $instanceName
-        return $command
-    }
-
-
-    # NEXT, if the actual command name isn't fully qualified,
-    # assume it's global.
-    set cmd [lindex $command 0]
-
-    if {[string index $cmd 0] ne ":"} {
-        set command [lreplace $command 0 0 "::$cmd"]
-    }
-
-    # NEXT, update the ensemble map.
-    set map [namespace ensemble configure $eCmd -map]
-
-    dict append map $method $command
-
-    namespace ensemble configure $eCmd -map $map
-
-    return [list ]
-}
-
-#-----------------------------------------------------------------------
-# Component Management and Method Caching
-
-# Retrieves the object name given the component name.
-proc ::snit::RT.Component {type selfns name} {
-    variable ${selfns}::Snit_components
-
-    if {[catch {set Snit_components($name)} result]} {
-        variable ${selfns}::Snit_instance
-
-        error "component \"$name\" is undefined in $type $Snit_instance"
-    }
-    
-    return $result
-}
-
-# Component trace; used for write trace on component instance 
-# variables.  Saves the new component object name, provided 
-# that certain conditions are met.  Also clears the method
-# cache.
-
-proc ::snit::RT.ComponentTrace {type selfns component n1 n2 op} {
-    namespace upvar $type Snit_info Snit_info
-    namespace upvar $selfns \
-        $component      cvar            \
-        Snit_components Snit_components
-        
-    # If they try to redefine the hull component after
-    # it's been defined, that's an error--but only if
-    # this is a widget or widget adaptor.
-    if {"hull" == $component && 
-        $Snit_info(isWidget) &&
-        [info exists Snit_components($component)]} {
-        set cvar $Snit_components($component)
-        error "The hull component cannot be redefined"
-    }
-
-    # Save the new component value.
-    set Snit_components($component) $cvar
-
-    # Clear the instance caches.
-    # TBD: can we unset just the elements related to
-    # this component?
-    RT.ClearInstanceCaches $selfns
-}
-
-# WHD: Snit 2.0 code
-#
-# RT.UnknownMethod type selfns win eId eCmd method args
-#
-# type       The type or widget command.
-# selfns     The instance namespace.
-# win        The original instance name.
-# eId        The ensemble command ID; "" for the instance itself.
-# eCmd       The real ensemble command name
-# method     The unknown method name
-# args       The additional arguments, if any.
-#
-# This proc looks up the method relative to the specific ensemble.
-# If no method is found, it returns an empty list; this will result in
-# the parent ensemble throwing an error.
-# If the method is found, the ensemble's -map is extended with the 
-# correct command, and the empty list is returned; this caches the
-# method's command.  If the method is found, and it is also an
-# ensemble, the ensemble command is created with an empty map.
-
-proc ::snit::RT.UnknownMethod {type selfns win eId eCmd method args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_methodInfo
-    variable ${type}::Snit_typecomponents
-    variable ${selfns}::Snit_components
-
-    # FIRST, get the "self" value
-    set self [set ${selfns}::Snit_instance]
-
-    # FIRST, get the pattern data and the component name.
-    set fullMethod $eId
-    lappend fullMethod $method
-    set starredMethod [concat $eId *]
-    set methodTail $method
-
-    if {[info exists Snit_methodInfo($fullMethod)]} {
-        set key $fullMethod
-    } elseif {[info exists Snit_methodInfo($starredMethod)] &&
-              [lsearch -exact $Snit_info(exceptmethods) $methodTail] == -1} {
-        set key $starredMethod
-    } else {
-        return [list ]
-    }
-
-    foreach {flag pattern compName} $Snit_methodInfo($key) {}
-
-    if {$flag == 1} {
-        # FIRST, define the ensemble command.
-        lappend eId $method
-
-        # Fix provided by Anton Kovalenko; previously this call erroneously
-        # used ${type} rather than ${selfns}.
-        set newCmd ${selfns}::Snit_en[llength $eId]_[join $eId _]
-
-        set unknownCmd [list ::snit::RT.UnknownMethod \
-                            $type $selfns $win $eId]
-
-        set createCmd [list namespace ensemble create \
-                           -command $newCmd \
-                           -unknown $unknownCmd \
-                           -prefixes 0]
-
-        namespace eval $selfns $createCmd
-        
-        # NEXT, add the method to the current ensemble
-        set map [namespace ensemble configure $eCmd -map]
-
-        dict append map $method $newCmd
-
-        namespace ensemble configure $eCmd -map $map
-
-        return [list ]
-    }
-
-    # NEXT, build the substitution list
-    set subList [list \
-                     %% % \
-                     %t $type \
-                     %M $fullMethod \
-                     %m [lindex $fullMethod end] \
-                     %j [join $fullMethod _] \
-                     %n [list $selfns] \
-                     %w [list $win] \
-                     %s [list $self]]
-
-    if {$compName ne ""} {
-        if {[info exists Snit_components($compName)]} {
-            set compCmd $Snit_components($compName)
-        } elseif {[info exists Snit_typecomponents($compName)]} {
-            set compCmd $Snit_typecomponents($compName)
-        } else {
-            error "$type $self delegates method \"$fullMethod\" to undefined component \"$compName\""
-        }
-
-        lappend subList %c [list $compCmd]
-    }
-
-    # Note: The cached command will execute faster if it's
-    # already a list.
-    set command {}
-
-    foreach subpattern $pattern {
-        lappend command [string map $subList $subpattern]
-    }
-
-    # NEXT, if the actual command name isn't fully qualified,
-    # assume it's global.
-
-    set cmd [lindex $command 0]
-
-    if {[string index $cmd 0] ne ":"} {
-        set command [lreplace $command 0 0 "::$cmd"]
-    }
-
-    # NEXT, update the ensemble map.
-    set map [namespace ensemble configure $eCmd -map]
-
-    dict append map $method $command
-
-    namespace ensemble configure $eCmd -map $map
-
-    return [list ]
-}
-
-# Clears all instance command caches
-proc ::snit::RT.ClearInstanceCaches {selfns} {
-    # WHD: clear ensemble -map
-    if {![info exists ${selfns}::Snit_instance]} {
-        # Component variable set prior to constructor
-        # via the "variable" type definition statement.
-        return
-    }
-    set self [set ${selfns}::Snit_instance]
-    namespace ensemble configure $self -map {}
-
-    unset -nocomplain -- ${selfns}::Snit_cgetCache
-    unset -nocomplain -- ${selfns}::Snit_configureCache
-    unset -nocomplain -- ${selfns}::Snit_validateCache
-}
-
-
-#-----------------------------------------------------------------------
-# Component Installation
-
-# Implements %TYPE%::installhull.  The variables self and selfns
-# must be defined in the caller's context.
-#
-# Installs the named widget as the hull of a 
-# widgetadaptor.  Once the widget is hijacked, its new name
-# is assigned to the hull component.
-
-proc ::snit::RT.installhull {type {using "using"} {widgetType ""} args} {
-    variable ${type}::Snit_info
-    variable ${type}::Snit_optionInfo
-    upvar 1 self self
-    upvar 1 selfns selfns
-    namespace upvar $selfns \
-        hull    hull        \
-        options options
-
-    # FIRST, make sure we can do it.
-    if {!$Snit_info(isWidget)} { 
-        error "installhull is valid only for snit::widgetadaptors"
-    }
-            
-    if {[info exists ${selfns}::Snit_instance]} {
-        error "hull already installed for $type $self"
-    }
-
-    # NEXT, has it been created yet?  If not, create it using
-    # the specified arguments.
-    if {"using" == $using} {
-        # FIRST, create the widget
-        set cmd [linsert $args 0 $widgetType $self]
-        set obj [uplevel 1 $cmd]
-            
-        # NEXT, for each option explicitly delegated to the hull
-        # that doesn't appear in the usedOpts list, get the
-        # option database value and apply it--provided that the
-        # real option name and the target option name are different.
-        # (If they are the same, then the option database was
-        # already queried as part of the normal widget creation.)
-        #
-        # Also, we don't need to worry about implicitly delegated
-        # options, as the option and target option names must be
-        # the same.
-        if {[info exists Snit_optionInfo(delegated-hull)]} {
-                
-            # FIRST, extract all option names from args
-            set usedOpts {}
-            set ndx [lsearch -glob $args "-*"]
-            foreach {opt val} [lrange $args $ndx end] {
-                lappend usedOpts $opt
-            }
-                
-            foreach opt $Snit_optionInfo(delegated-hull) {
-                set target [lindex $Snit_optionInfo(target-$opt) 1]
-                
-                if {"$target" == $opt} {
-                    continue
-                }
-                    
-                set result [lsearch -exact $usedOpts $target]
-                    
-                if {$result != -1} {
-                    continue
-                }
-
-                set dbval [RT.OptionDbGet $type $self $opt]
-                $obj configure $target $dbval
-            }
-        }
-    } else {
-        set obj $using
-        
-        if {$obj ne $self} {
-            error \
-                "hull name mismatch: \"$obj\" != \"$self\""
-        }
-    }
-
-    # NEXT, get the local option defaults.
-    foreach opt $Snit_optionInfo(local) {
-        set dbval [RT.OptionDbGet $type $self $opt]
-            
-        if {"" != $dbval} {
-            set options($opt) $dbval
-        }
-    }
-
-
-    # NEXT, do the magic
-    set i 0
-    while 1 {
-        incr i
-        set newName "::hull${i}$self"
-        if {![llength [info commands $newName]]} {
-            break
-        }
-    }
-        
-    rename ::$self $newName
-    RT.MakeInstanceCommand $type $selfns $self
-        
-    # Note: this relies on RT.ComponentTrace to do the dirty work.
-    set hull $newName
-        
-    return
-}
-
-# Implements %TYPE%::install.
-#
-# Creates a widget and installs it as the named component.
-# It expects self and selfns to be defined in the caller's context.
-
-proc ::snit::RT.install {type compName "using" widgetType winPath args} {
-    variable ${type}::Snit_optionInfo
-    variable ${type}::Snit_info
-    upvar 1 self   self
-    upvar 1 selfns selfns
-
-    namespace upvar ${selfns} \
-        $compName comp        \
-        hull      hull
-
-    # We do the magic option database stuff only if $self is
-    # a widget.
-    if {$Snit_info(isWidget)} {
-        if {"" == $hull} {
-            error "tried to install \"$compName\" before the hull exists"
-        }
-            
-        # FIRST, query the option database and save the results 
-        # into args.  Insert them before the first option in the
-        # list, in case there are any non-standard parameters.
-        #
-        # Note: there might not be any delegated options; if so,
-        # don't bother.
-
-        if {[info exists Snit_optionInfo(delegated-$compName)]} {
-            set ndx [lsearch -glob $args "-*"]
-                
-            foreach opt $Snit_optionInfo(delegated-$compName) {
-                set dbval [RT.OptionDbGet $type $self $opt]
-                    
-                if {"" != $dbval} {
-                    set target [lindex $Snit_optionInfo(target-$opt) 1]
-                    set args [linsert $args $ndx $target $dbval]
-                }
-            }
-        }
-    }
-             
-    # NEXT, create the component and save it.
-    set cmd [concat [list $widgetType $winPath] $args]
-    set comp [uplevel 1 $cmd]
-
-    # NEXT, handle the option database for "delegate option *",
-    # in widgets only.
-    if {$Snit_info(isWidget) && $Snit_optionInfo(starcomp) eq $compName} {
-        # FIRST, get the list of option specs from the widget.
-        # If configure doesn't work, skip it.
-        if {[catch {$comp configure} specs]} {
-            return
-        }
-
-        # NEXT, get the set of explicitly used options from args
-        set usedOpts {}
-        set ndx [lsearch -glob $args "-*"]
-        foreach {opt val} [lrange $args $ndx end] {
-            lappend usedOpts $opt
-        }
-
-        # NEXT, "delegate option *" matches all options defined
-        # by this widget that aren't defined by the widget as a whole,
-        # and that aren't excepted.  Plus, we skip usedOpts.  So build 
-        # a list of the options it can't match.
-        set skiplist [concat \
-                          $usedOpts \
-                          $Snit_optionInfo(except) \
-                          $Snit_optionInfo(local) \
-                          $Snit_optionInfo(delegated)]
-        
-        # NEXT, loop over all of the component's options, and set
-        # any not in the skip list for which there is an option 
-        # database value.
-        foreach spec $specs {
-            # Skip aliases
-            if {[llength $spec] != 5} {
-                continue
-            }
-
-            set opt [lindex $spec 0]
-
-            if {[lsearch -exact $skiplist $opt] != -1} {
-                continue
-            }
-
-            set res [lindex $spec 1]
-            set cls [lindex $spec 2]
-
-            set dbvalue [option get $self $res $cls]
-
-            if {"" != $dbvalue} {
-                $comp configure $opt $dbvalue
-            }
-        }
-    }
-
-    return
-}
-
-
-#-----------------------------------------------------------------------
-# Method/Variable Name Qualification
-
-# Implements %TYPE%::variable.  Requires selfns.
-proc ::snit::RT.variable {varname} {
-    upvar 1 selfns selfns
-
-    if {![string match "::*" $varname]} {
-        uplevel 1 [list upvar 1 ${selfns}::$varname $varname]
-    } else {
-        # varname is fully qualified; let the standard
-        # "variable" command handle it.
-        uplevel 1 [list ::variable $varname]
-    }
-}
-
-# Fully qualifies a typevariable name.
-#
-# This is used to implement the mytypevar command.
-
-proc ::snit::RT.mytypevar {type name} {
-    return ${type}::$name
-}
-
-# Fully qualifies an instance variable name.
-#
-# This is used to implement the myvar command.
-proc ::snit::RT.myvar {name} {
-    upvar 1 selfns selfns
-    return ${selfns}::$name
-}
-
-# Use this like "list" to convert a proc call into a command
-# string to pass to another object (e.g., as a -command).
-# Qualifies the proc name properly.
-#
-# This is used to implement the "myproc" command.
-
-proc ::snit::RT.myproc {type procname args} {
-    set procname "${type}::$procname"
-    return [linsert $args 0 $procname]
-}
-
-# DEPRECATED
-proc ::snit::RT.codename {type name} {
-    return "${type}::$name"
-}
-
-# Use this like "list" to convert a typemethod call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the type command at the beginning.
-#
-# This is used to implement the "mytypemethod" command.
-
-proc ::snit::RT.mytypemethod {type args} {
-    return [linsert $args 0 $type]
-}
-
-# Use this like "list" to convert a method call into a command
-# string to pass to another object (e.g., as a -command).
-# Inserts the code at the beginning to call the right object, even if
-# the object's name has changed.  Requires that selfns be defined
-# in the calling context, eg. can only be called in instance
-# code.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.mymethod {args} {
-    upvar 1 selfns selfns
-    return [linsert $args 0 ::snit::RT.CallInstance ${selfns}]
-}
-
-# Calls an instance method for an object given its
-# instance namespace and remaining arguments (the first of which
-# will be the method name.
-#
-# selfns		The instance namespace
-# args			The arguments
-#
-# Uses the selfns to determine $self, and calls the method
-# in the normal way.
-#
-# This is used to implement the "mymethod" command.
-
-proc ::snit::RT.CallInstance {selfns args} {
-    namespace upvar $selfns Snit_instance self
-
-    set retval [catch {uplevel 1 [linsert $args 0 $self]} result]
-
-    if {$retval} {
-        if {$retval == 1} {
-            global errorInfo
-            global errorCode
-            return -code error -errorinfo $errorInfo \
-                -errorcode $errorCode $result
-        } else {
-            return -code $retval $result
-        }
-    }
-
-    return $result
-}
-
-# Looks for the named option in the named variable.  If found,
-# it and its value are removed from the list, and the value
-# is returned.  Otherwise, the default value is returned.
-# If the option is undelegated, it's own default value will be
-# used if none is specified.
-#
-# Implements the "from" command.
-
-proc ::snit::RT.from {type argvName option {defvalue ""}} {
-    namespace upvar $type Snit_optionInfo Snit_optionInfo
-    upvar $argvName argv
-
-    set ioption [lsearch -exact $argv $option]
-
-    if {$ioption == -1} {
-        if {"" == $defvalue &&
-            [info exists Snit_optionInfo(default-$option)]} {
-            return $Snit_optionInfo(default-$option)
-        } else {
-            return $defvalue
-        }
-    }
-
-    set ivalue [expr {$ioption + 1}]
-    set value [lindex $argv $ivalue]
-    
-    set argv [lreplace $argv $ioption $ivalue] 
-
-    return $value
-}
-
-#-----------------------------------------------------------------------
-# Type Destruction
-
-# Implements the standard "destroy" typemethod:
-# Destroys a type completely.
-#
-# type		The snit type
-
-proc ::snit::RT.typemethod.destroy {type} {
-    variable ${type}::Snit_info
-        
-    # FIRST, destroy all instances
-    foreach selfns [namespace children $type] {
-        if {![namespace exists $selfns]} {
-            continue
-        }
-
-        namespace upvar $selfns Snit_instance obj
-            
-        if {$Snit_info(isWidget)} {
-            destroy $obj
-        } else {
-            if {[llength [info commands $obj]]} {
-                $obj destroy
-            }
-        }
-    }
-
-    # NEXT, get rid of the type command.
-    rename $type ""
-
-    # NEXT, destroy the type's data.
-    namespace delete $type
-}
-
-
-
-#-----------------------------------------------------------------------
-# Option Handling
-
-# Implements the standard "cget" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.method.cget {type selfns win self option} {
-    if {[catch {set ${selfns}::Snit_cgetCache($option)} command]} {
-        set command [snit::RT.CacheCgetCommand $type $selfns $win $self $option]
-        
-        if {[llength $command] == 0} {
-            return -code error "unknown option \"$option\""
-        }
-    }
-            
-    uplevel 1 $command
-}
-
-# Retrieves and caches the command that implements "cget" for the 
-# specified option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of the option
-
-proc ::snit::RT.CacheCgetCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_cgetCache
-                
-    if {[info exists Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.  If it has a cget method defined,
-            # use it; otherwise just return the value.
-
-            if {$Snit_optionInfo(cget-$option) eq ""} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                # WHD: Snit 2.0 code -- simpler, no slower.
-                set command [list \
-                                 $self \
-                                 {*}$Snit_optionInfo(cget-$option) \
-                                 $option]
-            }
-
-            set Snit_cgetCache($option) $command
-            return $command
-        }
-         
-        # Explicitly delegated option; get target
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {$Snit_optionInfo(starcomp) ne "" &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated; get target.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-    
-    # Get the component's object.
-    set obj [RT.Component $type $selfns $comp]
-
-    set command [list $obj cget $target]
-    set Snit_cgetCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configurelist" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# optionlist    A list of options and their values.
-
-proc ::snit::RT.method.configurelist {type selfns win self optionlist} {
-    variable ${type}::Snit_optionInfo
-
-    foreach {option value} $optionlist {
-        # FIRST, get the configure command, caching it if need be.
-        if {[catch {set ${selfns}::Snit_configureCache($option)} command]} {
-            set command [snit::RT.CacheConfigureCommand \
-                             $type $selfns $win $self $option]
-
-            if {[llength $command] == 0} {
-                return -code error "unknown option \"$option\""
-            }
-        }
-
-        # NEXT, if we have a type-validation object, use it.
-        # TBD: Should test (islocal-$option) here, but islocal
-        # isn't defined for implicitly delegated options.
-        if {[info exists Snit_optionInfo(typeobj-$option)]
-            && $Snit_optionInfo(typeobj-$option) ne ""} {
-            if {[catch {
-                $Snit_optionInfo(typeobj-$option) validate $value
-            } result]} {
-                return -code error "invalid $option value: $result"
-            }
-        }
-
-        # NEXT, the caching the configure command also cached the
-        # validate command, if any.  If we have one, run it.
-        set valcommand [set ${selfns}::Snit_validateCache($option)]
-
-        if {[llength $valcommand]} {
-            lappend valcommand $value
-            uplevel 1 $valcommand
-        }
-
-        # NEXT, configure the option with the value.
-        lappend command $value
-        uplevel 1 $command
-    }
-    
-    return
-}
-
-# Retrieves and caches the command that stores the named option.
-# Also stores the command that validates the name option if any;
-# If none, the validate command is "", so that the cache is always
-# populated.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        An option name
-
-proc ::snit::RT.CacheConfigureCommand {type selfns win self option} {
-    variable ${type}::Snit_optionInfo
-    variable ${selfns}::Snit_configureCache
-    variable ${selfns}::Snit_validateCache
-
-    if {[info exist Snit_optionInfo(islocal-$option)]} {
-        # We know the item; it's either local, or explicitly delegated.
-        
-        if {$Snit_optionInfo(islocal-$option)} {
-            # It's a local option.
-
-            # If it's readonly, it throws an error if we're already 
-            # constructed.
-            if {$Snit_optionInfo(readonly-$option)} {
-                if {[set ${selfns}::Snit_iinfo(constructed)]} {
-                    error "option $option can only be set at instance creation"
-                }
-            }
-
-            # If it has a validate method, cache that for later.
-            if {$Snit_optionInfo(validate-$option) ne ""} {
-                # WHD: Snit 2.0 code -- simpler, no slower.
-                set command [list \
-                                 $self \
-                                 {*}$Snit_optionInfo(validate-$option) \
-                                 $option]
-
-                set Snit_validateCache($option) $command
-            } else {
-                set Snit_validateCache($option) ""
-            }
-            
-            # If it has a configure method defined,
-            # cache it; otherwise, just set the value.
-            if {$Snit_optionInfo(configure-$option) eq ""} {
-                set command [list set ${selfns}::options($option)]
-            } else {
-                # WHD: Snit 2.0 code -- simpler, no slower.
-                set command [list \
-                                 $self \
-                                 {*}$Snit_optionInfo(configure-$option) \
-                                 $option]
-            }
-
-            set Snit_configureCache($option) $command
-            return $command
-        }
-
-        # Delegated option: get target.
-        set comp [lindex $Snit_optionInfo(target-$option) 0]
-        set target [lindex $Snit_optionInfo(target-$option) 1]
-    } elseif {$Snit_optionInfo(starcomp) != "" &&
-              [lsearch -exact $Snit_optionInfo(except) $option] == -1} {
-        # Unknown option, but unknowns are delegated.
-        set comp $Snit_optionInfo(starcomp)
-        set target $option
-    } else {
-        return ""
-    }
-
-    # There is no validate command in this case; save an empty string.
-    set Snit_validateCache($option) ""
-        
-    # Get the component's object
-    set obj [RT.Component $type $selfns $comp]
-    
-    set command [list $obj configure $target]
-    set Snit_configureCache($option) $command
-
-    return $command
-}
-
-# Implements the standard "configure" method
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# args          A list of options and their values, possibly empty.
-
-proc ::snit::RT.method.configure {type selfns win self args} {
-    # If two or more arguments, set values as usual.
-    if {[llength $args] >= 2} {
-        ::snit::RT.method.configurelist $type $selfns $win $self $args
-        return
-    }
-
-    # If zero arguments, acquire data for each known option
-    # and return the list
-    if {[llength $args] == 0} {
-        set result {}
-        foreach opt [RT.method.info.options $type $selfns $win $self] {
-            # Refactor this, so that we don't need to call via $self.
-            lappend result [RT.GetOptionDbSpec \
-                                $type $selfns $win $self $opt]
-        }
-        
-        return $result
-    }
-
-    # They want it for just one.
-    set opt [lindex $args 0]
-
-    return [RT.GetOptionDbSpec $type $selfns $win $self $opt]
-}
-
-
-# Retrieves the option database spec for a single option.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# option        The name of an option
-#
-# TBD: This is a bad name.  What it's returning is the
-# result of the configure query.
-
-proc ::snit::RT.GetOptionDbSpec {type selfns win self opt} {
-    variable ${type}::Snit_optionInfo
-
-    namespace upvar $selfns \
-        Snit_components Snit_components \
-        options         options
-    
-    if {[info exists options($opt)]} {
-        # This is a locally-defined option.  Just build the
-        # list and return it.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-        set def $Snit_optionInfo(default-$opt)
-
-        return [list $opt $res $cls $def \
-                    [RT.method.cget $type $selfns $win $self $opt]]
-    } elseif {[info exists Snit_optionInfo(target-$opt)]} {
-        # This is an explicitly delegated option.  The only
-        # thing we don't have is the default.
-        set res $Snit_optionInfo(resource-$opt)
-        set cls $Snit_optionInfo(class-$opt)
-        
-        # Get the default
-        set logicalName [lindex $Snit_optionInfo(target-$opt) 0]
-        set comp $Snit_components($logicalName)
-        set target [lindex $Snit_optionInfo(target-$opt) 1]
-
-        if {[catch {$comp configure $target} result]} {
-            set defValue {}
-        } else {
-            set defValue [lindex $result 3]
-        }
-
-        return [list $opt $res $cls $defValue [$self cget $opt]]
-    } elseif {$Snit_optionInfo(starcomp) ne "" &&
-              [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-        set logicalName $Snit_optionInfo(starcomp)
-        set target $opt
-        set comp $Snit_components($logicalName)
-
-        if {[catch {set value [$comp cget $target]} result]} {
-            error "unknown option \"$opt\""
-        }
-
-        if {![catch {$comp configure $target} result]} {
-            # Replace the delegated option name with the local name.
-            return [::snit::Expand $result $target $opt]
-        }
-
-        # configure didn't work; return simple form.
-        return [list $opt "" "" "" $value]
-    } else {
-        error "unknown option \"$opt\""
-    }
-}
-
-#-----------------------------------------------------------------------
-# Type Introspection
-
-# Implements the standard "info" typemethod.
-#
-# type		The snit type
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.typemethod.info {type command args} {
-    global errorInfo
-    global errorCode
-
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        typevars    -
-        typemethods -
-        instances {
-            # TBD: it should be possible to delete this error
-            # handling.
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 \
-			       ::snit::RT.typemethod.info.$command $type]
-            } result]
-
-            if {$errflag} {
-                return -code error -errorinfo $errorInfo \
-                    -errorcode $errorCode $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            error "\"$type info $command\" is not defined"
-        }
-    }
-}
-
-
-# Returns a list of the type's typevariables whose names match a 
-# pattern, excluding Snit internal variables.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typevars {type {pattern *}} {
-    set result {}
-    foreach name [info vars "${type}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-    
-    return $result
-}
-
-# Returns a list of the type's methods whose names match a 
-# pattern.  If "delegate typemethod *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.typemethod.info.typemethods {type {pattern *}} {
-    variable ${type}::Snit_typemethodInfo
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_typemethodInfo -glob $pattern] {
-        if {[lindex $Snit_typemethodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    # WHD: fixed up to use newstyle method cache/list of subcommands.
-    if {[info exists Snit_typemethodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        # Next, get the type's -map
-        array set typemethodCache [namespace ensemble configure $type -map]
-
-        # Next, get matching names from the cache that we don't already
-        # know about.
-        foreach name [array names typemethodCache -glob $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $type info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.args {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 1 end]
-}
-
-# $type info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.body {type method} {
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_typemethodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $type info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.typemethod.info.default {type method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_typemethodInfo  Snit_typemethodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_typemethodInfo($method)]} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    foreach {flag cmd component} $Snit_typemethodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown typemethod \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated typemethod \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# Returns a list of the type's instances whose names match
-# a pattern.
-#
-# type		A Snit type
-# pattern       Optional.  The glob pattern to match
-#               Defaults to *
-#
-# REQUIRE: type is fully qualified.
-
-proc ::snit::RT.typemethod.info.instances {type {pattern *}} {
-    set result {}
-
-    foreach selfns [namespace children $type] {
-        namespace upvar $selfns Snit_instance instance
-
-        if {[string match $pattern $instance]} {
-            lappend result $instance
-        }
-    }
-
-    return $result
-}
-
-#-----------------------------------------------------------------------
-# Instance Introspection
-
-# Implements the standard "info" method.
-#
-# type		The snit type
-# selfns        The instance's instance namespace
-# win           The instance's original name
-# self          The instance's current name
-# command       The info subcommand
-# args          All other arguments.
-
-proc ::snit::RT.method.info {type selfns win self command args} {
-    switch -exact $command {
-	args        -
-	body        -
-	default     -
-        type        -
-        vars        -
-        options     -
-        methods     -
-        typevars    -
-        typemethods {
-            set errflag [catch {
-                uplevel 1 [linsert $args 0 ::snit::RT.method.info.$command \
-			       $type $selfns $win $self]
-            } result]
-
-            if {$errflag} {
-                global errorInfo
-                return -code error -errorinfo $errorInfo $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            # error "\"$self info $command\" is not defined"
-            return -code error "\"$self info $command\" is not defined"
-        }
-    }
-}
-
-# $self info type
-#
-# Returns the instance's type
-proc ::snit::RT.method.info.type {type selfns win self} {
-    return $type
-}
-
-# $self info typevars
-#
-# Returns the instance's type's typevariables
-proc ::snit::RT.method.info.typevars {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typevars $type $pattern]
-}
-
-# $self info typemethods
-#
-# Returns the instance's type's typemethods
-proc ::snit::RT.method.info.typemethods {type selfns win self {pattern *}} {
-    return [RT.typemethod.info.typemethods $type $pattern]
-}
-
-# Returns a list of the instance's methods whose names match a 
-# pattern.  If "delegate method *" is used, the list may
-# not be complete.
-#
-# type		A Snit type
-# selfns        The instance namespace
-# win		The original instance name
-# self          The current instance name
-# pattern       Optional.  The glob pattern to match.  Defaults
-#               to *.
-
-proc ::snit::RT.method.info.methods {type selfns win self {pattern *}} {
-    variable ${type}::Snit_methodInfo
-
-    # FIRST, get the explicit names, skipping prefixes.
-    set result {}
-
-    foreach name [array names Snit_methodInfo -glob $pattern] {
-        if {[lindex $Snit_methodInfo($name) 0] != 1} {
-            lappend result $name
-        }
-    }
-
-    # NEXT, add any from the cache that aren't explicit.
-    # WHD: Fixed up to use newstyle method cache/list of subcommands.
-    if {[info exists Snit_methodInfo(*)]} {
-        # First, remove "*" from the list.
-        set ndx [lsearch -exact $result "*"]
-        if {$ndx != -1} {
-            set result [lreplace $result $ndx $ndx]
-        }
-
-        # Next, get the instance's -map
-        set self [set ${selfns}::Snit_instance]
-
-        array set methodCache [namespace ensemble configure $self -map]
-
-        # Next, get matching names from the cache that we don't already
-        # know about.
-        foreach name [array names methodCache -glob $pattern] {
-            if {[lsearch -exact $result $name] == -1} {
-                lappend result $name
-            }
-        }
-    }
-
-    return $result
-}
-
-# $self info args
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.args {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [lrange [::info args $theproc] 4 end]
-}
-
-# $self info body
-#
-# Returns a method's body. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.body {type selfns win self method} {
-
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    #parray Snit_methodInfo
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [RT.body [::info body $theproc]]
-}
-
-# $self info default
-#
-# Returns a method's list of arguments. does not work for delegated
-# methods, nor for the internal dispatch methods of multi-word
-# methods.
-
-proc ::snit::RT.method.info.default {type selfns win self method aname dvar} {
-    upvar 1 $dvar def
-    upvar ${type}::Snit_methodInfo  Snit_methodInfo
-
-    # Snit_methodInfo: method -> list (flag cmd component)
-
-    # flag      : 1 -> internal dispatcher for multi-word method.
-    #             0 -> regular method
-    #
-    # cmd       : template mapping from method to command prefix, may
-    #             contain placeholders for various pieces of information.
-    #
-    # component : is empty for normal methods.
-
-    if {![info exists Snit_methodInfo($method)]} {
-	return -code error "Unknown method \"$method\""
-    }
-    foreach {flag cmd component} $Snit_methodInfo($method) break
-    if {$flag} {
-	return -code error "Unknown method \"$method\""
-    }
-    if {$component != ""} {
-	return -code error "Delegated method \"$method\""
-    }
-
-    set map     [list %m $method %j [join $method _] %t $type %n $selfns %w $win %s $self]
-    set theproc [lindex [string map $map $cmd] 0]
-    return [::info default $theproc $aname def]
-}
-
-# $self info vars
-#
-# Returns the instance's instance variables
-proc ::snit::RT.method.info.vars {type selfns win self {pattern *}} {
-    set result {}
-    foreach name [info vars "${selfns}::$pattern"] {
-        set tail [namespace tail $name]
-        if {![string match "Snit_*" $tail]} {
-            lappend result $name
-        }
-    }
-
-    return $result
-}
-
-# $self info options 
-#
-# Returns a list of the names of the instance's options
-proc ::snit::RT.method.info.options {type selfns win self {pattern *}} {
-    variable ${type}::Snit_optionInfo
-
-    # First, get the local and explicitly delegated options
-    set result [concat $Snit_optionInfo(local) $Snit_optionInfo(delegated)]
-
-    # If "configure" works as for Tk widgets, add the resulting
-    # options to the list.  Skip excepted options
-    if {$Snit_optionInfo(starcomp) ne ""} {
-        namespace upvar $selfns Snit_components Snit_components
-
-        set logicalName $Snit_optionInfo(starcomp)
-        set comp $Snit_components($logicalName)
-
-        if {![catch {$comp configure} records]} {
-            foreach record $records {
-                set opt [lindex $record 0]
-                if {[lsearch -exact $result $opt] == -1 &&
-                    [lsearch -exact $Snit_optionInfo(except) $opt] == -1} {
-                    lappend result $opt
-                }
-            }
-        }
-    }
-
-    # Next, apply the pattern
-    set names {}
-
-    foreach name $result {
-        if {[string match $pattern $name]} {
-            lappend names $name
-        }
-    }
-
-    return $names
-}
-
-proc ::snit::RT.body {body} {
-    regsub -all ".*# END snit method prolog\n" $body {} body
-    return $body
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,6 +1,0 @@
-if {[package vsatisfies [package provide Tcl] 8.5]} {
-    package ifneeded snit 2.2.1 \
-        [list source [file join $dir snit2.tcl]]
-}
-
-package ifneeded snit 1.3.1 [list source [file join $dir snit.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#	snit.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#       Snit's Not Incr Tcl, a simple object system in Pure Tcl.
-#
-#       Snit 1.x Loader 
-#
-#       Copyright (C) 2003-2006 by William H. Duquette
-#       This code is licensed as described in license.txt.
-#
-#-----------------------------------------------------------------------
-
-package require Tcl 8.3
-
-# Define the snit namespace and save the library directory
-
-namespace eval ::snit:: {
-    set library [file dirname [info script]]
-}
-
-# Select the implementation based on the version of the Tcl core
-# executing this code. For 8.3 we use a backport emulating various
-# 8.4 features
-
-if {[package vsatisfies [package provide Tcl] 8.4]} {
-    source [file join $::snit::library main1.tcl]
-} else {
-    source [file join $::snit::library main1_83.tcl]
-    source [file join $::snit::library snit_tcl83_utils.tcl]
-}
-
-# Load the library of Snit validation types.
-
-source [file join $::snit::library validate.tcl]
-
-package provide snit 1.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit2.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit2.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#	snit2.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#       Snit's Not Incr Tcl, a simple object system in Pure Tcl.
-#
-#       Snit 2.x Loader
-#
-#       Copyright (C) 2003-2006 by William H. Duquette
-#       This code is licensed as described in license.txt.
-#
-#-----------------------------------------------------------------------
-
-package require Tcl 8.5
-
-# Define the snit namespace and save the library directory
-
-namespace eval ::snit:: {
-    set library [file dirname [info script]]
-}
-
-# Load the kernel.
-source [file join $::snit::library main2.tcl]
-
-# Load the library of Snit validation types.
-source [file join $::snit::library validate.tcl]
-
-package provide snit 2.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit_tcl83_utils.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/snit_tcl83_utils.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,231 +1,0 @@
-#--------------------------------------------------------------------------
-# TITLE:
-#	snit_tcl83_utils.tcl
-#
-# AUTHOR:
-#	Kenneth Green, 28 Aug 2004
-#
-# DESCRIPTION:
-#       Utilities to support the back-port of snit from Tcl 8.4 to 8.3
-#
-#--------------------------------------------------------------------------
-# Copyright
-#
-# Copyright (c) 2005 Kenneth Green
-# Modified by Andreas Kupries.
-# All rights reserved. This code is licensed as described in license.txt.
-#--------------------------------------------------------------------------
-# This code is freely distributable, but is provided as-is with
-# no warranty expressed or implied.
-#--------------------------------------------------------------------------
-# Acknowledgements
-#   The changes described in this file are made to the awesome 'snit'
-#   library as provided by William H. Duquette under the terms
-#   defined in the associated 'license.txt'.
-#-----------------------------------------------------------------------
-
-#-----------------------------------------------------------------------
-# Namespace
-
-namespace eval ::snit83 {}
-
-#-----------------------------------------------------------------------
-# Some Snit83 variables
-
-namespace eval ::snit83 {
-    variable  cmdTraceTable
-    array set cmdTraceTable {}
-
-    namespace eval private {}
-}
-
-
-#-----------------------------------------------------------------------
-# Initialisation
-
-#
-# Override Tcl functions so we can mimic some behaviours. This is
-# conditional on not having been done already. Otherwise loading snit
-# twice will fail the second time.
-#
-
-if [info exists tk_version] {
-    if {
-	![llength [info procs destroy]] ||
-	![regexp snit83 [info body destroy]]
-    } {
-	rename destroy __destroy__
-    }
-}
-if {
-    ![llength [info procs namespace]] ||
-    ![regexp snit83 [info body namespace]]
-} {
-    rename namespace __namespace__
-    rename rename    __rename__ ;# must be last one renamed!
-}
-
-#-----------------------------------------------------------------------
-# Global namespace functions
-
-
-# destroy -
-#
-# Perform delete tracing and then invoke the actual Tk destroy command
-
-if [info exists tk_version] {
-    proc destroy { w } {
-	variable ::snit83::cmdTraceTable
-
-	set index "delete,$w"
-	if [info exists cmdTraceTable($index)] {
-	    set cmd $cmdTraceTable($index)
-	    ::unset cmdTraceTable($index) ;# prevent recursive tracing
-	    if [catch {eval $cmd $oldName \"$newName\" delete} err] { ; # "
-		error $err
-	    }
-	}
-
-	return [__destroy__ $w]
-    }
-}
-
-# namespace -
-#
-# Add limited support for 'namespace exists'. Must be a fully
-# qualified namespace name (pattern match support not provided).
-
-proc namespace { cmd args } {
-    if {[string equal $cmd "exists"]} {
-        set ptn [lindex $args 0]
-        return [::snit83::private::NamespaceIsDescendantOf :: $ptn]
-    } elseif {[string equal $cmd "delete"]} {
-        if [namespace exists [lindex $args 0]] {
-            return [uplevel 1 [subst {__namespace__ $cmd $args}]]
-        }
-    } else {
-        return [uplevel 1 [subst {__namespace__ $cmd $args}]]
-    }
-}
-
-# rename -
-#
-# Perform rename tracing and then invoke the actual Tcl rename command
-
-proc rename { oldName newName } {
-    variable ::snit83::cmdTraceTable
-
-    # Get caller's namespace since rename must be performed
-    # in the context of the caller's namespace
-    set callerNs "::"
-    set callerLevel [expr {[info level] - 1}]
-    if { $callerLevel > 0 } {
-        set callerInfo [info level $callerLevel]
-        set procName   [lindex $callerInfo 0]
-        set callerNs   [namespace qualifiers $procName]
-    }
-
-    #puts "rename: callerNs: $callerNs"
-    #puts "rename: '$oldName' -> '$newName'"
-    #puts "rename: rcds - [join [array names cmdTraceTable] "\nrename: rcds - "]"
-
-    set result [namespace eval $callerNs [concat __rename__ [list $oldName $newName]]]
-
-    set index1 "rename,$oldName"
-    set index2 "rename,::$oldName"
-
-    foreach index [list $index1 $index2] {
-        if [info exists cmdTraceTable($index)] {
-            set cmd $cmdTraceTable($index)
-
-	    #puts "rename: '$cmd' { $oldName -> $newName }"
-
-            ::unset cmdTraceTable($index) ;# prevent recursive tracing
-            if {![string equal $newName ""]} {
-                # Create a new trace record under the new name
-                set cmdTraceTable(rename,$newName) $cmd
-            }
-            if [catch {eval $cmd $oldName \"$newName\" rename} err] {
-                error $err
-            }
-            break
-        }
-    }
-
-    return $result
-}
-
-
-#-----------------------------------------------------------------------
-# Private functions
-
-proc ::snit83::private::NamespaceIsDescendantOf { parent child } {
-    set result 0
-
-    foreach ns [__namespace__ children $parent] {
-        if [string match $ns $child] {
-            set result 1
-            break;
-        } else {
-            if [set result [NamespaceIsDescendantOf $ns $child]] {
-                break
-            }
-        }
-    }
-    return $result
-}
-
-
-#-----------------------------------------------------------------------
-# Utility functions
-
-proc ::snit83::traceAddCommand {name ops command} {
-    variable cmdTraceTable
-
-    #puts "::snit83::traceAddCommand n/$name/ o/$ops/ c/$command/"
-    #puts "XX [join [array names cmdTraceTable] "\nXX "]"
-
-    foreach op $ops {
-        set index "$op,$name"
-	#puts "::snit83::traceAddCommand: index = $index cmd = $command"
-
-        set cmdTraceTable($index) $command
-    }
-}
-
-proc ::snit83::traceRemoveCommand {name ops command} {
-    variable cmdTraceTable
-
-    #puts "::snit83::traceRemoveCommand n/$name/ o/$ops/ c/$command/"
-    #puts "YY [join [array names cmdTraceTable] "\nYY "]"
-
-    foreach op $ops {
-        set index "$op,$name"
-	#puts "::snit83::traceRemoveCommand: index = $index cmd = $command"
-
-	catch { ::unset cmdTraceTable($index) }
-    }
-}
-
-# Add support for 'unset -nocomplain'
-proc ::snit83::unset { args } {
-
-    #puts "::snit83::unset - args: '$args'"
-
-    set noComplain 0
-    if {[string equal [lindex $args 0] "-nocomplain"]} {
-        set noComplain 1
-        set args [lrange $args 1 end]
-    }
-    if {[string equal [lindex $args 0] "--"]} {
-        set args [lrange $args 1 end]
-    }
-
-    if [catch {
-	uplevel 1 [linsert $args 0 ::unset]
-    } err] {
-        if { !$noComplain } {
-            error $err
-        }
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/snit/validate.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/snit/validate.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,711 +1,0 @@
-#-----------------------------------------------------------------------
-# TITLE:
-#    validate.tcl
-#
-# AUTHOR:
-#    Will Duquette
-#
-# DESCRIPTION:
-#    Snit validation types.
-#
-#-----------------------------------------------------------------------
-
-namespace eval ::snit:: { 
-    namespace export \
-        boolean \
-        double \
-        enum \
-        fpixels \
-        integer \
-        listtype \
-        pixels \
-        stringtype \
-        window
-}
-
-#-----------------------------------------------------------------------
-# snit::boolean
-
-snit::type ::snit::boolean {
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {![string is boolean -strict $value]} {
-            return -code error \
-   "invalid boolean \"$value\", should be one of: 1, 0, true, false, yes, no, on, off"
-
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    # None needed; no options
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::double
-
-snit::type ::snit::double {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -min value
-    #
-    # Minimum value
-
-    option -min -default "" -readonly 1
-
-    # -max value
-    #
-    # Maximum value
-
-    option -max -default "" -readonly 1
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {![string is double -strict $value]} {
-            return -code error \
-                "invalid value \"$value\", expected double"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        if {"" != $options(-min) && 
-            ![string is double -strict $options(-min)]} {
-            return -code error \
-                "invalid -min: \"$options(-min)\""
-        }
-
-        if {"" != $options(-max) && 
-            ![string is double -strict $options(-max)]} {
-            return -code error \
-                "invalid -max: \"$options(-max)\""
-        }
-
-        if {"" != $options(-min) &&
-            "" != $options(-max) && 
-            $options(-max) < $options(-min)} {
-            return -code error "-max < -min"
-        }
-    }
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-
-        if {("" != $options(-min) && $value < $options(-min))       ||
-            ("" != $options(-max) && $value > $options(-max))} {
-
-            set msg "invalid value \"$value\", expected double"
-
-            if {"" != $options(-min) && "" != $options(-max)} {
-                append msg " in range $options(-min), $options(-max)"
-            } elseif {"" != $options(-min)} {
-                append msg " no less than $options(-min)"
-            }
-        
-            return -code error $msg
-        }
-
-        return
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::enum
-
-snit::type ::snit::enum {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -values list
-    #
-    # Valid values for this type
-
-    option -values -default {} -readonly 1
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        # No -values specified; it's always valid
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    constructor {args} {
-        $self configurelist $args
-
-        if {[llength $options(-values)] == 0} {
-            return -code error \
-                "invalid -values: \"\""
-        }
-    }
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        if {[lsearch -exact $options(-values) $value] == -1} {
-            return -code error \
-    "invalid value \"$value\", should be one of: [join $options(-values) {, }]"
-        }
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::fpixels
-
-snit::type ::snit::fpixels {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -min value
-    #
-    # Minimum value
-
-    option -min -default "" -readonly 1
-
-    # -max value
-    #
-    # Maximum value
-
-    option -max -default "" -readonly 1
-
-    #-------------------------------------------------------------------
-    # Instance variables
-
-    variable min ""  ;# -min, no suffix
-    variable max ""  ;# -max, no suffix
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {[catch {winfo fpixels . $value} dummy]} {
-            return -code error \
-                "invalid value \"$value\", expected fpixels"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        if {"" != $options(-min) && 
-            [catch {winfo fpixels . $options(-min)} min]} {
-            return -code error \
-                "invalid -min: \"$options(-min)\""
-        }
-
-        if {"" != $options(-max) && 
-            [catch {winfo fpixels . $options(-max)} max]} {
-            return -code error \
-                "invalid -max: \"$options(-max)\""
-        }
-
-        if {"" != $min &&
-            "" != $max && 
-            $max < $min} {
-            return -code error "-max < -min"
-        }
-    }
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-        
-        set val [winfo fpixels . $value]
-
-        if {("" != $min && $val < $min) ||
-            ("" != $max && $val > $max)} {
-
-            set msg "invalid value \"$value\", expected fpixels"
-
-            if {"" != $min && "" != $max} {
-                append msg " in range $options(-min), $options(-max)"
-            } elseif {"" != $min} {
-                append msg " no less than $options(-min)"
-            }
-        
-            return -code error $msg
-        }
-
-        return
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::integer
-
-snit::type ::snit::integer {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -min value
-    #
-    # Minimum value
-
-    option -min -default "" -readonly 1
-
-    # -max value
-    #
-    # Maximum value
-
-    option -max -default "" -readonly 1
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {![string is integer -strict $value]} {
-            return -code error \
-                "invalid value \"$value\", expected integer"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        if {"" != $options(-min) && 
-            ![string is integer -strict $options(-min)]} {
-            return -code error \
-                "invalid -min: \"$options(-min)\""
-        }
-
-        if {"" != $options(-max) && 
-            ![string is integer -strict $options(-max)]} {
-            return -code error \
-                "invalid -max: \"$options(-max)\""
-        }
-
-        if {"" != $options(-min) &&
-            "" != $options(-max) && 
-            $options(-max) < $options(-min)} {
-            return -code error "-max < -min"
-        }
-    }
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-
-        if {("" != $options(-min) && $value < $options(-min))       ||
-            ("" != $options(-max) && $value > $options(-max))} {
-
-            set msg "invalid value \"$value\", expected integer"
-
-            if {"" != $options(-min) && "" != $options(-max)} {
-                append msg " in range $options(-min), $options(-max)"
-            } elseif {"" != $options(-min)} {
-                append msg " no less than $options(-min)"
-            }
-        
-            return -code error $msg
-        }
-
-        return
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::list
-
-snit::type ::snit::listtype {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -type type
-    #
-    # Specifies a value type
-
-    option -type -readonly 1
-
-    # -minlen len
-    #
-    # Minimum list length
-
-    option -minlen -readonly 1 -default 0
-
-    # -maxlen len
-    #
-    # Maximum list length
-
-    option -maxlen -readonly 1
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {[catch {llength $value} result]} {
-            return -code error \
-                "invalid value \"$value\", expected list"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-    
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        if {"" != $options(-minlen) && 
-            (![string is integer -strict $options(-minlen)] ||
-             $options(-minlen) < 0)} {
-            return -code error \
-                "invalid -minlen: \"$options(-minlen)\""
-        }
-
-        if {"" == $options(-minlen)} {
-            set options(-minlen) 0
-        }
-
-        if {"" != $options(-maxlen) && 
-            ![string is integer -strict $options(-maxlen)]} {
-            return -code error \
-                "invalid -maxlen: \"$options(-maxlen)\""
-        }
-
-        if {"" != $options(-maxlen) && 
-            $options(-maxlen) < $options(-minlen)} {
-            return -code error "-maxlen < -minlen"
-        }
-    }
-
-
-    #-------------------------------------------------------------------
-    # Methods
-
-    method validate {value} {
-        $type validate $value
-
-        set len [llength $value]
-
-        if {$len < $options(-minlen)} {
-            return -code error \
-              "value has too few elements; at least $options(-minlen) expected"
-        } elseif {"" != $options(-maxlen)} {
-            if {$len > $options(-maxlen)} {
-                return -code error \
-         "value has too many elements; no more than $options(-maxlen) expected"
-            }
-        }
-
-        # NEXT, check each value
-        if {"" != $options(-type)} {
-            foreach item $value {
-                set cmd $options(-type)
-                lappend cmd validate $item
-                uplevel \#0 $cmd
-            }
-        }
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::pixels
-
-snit::type ::snit::pixels {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -min value
-    #
-    # Minimum value
-
-    option -min -default "" -readonly 1
-
-    # -max value
-    #
-    # Maximum value
-
-    option -max -default "" -readonly 1
-
-    #-------------------------------------------------------------------
-    # Instance variables
-
-    variable min ""  ;# -min, no suffix
-    variable max ""  ;# -max, no suffix
-
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {[catch {winfo pixels . $value} dummy]} {
-            return -code error \
-                "invalid value \"$value\", expected pixels"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        if {"" != $options(-min) && 
-            [catch {winfo pixels . $options(-min)} min]} {
-            return -code error \
-                "invalid -min: \"$options(-min)\""
-        }
-
-        if {"" != $options(-max) && 
-            [catch {winfo pixels . $options(-max)} max]} {
-            return -code error \
-                "invalid -max: \"$options(-max)\""
-        }
-
-        if {"" != $min &&
-            "" != $max && 
-            $max < $min} {
-            return -code error "-max < -min"
-        }
-    }
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-        
-        set val [winfo pixels . $value]
-
-        if {("" != $min && $val < $min) ||
-            ("" != $max && $val > $max)} {
-
-            set msg "invalid value \"$value\", expected pixels"
-
-            if {"" != $min && "" != $max} {
-                append msg " in range $options(-min), $options(-max)"
-            } elseif {"" != $min} {
-                append msg " no less than $options(-min)"
-            }
-        
-            return -code error $msg
-        }
-
-        return
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::stringtype
-
-snit::type ::snit::stringtype {
-    #-------------------------------------------------------------------
-    # Options
-
-    # -minlen len
-    #
-    # Minimum list length
-
-    option -minlen -readonly 1 -default 0
-
-    # -maxlen len
-    #
-    # Maximum list length
-
-    option -maxlen -readonly 1
-
-    # -nocase 0|1
-    #
-    # globs and regexps are case-insensitive if -nocase 1.
-
-    option -nocase -readonly 1 -default 0
-
-    # -glob pattern
-    #
-    # Glob-match pattern, or ""
-
-    option -glob -readonly 1
-
-    # -regexp regexp
-    #
-    # Regular expression to match
-    
-    option -regexp -readonly 1
-    
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        # By default, any string (hence, any Tcl value) is valid.
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-    
-    constructor {args} {
-        # FIRST, get the options
-        $self configurelist $args
-
-        # NEXT, validate -minlen and -maxlen
-        if {"" != $options(-minlen) && 
-            (![string is integer -strict $options(-minlen)] ||
-             $options(-minlen) < 0)} {
-            return -code error \
-                "invalid -minlen: \"$options(-minlen)\""
-        }
-
-        if {"" == $options(-minlen)} {
-            set options(-minlen) 0
-        }
-
-        if {"" != $options(-maxlen) && 
-            ![string is integer -strict $options(-maxlen)]} {
-            return -code error \
-                "invalid -maxlen: \"$options(-maxlen)\""
-        }
-
-        if {"" != $options(-maxlen) && 
-            $options(-maxlen) < $options(-minlen)} {
-            return -code error "-maxlen < -minlen"
-        }
-
-        # NEXT, validate -nocase
-        if {[catch {snit::boolean validate $options(-nocase)} result]} {
-            return -code error "invalid -nocase: $result"
-        }
-
-        # Validate the glob
-        if {"" != $options(-glob) && 
-            [catch {string match $options(-glob) ""} dummy]} {
-            return -code error \
-                "invalid -glob: \"$options(-glob)\""
-        }
-
-        # Validate the regexp
-        if {"" != $options(-regexp) && 
-            [catch {regexp $options(-regexp) ""} dummy]} {
-            return -code error \
-                "invalid -regexp: \"$options(-regexp)\""
-        }
-    }
-
-
-    #-------------------------------------------------------------------
-    # Methods
-
-    method validate {value} {
-        # Usually we'd call [$type validate $value] here, but
-        # as it's a no-op, don't bother.
-
-        # FIRST, validate the length.
-        set len [string length $value]
-
-        if {$len < $options(-minlen)} {
-            return -code error \
-              "too short: at least $options(-minlen) characters expected"
-        } elseif {"" != $options(-maxlen)} {
-            if {$len > $options(-maxlen)} {
-                return -code error \
-         "too long: no more than $options(-maxlen) characters expected"
-            }
-        }
-
-        # NEXT, check the glob match, with or without case.
-        if {"" != $options(-glob)} {
-            if {$options(-nocase)} {
-                set result [string match -nocase $options(-glob) $value]
-            } else {
-                set result [string match $options(-glob) $value]
-            }
-            
-            if {!$result} {
-                return -code error \
-                    "invalid value \"$value\""
-            }
-        }
-        
-        # NEXT, check regexp match with or without case
-        if {"" != $options(-regexp)} {
-            if {$options(-nocase)} {
-                set result [regexp -nocase -- $options(-regexp) $value]
-            } else {
-                set result [regexp -- $options(-regexp) $value]
-            }
-            
-            if {!$result} {
-                return -code error \
-                    "invalid value \"$value\""
-            }
-        }
-    }
-}
-
-#-----------------------------------------------------------------------
-# snit::window
-
-snit::type ::snit::window {
-    #-------------------------------------------------------------------
-    # Type Methods
-
-    typemethod validate {value} {
-        if {![winfo exists $value]} {
-            return -code error \
-                "invalid value \"$value\", value is not a window"
-        }
-
-        return
-    }
-
-    #-------------------------------------------------------------------
-    # Constructor
-
-    # None needed; no options
-
-    #-------------------------------------------------------------------
-    # Public Methods
-
-    method validate {value} {
-        $type validate $value
-    }
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/soundex/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/soundex/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded soundex 1.0 [list source [file join $dir soundex.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/soundex/soundex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/soundex/soundex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,96 +1,0 @@
-# soundex.tcl --
-#
-#	Implementation of soundex in Tcl
-#
-# Copyright (c) 2003 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: soundex.tcl,v 1.3 2004/01/15 06:36:14 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::soundex {}
-
-## ------------------------------------------------------------
-##
-## I. Soundex by Knuth.
-
-# This implementation of the Soundex algorithm is released to the public
-# domain: anyone may use it for any purpose.  See if I care.
-
-# N. Dean Pentcheff 1/13/89 Dept. of Zoology University of California Berkeley,
-#    CA  94720 dean@violet.berkeley.edu
-# TCL port by Evan Rempel 2/10/98 Dept Comp Services University of Victoria.
-# erempel@uvic.ca
-
-# proc ::soundex::knuth ( string )
-#
-#   Given as argument: a character string. Returns: a static string, 4 characters long
-#   This string is the Soundex key for the argument string.
-#   Side effects and limitations:
-#   Does not clobber the string passed in as the argument. No limit on
-#   argument string length. Assumes a character set with continuously
-#   ascending and contiguous letters within each case and within the digits
-#   (e.g. this works for ASCII and bombs in EBCDIC. But then, most things
-#   do.). Reference: Adapted from Knuth, D.E. (1973) The art of computer
-#   programming; Volume 3: Sorting and searching.  Addison-Wesley Publishing
-#   Company: Reading, Mass. Page 392.
-#   Special cases: Leading or embedded spaces, numerals, or punctuation are squeezed
-#   out before encoding begins.
-#
-#   Null strings or those with no encodable letters return the code 'Z000'.
-#
-#   Test data from Knuth (1973):
-#   Euler   Gauss   Hilbert Knuth   Lloyd   Lukasiewicz
-#   E460    G200    H416    K530    L300    L222
-
-namespace eval ::soundex {
-    variable  soundexKnuthCode
-    array set soundexKnuthCode {
-	a 0 b 1 c 2 d 3 e 0 f 1 g 2 h 0 i 0 j 2 k 2 l 4 m 5
-	n 5 o 0 p 1 q 2 r 6 s 2 t 3 u 0 v 1 w 0 x 2 y 0 z 2
-    }
-}
-proc ::soundex::knuth {in} {
-    variable soundexKnuthCode
-    set key ""
-
-    # Remove the leading/trailing white space punctuation etc.
-
-    set TempIn [string trim $in "\t\n\r .,'-"]
-
-    # Only use alphabetic characters, so strip out all others
-    # also, soundex index uses only lower case chars, so force to lower
-
-    regsub -all {[^a-z]} [string tolower $TempIn] {} TempIn
-    if {[string length $TempIn] == 0} {
-	return Z000
-    }
-    set last [string index $TempIn 0]
-    set key  [string toupper $last]
-    set last $soundexKnuthCode($last)
-
-    # Scan rest of string, stop at end of string or when the key is
-    # full
-
-    set count    1
-    set MaxIndex [string length $TempIn]
-
-    for {set index 1} {(($count < 4) && ($index < $MaxIndex))} {incr index } {
-	set chcode $soundexKnuthCode([string index $TempIn $index])
-	# Fold together adjacent letters sharing the same code
-	if {![string equal $last $chcode]} {
-	    set last $chcode
-	    # Ignore code==0 letters except as separators
-	    if {$last != 0} then {
-		set key $key$last
-		incr count
-	    }
-	}
-    }
-    return [string range ${key}0000 0 3]
-}
-
-package provide soundex 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/stooop/mkpkgidx.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/stooop/mkpkgidx.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,112 +1,0 @@
-# command line:
-# $ interpreter mkpkgidx.tcl -p package1.n.n -p package2 -p package3.n ...
-#     packageName file1 file2 ...
-# use wish as interpreter instead of tclsh in order to handle graphical packages
-
-# Copyright (c) 2001 by Jean-Luc Fontaine <jfontain@free.fr>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: mkpkgidx.tcl,v 1.3 2004/01/15 06:36:14 andreas_kupries Exp $
-
-# this utility must be used to create the package index file for a package that
-# uses stooop.
-# it differs from the tcl pkg_mkIndex procedure in the way it sources files.
-# since base classes can usually be found in files separate from the derived
-# class source file, sourcing each file in a different interpreter (as is done
-# in the pkg_mkIndex procedure) results in an error for stooop that catches the
-# fact that the base class is not defined. the solution is to use a single
-# interpreter which will source the class files in order (base classes first at
-# the user's responsibility). since stooop is loaded in that single interpreter,
-# inheritance problems and others are automatically caught in the process.
-# the generated package index file is fully compatible with the tcl generated
-# ones.
-# the stooop library makes sure that base classes source files are automatically
-# sourced when a derived class is defined (see the stooop.tcl source file for
-# more information).
-# if your software requires one or more packages, you may force their loading
-# by using the -p arguments. each package version number is optionally appended
-# to the package name and follows the same rules as the Tcl package require
-# command
-# example: $ tclsh -p switched.1 -p scwoop foo bar.tcl barfoo.tcl foobar.tcl ...
-
-if {[catch {package require stooop 4}]} {
-    # in case stooop package is not installed
-    source stooop.tcl
-}
-namespace import stooop::*
-
-proc indexData {packageName files} {
-    global auto_index
-
-    set index "# Package index file created with stooop version [package provide stooop] for stooop packages\n"
-    set data {}
-
-    foreach command [info commands] {
-        set defined($command) {}
-    }
-
-    foreach file $files {
-        # source at global level to avoid variable names collisions:
-        uplevel #0 source [list $file]
-
-        catch {unset newCommands}                    ;# empty new commands array
-        foreach command [info commands] {
-            # check new commands at the global level
-            # filter out tk widget commands and ignore commands eventually
-            # loaded from a package required by the new commands
-            if {
-                [string match .* $command]||[info exists defined($command)]||
-                [info exists auto_index($command)]||\
-                [info exists auto_index(::$command)]
-            } continue
-            set newCommands($command) {}
-            set defined($command) {}
-        }
-        # check new classes, which actually are namespaces:
-        foreach class [array name stooop::declared] {
-            if {![info exists declared($class)]} {
-                # check new commands at the class namespace level:
-                foreach command [info commands ::${class}::*] {
-                    # ignore commands eventually loaded from a package required
-                    # by the new commands
-                    if {\
-                        [info exists defined($command)]||\
-                        [info exists auto_index($command)]||\
-                        [info exists auto_index(::$command)]\
-                    } continue
-                    set newCommands($command) {}
-                    set defined($command) {}
-                }
-                set declared($class) {}
-            }
-        }
-        # so far only sourceable file, not shared libraries, are handled
-        lappend data [list $file source [lsort [array names newCommands]]]
-    }
-    set version [package provide $packageName]
-    append index "\npackage ifneeded $packageName $version \[list tclPkgSetup \$dir $packageName $version [list $data]\]"
-    return $index
-}
-
-proc printUsage {exitCode} {
-    global argv0
-
-    puts stderr "usage: $argv0 \[\[-p package.n.n\] \[-p package.n.n\] ...\] moduleName tclFile tclFile ..."
-    exit $exitCode
-}
-
-# first gather eventual packages:
-for {set index 0} {$index<[llength $argv]} {incr index} {
-    if {[string compare [lindex $argv $index] -p]!=0} break
-    set version {}
-    scan [lindex $argv [incr index]] {%[^.].%s} name version
-    eval package require $name $version
-}
-
-set argv [lrange $argv $index end]                   ;# keep remaining arguments
-if {[llength $argv]<2} {
-    printUsage 1
-}
-
-puts [open pkgIndex.tcl w] [indexData [lindex $argv 0] [lrange $argv 1 end]]
-exit                                                     ;# in case wish is used
Index: tolsh/tolsh.vfs/lib/tcllib1.10/stooop/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/stooop/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,22 +1,0 @@
-# @mdgen EXCLUDE: xifo.tcl
-# @mdgen EXCLUDE: mkpkgidx.tcl
-#
-# Copyright (c) 2001 by Jean-Luc Fontaine <jfontain@free.fr>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: pkgIndex.tcl,v 1.10 2007/03/23 17:31:51 andreas_kupries Exp $
-
-# Since stooop redefines the proc command and the default package facility will
-# only load the stooop package at the first unknown command, proc being
-# obviously known by default, forcing the loading of stooop is mandatory prior
-# to the first proc declaration.
-
-if {![package vsatisfies [package provide Tcl] 8.3]} {return}
-package ifneeded stooop 4.4.1 [list source [file join $dir stooop.tcl]]
-
-# the following package index instruction was generated using:
-#   "tclsh mkpkgidx.tcl switched switched.tcl"
-# (comment out the following line if you do not want to use the switched class
-# as a package)
-
-package ifneeded switched 2.2.1 [list source [file join $dir switched.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/stooop/stooop.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/stooop/stooop.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,938 +1,0 @@
-# stooop
-# Simple Tcl Only Object Oriented Programming
-# An object oriented extension to the Tcl programming language
-#
-# Copyright (c) 2002 by Jean-Luc Fontaine <jfontain@free.fr>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: stooop.tcl,v 1.9 2004/01/15 06:36:14 andreas_kupries Exp $
-
-
-# check whether empty named arrays and array unset are supported:
-package require Tcl 8.3
-
-package provide stooop 4.4.1
-
-# rename proc before it is overloaded, ignore error in case of multiple
-# inclusion of this file:
-catch {rename proc _proc}
-
-namespace eval ::stooop {
-    variable check
-    variable trace
-
-    # no checking by default: use an empty instruction to avoid any performance
-    # hit:
-    set check(code) {}
-    if {[info exists ::env(STOOOPCHECKALL)]&&$::env(STOOOPCHECKALL)} {
-        array set ::env\
-            {STOOOPCHECKPROCEDURES 1 STOOOPCHECKDATA 1 STOOOPCHECKOBJECTS 1}
-    }
-    set check(procedures) [expr {\
-        [info exists ::env(STOOOPCHECKPROCEDURES)]&&\
-        $::env(STOOOPCHECKPROCEDURES)\
-    }]
-    set check(data) [expr {\
-        [info exists ::env(STOOOPCHECKDATA)]&&$::env(STOOOPCHECKDATA)\
-    }]
-    set check(objects) [expr {\
-        [info exists ::env(STOOOPCHECKOBJECTS)]&&$::env(STOOOPCHECKOBJECTS)\
-    }]
-    if {$check(procedures)} {
-        append check(code) {::stooop::checkProcedure;}
-    }
-    if {[info exists ::env(STOOOPTRACEALL)]} {
-        # use same channel for both traces
-        set ::env(STOOOPTRACEPROCEDURES) $::env(STOOOPTRACEALL)
-        set ::env(STOOOPTRACEDATA) $::env(STOOOPTRACEALL)
-    }
-    if {[info exists ::env(STOOOPTRACEPROCEDURES)]} {
-        set trace(procedureChannel) $::env(STOOOPTRACEPROCEDURES)
-        switch $trace(procedureChannel) {
-            stdout - stderr {}
-            default {
-                # eventually truncate output file if it exists:
-                set trace(procedureChannel) [open $::env(STOOOPTRACEPROCEDURES) w+]
-            }
-        }
-        # default format:
-        set trace(procedureFormat)\
-            {class: %C, procedure: %p, object: %O, arguments: %a}
-        # eventually override with user defined format:
-        catch {set trace(procedureFormat) $::env(STOOOPTRACEPROCEDURESFORMAT)}
-        append check(code) {::stooop::traceProcedure;}
-    }
-    if {[info exists ::env(STOOOPTRACEDATA)]} {
-        set trace(dataChannel) $::env(STOOOPTRACEDATA)
-        switch $trace(dataChannel) {
-            stdout - stderr {}
-            default {
-                # eventually truncate output file if it exists
-                set trace(dataChannel) [open $::env(STOOOPTRACEDATA) w+]
-            }
-        }
-        # default format:
-        set trace(dataFormat) {class: %C, procedure: %p, array: %A, object: %O, member: %m, operation: %o, value: %v}
-        # eventually override with user defined format:
-        catch {set trace(dataFormat) $::env(STOOOPTRACEDATAFORMAT)}
-        # trace all operations by default:
-        set trace(dataOperations) rwu
-        # eventually override with user defined operations:
-        catch {set trace(dataOperations) $::env(STOOOPTRACEDATAOPERATIONS)}
-    }
-
-    namespace export class virtual new delete classof  ;# export public commands
-
-    if {![info exists newId]} {
-        # initialize object id counter only once even if this file is sourced
-        # several times:
-        variable newId 0
-    }
-
-    # create an object of specified class or copy an existing object:
-    _proc new {classOrId args} {
-        variable newId
-        variable fullClass
-
-        # use local variable for identifier because new can be invoked
-        # recursively:
-        if {[string is integer $classOrId]} {
-            # first argument is an object identifier (unsigned integer), copy
-            # source object to new object of identical class
-            if {[catch {\
-                set fullClass([set id [incr newId]]) $fullClass($classOrId)\
-            }]} {
-                error "invalid object identifier $classOrId"
-            }
-            # invoke the copy constructor for the class in caller's variable
-            # context so that object copy is transparent (see above):
-            uplevel 1 $fullClass($classOrId)::_copy $id $classOrId
-        } else {                                    ;# first argument is a class
-            # generate constructor name:
-            set constructor ${classOrId}::[namespace tail $classOrId]
-            # we could detect here whether class was ever declared but that
-            # would prevent stooop packages to load properly, because
-            # constructor would not be invoked and thus class source file never
-            # sourced
-            # invoke the constructor for the class with optional arguments in
-            # caller's variable context so that object creation is transparent
-            # and that array names as constructor parameters work with a simple
-            # upvar
-            # note: if class is in a package, the class namespace code is loaded
-            # here, as the first object of the class is created
-            uplevel 1 $constructor [set id [incr newId]] $args
-            # generate fully qualified class namespace name now that we are sure
-            # that class namespace code has been invoked:
-            set fullClass($id) [namespace qualifiers\
-                [uplevel 1 namespace which -command $constructor]\
-            ]
-        }
-        return $id                          ;# return a unique object identifier
-    }
-
-    _proc delete {args} {                          ;# delete one or more objects
-        variable fullClass
-
-        foreach id $args {
-            # destruct in caller's variable context so that object deletion is
-            # transparent:
-            uplevel 1 ::stooop::deleteObject $fullClass($id) $id
-            unset fullClass($id)
-        }
-    }
-
-    # delete object data starting at specified class layer and going up the base
-    # class hierarchy if any
-    # invoke the destructor for the object class and unset all the object data
-    # members for the class
-    # the destructor will in turn delete the base classes layers
-    _proc deleteObject {fullClass id} {
-        # invoke the destructor for the class in caller's variable context so
-        # that object deletion is transparent:
-        uplevel 1 ${fullClass}::~[namespace tail $fullClass] $id
-        # delete all this object data members if any (assume that they were
-        # stored as ${class}::($id,memberName)):
-        array unset ${fullClass}:: $id,*
-        # data member arrays deletion is left to the user
-    }
-
-    _proc classof {id} {
-        variable fullClass
-
-        return $fullClass($id)                         ;# return class of object
-    }
-
-    # copy object data members from one object to another:
-    _proc copy {fullClass from to} {
-        set index [string length $from]
-        # copy regular data members:
-        foreach {name value} [array get ${fullClass}:: $from,*] {
-            set ${fullClass}::($to[string range $name $index end]) $value
-        }
-        # if any, array data members copy is left to the class programmer
-        # through the then mandatory copy constructor
-    }
-}
-
-_proc ::stooop::class {args} {
-    variable declared
-
-    set class [lindex $args 0]
-    # register class using its fully qualified name:
-    set declared([uplevel 1 namespace eval $class {namespace current}]) {}
-    # create the empty name array used to hold all class objects so that static
-    # members can be directly initialized within the class declaration but
-    # outside member procedures
-    uplevel 1 namespace eval $class [list "::variable {}\n[lindex $args end]"]
-}
-
-# if procedure is a member of a known class, class and procedure names are set
-# and true is returned, otherwise false is returned:
-_proc ::stooop::parseProcedureName {\
-    namespace name fullClassVariable procedureVariable messageVariable\
-} {
-    # namespace argument is the current namespace (fully qualified) in which the
-    # procedure is defined
-    variable declared
-    upvar 1 $fullClassVariable fullClass $procedureVariable procedure\
-        $messageVariable message
-
-    if {\
-        [info exists declared($namespace)]&&\
-        ([string length [namespace qualifiers $name]]==0)\
-    } {
-        # a member procedure is being defined inside a class namespace
-        set fullClass $namespace
-        set procedure $name                ;# member procedure name is full name
-        return 1
-    } else {
-        # procedure is either a member of a known class or a regular procedure
-        if {![string match ::* $name]} {
-            # eventually fully qualify procedure name
-            if {[string equal $namespace ::]} { ;# global namespace special case
-                set name ::$name
-            } else {
-                set name ${namespace}::$name
-            }
-        }
-        # eventual class name is leading part:
-        set fullClass [namespace qualifiers $name]
-        if {[info exists declared($fullClass)]} {           ;# if class is known
-            set procedure [namespace tail $name] ;# procedure always is the tail
-            return 1
-        } else {                                       ;# not a member procedure
-            if {[string length $fullClass]==0} {
-                set message "procedure $name class name is empty"
-            } else {
-                set message "procedure $name class $fullClass is unknown"
-            }
-            return 0
-        }
-    }
-}
-
-# virtual operator, to be placed before proc
-# virtualize a member procedure, determine whether it is a pure virtual, check
-# for procedures that cannot be virtualized
-_proc ::stooop::virtual {keyword name arguments args} {
-    # set a flag so that proc knows it is acting upon a virtual procedure, also
-    # serves as a pure indicator:
-    variable pureVirtual
-
-    if {![string equal [uplevel 1 namespace which -command $keyword] ::proc]} {
-        error "virtual operator works only on proc, not $keyword"
-    }
-    if {![parseProcedureName\
-        [uplevel 1 namespace current] $name fullClass procedure message\
-    ]} {
-        error $message                   ;# not in a member procedure definition
-    }
-    set class [namespace tail $fullClass]
-    if {[string equal $class $procedure]} {
-        error "cannot make class $fullClass constructor virtual"
-    }
-    if {[string equal ~$class $procedure]} {
-        error "cannot make class $fullClass destructor virtual"
-    }
-    if {![string equal [lindex $arguments 0] this]} {
-        error "cannot make static procedure $procedure of class $fullClass virtual"
-    }
-    # no procedure body means pure virtual:
-    set pureVirtual [expr {[llength $args]==0}]
-    # process procedure declaration, body being empty for pure virtual procedure
-    # make virtual transparent by using uplevel:
-    uplevel 1 ::proc [list $name $arguments [lindex $args 0]]
-    unset pureVirtual
-}
-
-_proc proc {name arguments args} {
-    if {![::stooop::parseProcedureName\
-        [uplevel 1 namespace current] $name fullClass procedure message\
-    ]} {
-        # not in a member procedure definition, fall back to normal procedure
-        # declaration
-        # uplevel is required instead of eval here otherwise tcl seems to forget
-        # the procedure namespace if it exists
-        uplevel 1 _proc [list $name $arguments] $args
-        return
-    }
-    if {[llength $args]==0} {               ;# check for procedure body presence
-        error "missing body for ${fullClass}::$procedure"
-    }
-    set class [namespace tail $fullClass]
-    if {[string equal $class $procedure]} {      ;# class constructor definition
-        if {![string equal [lindex $arguments 0] this]} {
-            error "class $fullClass constructor first argument must be this"
-        }
-        if {[string equal [lindex $arguments 1] copy]} {
-            # user defined copy constructor definition
-            if {[llength $arguments]!=2} {
-                error "class $fullClass copy constructor must have 2 arguments exactly"
-            }
-            # make sure of proper declaration order:
-            if {[catch {info body ::${fullClass}::$class}]} {
-                error "class $fullClass copy constructor defined before constructor"
-            }
-            eval ::stooop::constructorDeclaration\
-                $fullClass $class 1 \{$arguments\} $args
-        } else {                                             ;# main constructor
-            eval ::stooop::constructorDeclaration\
-                $fullClass $class 0 \{$arguments\} $args
-            # always generate default copy constructor:
-            ::stooop::generateDefaultCopyConstructor $fullClass
-        }
-    } elseif {[string equal ~$class $procedure]} {
-        # class destructor declaration
-        if {[llength $arguments]!=1} {
-            error "class $fullClass destructor must have 1 argument exactly"
-        }
-        if {![string equal [lindex $arguments 0] this]} {
-            error "class $fullClass destructor argument must be this"
-        }
-        # make sure of proper declaration order
-        # (use fastest method for testing procedure existence):
-        if {[catch {info body ::${fullClass}::$class}]} {
-            error "class $fullClass destructor defined before constructor"
-        }
-        ::stooop::destructorDeclaration\
-            $fullClass $class $arguments [lindex $args 0]
-    } else {
-        # regular member procedure, may be static if there is no this first
-        # argument
-        # make sure of proper declaration order:
-        if {[catch {info body ::${fullClass}::$class}]} {
-            error "class $fullClass member procedure $procedure defined before constructor"
-        }
-        ::stooop::memberProcedureDeclaration\
-            $fullClass $class $procedure $arguments [lindex $args 0]
-    }
-}
-
-# copy flag is set for user defined copy constructor:
-_proc ::stooop::constructorDeclaration {fullClass class copy arguments args} {
-    variable check
-    variable fullBases
-    variable variable
-
-    set number [llength $args]
-    # check that each base class constructor has arguments:
-    if {($number%2)==0} {
-        error "bad class $fullClass constructor declaration, a base class, contructor arguments or body may be missing"
-    }
-    if {[string equal [lindex $arguments end] args]} {
-        # remember that there is a variable number of arguments in class
-        # constructor
-        set variable($fullClass) {}
-    }
-    if {!$copy} {
-        # do not initialize (or reinitialize in case of multiple class file
-        # source statements) base classes for copy constructor
-        set fullBases($fullClass) {}
-    }
-    # check base classes and their constructor arguments:
-    foreach {base baseArguments} [lrange $args 0 [expr {$number-2}]] {
-        # fully qualify base class namespace by looking up constructor, which
-        # must exist
-        set constructor ${base}::[namespace tail $base]
-        # in case base class is defined in a file that is part of a package,
-        # make sure that file is sourced through the tcl package auto-loading
-        # mechanism by directly invoking the base class constructor while
-        # ignoring the resulting error
-        catch {$constructor}
-        # determine fully qualified base class name in user invocation level
-        # (up 2 levels from here since this procedure is invoked exclusively by
-        # proc)
-        set fullBase [namespace qualifiers\
-            [uplevel 2 namespace which -command $constructor]\
-        ]
-        if {[string length $fullBase]==0} {   ;# base constructor is not defined
-            if {[string match *$base $fullClass]} {
-                # if the specified base class name is included last in the fully
-                # qualified class name, assume that it was meant to be the same
-                error "class $fullClass cannot be derived from itself"
-            } else {
-                error "class $fullClass constructor defined before base class $base constructor"
-            }
-        }
-        # check and save base classes only for main constructor that defines
-        # them:
-        if {!$copy} {
-            if {[lsearch -exact $fullBases($fullClass) $fullBase]>=0} {
-                error "class $fullClass directly inherits from class $fullBase more than once"
-            }
-            lappend fullBases($fullClass) $fullBase
-        }
-        # replace new lines with blanks in base arguments part in case user has
-        # formatted long declarations with new lines
-        regsub -all {\n} $baseArguments { } constructorArguments($fullBase)
-    }
-    # setup access to class data (an empty named array)
-    # fully qualify tcl variable command for it may have been redefined within
-    # the class namespace
-    # since constructor is directly invoked by new, the object identifier must
-    # be valid, so debugging the procedure is pointless
-    set constructorBody \
-"::variable {}
-$check(code)
-"
-    # base class(es) derivation specified:
-    if {[llength $fullBases($fullClass)]>0} {
-        # invoke base class constructors before evaluating constructor body
-        # then set base part hidden derived member so that virtual procedures
-        # are invoked at base class level as in C++
-        if {[info exists variable($fullClass)]} {
-            # variable number of arguments in derived class constructor
-            foreach fullBase $fullBases($fullClass) {
-                if {![info exists constructorArguments($fullBase)]} {
-                    error "missing base class $fullBase constructor arguments from class $fullClass constructor"
-                }
-                set baseConstructor ${fullBase}::[namespace tail $fullBase]
-                if {\
-                    [info exists variable($fullBase)]&&\
-                    ([string first {$args} $constructorArguments($fullBase)]>=0)\
-                } {
-                    # variable number of arguments in base class constructor and
-                    # in derived class base class constructor arguments
-                    # use eval so that base class constructor sees arguments
-                    # instead of a list
-                    # only the last argument of the base class constructor
-                    # arguments is considered as a variable list
-                    # (it usually is $args but could be a procedure invocation,
-                    # such as [filter $args])
-                    # fully qualify tcl commands such as set, for they may have
-                    #  been redefined within the class namespace
-                    append constructorBody \
-"::set _list \[::list $constructorArguments($fullBase)\]
-::eval $baseConstructor \$this \[::lrange \$_list 0 \[::expr {\[::llength \$_list\]-2}\]\] \[::lindex \$_list end\]
-::unset _list
-::set ${fullBase}::(\$this,_derived) $fullClass
-"
-                } else {
-                    # no special processing needed
-                    # variable number of arguments in base class constructor or
-                    # variable arguments list passed as is to base class
-                    #  constructor
-                    append constructorBody \
-"$baseConstructor \$this $constructorArguments($fullBase)
-::set ${fullBase}::(\$this,_derived) $fullClass
-"
-                }
-            }
-        } else {                                 ;# constant number of arguments
-            foreach fullBase $fullBases($fullClass) {
-                if {![info exists constructorArguments($fullBase)]} {
-                    error "missing base class $fullBase constructor arguments from class $fullClass constructor"
-                }
-                set baseConstructor ${fullBase}::[namespace tail $fullBase]
-                append constructorBody \
-"$baseConstructor \$this $constructorArguments($fullBase)
-::set ${fullBase}::(\$this,_derived) $fullClass
-"
-            }
-        }
-    }                                 ;# else no base class derivation specified
-    if {$copy} {
-        # for user defined copy constructor, copy derived class member if it
-        # exists
-        append constructorBody \
-"::catch {::set (\$this,_derived) \$(\$[::lindex $arguments 1],_derived)}
-"
-    }
-    # finally append user defined procedure body:
-    append constructorBody [lindex $args end]
-    if {$copy} {
-        _proc ${fullClass}::_copy $arguments $constructorBody
-    } else {
-        _proc ${fullClass}::$class $arguments $constructorBody
-    }
-}
-
-_proc ::stooop::destructorDeclaration {fullClass class arguments body} {
-    variable check
-    variable fullBases
-
-    # setup access to class data
-    # since the object identifier is always valid at this point, debugging the
-    # procedure is pointless
-    set body \
-"::variable {}
-$check(code)
-$body
-"
-    # if there are any, delete base classes parts in reverse order of
-    # construction
-    for {set index [expr {[llength $fullBases($fullClass)]-1}]} {$index>=0}\
-        {incr index -1}\
-    {
-        set fullBase [lindex $fullBases($fullClass) $index]
-        append body \
-"::stooop::deleteObject $fullBase \$this
-"
-    }
-    _proc ${fullClass}::~$class $arguments $body
-}
-
-_proc ::stooop::memberProcedureDeclaration {\
-    fullClass class procedure arguments body\
-} {
-    variable check
-    variable pureVirtual
-
-    if {[info exists pureVirtual]} {                      ;# virtual declaration
-        if {$pureVirtual} {                          ;# pure virtual declaration
-            # setup access to class data
-            # evaluate derived procedure which must exists. derived procedure
-            # return value is automatically returned
-            _proc ${fullClass}::$procedure $arguments \
-"::variable {}
-$check(code)
-::uplevel 1 \$(\$this,_derived)::$procedure \[::lrange \[::info level 0\] 1 end\]
-"
-        } else {                                  ;# regular virtual declaration
-            # setup access to class data
-            # evaluate derived procedure and return if it exists
-            # else evaluate the base class procedure which can be invoked from
-            # derived class procedure by prepending _
-            _proc ${fullClass}::_$procedure $arguments \
-"::variable {}
-$check(code)
-$body
-"
-            _proc ${fullClass}::$procedure $arguments \
-"::variable {}
-$check(code)
-if {!\[::catch {::info body \$(\$this,_derived)::$procedure}\]} {
-::return \[::uplevel 1 \$(\$this,_derived)::$procedure \[::lrange \[::info level 0\] 1 end\]\]
-}
-::uplevel 1 ${fullClass}::_$procedure \[::lrange \[::info level 0\] 1 end\]
-"
-        }
-    } else {                                          ;# non virtual declaration
-        # setup access to class data:
-        _proc ${fullClass}::$procedure $arguments \
-"::variable {}
-$check(code)
-$body
-"
-    }
-}
-
-# generate default copy procedure which may be overriden by the user for any
-# class layer:
-_proc ::stooop::generateDefaultCopyConstructor {fullClass} {
-    variable fullBases
-
-    # generate code for cloning base classes layers if there is at least one
-    # base class
-    foreach fullBase $fullBases($fullClass) {
-        append body \
-"${fullBase}::_copy \$this \$sibling
-"
-    }
-    append body \
-"::stooop::copy $fullClass \$sibling \$this
-"
-    _proc ${fullClass}::_copy {this sibling} $body
-}
-
-
-if {[llength [array names ::env STOOOP*]]>0} {
-    # if one or more environment variables are set, we are in debugging mode
-
-    # gracefully handle multiple sourcing of this file:
-    catch {rename ::stooop::class ::stooop::_class}
-    # use a new class procedure instead of adding debugging code to existing one
-    _proc ::stooop::class {args} {
-        variable trace
-        variable check
-
-        set class [lindex $args 0]
-        if {$check(data)} {
-            # check write and unset operations on empty named array holding
-            # class data
-            uplevel 1 namespace eval $class\
-                [list {::trace variable {} wu ::stooop::checkData}]
-        }
-        if {[info exists ::env(STOOOPTRACEDATA)]} {
-            # trace write and unset operations on empty named array holding
-            # class data
-            uplevel 1 namespace eval $class [list\
-                "::trace variable {} $trace(dataOperations) ::stooop::traceData"\
-            ]
-        }
-        uplevel 1 ::stooop::_class $args
-    }
-
-    if {$::stooop::check(procedures)} {
-        # prevent the creation of any object of a pure interface class
-        # use a new virtual procedure instead of adding debugging code to
-        # existing one
-        # gracefully handle multiple sourcing of this file:
-        catch {rename ::stooop::virtual ::stooop::_virtual}
-        # keep track of interface classes (which have at least 1 pure virtual
-        # procedure):
-        _proc ::stooop::virtual {keyword name arguments args} {
-            variable interface
-
-            uplevel 1 ::stooop::_virtual [list $keyword $name $arguments] $args
-            parseProcedureName [uplevel 1 namespace current] $name\
-                fullClass procedure message
-            if {[llength $args]==0} {    ;# no procedure body means pure virtual
-                set interface($fullClass) {}
-            }
-        }
-    }
-
-    if {$::stooop::check(objects)} {
-        _proc invokingProcedure {} {
-            if {[catch {set procedure [lindex [info level -2] 0]}]} {
-                # no invoking procedure
-                return {top level}
-            } elseif {\
-                ([string length $procedure]==0)||\
-                [string equal $procedure namespace]\
-            } {                                 ;# invoked from a namespace body
-                return "namespace [uplevel 2 namespace current]"
-            } else {
-                # store fully qualified name, visible from creator procedure
-                # invoking procedure
-                return [uplevel 3 namespace which -command $procedure]
-            }
-        }
-    }
-
-    if {$::stooop::check(procedures)||$::stooop::check(objects)} {
-        # gracefully handle multiple sourcing of this file:
-        catch {rename ::stooop::new ::stooop::_new}
-        # use a new new procedure instead of adding debugging code to existing
-        # one:
-        _proc ::stooop::new {classOrId args} {
-            variable newId
-            variable check
-
-            if {$check(procedures)} {
-                variable fullClass
-                variable interface
-            }
-            if {$check(objects)} {
-                variable creator
-            }
-            if {$check(procedures)} {
-                if {[string is integer $classOrId]} {
-                    # first argument is an object identifier
-                    # class code, if from a package, must already be loaded
-                    set fullName $fullClass($classOrId)
-                } else {                            ;# first argument is a class
-                    # generate constructor name:
-                    set constructor ${classOrId}::[namespace tail $classOrId]
-                    # force loading in case class is in a package so namespace
-                    # commands work properly:
-                    catch {$constructor}
-                    set fullName [namespace qualifiers\
-                        [uplevel 1 namespace which -command $constructor]\
-                    ]
-                    # anticipate full class name storage in original new{} in
-                    # order to avoid invalid object identifier error in
-                    # checkProcedure{} when member procedure is invoked from
-                    # within contructor, in which case full class name would
-                    # have yet to be stored.
-                    set fullClass([expr {$newId+1}]) $fullName
-                    # new identifier is really incremented in original new{}
-                }
-                if {[info exists interface($fullName)]} {
-                    error "class $fullName with pure virtual procedures should not be instanciated"
-                }
-            }
-            if {$check(objects)} {
-                # keep track of procedure in which creation occured (new
-                # identifier is really incremented in original new{})
-                set creator([expr {$newId+1}]) [invokingProcedure]
-            }
-            return [uplevel 1 ::stooop::_new $classOrId $args]
-        }
-    }
-
-    if {$::stooop::check(objects)} {
-        _proc ::stooop::delete {args} {
-            variable fullClass
-            variable deleter
-
-            # keep track of procedure in which deletion occured:
-            set procedure [invokingProcedure]
-            foreach id $args {
-                uplevel 1 ::stooop::deleteObject $fullClass($id) $id
-                unset fullClass($id)
-                set deleter($id) $procedure
-            }
-        }
-    }
-
-    # return the unsorted list of ancestors in class hierarchy:
-    _proc ::stooop::ancestors {fullClass} {
-        variable ancestors                         ;# use a cache for efficiency
-        variable fullBases
-
-        if {[info exists ancestors($fullClass)]} {
-            return $ancestors($fullClass)                  ;# found in the cache
-        }
-        set list {}
-        foreach class $fullBases($fullClass) {
-            set list [concat $list [list $class] [ancestors $class]]
-        }
-        set ancestors($fullClass) $list                         ;# save in cache
-        return $list
-    }
-
-    # since this procedure is always invoked from a debug procedure, take the
-    # extra level in the stack frame into account
-    # parameters (passed as references) that cannot be determined are not set
-    _proc ::stooop::debugInformation {\
-        className fullClassName procedureName fullProcedureName\
-        thisParameterName\
-    } {
-        upvar 1 $className class $fullClassName fullClass\
-            $procedureName procedure $fullProcedureName fullProcedure\
-            $thisParameterName thisParameter
-        variable declared
-
-        set namespace [uplevel 2 namespace current]
-        # not in a class namespace:
-        if {[lsearch -exact [array names declared] $namespace]<0} return
-        # remove redundant global qualifier:
-        set fullClass [string trimleft $namespace :]
-        set class [namespace tail $fullClass]                      ;# class name
-        set list [info level -2]
-        set first [lindex $list 0]
-        if {([llength $list]==0)||[string equal $first namespace]}\
-            return                     ;# not in a procedure, nothing else to do
-        set procedure $first
-        # procedure must be known at the invoker level:
-        set fullProcedure [uplevel 3 namespace which -command $procedure]
-        set procedure [namespace tail $procedure]        ;# strip procedure name
-        if {[string equal $class $procedure]} {                   ;# constructor
-            set procedure constructor
-        } elseif {[string equal ~$class $procedure]} {             ;# destructor
-            set procedure destructor
-        }
-        if {[string equal [lindex [info args $fullProcedure] 0] this]} {
-            # non static procedure
-            # object identifier is first argument:
-            set thisParameter [lindex $list 1]
-        }
-    }
-
-    # check that member procedure is valid for object passed as parameter:
-    _proc ::stooop::checkProcedure {} {
-        variable fullClass
-
-        debugInformation class qualifiedClass procedure qualifiedProcedure this
-        # static procedure, no checking possible:
-        if {![info exists this]} return
-        # in constructor, checking useless since object is not yet created:
-        if {[string equal $procedure constructor]} return
-        if {![info exists fullClass($this)]} {
-            error "$this is not a valid object identifier"
-        }
-        set fullName [string trimleft $fullClass($this) :]
-        # procedure and object classes match:
-        if {[string equal $fullName $qualifiedClass]} return
-        # restore global qualifiers to compare with internal full class array
-        # data
-        if {[lsearch -exact [ancestors ::$fullName] ::$qualifiedClass]<0} {
-            error "class $qualifiedClass of $qualifiedProcedure procedure not an ancestor of object $this class $fullName"
-        }
-    }
-
-    # gather current procedure data, perform substitutions and output to trace
-    # channel:
-    _proc ::stooop::traceProcedure {} {
-        variable trace
-
-        debugInformation class qualifiedClass procedure qualifiedProcedure this
-        # all debug data is available since we are for sure in a class procedure
-        set text $trace(procedureFormat)
-        regsub -all %C $text $qualifiedClass text  ;# fully qualified class name
-        regsub -all %c $text $class text
-        # fully qualified procedure name:
-        regsub -all %P $text $qualifiedProcedure text
-        regsub -all %p $text $procedure text
-        if {[info exists this]} {                        ;# non static procedure
-            regsub -all %O $text $this text
-            # remaining arguments:
-            regsub -all %a $text [lrange [info level -1] 2 end] text
-        } else {                                             ;# static procedure
-            regsub -all %O $text {} text
-            # remaining arguments:
-            regsub -all %a $text [lrange [info level -1] 1 end] text
-        }
-        puts $trace(procedureChannel) $text
-    }
-
-    # check that class data member is accessed within procedure of identical
-    # class
-    # then if procedure is not static, check that only data belonging to the
-    # object passed as parameter is accessed
-    _proc ::stooop::checkData {array name operation} {
-        scan $name %u,%s identifier member
-        # ignore internally defined members:
-        if {[info exists member]&&[string equal $member _derived]} return
-
-        debugInformation class qualifiedClass procedure qualifiedProcedure this
-        # no checking can be done outside of a class namespace:
-        if {![info exists class]} return
-        # determine array full name:
-        set array [uplevel 1 [list namespace which -variable $array]]
-        if {![info exists procedure]} {              ;# inside a class namespace
-            # compare with empty named array fully qualified name:
-            if {![string equal $array ::${qualifiedClass}::]} {
-                # trace command error message is automatically prepended and
-                # indicates operation
-                error\
-                    "class access violation in class $qualifiedClass namespace"
-            }
-            return                                                       ;# done
-        }
-        # ignore internal copy procedure:
-        if {[string equal $qualifiedProcedure ::stooop::copy]} return
-        if {![string equal $array ::${qualifiedClass}::]} {
-            # compare with empty named array fully qualified name
-            # trace command error message is automatically prepended and
-            # indicates operation
-            error "class access violation in procedure $qualifiedProcedure"
-        }
-        # static procedure, all objects can be accessed:
-        if {![info exists this]} return
-        # static data members can be accessed:
-        if {![info exists identifier]} return
-        # check that accessed data belongs to this object:
-        if {$this!=$identifier} {
-            error "object $identifier access violation in procedure $qualifiedProcedure acting on object $this"
-        }
-    }
-
-    # gather accessed data member information, perform substitutions and output
-    # to trace channel
-    _proc ::stooop::traceData {array name operation} {
-        variable trace
-
-        scan $name %u,%s identifier member
-        # ignore internally defined members:
-        if {[info exists member]&&[string equal $member _derived]} return
-
-        # ignore internal destruction:
-        if {\
-            ![catch {lindex [info level -1] 0} procedure]&&\
-            [string equal ::stooop::deleteObject $procedure]\
-        } return
-        set class {}                           ;# in case we are outside a class
-        set qualifiedClass {}
-        set procedure {}             ;# in case we are outside a class procedure
-        set qualifiedProcedure {}
-
-        debugInformation class qualifiedClass procedure qualifiedProcedure this
-        set text $trace(dataFormat)
-        regsub -all %C $text $qualifiedClass text  ;# fully qualified class name
-        regsub -all %c $text $class text
-        if {[info exists member]} {
-            regsub -all %m $text $member text
-        } else {
-            regsub -all %m $text $name text                     ;# static member
-        }
-        # fully qualified procedure name:
-        regsub -all %P $text $qualifiedProcedure text
-        regsub -all %p $text $procedure text
-        # fully qualified array name with global qualifiers stripped:
-        regsub -all %A $text [string trimleft\
-            [uplevel 1 [list namespace which -variable $array]] :\
-        ] text
-        if {[info exists this]} {                        ;# non static procedure
-            regsub -all %O $text $this text
-        } else {                                             ;# static procedure
-            regsub -all %O $text {} text
-        }
-        array set string {r read w write u unset}
-        regsub -all %o $text $string($operation) text
-        if {[string equal $operation u]} {
-            regsub -all %v $text {} text              ;# no value when unsetting
-        } else {
-            regsub -all %v $text [uplevel 1 set ${array}($name)] text
-        }
-        puts $trace(dataChannel) $text
-    }
-
-    if {$::stooop::check(objects)} {
-        # print existing objects along with creation procedure, with optional
-        # class pattern (see the string Tcl command manual)
-        _proc ::stooop::printObjects {{pattern *}} {
-            variable fullClass
-            variable creator
-
-            puts "stooop::printObjects invoked from [invokingProcedure]:"
-            foreach id [lsort -integer [array names fullClass]] {
-                if {[string match $pattern $fullClass($id)]} {
-                    puts "$fullClass($id)\($id\) + $creator($id)"
-                }
-            }
-        }
-
-        # record all existing objects for later report:
-        _proc ::stooop::record {} {
-            variable fullClass
-            variable checkpointFullClass
-
-            puts "stooop::record invoked from [invokingProcedure]"
-            catch {unset checkpointFullClass}
-            array set checkpointFullClass [array get fullClass]
-        }
-
-        # print all new or deleted object since last record, with optional class
-        # pattern:
-        _proc ::stooop::report {{pattern *}} {
-            variable fullClass
-            variable checkpointFullClass
-            variable creator
-            variable deleter
-
-            puts "stooop::report invoked from [invokingProcedure]:"
-            set checkpointIds [lsort -integer [array names checkpointFullClass]]
-            set currentIds [lsort -integer [array names fullClass]]
-            foreach id $currentIds {
-                if {\
-                    [string match $pattern $fullClass($id)]&&\
-                    ([lsearch -exact $checkpointIds $id]<0)\
-                } {
-                    puts "+ $fullClass($id)\($id\) + $creator($id)"
-                }
-            }
-            foreach id $checkpointIds {
-                if {\
-                    [string match $pattern $checkpointFullClass($id)]&&\
-                    ([lsearch -exact $currentIds $id]<0)\
-                } {
-                    puts "- $checkpointFullClass($id)\($id\) - $deleter($id) + $creator($id)"
-                }
-            }
-        }
-    }
-
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/stooop/switched.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/stooop/switched.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,133 +1,0 @@
-# The switched class (for the stooop object oriented extension)
-#
-# Copyright (c) 2001 by Jean-Luc Fontaine <jfontain@free.fr>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: switched.tcl,v 1.5 2006/09/19 23:36:18 andreas_kupries Exp $
-
-package require stooop
-package provide switched 2.2.1
-
-
-::stooop::class switched {
-
-    proc switched {this args} {            ;# arguments are option / value pairs
-        if {([llength $args]%2)!=0} {
-            error "value for \"[lindex $args end]\" missing"
-        }
-        set ($this,complete) 0
-        # delay arguments processing till completion as pure virtual procedure
-        # invocations do not work from base class constructor
-        set ($this,arguments) $args
-    }
-
-    proc ~switched {this} {}
-
-    # derived class implementation must return a list of
-    # {name "default value" "initial value"} lists
-    ::stooop::virtual proc options {this}
-
-    # must be invoked once only at the end of derived class constructor so that
-    # configuration occurs once derived object is completely built:
-    proc complete {this} {
-        foreach description [options $this] {
-            set option [lindex $description 0]
-            # by default always set option to default value:
-            set ($this,$option) [set default [lindex $description 1]]
-            if {[llength $description]<3} {
-                # no initial value so force initialization with default value
-                set initialize($option) {}
-            } elseif {![string equal $default [lindex $description 2]]} {
-                set ($this,$option) [lindex $description 2]
-                # initial value different from default value so force
-                # initialization
-                set initialize($option) {}
-            }
-        }
-        # check validity of constructor options, which always take precedence
-        # for initialization
-        foreach {option value} $($this,arguments) {
-            if {[catch {string compare $($this,$option) $value} different]} {
-                error "$($this,_derived): unknown option \"$option\""
-            }
-            if {$different} {
-                set ($this,$option) $value
-                set initialize($option) {}
-            }
-        }
-        unset ($this,arguments)
-        # all option values are initialized before any of the set procedures are
-        # called
-        foreach option [array names initialize] {
-            $($this,_derived)::set$option $this $($this,$option)
-        }
-        set ($this,complete) 1
-    }
-
-    proc configure {this args} {      ;# should not be invoked before completion
-        if {[llength $args]==0} {
-            return [descriptions $this]
-        }
-        foreach {option value} $args {
-            # check all options validity before doing anything else
-            if {![info exists ($this,$option)]} {
-                error "$($this,_derived): unknown option \"$option\""
-            }
-        }
-        if {[llength $args]==1} {
-            return [description $this [lindex $args 0]]
-        }
-        if {([llength $args]%2)!=0} {
-            error "value for \"[lindex $args end]\" missing"
-        }
-        # derived (dynamic virtual) procedure must either accept (or eventually
-        # adjust) the value or throw an error
-        # option data member is set prior to invoking the procedure in case
-        # other procedures are invoked and expect the new value
-        foreach {option value} $args {
-            if {![string equal $($this,$option) $value]} {
-                $($this,_derived)::set$option $this [set ($this,$option) $value]
-            }
-        }
-    }
-
-    proc cget {this option} {
-        if {[catch {set value $($this,$option)}]} {
-            error "$($this,_derived): unknown option \"$option\""
-        }
-        return $value                   ;# return specified option current value
-    }
-
-    proc description {this option} {  ;# build specified option description list
-        foreach description [options $this] {
-            if {[string equal [lindex $description 0] $option]} {
-                if {[llength $description]<3} {              ;# no initial value
-                    lappend description $($this,$option) ;# append current value
-                    return $description
-                } else {
-                    # set current value:
-                    return [lreplace $description 2 2 $($this,$option)]
-                }
-            }
-        }
-    }
-
-    # build option descriptions list for all supported options:
-    proc descriptions {this} {
-        set descriptions {}
-        foreach description [options $this] {
-            if {[llength $description]<3} {                  ;# no initial value
-                # append current value:
-                lappend description $($this,[lindex $description 0])
-                lappend descriptions $description
-            } else {
-                # set current value:
-                lappend descriptions [lreplace\
-                    $description 2 2 $($this,[lindex $description 0])\
-                ]
-            }
-        }
-        return $descriptions
-    }
-
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/stooop/xifo.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/stooop/xifo.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,142 +1,0 @@
-# The lifo and fifo classes (for the stooop object oriented extension)
-#
-# Copyright (c) 2002 by Jean-Luc Fontaine <jfontain@free.fr>.
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: xifo.tcl,v 1.4 2004/07/19 19:12:45 jfontain Exp $
-
-
-# Here is a sample FIFO/LIFO implementation with stooop.
-# Sample test code is at the bottom of this file.
-
-
-# Uncomment the following lines for the bottom sample code to work:
-# package require stooop
-# namespace import stooop::*
-
-
-::stooop::class xifo {
-
-    proc xifo {this size} {
-        set ($this,size) $size
-        empty $this
-    }
-
-    proc ~xifo {this} {
-        variable ${this}data
-        catch {unset ${this}data}
-    }
-
-    proc in {this data} {
-        variable ${this}data
-        tidyUp $this
-        if {[array size ${this}data] >= $($this,size)} {
-            unset ${this}data($($this,first))
-            incr ($this,first)
-        }
-        set ${this}data([incr ($this,last)]) $data
-    }
-
-    proc tidyUp {this} {                       ;# warning: for internal use only
-        variable ${this}data
-        catch {
-            unset ${this}data($($this,unset))
-            unset ($this,unset)
-        }
-    }
-
-    proc empty {this} {
-        variable ${this}data
-        catch {unset ${this}data}
-        catch {unset ($this,unset)}
-        set ($this,first) 0
-        set ($this,last) -1
-    }
-
-    proc isEmpty {this} {
-        return [expr {$($this,last) < $($this,first)}]
-    }
-
-    ::stooop::virtual proc out {this}
-
-    ::stooop::virtual proc data {this}
-}
-
-
-::stooop::class lifo {
-
-    proc lifo {this {size 2147483647}} xifo {$size} {}
-
-    proc ~lifo {this} {}
-
-    proc out {this} {
-        xifo::tidyUp $this
-        if {[array size xifo::${this}data] == 0} {
-            error "lifo $this out error, empty"
-        }
-        # delay unsetting popped data to improve performance by avoiding a data
-        # copy:
-        set xifo::($this,unset) $xifo::($this,last)
-        incr xifo::($this,last) -1
-        return [set xifo::${this}data($xifo::($this,unset))]
-    }
-
-    proc data {this} {
-        set list {}
-        set first $xifo::($this,first)
-        for {set index $xifo::($this,last)} {$index >= $first} {incr index -1} {
-            lappend list [set xifo::${this}data($index)]
-        }
-        return $list
-    }
-
-}
-
-
-::stooop::class fifo {
-
-    proc fifo {this {size 2147483647}} xifo {$size} {}
-
-    proc ~fifo {this} {}
-
-    proc out {this} {
-        xifo::tidyUp $this
-        if {[array size xifo::${this}data] == 0} {
-            error "fifo $this out error, empty"
-        }
-        # delay unsetting popped data to improve performance by avoiding a data
-        # copy:
-        set xifo::($this,unset) $xifo::($this,first)
-        incr xifo::($this,first)
-        return [set xifo::${this}data($xifo::($this,unset))]
-    }
-
-    proc data {this} {
-        set list {}
-        set last $xifo::($this,last)
-        for {set index $xifo::($this,first)} {$index <= $last} {incr index} {
-            lappend list [set xifo::${this}data($index)]
-        }
-        return $list
-    }
-
-}
-
-
-# Here are a few lines of sample code:
-#    proc exercise {id} {
-#        for {set u 0} {$u < 10} {incr u} {
-#            xifo::in $id $u
-#        }
-#        puts [xifo::out $id]
-#        puts [xifo::data $id]
-#        xifo::in $id $u
-#        xifo::in $id [incr u]
-#        puts [xifo::data $id]
-#    }
-#    set id [stooop::new lifo 10]
-#    exercise $id
-#    stooop::delete $id
-#    set id [stooop::new fifo 10]
-#    exercise $id
-#    stooop::delete $id
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,180 +1,0 @@
-# graph.tcl --
-#
-#	Implementation of a graph data structure for Tcl.
-#
-# Copyright (c) 2000-2005 by Andreas Kupries
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: graph.tcl,v 1.30 2007/02/16 07:04:48 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: graph_c.tcl
-
-package require Tcl 8.2
-
-namespace eval ::struct::graph {}
-
-# ### ### ### ######### ######### #########
-## Management of graph implementations.
-
-# ::struct::graph::LoadAccelerator --
-#
-#	Loads a named implementation, if possible.
-#
-# Arguments:
-#	key	Name of the implementation to load.
-#
-# Results:
-#	A boolean flag. True if the implementation
-#	was successfully loaded; and False otherwise.
-
-proc ::struct::graph::LoadAccelerator {key} {
-    variable accel
-    set r 0
-    switch -exact -- $key {
-	critcl {
-	    # Critcl implementation of graph requires Tcl 8.4.
-	    if {![package vsatisfies [package provide Tcl] 8.4]} {return 0}
-	    if {[catch {package require tcllibc}]} {return 0}
-	    set r [llength [info commands ::struct::graph_critcl]]
-	}
-	tcl {
-	    variable selfdir
-	    source [file join $selfdir graph_tcl.tcl]
-	    set r 1
-	}
-        default {
-            return -code error "invalid accelerator/impl. package $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($key) $r
-    return $r
-}
-
-# ::struct::graph::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-	rename ::struct::graph ::struct::graph_$loaded
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-	rename ::struct::graph_$key ::struct::graph
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# ::struct::graph::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::struct::graph::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::struct::graph::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::struct::graph::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-proc ::struct::graph::Names {} {
-    return {
-	critcl {tcllibc based}
-	tcl    {pure Tcl}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Data structures.
-
-namespace eval ::struct::graph {
-    variable  selfdir [file dirname [info script]]
-    variable  accel
-    array set accel   {tcl 0 critcl 0}
-    variable  loaded  {}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Choose an implementation,
-## most prefered first. Loads only one of the
-## possible implementations. And activates it.
-
-namespace eval ::struct::graph {
-    variable e
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Export the constructor command.
-    namespace export graph
-}
-
-package provide struct::graph 2.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2155 +1,0 @@
-# graph.tcl --
-#
-#	Implementation of a graph data structure for Tcl.
-#
-# Copyright (c) 2000 by Andreas Kupries
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: graph1.tcl,v 1.4 2005/09/28 04:51:24 andreas_kupries Exp $
-
-# Create the namespace before determining cgraph vs. tcl
-# Otherwise the loading 'struct.tcl' may get into trouble
-# when trying to import commands from them
-
-namespace eval ::struct {}
-namespace eval ::struct::graph {}
-
-# Try to load the cgraph package
-# Get it at http://physnet.uni-oldenburg.de/~schlenk/tcl/graph/ 
-
-if {![catch {package require cgraph 0.6}]} {
-    # the cgraph package takes over, so we can return
-    return
-}
-
-namespace eval ::struct {}
-namespace eval ::struct::graph {
-    # Data storage in the graph module
-    # -------------------------------
-    #
-    # There's a lot of bits to keep track of for each graph:
-    #	nodes
-    #	node values
-    #	node relationships (arcs)
-    #   arc values
-    #
-    # It would quickly become unwieldy to try to keep these in arrays or lists
-    # within the graph namespace itself.  Instead, each graph structure will
-    # get its own namespace.  Each namespace contains:
-    #	node:$node	array mapping keys to values for the node $node
-    #	arc:$arc	array mapping keys to values for the arc $arc
-    #	inArcs		array mapping nodes to the list of incoming arcs
-    #	outArcs		array mapping nodes to the list of outgoing arcs
-    #	arcNodes	array mapping arcs to the two nodes (start & end)
-    
-    # counter is used to give a unique name for unnamed graph
-    variable counter 0
-
-    # commands is the list of subcommands recognized by the graph
-    variable commands [list	\
-	    "arc"		\
-	    "arcs"		\
-	    "destroy"		\
-	    "get"		\
-	    "getall"		\
-	    "keys"		\
-	    "keyexists"		\
-	    "node"		\
-	    "nodes"		\
-	    "set"		\
-	    "swap"		\
-	    "unset"             \
-	    "walk"		\
-	    ]
-
-    variable arcCommands [list	\
-	    "append"	\
-	    "delete"	\
-	    "exists"	\
-	    "get"	\
-	    "getall"	\
-	    "insert"	\
-	    "keys"	\
-	    "keyexists"	\
-	    "lappend"	\
-	    "set"	\
-	    "source"	\
-	    "target"	\
-	    "unset"	\
-	    ]
-
-    variable nodeCommands [list	\
-	    "append"	\
-	    "degree"	\
-	    "delete"	\
-	    "exists"	\
-	    "get"	\
-	    "getall"	\
-	    "insert"	\
-	    "keys"	\
-	    "keyexists"	\
-	    "lappend"	\
-	    "opposite"	\
-	    "set"	\
-	    "unset"	\
-	    ]
-
-    # Only export one command, the one used to instantiate a new graph
-    namespace export graph
-}
-
-# ::struct::graph::graph --
-#
-#	Create a new graph with a given name; if no name is given, use
-#	graphX, where X is a number.
-#
-# Arguments:
-#	name	name of the graph; if null, generate one.
-#
-# Results:
-#	name	name of the graph created
-
-proc ::struct::graph::graph {{name ""}} {
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "graph${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-	error "command \"$name\" already exists, unable to create graph"
-    }
-
-    # Set up the namespace
-    namespace eval ::struct::graph::graph$name {
-
-	# Set up the map for values associated with the graph itself
-	variable graphData
-	array set graphData {data ""}
-
-	# Set up the map from nodes to the arcs coming to them
-	variable  inArcs
-	array set inArcs {}
-
-	# Set up the map from nodes to the arcs going out from them
-	variable  outArcs
-	array set outArcs {}
-
-	# Set up the map from arcs to the nodes they touch.
-	variable  arcNodes
-	array set arcNodes {}
-
-	# Set up a value for use in creating unique node names
-	variable nextUnusedNode
-	set nextUnusedNode 1
-
-	# Set up a value for use in creating unique arc names
-	variable nextUnusedArc
-	set nextUnusedArc 1
-    }
-
-    # Create the command to manipulate the graph
-    interp alias {} ::$name {} ::struct::graph::GraphProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::graph::GraphProc --
-#
-#	Command that processes all graph object commands.
-#
-# Arguments:
-#	name	name of the graph object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::graph::GraphProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    if { [llength [info commands ::struct::graph::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$cmd\": must be $optlist"
-    }
-    eval [list ::struct::graph::_$cmd $name] $args
-}
-
-# ::struct::graph::_arc --
-#
-#	Dispatches the invocation of arc methods to the proper handler
-#	procedure.
-#
-# Arguments:
-#	name	name of the graph.
-#	cmd	arc command to invoke
-#	args	arguments to propagate to the handler for the arc command
-#
-# Results:
-#	As of the invoked handler.
-
-proc ::struct::graph::_arc {name cmd args} {
-
-    # Split the args into command and args components
-    if { [llength [info commands ::struct::graph::__arc_$cmd]] == 0 } {
-	variable arcCommands
-	set optlist [join $arcCommands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$cmd\": must be $optlist"
-    }
-
-    eval [list ::struct::graph::__arc_$cmd $name] $args
-}
-
-# ::struct::graph::__arc_delete --
-#
-#	Remove an arc from a graph, including all of its values.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of arcs to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__arc_delete {name args} {
-
-    foreach arc $args {
-	if { ![__arc_exists $name $arc] } {
-	    error "arc \"$arc\" does not exist in graph \"$name\""
-	}
-    }
-
-    upvar ::struct::graph::graph${name}::inArcs   inArcs
-    upvar ::struct::graph::graph${name}::outArcs  outArcs
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-
-    foreach arc $args {
-	foreach {source target} $arcNodes($arc) break ; # lassign
-
-	unset arcNodes($arc)
-	# FRINK: nocheck
-	unset ::struct::graph::graph${name}::arc$arc
-
-	# Remove arc from the arc lists of source and target nodes.
-
-	set index            [lsearch -exact $outArcs($source) $arc]
-	set outArcs($source) [lreplace       $outArcs($source) $index $index]
-
-	set index            [lsearch -exact $inArcs($target)  $arc]
-	set inArcs($target)  [lreplace       $inArcs($target)  $index $index]
-    }
-
-    return
-}
-
-# ::struct::graph::__arc_exists --
-#
-#	Test for existance of a given arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to look for.
-#
-# Results:
-#	1 if the arc exists, 0 else.
-
-proc ::struct::graph::__arc_exists {name arc} {
-    return [info exists ::struct::graph::graph${name}::arcNodes($arc)]
-}
-
-# ::struct::graph::__arc_get --
-#
-#	Get a keyed value from an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__arc_get {name arc {flag -key} {key data}} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-    
-    upvar ::struct::graph::graph${name}::arc${arc} data
-
-    if { ![info exists data($key)] } {
-	error "invalid key \"$key\" for arc \"$arc\""
-    }
-
-    return $data($key)
-}
-
-# ::struct::graph::__arc_getall --
-#
-#	Get a serialized array of key/value pairs from an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#
-# Results:
-#	value	serialized array of key/value pairs.
-
-proc ::struct::graph::__arc_getall {name arc args} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }
-    
-    upvar ::struct::graph::graph${name}::arc${arc} data
-
-    return [array get data]
-}
-
-# ::struct::graph::__arc_keys --
-#
-#	Get a list of keys for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__arc_keys {name arc args} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }    
-
-    upvar ::struct::graph::graph${name}::arc${arc} data
-
-    return [array names data]
-}
-
-# ::struct::graph::__arc_keyexists --
-#
-#	Test for existance of a given key for a given arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::__arc_keyexists {name arc {flag -key} {key data}} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    if { ![string equal $flag "-key"] } {
-	error "invalid option \"$flag\": should be -key"
-    }
-    
-    upvar ::struct::graph::graph${name}::arc${arc} data
-
-    return [info exists data($key)]
-}
-
-# ::struct::graph::__arc_insert --
-#
-#	Add an arc to a graph.
-#
-# Arguments:
-#	name		name of the graph.
-#	source		source node of the new arc
-#	target		target node of the new arc
-#	args		arc to insert; must be unique.  If none is given,
-#			the routine will generate a unique node name.
-#
-# Results:
-#	arc		The name of the new arc.
-
-proc ::struct::graph::__arc_insert {name source target args} {
-
-    if { [llength $args] == 0 } {
-	# No arc name was given; generate a unique one
-	set arc [__generateUniqueArcName $name]
-    } else {
-	set arc [lindex $args 0]
-    }
-
-    if { [__arc_exists $name $arc] } {
-	error "arc \"$arc\" already exists in graph \"$name\""
-    }
-    
-    if { ![__node_exists $name $source] } {
-	error "source node \"$source\" does not exist in graph \"$name\""
-    }
-    
-    if { ![__node_exists $name $target] } {
-	error "target node \"$target\" does not exist in graph \"$name\""
-    }
-    
-    upvar ::struct::graph::graph${name}::inArcs    inArcs
-    upvar ::struct::graph::graph${name}::outArcs   outArcs
-    upvar ::struct::graph::graph${name}::arcNodes  arcNodes
-    upvar ::struct::graph::graph${name}::arc${arc} data
-
-    # Set up the new arc
-    set data(data)       ""
-    set arcNodes($arc) [list $source $target]
-
-    # Add this arc to the arc lists of its source resp. target nodes.
-    lappend outArcs($source) $arc
-    lappend inArcs($target)  $arc
-
-    return $arc
-}
-
-# ::struct::graph::__arc_set --
-#
-#	Set or get a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	args	?-key key? ?value?
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_set {name arc args} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arc$arc data
-
-    if { [llength $args] > 3 } {
-	error "wrong # args: should be \"$name arc set $arc ?-key key?\
-		?value?\""
-    }
-    
-    set key "data"
-    set haveValue 0
-    if { [llength $args] > 1 } {
-	foreach {flag key} $args break
-	if { ![string match "${flag}*" "-key"] } {
-	    error "invalid option \"$flag\": should be key"
-	}
-	if { [llength $args] == 3 } {
-	    set haveValue 1
-	    set value [lindex $args end]
-	}
-    } elseif { [llength $args] == 1 } {
-	set haveValue 1
-	set value [lindex $args end]
-    }
-
-    if { $haveValue } {
-	# Setting a value
-	return [set data($key) $value]
-    } else {
-	# Getting a value
-	if { ![info exists data($key)] } {
-	    error "invalid key \"$key\" for arc \"$arc\""
-	}
-	return $data($key)
-    }
-}
-
-# ::struct::graph::__arc_append --
-#
-#	Append a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	args	?-key key? value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_append {name arc args} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arc$arc data
-
-    if { [llength $args] != 1 && [llength $args] != 3 } {
-	error "wrong # args: should be \"$name arc append $arc ?-key key?\
-		value\""
-    }
-    
-    if { [llength $args] == 3 } {
-	foreach {flag key} $args break
-	if { ![string equal $flag "-key"] } {
-	    error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    return [append data($key) $value]
-}
-
-# ::struct::graph::__arc_lappend --
-#
-#	lappend a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	args	?-key key? value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_lappend {name arc args} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arc$arc data
-
-    if { [llength $args] != 1 && [llength $args] != 3 } {
-	error "wrong # args: should be \"$name arc lappend $arc ?-key key?\
-		value\""
-    }
-    
-    if { [llength $args] == 3 } {
-	foreach {flag key} $args break
-	if { ![string equal $flag "-key"] } {
-	    error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    return [lappend data($key) $value]
-}
-
-# ::struct::graph::__arc_source --
-#
-#	Return the node at the beginning of the specified arc.
-#
-# Arguments:
-#	name	name of the graph object.
-#	arc	arc to look up.
-#
-# Results:
-#	node	name of the node.
-
-proc ::struct::graph::__arc_source {name arc} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-    return [lindex $arcNodes($arc) 0]
-}
-
-# ::struct::graph::__arc_target --
-#
-#	Return the node at the end of the specified arc.
-#
-# Arguments:
-#	name	name of the graph object.
-#	arc	arc to look up.
-#
-# Results:
-#	node	name of the node.
-
-proc ::struct::graph::__arc_target {name arc} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-    return [lindex $arcNodes($arc) 1]
-}
-
-# ::struct::graph::__arc_unset --
-#
-#	Remove a keyed value from a arc.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify.
-#	args	additional args: ?-key key?
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__arc_unset {name arc {flag -key} {key data}} {
-    if { ![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-    
-    if { ![string match "${flag}*" "-key"] } {
-	error "invalid option \"$flag\": should be \"$name arc unset\
-		$arc ?-key key?\""
-    }
-
-    upvar ::struct::graph::graph${name}::arc${arc} data
-    if { [info exists data($key)] } {
-	unset data($key)
-    }
-    return
-}
-
-# ::struct::graph::_arcs --
-#
-#	Return a list of all arcs in a graph satisfying some
-#	node based restriction.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	arcs	list of arcs
-
-proc ::struct::graph::_arcs {name args} {
-
-    # Discriminate between conditions and nodes
-
-    set haveCond 0
-    set haveKey 0
-    set haveValue 0
-    set cond "none"
-    set condNodes [list]
-
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set arg [lindex $args $i]
-	switch -glob -- $arg {
-	    -in -
-	    -out -
-	    -adj -
-	    -inner -
-	    -embedding {
-		if {$haveCond} {
-		    return -code error "invalid restriction:\
-			    illegal multiple use of\
-			    \"-in\"|\"-out\"|\"-adj\"|\"-inner\"|\"-embedding\""
-		}
-
-		set haveCond 1
-		set cond [string range $arg 1 end]
-	    }
-	    -key {
-		if {$haveKey} {
-		    return -code error {invalid restriction: illegal multiple use of "-key"}
-		}
-
-		incr i
-		set key [lindex $args $i]
-		set haveKey 1
-	    }
-	    -value {
-		if {$haveValue} {
-		    return -code error {invalid restriction: illegal multiple use of "-value"}
-		}
-
-		incr i
-		set value [lindex $args $i]
-		set haveValue 1
-	    }
-	    -* {
-		error "invalid restriction \"$arg\": should be -in, -out,\
-			-adj, -inner, -embedding, -key or -value"
-	    }
-	    default {
-		lappend condNodes $arg
-	    }
-	}
-    }
-
-    # Validate that there are nodes to use in the restriction.
-    # otherwise what's the point?
-    if {$haveCond} {
-	if {[llength $condNodes] == 0} {
-	    set usage "$name arcs ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding node node...?"
-	    error "no nodes specified: should be \"$usage\""
-	}
-
-	# Make sure that the specified nodes exist!
-	foreach node $condNodes {
-	    if { ![__node_exists $name $node] } {
-		error "node \"$node\" does not exist in graph \"$name\""
-	    }
-	}
-    }
-
-    # Now we are able to go to work
-    upvar ::struct::graph::graph${name}::inArcs   inArcs
-    upvar ::struct::graph::graph${name}::outArcs  outArcs
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-
-    set       arcs [list]
-
-    switch -exact -- $cond {
-	in {
-	    # Result is all arcs going to at least one node
-	    # in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    # As an arc has only one destination, i.e. is the
-		    # in-arc of exactly one node it is impossible to
-		    # count an arc twice. IOW the [info exists] below
-		    # is never true. Found through coverage analysis
-		    # and then trying to think up a testcase invoking
-		    # the continue.
-		    # if {[info exists coll($e)]} {continue}
-		    lappend arcs    $e
-		    #set     coll($e) .
-		}
-	    }
-	}
-	out {
-	    # Result is all arcs coming from at least one node
-	    # in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $outArcs($node) {
-		    # See above 'in', same reasoning, one source per arc.
-		    # if {[info exists coll($e)]} {continue}
-		    lappend arcs    $e
-		    #set     coll($e) .
-		}
-	    }
-	}
-	adj {
-	    # Result is all arcs coming from or going to at
-	    # least one node in the list of arguments.
-
-	    array set coll  {}
-	    # Here we do need 'coll' as each might be an in- and
-	    # out-arc for one or two nodes in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    if {[info exists coll($e)]} {continue}
-		    lappend arcs    $e
-		    set     coll($e) .
-		}
-		foreach e $outArcs($node) {
-		    if {[info exists coll($e)]} {continue}
-		    lappend arcs    $e
-		    set     coll($e) .
-		}
-	    }
-	}
-	inner {
-	    # Result is all arcs running between nodes in the list.
-
-	    array set coll  {}
-	    # Here we do need 'coll' as each might be an in- and
-	    # out-arc for one or two nodes in the list of arguments.
-
-	    array set group {}
-	    foreach node $condNodes {
-		set group($node) .
-	    }
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {![info exists group($n)]} {continue}
-		    if { [info exists coll($e)]}  {continue}
-		    lappend arcs    $e
-		    set     coll($e) .
-		}
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {![info exists group($n)]} {continue}
-		    if { [info exists coll($e)]}  {continue}
-		    lappend arcs    $e
-		    set     coll($e) .
-		}
-	    }
-	}
-	embedding {
-	    # Result is all arcs from -adj minus the arcs from -inner.
-	    # IOW all arcs going from a node in the list to a node
-	    # which is *not* in the list
-
-	    # This also means that no arc can be counted twice as it
-	    # is either going to a node, or coming from a node in the
-	    # list, but it can't do both, because then it is part of
-	    # -inner, which was excluded!
-
-	    array set group {}
-	    foreach node $condNodes {
-		set group($node) .
-	    }
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {[info exists group($n)]} {continue}
-		    # if {[info exists coll($e)]}  {continue}
-		    lappend arcs    $e
-		    # set     coll($e) .
-		}
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {[info exists group($n)]} {continue}
-		    # if {[info exists coll($e)]}  {continue}
-		    lappend arcs    $e
-		    # set     coll($e) .
-		}
-	    }
-	}
-	none {
-	    set arcs [array names arcNodes]
-	}
-	default {error "Can't happen, panic"}
-    }
-
-    #
-    # We have a list of arcs that match the relation to the nodes.
-    # Now filter according to -key and -value.
-    #
-
-    set filteredArcs [list]
-
-    if {$haveKey} {
-	foreach arc $arcs {
-	    catch {
-		set aval [__arc_get $name $arc -key $key]
-		if {$haveValue} {
-		    if {$aval == $value} {
-			lappend filteredArcs $arc
-		    }
-		} else {
-		    lappend filteredArcs $arc
-		}
-	    }
-	}
-    } else {
-	set filteredArcs $arcs
-    }
-
-    return $filteredArcs
-}
-
-# ::struct::graph::_destroy --
-#
-#	Destroy a graph, including its associated command and data storage.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_destroy {name} {
-    namespace delete ::struct::graph::graph$name
-    interp alias {} ::$name {}
-}
-
-# ::struct::graph::__generateUniqueArcName --
-#
-#	Generate a unique arc name for the given graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	arc	name of a arc guaranteed to not exist in the graph.
-
-proc ::struct::graph::__generateUniqueArcName {name} {
-    upvar ::struct::graph::graph${name}::nextUnusedArc nextUnusedArc
-    while {[__arc_exists $name "arc${nextUnusedArc}"]} {
-	incr nextUnusedArc
-    }
-    return "arc${nextUnusedArc}"
-}
-
-# ::struct::graph::__generateUniqueNodeName --
-#
-#	Generate a unique node name for the given graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	node	name of a node guaranteed to not exist in the graph.
-
-proc ::struct::graph::__generateUniqueNodeName {name} {
-    upvar ::struct::graph::graph${name}::nextUnusedNode nextUnusedNode
-    while {[__node_exists $name "node${nextUnusedNode}"]} {
-	incr nextUnusedNode
-    }
-    return "node${nextUnusedNode}"
-}
-
-# ::struct::graph::_get --
-#
-#	Get a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_get {name {flag -key} {key data}} {
-    upvar ::struct::graph::graph${name}::graphData data
-
-    if { ![info exists data($key)] } {
-	error "invalid key \"$key\" for graph \"$name\""
-    }
-
-    return $data($key)
-}
-
-# ::struct::graph::_getall --
-#
-#	Get a serialized list of key/value pairs from a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_getall {name args} { 
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }
-    
-    upvar ::struct::graph::graph${name}::graphData data
-    return [array get data]
-}
-
-# ::struct::graph::_keys --
-#
-#	Get a list of keys from a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	value	list of known keys
-
-proc ::struct::graph::_keys {name args} { 
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }
-
-    upvar ::struct::graph::graph${name}::graphData data
-    return [array names data]
-}
-
-# ::struct::graph::_keyexists --
-#
-#	Test for existance of a given key in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::_keyexists {name {flag -key} {key data}} {
-    if { ![string equal $flag "-key"] } {
-	error "invalid option \"$flag\": should be -key"
-    }
-    
-    upvar ::struct::graph::graph${name}::graphData data
-    return [info exists data($key)]
-}
-
-# ::struct::graph::_node --
-#
-#	Dispatches the invocation of node methods to the proper handler
-#	procedure.
-#
-# Arguments:
-#	name	name of the graph.
-#	cmd	node command to invoke
-#	args	arguments to propagate to the handler for the node command
-#
-# Results:
-#	As of the the invoked handler.
-
-proc ::struct::graph::_node {name cmd args} {
-
-    # Split the args into command and args components
-    if { [llength [info commands ::struct::graph::__node_$cmd]] == 0 } {
-	variable nodeCommands
-	set optlist [join $nodeCommands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$cmd\": must be $optlist"
-    }
-
-    eval [list ::struct::graph::__node_$cmd $name] $args
-}
-
-# ::struct::graph::__node_degree --
-#
-#	Return the number of arcs adjacent to the specified node.
-#	If one of the restrictions -in or -out is given only
-#	incoming resp. outgoing arcs are counted.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	option, followed by the node.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_degree {name args} {
-
-    if {([llength $args] < 1) || ([llength $args] > 2)} {
-	error "wrong # args: should be \"$name node degree ?-in|-out? node\""
-    }
-
-    switch -exact -- [llength $args] {
-	1 {
-	    set opt {}
-	    set node [lindex $args 0]
-	}
-	2 {
-	    set opt  [lindex $args 0]
-	    set node [lindex $args 1]
-	}
-	default {error "Can't happen, panic"}
-    }
-
-    # Validate the option.
-
-    switch -exact -- $opt {
-	{}   -
-	-in  -
-	-out {}
-	default {
-	    error "invalid option \"$opt\": should be -in or -out"
-	}
-    }
-
-    # Validate the node
-
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::inArcs   inArcs
-    upvar ::struct::graph::graph${name}::outArcs  outArcs
-
-    switch -exact -- $opt {
-	-in  {
-	    set result [llength $inArcs($node)]
-	}
-	-out {
-	    set result [llength $outArcs($node)]
-	}
-	{} {
-	    set result [expr {[llength $inArcs($node)] \
-		    + [llength $outArcs($node)]}]
-
-	    # loops count twice, don't do <set> arithmetics, i.e. no union!
-	    if {0} {
-		array set coll  {}
-		set result [llength $inArcs($node)]
-
-		foreach e $inArcs($node) {
-		    set coll($e) .
-		}
-		foreach e $outArcs($node) {
-		    if {[info exists coll($e)]} {continue}
-		    incr result
-		    set     coll($e) .
-		}
-	    }
-	}
-	default {error "Can't happen, panic"}
-    }
-
-    return $result
-}
-
-# ::struct::graph::__node_delete --
-#
-#	Remove a node from a graph, including all of its values.
-#	Additionally removes the arcs connected to this node.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of the nodes to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_delete {name args} {
-
-    foreach node $args {
-	if { ![__node_exists $name $node] } {
-	    error "node \"$node\" does not exist in graph \"$name\""
-	}
-    }
-
-    upvar ::struct::graph::graph${name}::inArcs  inArcs
-    upvar ::struct::graph::graph${name}::outArcs outArcs
-
-    foreach node $args {
-	# Remove all the arcs connected to this node
-	foreach e $inArcs($node) {
-	    __arc_delete $name $e
-	}
-	foreach e $outArcs($node) {
-	    # Check existence to avoid problems with
-	    # loops (they are in and out arcs! at
-	    # the same time and thus already deleted)
-	    if { [__arc_exists $name $e] } {
-		__arc_delete $name $e
-	    }
-	}
-
-	unset inArcs($node)
-	unset outArcs($node)
-	# FRINK: nocheck
-	unset ::struct::graph::graph${name}::node$node
-    }
-
-    return
-}
-
-# ::struct::graph::__node_exists --
-#
-#	Test for existance of a given node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to look for.
-#
-# Results:
-#	1 if the node exists, 0 else.
-
-proc ::struct::graph::__node_exists {name node} {
-    return [info exists ::struct::graph::graph${name}::inArcs($node)]
-}
-
-# ::struct::graph::__node_get --
-#
-#	Get a keyed value from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_get {name node {flag -key} {key data}} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    
-    upvar ::struct::graph::graph${name}::node${node} data
-
-    if { ![info exists data($key)] } {
-	error "invalid key \"$key\" for node \"$node\""
-    }
-
-    return $data($key)
-}
-
-# ::struct::graph::__node_getall --
-#
-#	Get a serialized list of key/value pairs from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_getall {name node args} { 
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }
-    
-    upvar ::struct::graph::graph${name}::node${node} data
-
-    return [array get data]
-}
-
-# ::struct::graph::__node_keys --
-#
-#	Get a list of keys from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_keys {name node args} { 
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    
-    if { [llength $args] } {
-	error "wrong # args: should be none"
-    }
-
-    upvar ::struct::graph::graph${name}::node${node} data
-
-    return [array names data]
-}
-
-# ::struct::graph::__node_keyexists --
-#
-#	Test for existance of a given key for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	flag	-key; anything else is an error
-#	key	key to lookup; defaults to data
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::__node_keyexists {name node {flag -key} {key data}} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    
-    if { ![string equal $flag "-key"] } {
-	error "invalid option \"$flag\": should be -key"
-    }
-    
-    upvar ::struct::graph::graph${name}::node${node} data
-
-    return [info exists data($key)]
-}
-
-# ::struct::graph::__node_insert --
-#
-#	Add a node to a graph.
-#
-# Arguments:
-#	name		name of the graph.
-#	args		node to insert; must be unique.  If none is given,
-#			the routine will generate a unique node name.
-#
-# Results:
-#	node		The namee of the new node.
-
-proc ::struct::graph::__node_insert {name args} {
-
-    if { [llength $args] == 0 } {
-	# No node name was given; generate a unique one
-	set node [__generateUniqueNodeName $name]
-    } else {
-	set node [lindex $args 0]
-    }
-
-    if { [__node_exists $name $node] } {
-	error "node \"$node\" already exists in graph \"$name\""
-    }
-    
-    upvar ::struct::graph::graph${name}::inArcs      inArcs
-    upvar ::struct::graph::graph${name}::outArcs     outArcs
-    upvar ::struct::graph::graph${name}::node${node} data
-
-    # Set up the new node
-    set inArcs($node)  [list]
-    set outArcs($node) [list]
-    set data(data) ""
-
-    return $node
-}
-
-# ::struct::graph::__node_opposite --
-#
-#	Retrieve node opposite to the specified one, along the arc.
-#
-# Arguments:
-#	name		name of the graph.
-#	node		node to look up.
-#	arc		arc to look up.
-#
-# Results:
-#	nodex	Node opposite to <node,arc>
-
-proc ::struct::graph::__node_opposite {name node arc} {
-    if {![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    
-    if {![__arc_exists $name $arc] } {
-	error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-
-    # Node must be connected to at least one end of the arc.
-
-    if {[string equal $node [lindex $arcNodes($arc) 0]]} {
-	set result [lindex $arcNodes($arc) 1]
-    } elseif {[string equal $node [lindex $arcNodes($arc) 1]]} {
-	set result [lindex $arcNodes($arc) 0]
-    } else {
-	error "node \"$node\" and arc \"$arc\" are not connected\
-		in graph \"$name\""
-    }
-
-    return $result
-}
-
-# ::struct::graph::__node_set --
-#
-#	Set or get a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	args	?-key key? ?value?
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_set {name node args} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    upvar ::struct::graph::graph${name}::node$node data
-
-    if { [llength $args] > 3 } {
-	error "wrong # args: should be \"$name node set $node ?-key key?\
-		?value?\""
-    }
-    
-    set key "data"
-    set haveValue 0
-    if { [llength $args] > 1 } {
-	foreach {flag key} $args break
-	if { ![string match "${flag}*" "-key"] } {
-	    error "invalid option \"$flag\": should be key"
-	}
-	if { [llength $args] == 3 } {
-	    set haveValue 1
-	    set value [lindex $args end]
-	}
-    } elseif { [llength $args] == 1 } {
-	set haveValue 1
-	set value [lindex $args end]
-    }
-
-    if { $haveValue } {
-	# Setting a value
-	return [set data($key) $value]
-    } else {
-	# Getting a value
-	if { ![info exists data($key)] } {
-	    error "invalid key \"$key\" for node \"$node\""
-	}
-	return $data($key)
-    }
-}
-
-# ::struct::graph::__node_append --
-#
-#	Append a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	args	?-key key? value
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_append {name node args} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    upvar ::struct::graph::graph${name}::node$node data
-
-    if { [llength $args] != 1 && [llength $args] != 3 } {
-	error "wrong # args: should be \"$name node append $node ?-key key?\
-		value\""
-    }
-    
-    if { [llength $args] == 3 } {
-	foreach {flag key} $args break
-	if { ![string equal $flag "-key"] } {
-	    error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    return [append data($key) $value]
-}
-
-# ::struct::graph::__node_lappend --
-#
-#	lappend a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	args	?-key key? value
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_lappend {name node args} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    upvar ::struct::graph::graph${name}::node$node data
-
-    if { [llength $args] != 1 && [llength $args] != 3 } {
-	error "wrong # args: should be \"$name node lappend $node ?-key key?\
-		value\""
-    }
-    
-    if { [llength $args] == 3 } {
-	foreach {flag key} $args break
-	if { ![string equal $flag "-key"] } {
-	    error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    return [lappend data($key) $value]
-}
-
-# ::struct::graph::__node_unset --
-#
-#	Remove a keyed value from a node.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify.
-#	args	additional args: ?-key key?
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_unset {name node {flag -key} {key data}} {
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-    
-    if { ![string match "${flag}*" "-key"] } {
-	error "invalid option \"$flag\": should be \"$name node unset\
-		$node ?-key key?\""
-    }
-
-    upvar ::struct::graph::graph${name}::node${node} data
-    if { [info exists data($key)] } {
-	unset data($key)
-    }
-    return
-}
-
-# ::struct::graph::_nodes --
-#
-#	Return a list of all nodes in a graph satisfying some restriction.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of options and nodes specifying the restriction.
-#
-# Results:
-#	nodes	list of nodes
-
-proc ::struct::graph::_nodes {name args} {
-
-    # Discriminate between conditions and nodes
-
-    set haveCond 0
-    set haveKey 0
-    set haveValue 0
-    set cond "none"
-    set condNodes [list]
-
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set arg [lindex $args $i]
-	switch -glob -- $arg {
-	    -in -
-	    -out -
-	    -adj -
-	    -inner -
-	    -embedding {
-		if {$haveCond} {
-		    return -code error "invalid restriction:\
-			    illegal multiple use of\
-			    \"-in\"|\"-out\"|\"-adj\"|\"-inner\"|\"-embedding\""
-		}
-
-		set haveCond 1
-		set cond [string range $arg 1 end]
-	    }
-	    -key {
-		if {$haveKey} {
-		    return -code error {invalid restriction: illegal multiple use of "-key"}
-		}
-
-		incr i
-		set key [lindex $args $i]
-		set haveKey 1
-	    }
-	    -value {
-		if {$haveValue} {
-		    return -code error {invalid restriction: illegal multiple use of "-value"}
-		}
-
-		incr i
-		set value [lindex $args $i]
-		set haveValue 1
-	    }
-	    -* {
-		error "invalid restriction \"$arg\": should be -in, -out,\
-			-adj, -inner, -embedding, -key or -value"
-	    }
-	    default {
-		lappend condNodes $arg
-	    }
-	}
-    }
-
-    # Validate that there are nodes to use in the restriction.
-    # otherwise what's the point?
-    if {$haveCond} {
-	if {[llength $condNodes] == 0} {
-	    set usage "$name nodes ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding node node...?"
-	    error "no nodes specified: should be \"$usage\""
-	}
-
-	# Make sure that the specified nodes exist!
-	foreach node $condNodes {
-	    if { ![__node_exists $name $node] } {
-		error "node \"$node\" does not exist in graph \"$name\""
-	    }
-	}
-    }
-
-    # Now we are able to go to work
-    upvar ::struct::graph::graph${name}::inArcs   inArcs
-    upvar ::struct::graph::graph${name}::outArcs  outArcs
-    upvar ::struct::graph::graph${name}::arcNodes arcNodes
-
-    set       nodes [list]
-    array set coll  {}
-
-    switch -exact -- $cond {
-	in {
-	    # Result is all nodes with at least one arc going to
-	    # at least one node in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {[info exists coll($n)]} {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-	    }
-	}
-	out {
-	    # Result is all nodes with at least one arc coming from
-	    # at least one node in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {[info exists coll($n)]} {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-	    }
-	}
-	adj {
-	    # Result is all nodes with at least one arc coming from
-	    # or going to at least one node in the list of arguments.
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {[info exists coll($n)]} {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {[info exists coll($n)]} {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-	    }
-	}
-	inner {
-	    # Result is all nodes from the list! with at least one arc
-	    # coming from or going to at least one node in the list of
-	    # arguments.
-
-	    array set group {}
-	    foreach node $condNodes {
-		set group($node) .
-	    }
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {![info exists group($n)]} {continue}
-		    if { [info exists coll($n)]}  {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {![info exists group($n)]} {continue}
-		    if { [info exists coll($n)]}  {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-	    }
-	}
-	embedding {
-	    # Result is all nodes with at least one arc coming from
-	    # or going to at least one node in the list of arguments,
-	    # but not in the list itself!
-
-	    array set group {}
-	    foreach node $condNodes {
-		set group($node) .
-	    }
-
-	    foreach node $condNodes {
-		foreach e $inArcs($node) {
-		    set n [lindex $arcNodes($e) 0]
-		    if {[info exists group($n)]} {continue}
-		    if {[info exists coll($n)]}  {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-		foreach e $outArcs($node) {
-		    set n [lindex $arcNodes($e) 1]
-		    if {[info exists group($n)]} {continue}
-		    if {[info exists coll($n)]}  {continue}
-		    lappend nodes    $n
-		    set     coll($n) .
-		}
-	    }
-	}
-	none {
-	    set nodes [array names inArcs]
-	}
-	default {error "Can't happen, panic"}
-    }
-
-    #
-    # We have a list of nodes that match the relation to the nodes.
-    # Now filter according to -key and -value.
-    #
-
-    set filteredNodes [list]
-
-    if {$haveKey} {
-	foreach node $nodes {
-	    catch {
-		set nval [__node_get $name $node -key $key]
-		if {$haveValue} {
-		    if {$nval == $value} {
-			lappend filteredNodes $node
-		    }
-		} else {
-		    lappend filteredNodes $node
-		}
-	    }
-	}
-    } else {
-	set filteredNodes $nodes
-    }
-
-    return $filteredNodes
-}
-
-# ::struct::graph::_set --
-#
-#	Set or get a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	flag	-key; anything else is an error
-#	args	?-key key? ?value?
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_set {name args} {
-    upvar ::struct::graph::graph${name}::graphData data
-
-    if { [llength $args] > 3 } {
-	error "wrong # args: should be \"$name set ?-key key?\
-		?value?\""
-    }
-
-    set key "data"
-    set haveValue 0
-    if { [llength $args] > 1 } {
-	foreach {flag key} $args break
-	if { ![string match "${flag}*" "-key"] } {
-	    error "invalid option \"$flag\": should be key"
-	}
-	if { [llength $args] == 3 } {
-	    set haveValue 1
-	    set value [lindex $args end]
-	}
-    } elseif { [llength $args] == 1 } {
-	set haveValue 1
-	set value [lindex $args end]
-    }
-
-    if { $haveValue } {
-	# Setting a value
-	return [set data($key) $value]
-    } else {
-	# Getting a value
-	if { ![info exists data($key)] } {
-	    error "invalid key \"$key\" for graph \"$name\""
-	}
-	return $data($key)
-    }
-}
-
-# ::struct::graph::_swap --
-#
-#	Swap two nodes in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node1	first node to swap.
-#	node2	second node to swap.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_swap {name node1 node2} {
-    # Can only swap two real nodes
-    if { ![__node_exists $name $node1] } {
-	error "node \"$node1\" does not exist in graph \"$name\""
-    }
-    if { ![__node_exists $name $node2] } {
-	error "node \"$node2\" does not exist in graph \"$name\""
-    }
-
-    # Can't swap a node with itself
-    if { [string equal $node1 $node2] } {
-	error "cannot swap node \"$node1\" with itself"
-    }
-
-    # Swapping nodes means swapping their labels, values and arcs
-    upvar ::struct::graph::graph${name}::outArcs      outArcs
-    upvar ::struct::graph::graph${name}::inArcs       inArcs
-    upvar ::struct::graph::graph${name}::arcNodes     arcNodes
-    upvar ::struct::graph::graph${name}::node${node1} node1Vals
-    upvar ::struct::graph::graph${name}::node${node2} node2Vals
-
-    # Redirect arcs to the new nodes.
-
-    foreach e $inArcs($node1) {
-	set arcNodes($e) [lreplace $arcNodes($e) end end $node2]
-    }
-    foreach e $inArcs($node2) {
-	set arcNodes($e) [lreplace $arcNodes($e) end end $node1]
-    }
-    foreach e $outArcs($node1) {
-	set arcNodes($e) [lreplace $arcNodes($e) 0 0 $node2]
-    }
-    foreach e $outArcs($node2) {
-	set arcNodes($e) [lreplace $arcNodes($e) 0 0 $node1]
-    }
-
-    # Swap arc lists
-
-    set tmp            $inArcs($node1)
-    set inArcs($node1) $inArcs($node2)
-    set inArcs($node2) $tmp
-
-    set tmp             $outArcs($node1)
-    set outArcs($node1) $outArcs($node2)
-    set outArcs($node2) $tmp
-
-    # Swap the values
-    set   value1        [array get node1Vals]
-    unset node1Vals
-    array set node1Vals [array get node2Vals]
-    unset node2Vals
-    array set node2Vals $value1
-
-    return
-}
-
-# ::struct::graph::_unset --
-#
-#	Remove a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	flag	-key; anything else is an error
-#	args	additional args: ?-key key?
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_unset {name {flag -key} {key data}} {
-    upvar ::struct::graph::graph${name}::graphData data
-    
-    if { ![string match "${flag}*" "-key"] } {
-	error "invalid option \"$flag\": should be \"$name unset\
-		?-key key?\""
-    }
-
-    if { [info exists data($key)] } {
-	unset data($key)
-    }
-
-    return
-}
-
-# ::struct::graph::_walk --
-#
-#	Walk a graph using a pre-order depth or breadth first
-#	search. Pre-order DFS is the default.  At each node that is visited,
-#	a command will be called with the name of the graph and the node.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node at which to start.
-#	args	additional args: ?-order pre|post|both? ?-type {bfs|dfs}?
-#		-command cmd
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_walk {name node args} {
-    set usage "$name walk $node ?-dir forward|backward?\
-	    ?-order pre|post|both? ?-type {bfs|dfs}? -command cmd"
-
-    if {[llength $args] > 8 || [llength $args] < 2} {
-	error "wrong # args: should be \"$usage\""
-    }
-
-    if { ![__node_exists $name $node] } {
-	error "node \"$node\" does not exist in graph \"$name\""
-    }
-
-    # Set defaults
-    set type  dfs
-    set order pre
-    set cmd   ""
-    set dir   forward
-
-    # Process specified options
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set flag [lindex $args $i]
-	incr i
-	if { $i >= [llength $args] } {
-	    error "value for \"$flag\" missing: should be \"$usage\""
-	}
-	switch -glob -- $flag {
-	    "-type" {
-		set type [string tolower [lindex $args $i]]
-	    }
-	    "-order" {
-		set order [string tolower [lindex $args $i]]
-	    }
-	    "-command" {
-		set cmd [lindex $args $i]
-	    }
-	    "-dir" {
-		set dir [string tolower [lindex $args $i]]
-	    }
-	    default {
-		error "unknown option \"$flag\": should be \"$usage\""
-	    }
-	}
-    }
-    
-    # Make sure we have a command to run, otherwise what's the point?
-    if { [string equal $cmd ""] } {
-	error "no command specified: should be \"$usage\""
-    }
-
-    # Validate that the given type is good
-    switch -glob -- $type {
-	"dfs" {
-	    set type "dfs"
-	}
-	"bfs" {
-	    set type "bfs"
-	}
-	default {
-	    error "invalid search type \"$type\": should be dfs, or bfs"
-	}
-    }
-    
-    # Validate that the given order is good
-    switch -glob -- $order {
-	"both" {
-	    set order both
-	}
-	"pre" {
-	    set order pre
-	}
-	"post" {
-	    set order post
-	}
-	default {
-	    error "invalid search order \"$order\": should be both,\
-		    pre or post"
-	}
-    }
-
-    # Validate that the given direction is good
-    switch -glob -- $dir {
-	"forward" {
-	    set dir -out
-	}
-	"backward" {
-	    set dir -in
-	}
-	default {
-	    error "invalid search direction \"$dir\": should be\
-		    forward or backward"
-	}
-    }
-
-    # Do the walk
-
-    set st [list ]
-    lappend st $node
-    array set visited {}
-
-    if { [string equal $type "dfs"] } {
-	if { [string equal $order "pre"] } {
-	    # Pre-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex   $st end]
-		set st   [lreplace $st end end]
-
-		# Evaluate the command at this node
-		set cmdcpy $cmd
-		lappend cmdcpy enter $name $node
-		uplevel 2 $cmdcpy
-
-		set visited($node) .
-
-		# Add this node's neighbours (according to direction)
-		#  Have to add them in reverse order
-		#  so that they will be popped left-to-right
-
-		set next [_nodes $name $dir $node]
-		set len  [llength $next]
-
-		for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-		    set nextnode [lindex $next $i]
-		    if {[info exists visited($nextnode)]} {
-			# Skip nodes already visited
-			continue
-		    }
-		    lappend st $nextnode
-		}
-	    }
-	} elseif { [string equal $order "post"] } {
-	    # Post-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex $st end]
-
-		if {[info exists visited($node)]} {
-		    # Second time we are here, pop it,
-		    # then evaluate the command.
-
-		    set st [lreplace $st end end]
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy leave $name $node
-		    uplevel 2 $cmdcpy
-		} else {
-		    # First visit. Remember it.
-		    set visited($node) .
-	    
-		    # Add this node's neighbours.
-		    set next [_nodes $name $dir $node]
-		    set len  [llength $next]
-
-		    for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-			set nextnode [lindex $next $i]
-			if {[info exists visited($nextnode)]} {
-			    # Skip nodes already visited
-			    continue
-			}
-			lappend st $nextnode
-		    }
-		}
-	    }
-	} else {
-	    # Both-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex $st end]
-
-		if {[info exists visited($node)]} {
-		    # Second time we are here, pop it,
-		    # then evaluate the command.
-
-		    set st [lreplace $st end end]
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy leave $name $node
-		    uplevel 2 $cmdcpy
-		} else {
-		    # First visit. Remember it.
-		    set visited($node) .
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy enter $name $node
-		    uplevel 2 $cmdcpy
-	    
-		    # Add this node's neighbours.
-		    set next [_nodes $name $dir $node]
-		    set len  [llength $next]
-
-		    for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-			set nextnode [lindex $next $i]
-			if {[info exists visited($nextnode)]} {
-			    # Skip nodes already visited
-			    continue
-			}
-			lappend st $nextnode
-		    }
-		}
-	    }
-	}
-
-    } else {
-	if { [string equal $order "pre"] } {
-	    # Pre-order Breadth first search
-	    while { [llength $st] > 0 } {
-		set node [lindex $st 0]
-		set st   [lreplace $st 0 0]
-		# Evaluate the command at this node
-		set cmdcpy $cmd
-		lappend cmdcpy enter $name $node
-		uplevel 2 $cmdcpy
-	    
-		set visited($node) .
-
-		# Add this node's neighbours.
-		foreach child [_nodes $name $dir $node] {
-		    if {[info exists visited($child)]} {
-			# Skip nodes already visited
-			continue
-		    }
-		    lappend st $child
-		}
-	    }
-	} else {
-	    # Post-order Breadth first search
-	    # Both-order Breadth first search
-	    # Haven't found anything in Knuth
-	    # and unable to define something
-	    # consistent for myself. Leave it
-	    # out.
-
-	    error "unable to do a ${order}-order breadth first walk"
-	}
-    }
-    return
-}
-
-# ::struct::graph::Union --
-#
-#	Return a list which is the union of the elements
-#	in the specified lists.
-#
-# Arguments:
-#	args	list of lists representing sets.
-#
-# Results:
-#	set	list representing the union of the argument lists.
-
-proc ::struct::graph::Union {args} {
-    switch -- [llength $args] {
-	0 {
-	    return {}
-	}
-	1 {
-	    return [lindex $args 0]
-	}
-	default {
-	    foreach set $args {
-		foreach e $set {
-		    set tmp($e) .
-		}
-	    }
-	    return [array names tmp]
-	}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'graph::graph' into the general structure namespace.
-    namespace import -force graph::graph
-    namespace export graph
-}
-package provide struct::graph 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph_c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph_c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,159 +1,0 @@
-# graphc.tcl --
-#
-#       Implementation of a graph data structure for Tcl.
-#       This code based on critcl, API compatible to the PTI [x].
-#       [x] Pure Tcl Implementation.
-#
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: graph_c.tcl,v 1.1 2006/11/16 06:33:12 andreas_kupries Exp $
-
-package require critcl
-package provide struct_graphc 2.1
-package require Tcl 8.2
-
-namespace eval ::struct {
-    # Supporting code for the main command.
-
-    catch {
-	critcl::cheaders -g
-	critcl::debug memory symbols
-    }
-
-    critcl::cheaders graph/*.h
-    critcl::csources graph/*.c
-
-    critcl::ccode {
-	/* -*- c -*- */
-
-	#include <global.h>
-	#include <objcmd.h>
-	#include <graph.h>
-
-	#define USAGE "?name ?=|:=|as|deserialize source??"
-
-	static void gg_delete (ClientData clientData)
-	{
-	    /* Release the whole graph. */
-	    g_delete ((G*) clientData);
-	}
-    }
-
-    # Main command, graph creation.
-
-    critcl::ccommand graph_critcl {dummy interp objc objv} {
-	/* Syntax */
-	/*  - epsilon                         |1 */
-	/*  - name                            |2 */
-	/*  - name =|:=|as|deserialize source |4 */
-
-	CONST char* name;
-	G*          g;
-	Tcl_Obj*    fqn;
-	Tcl_CmdInfo ci;
-
-	if ((objc != 4) && (objc != 2) && (objc != 1)) {
-	    Tcl_WrongNumArgs (interp, 1, objv, USAGE);
-	    return TCL_ERROR;
-	}
-
-	if (objc < 2) {
-	    name = gg_new (interp);
-	} else {
-	    name = Tcl_GetString (objv [1]);
-	}
-
-	if (!Tcl_StringMatch (name, "::*")) {
-	    /* Relative name. Prefix with current namespace */
-
-	    Tcl_Eval (interp, "namespace current");
-	    fqn = Tcl_GetObjResult (interp);
-	    fqn = Tcl_DuplicateObj (fqn);
-	    Tcl_IncrRefCount (fqn);
-
-	    if (!Tcl_StringMatch (Tcl_GetString (fqn), "::")) {
-		Tcl_AppendToObj (fqn, "::", -1);
-	    }
-	    Tcl_AppendToObj (fqn, name, -1);
-	} else {
-	    fqn = Tcl_NewStringObj (name, -1);
-	    Tcl_IncrRefCount (fqn);
-	}
-
-	Tcl_ResetResult (interp);
-
-	if (Tcl_GetCommandInfo (interp, Tcl_GetString (fqn), &ci)) {
-	    Tcl_Obj* err;
-
-	    err = Tcl_NewObj ();
-	    Tcl_AppendToObj    (err, "command \"", -1);
-	    Tcl_AppendObjToObj (err, fqn);
-	    Tcl_AppendToObj    (err, "\" already exists, unable to create graph", -1);
-
-	    Tcl_DecrRefCount (fqn);
-	    Tcl_SetObjResult (interp, err);
-	    return TCL_ERROR;
-	}
-
-	if (objc == 4) {
-	    /* Construction with immediate initialization */
-	    /* through deserialization */
-
-	    Tcl_Obj* type = objv[2];
-	    Tcl_Obj* src  = objv[3];
-	    int      srctype;
-
-	    static CONST char* types [] = {
-		":=", "=", "as", "deserialize", NULL
-	    };
-	    enum types {
-		G_ASSIGN, G_IS, G_AS, G_DESER
-	    };
-
-	    if (Tcl_GetIndexFromObj (interp, type, types, "type", 0, &srctype) != TCL_OK) {
-		Tcl_DecrRefCount (fqn);
-		Tcl_ResetResult  (interp);
-		Tcl_WrongNumArgs (interp, 1, objv, USAGE);
-		return TCL_ERROR;
-	    }
-
-	    g = g_new ();
-
-	    switch (srctype) {
-		case G_ASSIGN:
-		case G_AS:
-		case G_IS:
-		if (g_ms_assign (interp, g, src) != TCL_OK) {
-		    g_delete (g);
-		    Tcl_DecrRefCount (fqn);
-		    return TCL_ERROR;
-		}
-		break;
-
-		case G_DESER:
-		if (g_deserialize (g, interp, src) != TCL_OK) {
-		    g_delete (g);
-		    Tcl_DecrRefCount (fqn);
-		    return TCL_ERROR;
-		}
-		break;
-	    }
-	} else {
-	    g = g_new ();
-	}
-
-	g->cmd = Tcl_CreateObjCommand (interp, Tcl_GetString (fqn),
-                                       g_objcmd, (ClientData) g,
-                                       gg_delete);
-
-	Tcl_SetObjResult (interp, fqn);
-	Tcl_DecrRefCount (fqn);
-	return TCL_OK;
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/graph_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3049 +1,0 @@
-# graph_tcl.tcl --
-#
-#	Implementation of a graph data structure for Tcl.
-#
-# Copyright (c) 2000-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: graph_tcl.tcl,v 1.1 2006/11/16 06:33:12 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require struct::list
-package require struct::set
-
-namespace eval ::struct::graph {
-    # Data storage in the graph module
-    # -------------------------------
-    #
-    # There's a lot of bits to keep track of for each graph:
-    #	nodes
-    #	node values
-    #	node relationships (arcs)
-    #   arc values
-    #
-    # It would quickly become unwieldy to try to keep these in arrays or lists
-    # within the graph namespace itself.  Instead, each graph structure will
-    # get its own namespace.  Each namespace contains:
-    #	node:$node	array mapping keys to values for the node $node
-    #	arc:$arc	array mapping keys to values for the arc $arc
-    #	inArcs		array mapping nodes to the list of incoming arcs
-    #	outArcs		array mapping nodes to the list of outgoing arcs
-    #	arcNodes	array mapping arcs to the two nodes (start & end)
-    
-    # counter is used to give a unique name for unnamed graph
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new graph
-    namespace export graph_tcl
-}
-
-# ::struct::graph::graph_tcl --
-#
-#	Create a new graph with a given name; if no name is given, use
-#	graphX, where X is a number.
-#
-# Arguments:
-#	name	name of the graph; if null, generate one.
-#
-# Results:
-#	name	name of the graph created
-
-proc ::struct::graph::graph_tcl {args} {
-    variable counter
-    
-    set src     {}
-    set srctype {}
-
-    switch -exact -- [llength [info level 0]] {
-	1 {
-	    # Missing name, generate one.
-	    incr counter
-	    set name "graph${counter}"
-	}
-	2 {
-	    # Standard call. New empty graph.
-	    set name [lindex $args 0]
-	}
-	4 {
-	    # Copy construction.
-	    foreach {name as src} $args break
-	    switch -exact -- $as {
-		= - := - as {
-		    set srctype graph
-		}
-		deserialize {
-		    set srctype serial
-		}
-		default {
-		    return -code error \
-			    "wrong # args: should be \"graph ?name ?=|:=|as|deserialize source??\""
-		}
-	    }
-	}
-	default {
-	    # Error.
-	    return -code error \
-		    "wrong # args: should be \"graph ?name ?=|:=|as|deserialize source??\""
-	}
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-    if {[llength [info commands $name]]} {
-	return -code error "command \"$name\" already exists, unable to create graph"
-    }
-
-    # Set up the namespace
-    namespace eval $name {
-
-	# Set up the map for values associated with the graph itself
-	variable  graphAttr
-	array set graphAttr {}
-
-	# Set up the node attribute mapping
-	variable  nodeAttr
-	array set nodeAttr {}
-
-	# Set up the arc attribute mapping
-	variable  arcAttr
-	array set arcAttr {}
-
-	# Set up the map from nodes to the arcs coming to them
-	variable  inArcs
-	array set inArcs {}
-
-	# Set up the map from nodes to the arcs going out from them
-	variable  outArcs
-	array set outArcs {}
-
-	# Set up the map from arcs to the nodes they touch.
-	variable  arcNodes
-	array set arcNodes {}
-
-	# Set up a value for use in creating unique node names
-	variable nextUnusedNode
-	set      nextUnusedNode 1
-
-	# Set up a value for use in creating unique arc names
-	variable nextUnusedArc
-	set      nextUnusedArc 1
-
-	# Set up a counter for use in creating attribute arrays.
-	variable nextAttr
-	set      nextAttr 0
-    }
-
-    # Create the command to manipulate the graph
-    interp alias {} $name {} ::struct::graph::GraphProc $name
-
-    # Automatic execution of assignment if a source
-    # is present.
-    if {$src != {}} {
-	switch -exact -- $srctype {
-	    graph  {_= $name $src}
-	    serial {_deserialize $name $src}
-	    default {
-		return -code error \
-			"Internal error, illegal srctype \"$srctype\""
-	    }
-	}
-    }
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::graph::GraphProc --
-#
-#	Command that processes all graph object commands.
-#
-# Arguments:
-#	name	name of the graph object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::graph::GraphProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub _$cmd
-    if { [llength [info commands ::struct::graph::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::graph::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    if {[string match __* $p]} {continue}
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::graph::$sub $name]
-}
-
-# ::struct::graph::_= --
-#
-#	Assignment operator. Copies the source graph into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the graph object we are copying into.
-#	source	Name of the graph object providing us with the
-#		data to copy.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::graph::_= {name source} {
-    _deserialize $name [$source serialize]
-    return
-}
-
-# ::struct::graph::_--> --
-#
-#	Reverse assignment operator. Copies this graph into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the graph object to copy
-#	dest	Name of the graph object we are copying to.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::graph::_--> {name dest} {
-    $dest deserialize [_serialize $name]
-    return
-}
-
-# ::struct::graph::_append --
-#
-#	Append a value for an attribute in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::_append {name key value} {
-    variable ${name}::graphAttr
-    return [append    graphAttr($key) $value]
-}
-
-# ::struct::graph::_lappend --
-#
-#	lappend a value for an attribute in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::_lappend {name key value} {
-    variable ${name}::graphAttr
-    return [lappend   graphAttr($key) $value]
-}
-
-# ::struct::graph::_arc --
-#
-#	Dispatches the invocation of arc methods to the proper handler
-#	procedure.
-#
-# Arguments:
-#	name	name of the graph.
-#	cmd	arc command to invoke
-#	args	arguments to propagate to the handler for the arc command
-#
-# Results:
-#	As of the invoked handler.
-
-proc ::struct::graph::_arc {name cmd args} {
-    # Split the args into command and args components
-
-    set sub __arc_$cmd
-    if { [llength [info commands ::struct::graph::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::graph::__arc_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::graph::$sub $name]
-}
-
-# ::struct::graph::__arc_delete --
-#
-#	Remove an arc from a graph, including all of its values.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of arcs to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__arc_delete {name args} {
-    if {![llength $args]} {
-	return {wrong # args: should be "::struct::graph::__arc_delete name arc arc..."}
-    }
-
-    foreach arc $args {CheckMissingArc $name $arc}
-
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-    variable ${name}::arcAttr
-
-    foreach arc $args {
-	foreach {source target} $arcNodes($arc) break ; # lassign
-
-	unset arcNodes($arc)
-
-	if {[info exists arcAttr($arc)]} {
-	    unset ${name}::$arcAttr($arc)
-	    unset arcAttr($arc)
-	}
-
-	# Remove arc from the arc lists of source and target nodes.
-
-	set index [lsearch -exact $outArcs($source) $arc]
-	ldelete outArcs($source) $index
-
-	set index [lsearch -exact $inArcs($target)  $arc]
-	ldelete inArcs($target) $index
-    }
-
-    return
-}
-
-# ::struct::graph::__arc_exists --
-#
-#	Test for existence of a given arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to look for.
-#
-# Results:
-#	1 if the arc exists, 0 else.
-
-proc ::struct::graph::__arc_exists {name arc} {
-    return [info exists ${name}::arcNodes($arc)]
-}
-
-# ::struct::graph::__arc_flip --
-#
-#	Exchanges origin and destination node of the specified arc.
-#
-# Arguments:
-#	name		name of the graph object.
-#	arc		arc to change.
-#
-# Results:
-#	None
-
-proc ::struct::graph::__arc_flip {name arc} {
-    CheckMissingArc  $name $arc
-
-    variable ${name}::arcNodes
-    variable ${name}::outArcs
-    variable ${name}::inArcs
-
-    set oldsource [lindex $arcNodes($arc) 0]
-    set oldtarget [lindex $arcNodes($arc) 1]
-
-    if {[string equal $oldsource $oldtarget]} return
-
-    set newtarget $oldsource
-    set newsource $oldtarget
-
-    set arcNodes($arc) [lreplace $arcNodes($arc) 0 0 $newsource]
-    lappend outArcs($newsource) $arc
-    ldelete outArcs($oldsource) [lsearch -exact $outArcs($oldsource) $arc]
-
-    set arcNodes($arc) [lreplace $arcNodes($arc) 1 1 $newtarget]
-    lappend inArcs($newtarget) $arc
-    ldelete inArcs($oldtarget) [lsearch -exact $inArcs($oldtarget) $arc]
-    return
-}
-
-# ::struct::graph::__arc_get --
-#
-#	Get a keyed value from an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	key	key to lookup
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__arc_get {name arc key} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attribute data for this arc, key has to be invalid.
-	return -code error "invalid key \"$key\" for arc \"$arc\""
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    if { ![info exists data($key)] } {
-	return -code error "invalid key \"$key\" for arc \"$arc\""
-    }
-    return $data($key)
-}
-
-# ::struct::graph::__arc_getall --
-#
-#	Get a serialized array of key/value pairs from an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	pattern	optional glob pattern to restrict retrieval
-#
-# Results:
-#	value	serialized array of key/value pairs.
-
-proc ::struct::graph::__arc_getall {name arc {pattern *}} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attributes ...
-	return {}
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    return [array get data $pattern]
-}
-
-# ::struct::graph::__arc_keys --
-#
-#	Get a list of keys for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	pattern	optional glob pattern to restrict retrieval
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__arc_keys {name arc {pattern *}} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attributes ...
-	return {}
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    return [array names data $pattern]
-}
-
-# ::struct::graph::__arc_keyexists --
-#
-#	Test for existence of a given key for a given arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to query.
-#	key	key to lookup
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::__arc_keyexists {name arc key} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attribute data for this arc, key cannot exist.
-	return 0
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    return [info exists data($key)]
-}
-
-# ::struct::graph::__arc_insert --
-#
-#	Add an arc to a graph.
-#
-# Arguments:
-#	name		name of the graph.
-#	source		source node of the new arc
-#	target		target node of the new arc
-#	args		arc to insert; must be unique.  If none is given,
-#			the routine will generate a unique node name.
-#
-# Results:
-#	arc		The name of the new arc.
-
-proc ::struct::graph::__arc_insert {name source target args} {
-
-    if { [llength $args] == 0 } {
-	# No arc name was given; generate a unique one
-	set arc [__generateUniqueArcName $name]
-    } elseif { [llength $args] > 1 } {
-	return {wrong # args: should be "::struct::graph::__arc_insert name source target ?arc?"}
-    } else {
-	set arc [lindex $args 0]
-    }
-
-    CheckDuplicateArc $name $arc    
-    CheckMissingNode  $name $source {source }
-    CheckMissingNode  $name $target {target }
-    
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-
-    # Set up the new arc
-    set arcNodes($arc) [list $source $target]
-
-    # Add this arc to the arc lists of its source resp. target nodes.
-    lappend outArcs($source) $arc
-    lappend inArcs($target)  $arc
-
-    return $arc
-}
-
-# ::struct::graph::__arc_rename --
-#
-#	Rename a arc in place.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	Name of the arc to rename
-#	newname	The new name of the arc.
-#
-# Results:
-#	The new name of the arc.
-
-proc ::struct::graph::__arc_rename {name arc newname} {
-    CheckMissingArc   $name $arc
-    CheckDuplicateArc $name $newname
-
-    set oldname  $arc
-
-    # Perform the rename in the internal
-    # data structures.
-
-    # - graphAttr - not required, arc independent.
-    # - nodeAttr  - not required, arc independent.
-    # - counters  - not required
-
-    variable ${name}::arcAttr
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-
-    # Arc relocation
-
-    set arcNodes($newname) [set nodes $arcNodes($oldname)]
-    unset                              arcNodes($oldname)
-
-    # Update the two nodes ...
-    foreach {start end} $nodes break
-
-    set pos [lsearch -exact $inArcs($end) $oldname]
-    lset inArcs($end) $pos $newname
-
-    set pos [lsearch -exact $outArcs($start) $oldname]
-    lset outArcs($start) $pos $newname
-
-    if {[info exists arcAttr($oldname)]} {
-	set arcAttr($newname) $arcAttr($oldname)
-	unset                  arcAttr($oldname)
-    }
-
-    return $newname
-}
-
-# ::struct::graph::__arc_set --
-#
-#	Set or get a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	key	attribute to modify or query
-#	args	?value?
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_set {name arc key args} {
-    if { [llength $args] > 1 } {
-	return -code error "wrong # args: should be \"$name arc set arc key ?value?\""
-    }
-    CheckMissingArc $name $arc
-
-    if { [llength $args] > 0 } {
-	# Setting the value. This may have to create
-	# the attribute array for this particular
-	# node
-
-	variable ${name}::arcAttr
-	if {![info exists arcAttr($arc)]} {
-	    # No attribute data for this node,
-	    # so create it as we need it now.
-	    GenAttributeStorage $name arc $arc
-	}
-
-	upvar ${name}::$arcAttr($arc) data
-	return [set data($key) [lindex $args end]]
-    } else {
-	# Getting a value
-	return [__arc_get $name $arc $key]
-    }
-}
-
-# ::struct::graph::__arc_append --
-#
-#	Append a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_append {name arc key value} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attribute data for this arc,
-	# so create it as we need it.
-	GenAttributeStorage $name arc $arc
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    return [append data($key) $value]
-}
-
-# ::struct::graph::__arc_attr --
-#
-#	Return attribute data for one key and multiple arcs, possibly all.
-#
-# Arguments:
-#	name	Name of the graph object.
-#	key	Name of the attribute to retrieve.
-#
-# Results:
-#	children	Dictionary mapping arcs to attribute data.
-
-proc ::struct::graph::__arc_attr {name key args} {
-    # Syntax:
-    #
-    # t attr key
-    # t attr key -arcs {arclist}
-    # t attr key -glob arcpattern
-    # t attr key -regexp arcpattern
-
-    variable ${name}::arcAttr
-
-    set usage "wrong # args: should be \"[list $name] arc attr key ?-arcs list|-glob pattern|-regexp pattern?\""
-    if {([llength $args] != 0) && ([llength $args] != 2)} {
-	return -code error $usage
-    } elseif {[llength $args] == 0} {
-	# This automatically restricts the list
-	# to arcs which can have the attribute
-	# in question.
-
-	set arcs [array names arcAttr]
-    } else {
-	# Determine a list of arcs to look at
-	# based on the chosen restriction.
-
-	foreach {mode value} $args break
-	switch -exact -- $mode {
-	    -arcs {
-		# This is the only branch where we have to
-		# perform an explicit restriction to the
-		# arcs which have attributes.
-		set arcs {}
-		foreach n $value {
-		    if {![info exists arcAttr($n)]} continue
-		    lappend arcs $n
-		}
-	    }
-	    -glob {
-		set arcs [array names arcAttr $value]
-	    }
-	    -regexp {
-		set arcs {}
-		foreach n [array names arcAttr] {
-		    if {![regexp -- $value $n]} continue
-		    lappend arcs $n
-		}
-	    }
-	    default {
-		return -code error "bad type \"$mode\": must be -arcs, -glob, or -regexp"
-	    }
-	}
-    }
-
-    # Without possibly matching arcs
-    # the result has to be empty.
-
-    if {![llength $arcs]} {
-	return {}
-    }
-
-    # Now locate matching keys and their values.
-
-    set result {}
-    foreach n $arcs {
-	upvar ${name}::$arcAttr($n) data
-	if {[info exists data($key)]} {
-	    lappend result $n $data($key)
-	}
-    }
-
-    return $result
-}
-
-# ::struct::graph::__arc_lappend --
-#
-#	lappend a value for an arc in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify or query.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given arc
-
-proc ::struct::graph::__arc_lappend {name arc key value} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attribute data for this arc,
-	# so create it as we need it.
-	GenAttributeStorage $name arc $arc
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    return [lappend data($key) $value]
-}
-
-# ::struct::graph::__arc_source --
-#
-#	Return the node at the beginning of the specified arc.
-#
-# Arguments:
-#	name	name of the graph object.
-#	arc	arc to look up.
-#
-# Results:
-#	node	name of the node.
-
-proc ::struct::graph::__arc_source {name arc} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcNodes
-    return [lindex $arcNodes($arc) 0]
-}
-
-# ::struct::graph::__arc_target --
-#
-#	Return the node at the end of the specified arc.
-#
-# Arguments:
-#	name	name of the graph object.
-#	arc	arc to look up.
-#
-# Results:
-#	node	name of the node.
-
-proc ::struct::graph::__arc_target {name arc} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcNodes
-    return [lindex $arcNodes($arc) 1]
-}
-
-# ::struct::graph::__arc_move-target --
-#
-#	Change the destination node of the specified arc.
-#	The arc is rotated around its origin to a different
-#	node.
-#
-# Arguments:
-#	name		name of the graph object.
-#	arc		arc to change.
-#	newtarget	new destination/target of the arc.
-#
-# Results:
-#	None
-
-proc ::struct::graph::__arc_move-target {name arc newtarget} {
-    CheckMissingArc  $name $arc
-    CheckMissingNode $name $newtarget
-
-    variable ${name}::arcNodes
-    variable ${name}::inArcs
-
-    set oldtarget [lindex $arcNodes($arc) 1]
-    if {[string equal $oldtarget $newtarget]} return
-
-    set arcNodes($arc) [lreplace $arcNodes($arc) 1 1 $newtarget]
-
-    lappend inArcs($newtarget) $arc
-    ldelete inArcs($oldtarget) [lsearch -exact $inArcs($oldtarget) $arc]
-    return
-}
-
-# ::struct::graph::__arc_move-source --
-#
-#	Change the origin node of the specified arc.
-#	The arc is rotated around its destination to a different
-#	node.
-#
-# Arguments:
-#	name		name of the graph object.
-#	arc		arc to change.
-#	newsource	new origin/source of the arc.
-#
-# Results:
-#	None
-
-proc ::struct::graph::__arc_move-source {name arc newsource} {
-    CheckMissingArc  $name $arc
-    CheckMissingNode $name $newsource
-
-    variable ${name}::arcNodes
-    variable ${name}::outArcs
-
-    set oldsource [lindex $arcNodes($arc) 0]
-    if {[string equal $oldsource $newsource]} return
-
-    set arcNodes($arc) [lreplace $arcNodes($arc) 0 0 $newsource]
-
-    lappend outArcs($newsource) $arc
-    ldelete outArcs($oldsource) [lsearch -exact $outArcs($oldsource) $arc]
-    return
-}
-
-# ::struct::graph::__arc_move --
-#
-#	Changes both origin and destination node of the specified arc.
-#
-# Arguments:
-#	name		name of the graph object.
-#	arc		arc to change.
-#	newsource	new origin/source of the arc.
-#	newtarget	new destination/target of the arc.
-#
-# Results:
-#	None
-
-proc ::struct::graph::__arc_move {name arc newsource newtarget} {
-    CheckMissingArc  $name $arc
-    CheckMissingNode $name $newsource
-    CheckMissingNode $name $newtarget
-
-    variable ${name}::arcNodes
-    variable ${name}::outArcs
-    variable ${name}::inArcs
-
-    set oldsource [lindex $arcNodes($arc) 0]
-    if {![string equal $oldsource $newsource]} {
-	set arcNodes($arc) [lreplace $arcNodes($arc) 0 0 $newsource]
-	lappend outArcs($newsource) $arc
-	ldelete outArcs($oldsource) [lsearch -exact $outArcs($oldsource) $arc]
-    }
-
-    set oldtarget [lindex $arcNodes($arc) 1]
-    if {![string equal $oldtarget $newtarget]} {
-	set arcNodes($arc) [lreplace $arcNodes($arc) 1 1 $newtarget]
-	lappend inArcs($newtarget) $arc
-	ldelete inArcs($oldtarget) [lsearch -exact $inArcs($oldtarget) $arc]
-    }
-    return
-}
-
-# ::struct::graph::__arc_unset --
-#
-#	Remove a keyed value from a arc.
-#
-# Arguments:
-#	name	name of the graph.
-#	arc	arc to modify.
-#	key	attribute to remove
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__arc_unset {name arc key} {
-    CheckMissingArc $name $arc
-
-    variable ${name}::arcAttr
-    if {![info exists arcAttr($arc)]} {
-	# No attribute data for this arc,
-	# nothing to do.
-	return
-    }
-
-    upvar ${name}::$arcAttr($arc) data
-    catch {unset data($key)}
-
-    if {[array size data] == 0} {
-	# No attributes stored for this arc, squash the whole array.
-	unset arcAttr($arc)
-	unset data
-    }
-    return
-}
-
-# ::struct::graph::_arcs --
-#
-#	Return a list of all arcs in a graph satisfying some
-#	node based restriction.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	arcs	list of arcs
-
-proc ::struct::graph::_arcs {name args} {
-
-    CheckE $name arcs $args
-
-    switch -exact -- $cond {
-	none      {set arcs [ArcsNONE $name]}
-	in        {set arcs [ArcsIN   $name $condNodes]}
-	out       {set arcs [ArcsOUT  $name $condNodes]}
-	adj       {set arcs [ArcsADJ  $name $condNodes]}
-	inner     {set arcs [ArcsINN  $name $condNodes]}
-	embedding {set arcs [ArcsEMB  $name $condNodes]}
-	default   {return -code error "Can't happen, panic"}
-    }
-
-    #
-    # We have a list of arcs that match the relation to the nodes.
-    # Now filter according to -key and -value.
-    #
-
-    if {$haveKey && $haveValue} {
-	set arcs [ArcsKV $name $key $value $arcs]
-    } elseif {$haveKey} {
-	set arcs [ArcsK $name $key $arcs]
-    }
-
-    #
-    # Apply the general filter command, if specified.
-    #
-
-    if {$haveFilter} {
-	lappend fcmd $name
-	set arcs [uplevel 1 [list ::struct::list filter $arcs $fcmd]]
-    }
-
-    return $arcs
-}
-
-proc ::struct::graph::ArcsIN {name cn} {
-    # arcs -in.	"Arcs going into the node set"
-    #
-    # ARC/in (NS) := { a | target(a) in NS }
-
-    # The result is all arcs going to at least one node in the set
-    # 'cn' of nodes.
-
-    # As an arc has only one destination, i.e. is the
-    # in-arc of exactly one node it is impossible to
-    # count an arc twice. Therefore there is no need
-    # to keep track of arcs to avoid duplicates.
-
-    variable ${name}::inArcs
-
-    set arcs {}
-    foreach node $cn {
-	foreach e $inArcs($node) {
-	    lappend arcs $e
-	}
-    }
-
-    return $arcs
-}
-
-proc ::struct::graph::ArcsOUT {name cn} {
-    # arcs -out. "Arcs coming from the node set"
-    #
-    # ARC/out (NS) := { a | source(a) in NS }
-
-    # The result is all arcs coming from at least one node in the list
-    # of arguments.
-
-    variable ${name}::outArcs
-
-    set arcs {}
-    foreach node $cn {
-	foreach e $outArcs($node) {
-	    lappend arcs $e
-	}
-    }
-
-    return $arcs
-}
-
-proc ::struct::graph::ArcsADJ {name cn} {
-    # arcs -adj. "Arcs adjacent to the node set"
-    #
-    # ARC/adj (NS) := ARC/in (NS) + ARC/out (NS)
-
-    # Result is all arcs coming from or going to at
-    # least one node in the list of arguments.
-
-    return [struct::set union \
-	    [ArcsIN  $name $cn] \
-	    [ArcsOUT $name $cn]]
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set union directly,
-	# intertwined with the data retrieval.
-
-	array set coll  {}
-	foreach node $condNodes {
-	    foreach e $inArcs($node) {
-		if {[info exists coll($e)]} {continue}
-		lappend arcs     $e
-		set     coll($e) .
-	    }
-	    foreach e $outArcs($node) {
-		if {[info exists coll($e)]} {continue}
-		lappend arcs     $e
-		set     coll($e) .
-	    }
-	}
-    }
-}
-
-proc ::struct::graph::ArcsINN {name cn} {
-    # arcs -adj. "Arcs inside the node set"
-    #
-    # ARC/inner (NS) := ARC/in (NS) * ARC/out (NS)
-
-    # Result is all arcs running between nodes
-    # in the list.
-
-    return [struct::set intersect \
-	    [ArcsIN  $name $cn] \
-	    [ArcsOUT $name $cn]]
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set intersection
-	# directly, intertwined with the data
-	# retrieval.
-
-	array set coll  {}
-	# Here we do need 'coll' as each might be an in- and
-	# out-arc for one or two nodes in the list of arguments.
-
-	array set group {}
-	foreach node $condNodes {
-	    set group($node) .
-	}
-
-	foreach node $condNodes {
-	    foreach e $inArcs($node) {
-		set n [lindex $arcNodes($e) 0]
-		if {![info exists group($n)]} {continue}
-		if { [info exists coll($e)]}  {continue}
-		lappend arcs    $e
-		set     coll($e) .
-	    }
-	    # Second iteration over outgoing arcs not
-	    # required. Any arc found above would be found here as
-	    # well, and arcs not recognized above can't be
-	    # recognized by the out loop either.
-	}
-    }
-}
-
-proc ::struct::graph::ArcsEMB {name cn} {
-    # arcs -adj. "Arcs bordering the node set"
-    #
-    # ARC/emb (NS) := ARC/inner (NS) - ARC/adj (NS)
-    # <=> (ARC/in + ARC/out) - (ARC/in * ARC/out)
-    # <=> (ARC/in - ARC/out) + (ARC/out - ARC/in)
-    # <=> symmetric difference (ARC/in, ARC/out)
-
-    # Result is all arcs from -adj minus the arcs from -inner.
-    # IOW all arcs going from a node in the list to a node
-    # which is *not* in the list
-
-    return [struct::set symdiff \
-	    [ArcsIN  $name $cn] \
-	    [ArcsOUT $name $cn]]
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set intersection
-	# directly, intertwined with the data
-	# retrieval.
-
-	# This also means that no arc can be counted twice as it
-	# is either going to a node, or coming from a node in the
-	# list, but it can't do both, because then it is part of
-	# -inner, which was excluded!
-
-	array set group {}
-	foreach node $condNodes {
-	    set group($node) .
-	}
-
-	foreach node $condNodes {
-	    foreach e $inArcs($node) {
-		set n [lindex $arcNodes($e) 0]
-		if {[info exists group($n)]} {continue}
-		# if {[info exists coll($e)]}  {continue}
-		lappend arcs    $e
-		# set     coll($e) .
-	    }
-	    foreach e $outArcs($node) {
-		set n [lindex $arcNodes($e) 1]
-		if {[info exists group($n)]} {continue}
-		# if {[info exists coll($e)]}  {continue}
-		lappend arcs    $e
-		# set     coll($e) .
-	    }
-	}
-    }
-}
-
-proc ::struct::graph::ArcsNONE {name} {
-    variable ${name}::arcNodes
-    return [array names arcNodes]
-}
-
-proc ::struct::graph::ArcsKV {name key value arcs} {
-    set filteredArcs {}
-    foreach arc $arcs {
-	catch {
-	    set aval [__arc_get $name $arc $key]
-	    if {$aval == $value} {
-		lappend filteredArcs $arc
-	    }
-	}
-    }
-    return $filteredArcs
-}
-
-proc ::struct::graph::ArcsK {name key arcs} {
-    set filteredArcs {}
-    foreach arc $arcs {
-	catch {
-	    __arc_get $name $arc $key
-	    lappend filteredArcs $arc
-	}
-    }
-    return $filteredArcs
-}
-
-# ::struct::graph::_deserialize --
-#
-#	Assignment operator. Copies a serialization into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the graph object we are copying into.
-#	serial	Serialized graph to copy from.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::graph::_deserialize {name serial} {
-    # As we destroy the original graph as part of
-    # the copying process we don't have to deal
-    # with issues like node names from the new graph
-    # interfering with the old ...
-
-    # I. Get the serialization of the source graph
-    #    and check it for validity.
-
-    CheckSerialization $serial \
-	    gattr nattr aattr ina outa arcn
-
-    # Get all the relevant data into the scope
-
-    variable ${name}::graphAttr
-    variable ${name}::nodeAttr
-    variable ${name}::arcAttr
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-    variable ${name}::nextAttr
-
-    # Kill the existing information and insert the new
-    # data in their place.
-
-    foreach n [array names inArcs] {
-	unset inArcs($n) outArcs($n)
-    }
-    array set inArcs   [array get ina]
-    array set outArcs  [array get outa]
-    unset ina outa
-
-    foreach a [array names arcNodes] {
-	unset arcNodes($a)
-    }
-    array set arcNodes [array get arcn]
-    unset arcn
-
-    set nextAttr 0
-    foreach a [array names nodeAttr] {
-	unset ${name}::$nodeAttr($a)
-    }
-    foreach a [array names arcAttr] {
-	unset ${name}::$arcAttr($a)
-    }
-    foreach n [array names nattr] {
-	GenAttributeStorage $name node $n
-	array set ${name}::$nodeAttr($n) $nattr($n)
-    }
-    foreach a [array names aattr] {
-	GenAttributeStorage $name arc $a
-	array set ${name}::$arcAttr($a) $aattr($a)
-    }
-    foreach k [array names graphAttr] {
-	unset graphAttr($k)
-    }
-    array set graphAttr $gattr
-
-    ## Debug ## Dump internals ...
-    if {0} {
-	puts "___________________________________ $name"
-	parray inArcs
-	parray outArcs
-	parray arcNodes
-	parray nodeAttr
-	parray arcAttr
-	parray graphAttr
-	puts ___________________________________
-    }
-    return
-}
-
-# ::struct::graph::_destroy --
-#
-#	Destroy a graph, including its associated command and data storage.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_destroy {name} {
-    namespace delete $name
-    interp alias {} $name {}
-}
-
-# ::struct::graph::__generateUniqueArcName --
-#
-#	Generate a unique arc name for the given graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	arc	name of a arc guaranteed to not exist in the graph.
-
-proc ::struct::graph::__generateUniqueArcName {name} {
-    variable ${name}::nextUnusedArc
-    while {[__arc_exists $name "arc${nextUnusedArc}"]} {
-	incr nextUnusedArc
-    }
-    return "arc${nextUnusedArc}"
-}
-
-# ::struct::graph::__generateUniqueNodeName --
-#
-#	Generate a unique node name for the given graph.
-#
-# Arguments:
-#	name	name of the graph.
-#
-# Results:
-#	node	name of a node guaranteed to not exist in the graph.
-
-proc ::struct::graph::__generateUniqueNodeName {name} {
-    variable ${name}::nextUnusedNode
-    while {[__node_exists $name "node${nextUnusedNode}"]} {
-	incr nextUnusedNode
-    }
-    return "node${nextUnusedNode}"
-}
-
-# ::struct::graph::_get --
-#
-#	Get a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	key	key to lookup
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_get {name key} {
-    variable  ${name}::graphAttr
-    if { ![info exists graphAttr($key)] } {
-	return -code error "invalid key \"$key\" for graph \"$name\""
-    }
-    return $graphAttr($key)
-}
-
-# ::struct::graph::_getall --
-#
-#	Get an attribute dictionary from a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	pattern	optional, glob pattern
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_getall {name {pattern *}} { 
-    variable ${name}::graphAttr
-    return [array get graphAttr $pattern]
-}
-
-# ::struct::graph::_keys --
-#
-#	Get a list of keys from a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	pattern	optional, glob pattern
-#
-# Results:
-#	value	list of known keys
-
-proc ::struct::graph::_keys {name {pattern *}} { 
-    variable   ${name}::graphAttr
-    return [array names graphAttr $pattern]
-}
-
-# ::struct::graph::_keyexists --
-#
-#	Test for existence of a given key in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	key	key to lookup
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::_keyexists {name key} {
-    variable   ${name}::graphAttr
-    return [info exists graphAttr($key)]
-}
-
-# ::struct::graph::_node --
-#
-#	Dispatches the invocation of node methods to the proper handler
-#	procedure.
-#
-# Arguments:
-#	name	name of the graph.
-#	cmd	node command to invoke
-#	args	arguments to propagate to the handler for the node command
-#
-# Results:
-#	As of the the invoked handler.
-
-proc ::struct::graph::_node {name cmd args} {
-    # Split the args into command and args components
-    set sub __node_$cmd
-    if { [llength [info commands ::struct::graph::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::graph::__node_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 7 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::graph::$sub $name]
-}
-
-# ::struct::graph::__node_degree --
-#
-#	Return the number of arcs adjacent to the specified node.
-#	If one of the restrictions -in or -out is given only
-#	incoming resp. outgoing arcs are counted.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	option, followed by the node.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_degree {name args} {
-
-    if {([llength $args] < 1) || ([llength $args] > 2)} {
-	return -code error "wrong # args: should be \"$name node degree ?-in|-out? node\""
-    }
-
-    switch -exact -- [llength $args] {
-	1 {
-	    set opt {}
-	    set node [lindex $args 0]
-	}
-	2 {
-	    set opt  [lindex $args 0]
-	    set node [lindex $args 1]
-	}
-	default {return -code error "Can't happen, panic"}
-    }
-
-    # Validate the option.
-
-    switch -exact -- $opt {
-	{}   -
-	-in  -
-	-out {}
-	default {
-	    return -code error "bad option \"$opt\": must be -in or -out"
-	}
-    }
-
-    # Validate the node
-
-    CheckMissingNode $name $node
-
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-
-    switch -exact -- $opt {
-	-in  {
-	    set result [llength $inArcs($node)]
-	}
-	-out {
-	    set result [llength $outArcs($node)]
-	}
-	{} {
-	    set result [expr {[llength $inArcs($node)] \
-		    + [llength $outArcs($node)]}]
-
-	    # loops count twice, don't do <set> arithmetics, i.e. no union!
-	    if {0} {
-		array set coll  {}
-		set result [llength $inArcs($node)]
-
-		foreach e $inArcs($node) {
-		    set coll($e) .
-		}
-		foreach e $outArcs($node) {
-		    if {[info exists coll($e)]} {continue}
-		    incr result
-		    set     coll($e) .
-		}
-	    }
-	}
-	default {return -code error "Can't happen, panic"}
-    }
-
-    return $result
-}
-
-# ::struct::graph::__node_delete --
-#
-#	Remove a node from a graph, including all of its values.
-#	Additionally removes the arcs connected to this node.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of the nodes to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_delete {name args} {
-    if {![llength $args]} {
-	return {wrong # args: should be "::struct::graph::__node_delete name node node..."}
-    }
-    foreach node $args {CheckMissingNode $name $node}
-
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::nodeAttr
-
-    foreach node $args {
-	# Remove all the arcs connected to this node
-	foreach e $inArcs($node) {
-	    __arc_delete $name $e
-	}
-	foreach e $outArcs($node) {
-	    # Check existence to avoid problems with
-	    # loops (they are in and out arcs! at
-	    # the same time and thus already deleted)
-	    if { [__arc_exists $name $e] } {
-		__arc_delete $name $e
-	    }
-	}
-
-	unset inArcs($node)
-	unset outArcs($node)
-
-	if {[info exists nodeAttr($node)]} {
-	    unset ${name}::$nodeAttr($node)
-	    unset nodeAttr($node)
-	}
-    }
-
-    return
-}
-
-# ::struct::graph::__node_exists --
-#
-#	Test for existence of a given node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to look for.
-#
-# Results:
-#	1 if the node exists, 0 else.
-
-proc ::struct::graph::__node_exists {name node} {
-    return [info exists ${name}::inArcs($node)]
-}
-
-# ::struct::graph::__node_get --
-#
-#	Get a keyed value from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	key	key to lookup
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_get {name node key} {
-    CheckMissingNode $name $node
- 
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attribute data for this node, key has to be invalid.
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    if { ![info exists data($key)] } {
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-    return $data($key)
-}
-
-# ::struct::graph::__node_getall --
-#
-#	Get a serialized list of key/value pairs from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	pattern	optional glob pattern to restrict retrieval
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_getall {name node {pattern *}} { 
-    CheckMissingNode $name $node
-
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attributes ...
-	return {}
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    return [array get data $pattern]
-}
-
-# ::struct::graph::__node_keys --
-#
-#	Get a list of keys from a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	pattern	optional glob pattern to restrict retrieval
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::__node_keys {name node {pattern *}} { 
-    CheckMissingNode $name $node
-
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attributes ...
-	return {}
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    return [array names data $pattern]
-}
-
-# ::struct::graph::__node_keyexists --
-#
-#	Test for existence of a given key for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to query.
-#	key	key to lookup
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::graph::__node_keyexists {name node key} {
-    CheckMissingNode $name $node
-    
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attribute data for this node, key cannot exist.
-	return 0
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    return [info exists data($key)]
-}
-
-# ::struct::graph::__node_insert --
-#
-#	Add a node to a graph.
-#
-# Arguments:
-#	name		name of the graph.
-#	args		node to insert; must be unique.  If none is given,
-#			the routine will generate a unique node name.
-#
-# Results:
-#	node		The name of the new node.
-
-proc ::struct::graph::__node_insert {name args} {
-    if {[llength $args] == 0} {
-	# No node name was given; generate a unique one
-	set args [list [__generateUniqueNodeName $name]]
-    } else {
-	foreach node $args {CheckDuplicateNode $name $node}
-    }
-    
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-
-    foreach node $args {
-	# Set up the new node
-	set inArcs($node)  {}
-	set outArcs($node) {}
-    }
-
-    return $args
-}
-
-# ::struct::graph::__node_opposite --
-#
-#	Retrieve node opposite to the specified one, along the arc.
-#
-# Arguments:
-#	name		name of the graph.
-#	node		node to look up.
-#	arc		arc to look up.
-#
-# Results:
-#	nodex	Node opposite to <node,arc>
-
-proc ::struct::graph::__node_opposite {name node arc} {
-    CheckMissingNode $name $node    
-    CheckMissingArc  $name $arc
-
-    variable ${name}::arcNodes
-
-    # Node must be connected to at least one end of the arc.
-
-    if {[string equal $node [lindex $arcNodes($arc) 0]]} {
-	set result [lindex $arcNodes($arc) 1]
-    } elseif {[string equal $node [lindex $arcNodes($arc) 1]]} {
-	set result [lindex $arcNodes($arc) 0]
-    } else {
-	return -code error "node \"$node\" and arc \"$arc\" are not connected\
-		in graph \"$name\""
-    }
-
-    return $result
-}
-
-# ::struct::graph::__node_set --
-#
-#	Set or get a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	key	attribute to modify or query
-#	args	?value?
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_set {name node key args} {
-    if { [llength $args] > 1 } {
-	return -code error "wrong # args: should be \"$name node set node key ?value?\""
-    }
-    CheckMissingNode $name $node
-    
-    if { [llength $args] > 0 } {
-	# Setting the value. This may have to create
-	# the attribute array for this particular
-	# node
-
-	variable ${name}::nodeAttr
-	if {![info exists nodeAttr($node)]} {
-	    # No attribute data for this node,
-	    # so create it as we need it now.
-	    GenAttributeStorage $name node $node
-	}
-	upvar ${name}::$nodeAttr($node) data
-
-	return [set data($key) [lindex $args end]]
-    } else {
-	# Getting a value
-	return [__node_get $name $node $key]
-    }
-}
-
-# ::struct::graph::__node_append --
-#
-#	Append a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_append {name node key value} {
-    CheckMissingNode $name $node
-
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name node $node
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    return [append data($key) $value]
-}
-
-# ::struct::graph::__node_attr --
-#
-#	Return attribute data for one key and multiple nodes, possibly all.
-#
-# Arguments:
-#	name	Name of the graph object.
-#	key	Name of the attribute to retrieve.
-#
-# Results:
-#	children	Dictionary mapping nodes to attribute data.
-
-proc ::struct::graph::__node_attr {name key args} {
-    # Syntax:
-    #
-    # t attr key
-    # t attr key -nodes {nodelist}
-    # t attr key -glob nodepattern
-    # t attr key -regexp nodepattern
-
-    variable ${name}::nodeAttr
-
-    set usage "wrong # args: should be \"[list $name] node attr key ?-nodes list|-glob pattern|-regexp pattern?\""
-    if {([llength $args] != 0) && ([llength $args] != 2)} {
-	return -code error $usage
-    } elseif {[llength $args] == 0} {
-	# This automatically restricts the list
-	# to nodes which can have the attribute
-	# in question.
-
-	set nodes [array names nodeAttr]
-    } else {
-	# Determine a list of nodes to look at
-	# based on the chosen restriction.
-
-	foreach {mode value} $args break
-	switch -exact -- $mode {
-	    -nodes {
-		# This is the only branch where we have to
-		# perform an explicit restriction to the
-		# nodes which have attributes.
-		set nodes {}
-		foreach n $value {
-		    if {![info exists nodeAttr($n)]} continue
-		    lappend nodes $n
-		}
-	    }
-	    -glob {
-		set nodes [array names nodeAttr $value]
-	    }
-	    -regexp {
-		set nodes {}
-		foreach n [array names nodeAttr] {
-		    if {![regexp -- $value $n]} continue
-		    lappend nodes $n
-		}
-	    }
-	    default {
-		return -code error "bad type \"$mode\": must be -glob, -nodes, or -regexp"
-	    }
-	}
-    }
-
-    # Without possibly matching nodes
-    # the result has to be empty.
-
-    if {![llength $nodes]} {
-	return {}
-    }
-
-    # Now locate matching keys and their values.
-
-    set result {}
-    foreach n $nodes {
-	upvar ${name}::$nodeAttr($n) data
-	if {[info exists data($key)]} {
-	    lappend result $n $data($key)
-	}
-    }
-
-    return $result
-}
-
-# ::struct::graph::__node_lappend --
-#
-#	lappend a value for a node in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify or query.
-#	args	key value
-#
-# Results:
-#	val	value associated with the given key of the given node
-
-proc ::struct::graph::__node_lappend {name node key value} {
-    CheckMissingNode $name $node
-
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name node $node
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    return [lappend data($key) $value]
-}
-
-# ::struct::graph::__node_unset --
-#
-#	Remove a keyed value from a node.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node to modify.
-#	key	attribute to remove
-#
-# Results:
-#	None.
-
-proc ::struct::graph::__node_unset {name node key} {
-    CheckMissingNode $name $node
-
-    variable ${name}::nodeAttr
-    if {![info exists nodeAttr($node)]} {
-	# No attribute data for this node,
-	# nothing to do.
-	return
-    }
-
-    upvar ${name}::$nodeAttr($node) data
-    catch {unset data($key)}
-
-    if {[array size data] == 0} {
-	# No attributes stored for this node, squash the whole array.
-	unset nodeAttr($node)
-	unset data
-    }
-    return
-}
-
-# ::struct::graph::_nodes --
-#
-#	Return a list of all nodes in a graph satisfying some restriction.
-#
-# Arguments:
-#	name	name of the graph.
-#	args	list of options and nodes specifying the restriction.
-#
-# Results:
-#	nodes	list of nodes
-
-proc ::struct::graph::_nodes {name args} {
-
-    CheckE $name nodes $args
-
-    switch -exact -- $cond {
-	none      {set nodes [NodesNONE $name]}
-	in        {set nodes [NodesIN   $name $condNodes]}
-	out       {set nodes [NodesOUT  $name $condNodes]}
-	adj       {set nodes [NodesADJ  $name $condNodes]}
-	inner     {set nodes [NodesINN  $name $condNodes]}
-	embedding {set nodes [NodesEMB  $name $condNodes]}
-	default   {return -code error "Can't happen, panic"}
-    }
-
-    #
-    # We have a list of nodes that match the relation to the nodes.
-    # Now filter according to -key and -value.
-    #
-
-    if {$haveKey && $haveValue} {
-	set nodes [NodesKV $name $key $value $nodes]
-    } elseif {$haveKey} {
-	set nodes [NodesK $name $key $nodes]
-    }
-
-    #
-    # Apply the general filter command, if specified.
-    #
-
-    if {$haveFilter} {
-	lappend fcmd $name
-	set nodes [uplevel 1 [list ::struct::list filter $nodes $fcmd]]
-    }
-
-    return $nodes
-}
-
-proc ::struct::graph::NodesIN {name cn} {
-    # nodes -in.
-    # "Neighbours with arcs going into the node set"
-    #
-    # NODES/in (NS) := { source(a) | a in ARC/in (NS) }
-
-    # Result is all nodes with at least one arc going to
-    # at least one node in the list of arguments.
-
-    variable ${name}::inArcs
-    variable ${name}::arcNodes
-
-    set nodes {}
-    array set coll {}
-
-    foreach node $cn {
-	foreach e $inArcs($node) {
-	    set n [lindex $arcNodes($e) 0]
-	    if {[info exists coll($n)]} {continue}
-	    lappend nodes    $n
-	    set     coll($n) .
-	}
-    }
-    return $nodes
-}
-
-proc ::struct::graph::NodesOUT {name cn} {
-    # nodes -out.
-    # "Neighbours with arcs coming from the node set"
-    #
-    # NODES/out (NS) := { target(a) | a in ARC/out (NS) }
-
-    # Result is all nodes with at least one arc coming from
-    # at least one node in the list of arguments.
-
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-
-    set nodes {}
-    array set coll {}
-
-    foreach node $cn {
-	foreach e $outArcs($node) {
-	    set n [lindex $arcNodes($e) 1]
-	    if {[info exists coll($n)]} {continue}
-	    lappend nodes    $n
-	    set     coll($n) .
-	}
-    }
-    return $nodes
-}
-
-proc ::struct::graph::NodesADJ {name cn} {
-    # nodes -adj.
-    # "Neighbours of the node set"
-    #
-    # NODES/adj (NS) := NODES/in (NS) + NODES/out (NS)
-
-    # Result is all nodes with at least one arc coming from
-    # or going to at least one node in the list of arguments.
-
-    return [struct::set union \
-	    [NodesIN  $name $cn] \
-	    [NodesOUT $name $cn]]
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set union directly,
-	# intertwined with the data retrieval.
-
-	foreach node $cn {
-	    foreach e $inArcs($node) {
-		set n [lindex $arcNodes($e) 0]
-		if {[info exists coll($n)]} {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	    foreach e $outArcs($node) {
-		set n [lindex $arcNodes($e) 1]
-		if {[info exists coll($n)]} {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	}
-    }
-}
-
-proc ::struct::graph::NodesINN {name cn} {
-    # nodes -adj.
-    # "Inner node of the node set"
-    #
-    # NODES/inner (NS) := NODES/adj (NS) * NS
-
-    # Result is all nodes from the set with at least one arc coming
-    # from or going to at least one node in the set.
-    #
-    # I.e the adjacent nodes also in the set.
-
-    return [struct::set intersect \
-	    [NodesADJ $name $cn] $cn]
-
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set intersect/union
-	# directly, intertwined with the data retrieval.
-
-	array set group {}
-	foreach node $cn {
-	    set group($node) .
-	}
-
-	foreach node $cn {
-	    foreach e $inArcs($node) {
-		set n [lindex $arcNodes($e) 0]
-		if {![info exists group($n)]} {continue}
-		if { [info exists coll($n)]}  {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	    foreach e $outArcs($node) {
-		set n [lindex $arcNodes($e) 1]
-		if {![info exists group($n)]} {continue}
-		if { [info exists coll($n)]}  {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	}
-    }
-}
-
-proc ::struct::graph::NodesEMB {name cn} {
-    # nodes -embedding.
-    # "Embedding nodes for the node set"
-    #
-    # NODES/emb (NS) := NODES/adj (NS) - NS
-
-    # Result is all nodes with at least one arc coming from or going
-    # to at least one node in the set, but not in the set itself
-    #
-    # I.e the adjacent nodes not in the set.
-
-    # Result is all nodes from the set with at least one arc coming
-    # from or going to at least one node in the set.
-    # I.e the adjacent nodes still in the set.
-
-    return [struct::set difference \
-	    [NodesADJ $name $cn] $cn]
-
-    if 0 {
-	# Alternate implementation using arrays,
-	# implementing the set diff/union directly,
-	# intertwined with the data retrieval.
-
-	array set group {}
-	foreach node $cn {
-	    set group($node) .
-	}
-
-	foreach node $cn {
-	    foreach e $inArcs($node) {
-		set n [lindex $arcNodes($e) 0]
-		if {[info exists group($n)]} {continue}
-		if {[info exists coll($n)]}  {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	    foreach e $outArcs($node) {
-		set n [lindex $arcNodes($e) 1]
-		if {[info exists group($n)]} {continue}
-		if {[info exists coll($n)]}  {continue}
-		lappend nodes    $n
-		set     coll($n) .
-	    }
-	}
-    }
-}
-
-proc ::struct::graph::NodesNONE {name} {
-    variable ${name}::inArcs
-    return [array names inArcs]
-}
-
-proc ::struct::graph::NodesKV {name key value nodes} {
-    set filteredNodes {}
-    foreach node $nodes {
-	catch {
-	    set nval [__node_get $name $node $key]
-	    if {$nval == $value} {
-		lappend filteredNodes $node
-	    }
-	}
-    }
-    return $filteredNodes
-}
-
-proc ::struct::graph::NodesK {name key nodes} {
-    set filteredNodes {}
-    foreach node $nodes {
-	catch {
-	    __node_get $name $node $key
-	    lappend filteredNodes $node
-	}
-    }
-    return $filteredNodes
-}
-
-# ::struct::graph::__node_rename --
-#
-#	Rename a node in place.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	Name of the node to rename
-#	newname	The new name of the node.
-#
-# Results:
-#	The new name of the node.
-
-proc ::struct::graph::__node_rename {name node newname} {
-    CheckMissingNode   $name $node
-    CheckDuplicateNode $name $newname
-
-    set oldname  $node
-
-    # Perform the rename in the internal
-    # data structures.
-
-    # - graphAttr - not required, node independent.
-    # - arcAttr   - not required, node independent.
-    # - counters  - not required
-
-    variable ${name}::nodeAttr
-    variable ${name}::inArcs
-    variable ${name}::outArcs
-    variable ${name}::arcNodes
-
-    # Node relocation
-
-    set inArcs($newname)    [set in $inArcs($oldname)]
-    unset                            inArcs($oldname)
-    set outArcs($newname) [set out $outArcs($oldname)]
-    unset                           outArcs($oldname)
-
-    if {[info exists nodeAttr($oldname)]} {
-	set nodeAttr($newname) $nodeAttr($oldname)
-	unset                   nodeAttr($oldname)
-    }
-
-    # Update all relevant arcs.
-    # 8.4: lset ...
-
-    foreach a $in {
-	set arcNodes($a) [list [lindex $arcNodes($a) 0] $newname]
-    }
-    foreach a $out {
-	set arcNodes($a) [list $newname [lindex $arcNodes($a) 1]]
-    }
-
-    return $newname
-}
-
-# ::struct::graph::_serialize --
-#
-#	Serialize a graph object (partially) into a transportable value.
-#	If only a subset of nodes is serialized the result will be a sub-
-#	graph in the mathematical sense of the word: These nodes and all
-#	arcs which are only between these nodes. No arcs to modes outside
-#	of the listed set.
-#
-# Arguments:
-#	name	Name of the graph.
-#	args	list of nodes to place into the serialized graph
-#
-# Results:
-#	A list structure describing the part of the graph which was serialized.
-
-proc ::struct::graph::_serialize {name args} {
-
-    # all - boolean flag - set if and only if the all nodes of the
-    # graph are chosen for serialization. Because if that is true we
-    # can skip the step finding the relevant arcs and simply take all
-    # arcs.
-
-    variable ${name}::arcNodes
-    variable ${name}::inArcs
-
-    set all 0
-    if {[llength $args] > 0} {
-	set nodes [luniq $args]
-	foreach n $nodes {CheckMissingNode $name $n}
-	if {[llength $nodes] == [array size inArcs]} {
-	    set all 1
-	}
-    } else {
-	set nodes [array names inArcs]
-	set all 1
-    }
-
-    if {$all} {
-	set arcs [array names arcNodes]
-    } else {
-	set arcs [eval [linsert $nodes 0 _arcs $name -inner]]
-    }
-
-    variable ${name}::nodeAttr
-    variable ${name}::arcAttr
-    variable ${name}::graphAttr
-
-    set na {}
-    set aa {}
-    array set np {}
-
-    # node indices, attribute data ...
-    set i 0
-    foreach n $nodes {
-	set np($n) [list $i]
-	incr i 3
-
-	if {[info exists nodeAttr($n)]} {
-	    upvar ${name}::$nodeAttr($n) data
-	    lappend np($n) [array get data]
-	} else {
-	    lappend np($n) {}
-	}
-    }
-
-    # arc dictionary
-    set arcdata  {}
-    foreach a $arcs {
-	foreach {src dst} $arcNodes($a) break
-	# Arc information
-
-	set     arc [list $a]
-	lappend arc [lindex $np($dst) 0]
-	if {[info exists arcAttr($a)]} {
-	    upvar ${name}::$arcAttr($a) data
-	    lappend arc [array get data]
-	} else {
-	    lappend arc {}
-	}
-
-	# Add the information to the node
-	# indices ...
-
-	lappend np($src) $arc
-    }
-
-    # Combine the transient data into one result.
-
-    set result [list]
-    foreach n $nodes {
-	lappend result $n
-	lappend result [lindex $np($n) 1]
-	lappend result [lrange $np($n) 2 end]
-    }
-    lappend result [array get graphAttr]
-
-    return $result
-}
-
-# ::struct::graph::_set --
-#
-#	Set or get a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	key	attribute to modify or query
-#	args	?value?
-#
-# Results:
-#	value	value associated with the key given.
-
-proc ::struct::graph::_set {name key args} {
-    if { [llength $args] > 1 } {
-	return -code error "wrong # args: should be \"$name set key ?value?\""
-    }
-    if { [llength $args] > 0 } {
-	variable ${name}::graphAttr
-	return [set graphAttr($key) [lindex $args end]]
-    } else {
-	# Getting a value
-	return [_get $name $key]
-    }
-}
-
-# ::struct::graph::_swap --
-#
-#	Swap two nodes in a graph.
-#
-# Arguments:
-#	name	name of the graph.
-#	node1	first node to swap.
-#	node2	second node to swap.
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_swap {name node1 node2} {
-    # Can only swap two real nodes
-    CheckMissingNode $name $node1
-    CheckMissingNode $name $node2
-
-    # Can't swap a node with itself
-    if { [string equal $node1 $node2] } {
-	return -code error "cannot swap node \"$node1\" with itself"
-    }
-
-    # Swapping nodes means swapping their labels, values and arcs
-    variable ${name}::outArcs
-    variable ${name}::inArcs
-    variable ${name}::arcNodes
-    variable ${name}::nodeAttr
-
-    # Redirect arcs to the new nodes.
-
-    foreach e $inArcs($node1)  {lset arcNodes($e) end $node2}
-    foreach e $inArcs($node2)  {lset arcNodes($e) end $node1}
-    foreach e $outArcs($node1) {lset arcNodes($e) 0 $node2}
-    foreach e $outArcs($node2) {lset arcNodes($e) 0 $node1}
-
-    # Swap arc lists
-
-    set tmp            $inArcs($node1)
-    set inArcs($node1) $inArcs($node2)
-    set inArcs($node2) $tmp
-
-    set tmp             $outArcs($node1)
-    set outArcs($node1) $outArcs($node2)
-    set outArcs($node2) $tmp
-
-    # Swap the values
-    # More complicated now with the possibility that nodes do not have
-    # attribute storage associated with them. But also
-    # simpler as we just have to swap/move the array
-    # reference
-
-    if {
-	[set ia [info exists nodeAttr($node1)]] ||
-	[set ib [info exists nodeAttr($node2)]]
-    } {
-	# At least one of the nodes has attribute data. We simply swap
-	# the references to the arrays containing them. No need to
-	# copy the actual data around.
-
-	if {$ia && $ib} {
-	    set tmp               $nodeAttr($node1)
-	    set nodeAttr($node1) $nodeAttr($node2)
-	    set nodeAttr($node2) $tmp
-	} elseif {$ia} {
-	    set   nodeAttr($node2) $nodeAttr($node1)
-	    unset nodeAttr($node1)
-	} elseif {$ib} {
-	    set   nodeAttr($node1) $nodeAttr($node2)
-	    unset nodeAttr($node2)
-	} else {
-	    return -code error "Impossible condition."
-	}
-    } ; # else: No attribute storage => Nothing to do {}
-
-    return
-}
-
-# ::struct::graph::_unset --
-#
-#	Remove a keyed value from the graph itself
-#
-# Arguments:
-#	name	name of the graph.
-#	key	attribute to remove
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_unset {name key} {
-    variable ${name}::graphAttr
-    if {[info exists  graphAttr($key)]} {
-	unset graphAttr($key)
-    }
-    return
-}
-
-# ::struct::graph::_walk --
-#
-#	Walk a graph using a pre-order depth or breadth first
-#	search. Pre-order DFS is the default.  At each node that is visited,
-#	a command will be called with the name of the graph and the node.
-#
-# Arguments:
-#	name	name of the graph.
-#	node	node at which to start.
-#	args	additional args: ?-order pre|post|both? ?-type {bfs|dfs}?
-#		-command cmd
-#
-# Results:
-#	None.
-
-proc ::struct::graph::_walk {name node args} {
-    set usage "$name walk node ?-dir forward|backward?\
-	    ?-order pre|post|both? ?-type bfs|dfs? -command cmd"
-
-    if {[llength $args] < 2} {
-	return -code error "wrong # args: should be \"$usage\""
-    }
-
-    CheckMissingNode $name $node
-
-    # Set defaults
-    set type  dfs
-    set order pre
-    set cmd   ""
-    set dir   forward
-
-    # Process specified options
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set flag [lindex $args $i]
-	switch -glob -- $flag {
-	    "-type" {
-		incr i
-		if { $i >= [llength $args] } {
-		    return -code error "value for \"$flag\" missing: should be \"$usage\""
-		}
-		set type [string tolower [lindex $args $i]]
-	    }
-	    "-order" {
-		incr i
-		if { $i >= [llength $args] } {
-		    return -code error "value for \"$flag\" missing: should be \"$usage\""
-		}
-		set order [string tolower [lindex $args $i]]
-	    }
-	    "-command" {
-		incr i
-		if { $i >= [llength $args] } {
-		    return -code error "value for \"$flag\" missing: should be \"$usage\""
-		}
-		set cmd [lindex $args $i]
-	    }
-	    "-dir" {
-		incr i
-		if { $i >= [llength $args] } {
-		    return -code error "value for \"$flag\" missing: should be \"$usage\""
-		}
-		set dir [string tolower [lindex $args $i]]
-	    }
-	    default {
-		return -code error "unknown option \"$flag\": should be \"$usage\""
-	    }
-	}
-    }
-    
-    # Make sure we have a command to run, otherwise what's the point?
-    if { [string equal $cmd ""] } {
-	return -code error "no command specified: should be \"$usage\""
-    }
-
-    # Validate that the given type is good
-    switch -glob -- $type {
-	"dfs" {
-	    set type "dfs"
-	}
-	"bfs" {
-	    set type "bfs"
-	}
-	default {
-	    return -code error "bad search type \"$type\": must be bfs or dfs"
-	}
-    }
-    
-    # Validate that the given order is good
-    switch -glob -- $order {
-	"both" {
-	    set order both
-	}
-	"pre" {
-	    set order pre
-	}
-	"post" {
-	    set order post
-	}
-	default {
-	    return -code error "bad search order \"$order\": must be both,\
-		    pre, or post"
-	}
-    }
-
-    # Validate that the given direction is good
-    switch -glob -- $dir {
-	"forward" {
-	    set dir -out
-	}
-	"backward" {
-	    set dir -in
-	}
-	default {
-	    return -code error "bad search direction \"$dir\": must be\
-		    backward or forward"
-	}
-    }
-
-    # Do the walk
-
-    set st [list ]
-    lappend st $node
-    array set visited {}
-
-    if { [string equal $type "dfs"] } {
-	if { [string equal $order "pre"] } {
-	    # Pre-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex   $st end]
-		ldelete st end
-
-		# Evaluate the command at this node
-		set cmdcpy $cmd
-		lappend cmdcpy enter $name $node
-		uplevel 1 $cmdcpy
-
-		set visited($node) .
-
-		# Add this node's neighbours (according to direction)
-		#  Have to add them in reverse order
-		#  so that they will be popped left-to-right
-
-		set next [_nodes $name $dir $node]
-		set len  [llength $next]
-
-		for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-		    set nextnode [lindex $next $i]
-		    if {[info exists visited($nextnode)]} {
-			# Skip nodes already visited
-			continue
-		    }
-		    lappend st $nextnode
-		}
-	    }
-	} elseif { [string equal $order "post"] } {
-	    # Post-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex $st end]
-
-		if {[info exists visited($node)]} {
-		    # Second time we are here, pop it,
-		    # then evaluate the command.
-
-		    ldelete st end
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy leave $name $node
-		    uplevel 1 $cmdcpy
-		} else {
-		    # First visit. Remember it.
-		    set visited($node) .
-	    
-		    # Add this node's neighbours.
-		    set next [_nodes $name $dir $node]
-		    set len  [llength $next]
-
-		    for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-			set nextnode [lindex $next $i]
-			if {[info exists visited($nextnode)]} {
-			    # Skip nodes already visited
-			    continue
-			}
-			lappend st $nextnode
-		    }
-		}
-	    }
-	} else {
-	    # Both-order Depth-first search
-
-	    while { [llength $st] > 0 } {
-		set node [lindex $st end]
-
-		if {[info exists visited($node)]} {
-		    # Second time we are here, pop it,
-		    # then evaluate the command.
-
-		    ldelete st end
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy leave $name $node
-		    uplevel 1 $cmdcpy
-		} else {
-		    # First visit. Remember it.
-		    set visited($node) .
-
-		    # Evaluate the command at this node
-		    set cmdcpy $cmd
-		    lappend cmdcpy enter $name $node
-		    uplevel 1 $cmdcpy
-	    
-		    # Add this node's neighbours.
-		    set next [_nodes $name $dir $node]
-		    set len  [llength $next]
-
-		    for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-			set nextnode [lindex $next $i]
-			if {[info exists visited($nextnode)]} {
-			    # Skip nodes already visited
-			    continue
-			}
-			lappend st $nextnode
-		    }
-		}
-	    }
-	}
-
-    } else {
-	if { [string equal $order "pre"] } {
-	    # Pre-order Breadth first search
-	    while { [llength $st] > 0 } {
-		set node [lindex $st 0]
-		ldelete st 0
-		# Evaluate the command at this node
-		set cmdcpy $cmd
-		lappend cmdcpy enter $name $node
-		uplevel 1 $cmdcpy
-	    
-		set visited($node) .
-
-		# Add this node's neighbours.
-		foreach child [_nodes $name $dir $node] {
-		    if {[info exists visited($child)]} {
-			# Skip nodes already visited
-			continue
-		    }
-		    lappend st $child
-		}
-	    }
-	} else {
-	    # Post-order Breadth first search
-	    # Both-order Breadth first search
-	    # Haven't found anything in Knuth
-	    # and unable to define something
-	    # consistent for myself. Leave it
-	    # out.
-
-	    return -code error "unable to do a ${order}-order breadth first walk"
-	}
-    }
-    return
-}
-
-# ::struct::graph::Union --
-#
-#	Return a list which is the union of the elements
-#	in the specified lists.
-#
-# Arguments:
-#	args	list of lists representing sets.
-#
-# Results:
-#	set	list representing the union of the argument lists.
-
-proc ::struct::graph::Union {args} {
-    switch -- [llength $args] {
-	0 {
-	    return {}
-	}
-	1 {
-	    return [lindex $args 0]
-	}
-	default {
-	    foreach set $args {
-		foreach e $set {
-		    set tmp($e) .
-		}
-	    }
-	    return [array names tmp]
-	}
-    }
-}
-
-# ::struct::graph::GenAttributeStorage --
-#
-#	Create an array to store the attributes of a node in.
-#
-# Arguments:
-#	name	Name of the graph containing the node
-#	type	Type of object for the attribute
-#	obj	Name of the node or arc which got attributes.
-#
-# Results:
-#	none
-
-proc ::struct::graph::GenAttributeStorage {name type obj} {
-    variable ${name}::nextAttr
-    upvar    ${name}::${type}Attr attribute
-
-    set   attr "a[incr nextAttr]"
-    set   attribute($obj) $attr
-    return
-}
-
-proc ::struct::graph::CheckMissingArc {name arc} {
-    if {![__arc_exists $name $arc]} {
-	return -code error "arc \"$arc\" does not exist in graph \"$name\""
-    }
-}
-
-proc ::struct::graph::CheckMissingNode {name node {prefix {}}} {
-    if {![__node_exists $name $node]} {
-	return -code error "${prefix}node \"$node\" does not exist in graph \"$name\""
-    }
-}
-
-proc ::struct::graph::CheckDuplicateArc {name arc} {
-    if {[__arc_exists $name $arc]} {
-	return -code error "arc \"$arc\" already exists in graph \"$name\""
-    }
-}
-
-proc ::struct::graph::CheckDuplicateNode {name node} {
-    if {[__node_exists $name $node]} {
-	return -code error "node \"$node\" already exists in graph \"$name\""
-    }
-}
-
-proc ::struct::graph::CheckE {name what arguments} {
-
-    # Discriminate between conditions and nodes
-
-    upvar 1 haveCond   haveCond   ; set haveCond   0
-    upvar 1 haveKey    haveKey    ; set haveKey    0
-    upvar 1 key        key        ; set key        {}
-    upvar 1 haveValue  haveValue  ; set haveValue  0
-    upvar 1 value      value      ; set value      {}
-    upvar 1 haveFilter haveFilter ; set haveFilter 0
-    upvar 1 fcmd       fcmd       ; set fcmd       {}
-    upvar 1 cond       cond       ; set cond       "none"
-    upvar 1 condNodes  condNodes  ; set condNodes  {}
-
-    set wa_usage "wrong # args: should be \"$name $what ?-key key? ?-value value? ?-filter cmd? ?-in|-out|-adj|-inner|-embedding node node...?\""
-
-    for {set i 0} {$i < [llength $arguments]} {incr i} {
-	set arg [lindex $arguments $i]
-	switch -glob -- $arg {
-	    -in -
-	    -out -
-	    -adj -
-	    -inner -
-	    -embedding {
-		if {$haveCond} {
-		    return -code error "invalid restriction:\
-			    illegal multiple use of\
-			    \"-in\"|\"-out\"|\"-adj\"|\"-inner\"|\"-embedding\""
-		}
-
-		set haveCond 1
-		set cond [string range $arg 1 end]
-	    }
-	    -key {
-		if {($i + 1) == [llength $arguments]} {
-		    return -code error $wa_usage
-		}
-		if {$haveKey} {
-		    return -code error {invalid restriction: illegal multiple use of "-key"}
-		}
-
-		incr i
-		set key [lindex $arguments $i]
-		set haveKey 1
-	    }
-	    -value {
-		if {($i + 1) == [llength $arguments]} {
-		    return -code error $wa_usage
-		}
-		if {$haveValue} {
-		    return -code error {invalid restriction: illegal multiple use of "-value"}
-		}
-
-		incr i
-		set value [lindex $arguments $i]
-		set haveValue 1
-	    }
-	    -filter {
-		if {($i + 1) == [llength $arguments]} {
-		    return -code error $wa_usage
-		}
-		if {$haveFilter} {
-		    return -code error {invalid restriction: illegal multiple use of "-filter"}
-		}
-
-		incr i
-		set fcmd [lindex $arguments $i]
-		set haveFilter 1
-	    }
-	    -* {
-		return -code error "bad restriction \"$arg\": must be -adj, -embedding,\
-			-filter, -in, -inner, -key, -out, or -value"
-	    }
-	    default {
-		lappend condNodes $arg
-	    }
-	}
-    }
-
-    # Validate that there are nodes to use in the restriction.
-    # otherwise what's the point?
-    if {$haveCond} {
-	if {[llength $condNodes] == 0} {
-	    return -code error $wa_usage
-	}
-
-	# Remove duplicates. Note: lsort -unique is not present in Tcl
-	# 8.2, thus not usable here.
-
-	array set nx {}
-	foreach c $condNodes {set nx($c) .}
-	set condNodes [array names nx]
-	unset nx
-
-	# Make sure that the specified nodes exist!
-	foreach node $condNodes {CheckMissingNode $name $node}
-    }
-
-    if {$haveValue && !$haveKey} {
-	return -code error {invalid restriction: use of "-value" without "-key"}
-    }
-
-    return
-}
-
-proc ::struct::graph::CheckSerialization {ser gavar navar aavar inavar outavar arcnvar} {
-    upvar 1 \
-	    $gavar   graphAttr \
-	    $navar   nodeAttr  \
-	    $aavar   arcAttr   \
-	    $inavar  inArcs    \
-	    $outavar outArcs   \
-	    $arcnvar arcNodes
-
-    array set nodeAttr  {}
-    array set arcAttr   {}
-    array set inArcs    {}
-    array set outArcs   {}
-    array set arcNodes  {}
-
-    # Overall length ok ?
-    if {[llength $ser] % 3 != 1} {
-	return -code error \
-		"error in serialization: list length not 1 mod 3."
-    }
-
-    # Attribute length ok ? Dictionary!
-    set graphAttr [lindex $ser end]
-    if {[llength $graphAttr] % 2} {
-	return -code error \
-		"error in serialization: malformed graph attribute dictionary."
-    }
-
-    # Basic decoder pass
-
-    foreach {node attr narcs} [lrange $ser 0 end-1] {
-	if {![info exists inArcs($node)]} {
-	    set inArcs($node)  [list]
-	}
-	set outArcs($node) [list]
-
-	# Attribute length ok ? Dictionary!
-	if {[llength $attr] % 2} {
-	    return -code error \
-		    "error in serialization: malformed node attribute dictionary."
-	}
-	# Remember attribute data only for non-empty nodes
-	if {[llength $attr]} {
-	    set nodeAttr($node) $attr
-	}
-
-	foreach arcd $narcs {
-	    if {[llength $arcd] != 3} {
-		return -code error \
-			"error in serialization: arc information length not 3."
-	    }
-
-	    foreach {arc dst aattr} $arcd break
-
-	    if {[info exists arcNodes($arc)]} {
-		return -code error \
-			"error in serialization: duplicate definition of arc \"$arc\"."
-	    }
-
-	    # Attribute length ok ? Dictionary!
-	    if {[llength $aattr] % 2} {
-		return -code error \
-			"error in serialization: malformed arc attribute dictionary."
-	    }
-	    # Remember attribute data only for non-empty nodes
-	    if {[llength $aattr]} {
-		set arcAttr($arc) $aattr
-	    }
-
-	    # Destination reference ok ?
-	    if {
-		![string is integer -strict $dst] ||
-		($dst % 3) ||
-		($dst < 0) ||
-		($dst >= [llength $ser])
-	    } {
-		return -code error \
-			"error in serialization: bad arc destination reference \"$dst\"."
-	    }
-
-	    # Get destination and reconstruct the
-	    # various relationships.
-
-	    set dstnode [lindex $ser $dst]
-
-	    set arcNodes($arc) [list $node $dstnode]
-	    lappend inArcs($dstnode) $arc
-	    lappend outArcs($node)   $arc
-	}
-    }
-
-    # Duplicate node names ?
-
-    if {[array size outArcs] < ([llength $ser] / 3)} {
-	return -code error \
-		"error in serialization: duplicate node names."
-    }
-
-    # Ok. The data is now ready for the caller.
-    return
-}
-
-##########################
-# Private functions follow
-#
-# Do a compatibility version of [lset] for pre-8.4 versions of Tcl.
-# This version does not do multi-arg [lset]!
-
-proc ::struct::graph::K { x y } { set x }
-
-if { [package vcompare [package provide Tcl] 8.4] < 0 } {
-    proc ::struct::graph::lset { var index arg } {
-	upvar 1 $var list
-	set list [::lreplace [K $list [set list {}]] $index $index $arg]
-    }
-}
-
-proc ::struct::graph::ldelete {var index {end {}}} {
-    upvar 1 $var list
-    if {$end == {}} {set end $index}
-    set list [lreplace [K $list [set list {}]] $index $end]
-    return
-}
-
-proc ::struct::graph::luniq {list} {
-    array set _ {}
-    set result [list]
-    foreach e $list {
-	if {[info exists _($e)]} {continue}
-	lappend result $e
-	set _($e) .
-    }
-    return $result
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Put 'graph::graph' into the general structure namespace
-    # for pickup by the main management.
-
-    namespace import -force graph::graph_tcl
-}
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/list.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/list.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1801 +1,0 @@
-#----------------------------------------------------------------------
-#
-# list.tcl --
-#
-#	Definitions for extended processing of Tcl lists.
-#
-# Copyright (c) 2003 by Kevin B. Kenny.  All rights reserved.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: list.tcl,v 1.22 2007/05/16 22:20:16 kennykb Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.0
-package require cmdline
-
-namespace eval ::struct { namespace eval list {} }
-
-namespace eval ::struct::list {
-    namespace export list
-
-    if {0} {
-	# Possibly in the future.
-	namespace export Lassign
-	namespace export LdbJoin
-	namespace export LdbJoinOuter
-	namespace export Lequal
-	namespace export Lfilter
-	namespace export Lfilterfor
-	namespace export Lfirstperm
-	namespace export Lflatten
-	namespace export Lfold
-	namespace export Lforeachperm
-	namespace export Liota
-	namespace export LlcsInvert
-	namespace export LlcsInvert2
-	namespace export LlcsInvertMerge
-	namespace export LlcsInvertMerge2
-	namespace export LlongestCommonSubsequence
-	namespace export LlongestCommonSubsequence2
-	namespace export Lmap
-	namespace export Lmapfor
-	namespace export Lnextperm
-	namespace export Lpermutations
-	namespace export Lrepeat
-	namespace export Lrepeatn
-	namespace export Lreverse
-	namespace export Lshift
-	namespace export Lswap
-    }
-}
-
-##########################
-# Public functions
-
-# ::struct::list::list --
-#
-#	Command that access all list commands.
-#
-# Arguments:
-#	cmd	Name of the subcommand to dispatch to.
-#	args	Arguments for the subcommand.
-#
-# Results:
-#	Whatever the result of the subcommand is.
-
-proc ::struct::list::list {cmd args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 1 } {
-	return -code error "wrong # args: should be \"$cmd ?arg arg ...?\""
-    }
-    set sub L$cmd
-    if { [llength [info commands ::struct::list::$sub]] == 0 } {
-	set optlist [info commands ::struct::list::L*]
-	set xlist {}
-	foreach p $optlist {
-	    lappend xlist [string range $p 1 end]
-	}
-	return -code error \
-		"bad option \"$cmd\": must be [linsert [join $xlist ", "] "end-1" "or"]"
-    }
-    return [uplevel 1 [linsert $args 0 ::struct::list::$sub]]
-}
-
-##########################
-# Private functions follow
-#
-# Do a compatibility version of [lset] for pre-8.4 versions of Tcl.
-# This version does not do multi-arg [lset]!
-
-proc ::struct::list::K { x y } { set x }
-
-if { [package vcompare [package provide Tcl] 8.4] < 0 } {
-    proc ::struct::list::lset { var index arg } {
-	upvar 1 $var list
-	set list [::lreplace [K $list [set list {}]] $index $index $arg]
-    }
-}
-
-##########################
-# Implementations of the functionality.
-#
-
-# ::struct::list::LlongestCommonSubsequence --
-#
-#       Computes the longest common subsequence of two lists.
-#
-# Parameters:
-#       sequence1, sequence2 -- Two lists to compare.
-#	maxOccurs -- If provided, causes the procedure to ignore
-#		     lines that appear more than $maxOccurs times
-#		     in the second sequence.  See below for a discussion.
-# Results:
-#       Returns a list of two lists of equal length.
-#       The first sublist is of indices into sequence1, and the
-#       second sublist is of indices into sequence2.  Each corresponding
-#       pair of indices corresponds to equal elements in the sequences;
-#       the sequence returned is the longest possible.
-#
-# Side effects:
-#       None.
-#
-# Notes:
-#
-#	While this procedure is quite rapid for many tasks of file
-# comparison, its performance degrades severely if the second list
-# contains many equal elements (as, for instance, when using this
-# procedure to compare two files, a quarter of whose lines are blank.
-# This drawback is intrinsic to the algorithm used (see the References
-# for details).  One approach to dealing with this problem that is
-# sometimes effective in practice is arbitrarily to exclude elements
-# that appear more than a certain number of times.  This number is
-# provided as the 'maxOccurs' parameter.  If frequent lines are
-# excluded in this manner, they will not appear in the common subsequence
-# that is computed; the result will be the longest common subsequence
-# of infrequent elements.
-#
-#	The procedure struct::list::LongestCommonSubsequence2
-# functions as a wrapper around this procedure; it computes the longest
-# common subsequence of infrequent elements, and then subdivides the
-# subsequences that lie between the matches to approximate the true
-# longest common subsequence.
-#
-# References:
-#	J. W. Hunt and M. D. McIlroy, "An algorithm for differential
-#	file comparison," Comp. Sci. Tech. Rep. #41, Bell Telephone
-#	Laboratories (1976). Available on the Web at the second
-#	author's personal site: http://www.cs.dartmouth.edu/~doug/
-
-proc ::struct::list::LlongestCommonSubsequence {
-    sequence1
-    sequence2
-    {maxOccurs 0x7fffffff}
-} {
-    # Construct a set of equivalence classes of lines in file 2
-
-    set index 0
-    foreach string $sequence2 {
-	lappend eqv($string) $index
-	incr index
-    }
-
-    # K holds descriptions of the common subsequences.
-    # Initially, there is one common subsequence of length 0,
-    # with a fence saying that it includes line -1 of both files.
-    # The maximum subsequence length is 0; position 0 of
-    # K holds a fence carrying the line following the end
-    # of both files.
-
-    lappend K [::list -1 -1 {}]
-    lappend K [::list [llength $sequence1] [llength $sequence2] {}]
-    set k 0
-
-    # Walk through the first file, letting i be the index of the line and
-    # string be the line itself.
-
-    set i 0
-    foreach string $sequence1 {
-	# Consider each possible corresponding index j in the second file.
-
-	if { [info exists eqv($string)]
-	     && [llength $eqv($string)] <= $maxOccurs } {
-
-	    # c is the candidate match most recently found, and r is the
-	    # length of the corresponding subsequence.
-
-	    set r 0
-	    set c [lindex $K 0]
-
-	    foreach j $eqv($string) {
-		# Perform a binary search to find a candidate common
-		# subsequence to which may be appended this match.
-
-		set max $k
-		set min $r
-		set s [expr { $k + 1 }]
-		while { $max >= $min } {
-		    set mid [expr { ( $max + $min ) / 2 }]
-		    set bmid [lindex [lindex $K $mid] 1]
-		    if { $j == $bmid } {
-			break
-		    } elseif { $j < $bmid } {
-			set max [expr {$mid - 1}]
-		    } else {
-			set s $mid
-			set min [expr { $mid + 1 }]
-		    }
-		}
-
-		# Go to the next match point if there is no suitable
-		# candidate.
-
-		if { $j == [lindex [lindex $K $mid] 1] || $s > $k} {
-		    continue
-		}
-
-		# s is the sequence length of the longest sequence
-		# to which this match point may be appended. Make
-		# a new candidate match and store the old one in K
-		# Set r to the length of the new candidate match.
-
-		set newc [::list $i $j [lindex $K $s]]
-		if { $r >= 0 } {
-		    lset K $r $c
-		}
-		set c $newc
-		set r [expr { $s + 1 }]
-
-		# If we've extended the length of the longest match,
-		# we're done; move the fence.
-
-		if { $s >= $k } {
-		    lappend K [lindex $K end]
-		    incr k
-		    break
-		}
-	    }
-
-	    # Put the last candidate into the array
-
-	    lset K $r $c
-	}
-
-	incr i
-    }
-
-    # Package the common subsequence in a convenient form
-
-    set seta {}
-    set setb {}
-    set q [lindex $K $k]
-
-    for { set i 0 } { $i < $k } {incr i } {
-	lappend seta {}
-	lappend setb {}
-    }
-    while { [lindex $q 0] >= 0 } {
-	incr k -1
-	lset seta $k [lindex $q 0]
-	lset setb $k [lindex $q 1]
-	set q [lindex $q 2]
-    }
-
-    return [::list $seta $setb]
-}
-
-# ::struct::list::LlongestCommonSubsequence2 --
-#
-#	Derives an approximation to the longest common subsequence
-#	of two lists.
-#
-# Parameters:
-#	sequence1, sequence2 - Lists to be compared
-#	maxOccurs - Parameter for imprecise matching - see below.
-#
-# Results:
-#       Returns a list of two lists of equal length.
-#       The first sublist is of indices into sequence1, and the
-#       second sublist is of indices into sequence2.  Each corresponding
-#       pair of indices corresponds to equal elements in the sequences;
-#       the sequence returned is an approximation to the longest possible.
-#
-# Side effects:
-#       None.
-#
-# Notes:
-#	This procedure acts as a wrapper around the companion procedure
-#	struct::list::LongestCommonSubsequence and accepts the same
-#	parameters.  It first computes the longest common subsequence of
-#	elements that occur no more than $maxOccurs times in the
-#	second list.  Using that subsequence to align the two lists,
-#	it then tries to augment the subsequence by computing the true
-#	longest common subsequences of the sublists between matched pairs.
-
-proc ::struct::list::LlongestCommonSubsequence2 {
-    sequence1
-    sequence2
-    {maxOccurs 0x7fffffff}
-} {
-    # Derive the longest common subsequence of elements that occur at
-    # most $maxOccurs times
-
-    foreach { l1 l2 } \
-	[LlongestCommonSubsequence $sequence1 $sequence2 $maxOccurs] {
-	    break
-	}
-
-    # Walk through the match points in the sequence just derived.
-
-    set result1 {}
-    set result2 {}
-    set n1 0
-    set n2 0
-    foreach i1 $l1 i2 $l2 {
-	if { $i1 != $n1 && $i2 != $n2 } {
-	    # The match points indicate that there are unmatched
-	    # elements lying between them in both input sequences.
-	    # Extract the unmatched elements and perform precise
-	    # longest-common-subsequence analysis on them.
-
-	    set subl1 [lrange $sequence1 $n1 [expr { $i1 - 1 }]]
-	    set subl2 [lrange $sequence2 $n2 [expr { $i2 - 1 }]]
-	    foreach { m1 m2 } [LlongestCommonSubsequence $subl1 $subl2] break
-	    foreach j1 $m1 j2 $m2 {
-		lappend result1 [expr { $j1 + $n1 }]
-		lappend result2 [expr { $j2 + $n2 }]
-	    }
-	}
-
-	# Add the current match point to the result
-
-	lappend result1 $i1
-	lappend result2 $i2
-	set n1 [expr { $i1 + 1 }]
-	set n2 [expr { $i2 + 1 }]
-    }
-
-    # If there are unmatched elements after the last match in both files,
-    # perform precise longest-common-subsequence matching on them and
-    # add the result to our return.
-
-    if { $n1 < [llength $sequence1] && $n2 < [llength $sequence2] } {
-	set subl1 [lrange $sequence1 $n1 end]
-	set subl2 [lrange $sequence2 $n2 end]
-	foreach { m1 m2 } [LlongestCommonSubsequence $subl1 $subl2] break
-	foreach j1 $m1 j2 $m2 {
-	    lappend result1 [expr { $j1 + $n1 }]
-	    lappend result2 [expr { $j2 + $n2 }]
-	}
-    }
-
-    return [::list $result1 $result2]
-}
-
-# ::struct::list::LlcsInvert --
-#
-#	Takes the data describing a longest common subsequence of two
-#	lists and inverts the information in the sense that the result
-#	of this command will describe the differences between the two
-#	sequences instead of the identical parts.
-#
-# Parameters:
-#	lcsData		longest common subsequence of two lists as
-#			returned by longestCommonSubsequence(2).
-# Results:
-#	Returns a single list whose elements describe the differences
-#	between the original two sequences. Each element describes
-#	one difference through three pieces, the type of the change,
-#	a pair of indices in the first sequence and a pair of indices
-#	into the second sequence, in this order.
-#
-# Side effects:
-#       None.
-
-proc ::struct::list::LlcsInvert {lcsData len1 len2} {
-    return [LlcsInvert2 [::lindex $lcsData 0] [::lindex $lcsData 1] $len1 $len2]
-}
-
-proc ::struct::list::LlcsInvert2 {idx1 idx2 len1 len2} {
-    set result {}
-    set last1 -1
-    set last2 -1
-
-    foreach a $idx1 b $idx2 {
-	# Four possible cases.
-	# a) last1 ... a and last2 ... b are not empty.
-	#    This is a 'change'.
-	# b) last1 ... a is empty, last2 ... b is not.
-	#    This is an 'addition'.
-	# c) last1 ... a is not empty, last2 ... b is empty.
-	#    This is a deletion.
-	# d) If both ranges are empty we can ignore the
-	#    two current indices.
-
-	set empty1 [expr {($a - $last1) <= 1}]
-	set empty2 [expr {($b - $last2) <= 1}]
-
-	if {$empty1 && $empty2} {
-	    # Case (d), ignore the indices
-	} elseif {$empty1} {
-	    # Case (b), 'addition'.
-	    incr last2 ; incr b -1
-	    lappend result [::list added [::list $last1 $a] [::list $last2 $b]]
-	    incr b
-	} elseif {$empty2} {
-	    # Case (c), 'deletion'
-	    incr last1 ; incr a -1
-	    lappend result [::list deleted [::list $last1 $a] [::list $last2 $b]]
-	    incr a
-	} else {
-	    # Case (q), 'change'.
-	    incr last1 ; incr a -1
-	    incr last2 ; incr b -1
-	    lappend result [::list changed [::list $last1 $a] [::list $last2 $b]]
-	    incr a
-	    incr b
-	}
-
-	set last1 $a
-	set last2 $b
-    }
-
-    # Handle the last chunk, using the information about the length of
-    # the original sequences.
-
-    set empty1 [expr {($len1 - $last1) <= 1}]
-    set empty2 [expr {($len2 - $last2) <= 1}]
-
-    if {$empty1 && $empty2} {
-	# Case (d), ignore the indices
-    } elseif {$empty1} {
-	# Case (b), 'addition'.
-	incr last2 ; incr len2 -1
-	lappend result [::list added [::list $last1 $len1] [::list $last2 $len2]]
-    } elseif {$empty2} {
-	# Case (c), 'deletion'
-	incr last1 ; incr len1 -1
-	lappend result [::list deleted [::list $last1 $len1] [::list $last2 $len2]]
-    } else {
-	# Case (q), 'change'.
-	incr last1 ; incr len1 -1
-	incr last2 ; incr len2 -1
-	lappend result [::list changed [::list $last1 $len1] [::list $last2 $len2]]
-    }
-
-    return $result
-}
-
-proc ::struct::list::LlcsInvertMerge {lcsData len1 len2} {
-    return [LlcsInvertMerge2 [::lindex $lcsData 0] [::lindex $lcsData 1] $len1 $len2]
-}
-
-proc ::struct::list::LlcsInvertMerge2 {idx1 idx2 len1 len2} {
-    set result {}
-    set last1 -1
-    set last2 -1
-
-    foreach a $idx1 b $idx2 {
-	# Four possible cases.
-	# a) last1 ... a and last2 ... b are not empty.
-	#    This is a 'change'.
-	# b) last1 ... a is empty, last2 ... b is not.
-	#    This is an 'addition'.
-	# c) last1 ... a is not empty, last2 ... b is empty.
-	#    This is a deletion.
-	# d) If both ranges are empty we can ignore the
-	#    two current indices. For merging we simply
-	#    take the information from the input.
-
-	set empty1 [expr {($a - $last1) <= 1}]
-	set empty2 [expr {($b - $last2) <= 1}]
-
-	if {$empty1 && $empty2} {
-	    # Case (d), add 'unchanged' chunk.
-	    set type --
-	    foreach {type left right} [lindex $result end] break
-	    if {[string match unchanged $type]} {
-		# There is an existing result to extend
-		lset left end $a
-		lset right end $b
-		lset result end [::list unchanged $left $right]
-	    } else {
-		# There is an unchanged result at the start of the list;
-		# it may be extended.
-		lappend result [::list unchanged [::list $a $a] [::list $b $b]]
-	    }
-	} else {
-	    if {$empty1} {
-		# Case (b), 'addition'.
-		incr last2 ; incr b -1
-		lappend result [::list added [::list $last1 $a] [::list $last2 $b]]
-		incr b
-	    } elseif {$empty2} {
-		# Case (c), 'deletion'
-		incr last1 ; incr a -1
-		lappend result [::list deleted [::list $last1 $a] [::list $last2 $b]]
-		incr a
-	    } else {
-		# Case (a), 'change'.
-		incr last1 ; incr a -1
-		incr last2 ; incr b -1
-		lappend result [::list changed [::list $last1 $a] [::list $last2 $b]]
-		incr a
-		incr b
-	    }
-	    # Finally, the two matching lines are a new unchanged region
-	    lappend result [::list unchanged [::list $a $a] [::list $b $b]]
-	}
-	set last1 $a
-	set last2 $b
-    }
-
-    # Handle the last chunk, using the information about the length of
-    # the original sequences.
-
-    set empty1 [expr {($len1 - $last1) <= 1}]
-    set empty2 [expr {($len2 - $last2) <= 1}]
-
-    if {$empty1 && $empty2} {
-	# Case (d), ignore the indices
-    } elseif {$empty1} {
-	# Case (b), 'addition'.
-	incr last2 ; incr len2 -1
-	lappend result [::list added [::list $last1 $len1] [::list $last2 $len2]]
-    } elseif {$empty2} {
-	# Case (c), 'deletion'
-	incr last1 ; incr len1 -1
-	lappend result [::list deleted [::list $last1 $len1] [::list $last2 $len2]]
-    } else {
-	# Case (q), 'change'.
-	incr last1 ; incr len1 -1
-	incr last2 ; incr len2 -1
-	lappend result [::list changed [::list $last1 $len1] [::list $last2 $len2]]
-    }
-
-    return $result
-}
-
-# ::struct::list::Lreverse --
-#
-#	Reverses the contents of the list and returns the reversed
-#	list as the result of the command.
-#
-# Parameters:
-#	sequence	List to be reversed.
-#
-# Results:
-#	The sequence in reverse.
-#
-# Side effects:
-#       None.
-
-proc ::struct::list::Lreverse {sequence} {
-    set l [::llength $sequence]
-
-    # Shortcut for lists where reversing yields the list itself
-    if {$l < 2} {return $sequence}
-
-    # Perform true reversal
-    set res [::list]
-    while {$l} {
-	::lappend res [::lindex $sequence [incr l -1]]
-    }
-    return $res
-}
-
-
-# ::struct::list::Lassign --
-#
-#	Assign list elements to variables.
-#
-# Parameters:
-#	sequence	List to assign
-#	args		Names of the variables to assign to.
-#
-# Results:
-#	The unassigned part of the sequence. Can be empty.
-#
-# Side effects:
-#       None.
-
-# Do a compatibility version of [assign] for pre-8.5 versions of Tcl.
-
-if { [package vcompare [package provide Tcl] 8.5] < 0 } {
-
-    proc ::struct::list::Lassign {sequence v args} {
-	set args [linsert $args 0 $v]
-	set a [::llength $args]
-
-	# Nothing to assign.
-	#if {$a == 0} {return $sequence}
-
-	# Perform assignments
-	set i 0
-	foreach v $args {
-	    upvar 1 $v var
-	    set      var [::lindex $sequence $i]
-	    incr i
-	}
-
-	# Return remainder, if there is any.
-	return [::lrange $sequence $a end]
-}
-
-} else {
-    # For 8.5 simply redirect the method to the core command.
-
-    interp alias {} ::struct::list::Lassign {} lassign
-}
-
-
-# ::struct::list::Lshift --
-#
-#	Shift a list in a variable one element down, and return first element
-#
-# Parameters:
-#	listvar		Name of variable containing the list to shift.
-#
-# Results:
-#	The first element of the list.
-#
-# Side effects:
-#       After the call the list variable will contain
-#	the second to last elements of the list.
-
-proc ::struct::list::Lshift {listvar} {
-    upvar 1 $listvar list
-    set list [Lassign [K $list [set list {}]] v]
-    return $v
-}
-
-
-# ::struct::list::Lflatten --
-#
-#	Remove nesting from the input
-#
-# Parameters:
-#	sequence	List to flatten
-#
-# Results:
-#	The input list with one or all levels of nesting removed.
-#
-# Side effects:
-#       None.
-
-proc ::struct::list::Lflatten {args} {
-    if {[::llength $args] < 1} {
-	return -code error \
-		"wrong#args: should be \"::struct::list::Lflatten ?-full? ?--? sequence\""
-    }
-
-    set full 0
-    while {[string match -* [set opt [::lindex $args 0]]]} {
-	switch -glob -- $opt {
-	    -full   {set full 1}
-	    --      {break}
-	    default {
-		return -code error "Unknown option \"$opt\", should be either -full, or --"
-	    }
-	}
-	set args [::lrange $args 1 end]
-    }
-
-    if {[::llength $args] != 1} {
-	return -code error \
-		"wrong#args: should be \"::struct::list::Lflatten ?-full? ?--? sequence\""
-    }
-
-    set sequence [::lindex $args 0]
-    set cont 1
-    while {$cont} {
-	set cont 0
-	set result [::list]
-	foreach item $sequence {
-	    # catch/llength detects if the item is following the list
-	    # syntax.
-
-	    if {[catch {llength $item} len]} {
-		# Element is not a list in itself, no flatten, add it
-		# as is.
-		lappend result $item
-	    } else {
-		# Element is parseable as list, add all sub-elements
-		# to the result.
-		foreach e $item {
-		    lappend result $e
-		}
-	    }
-	}
-	if {$full && [string compare $sequence $result]} {set cont 1}
-	set sequence $result
-    }
-    return $result
-}
-
-
-# ::struct::list::Lmap --
-#
-#	Apply command to each element of a list and return concatenated results.
-#
-# Parameters:
-#	sequence	List to operate on
-#	cmdprefix	Operation to perform on the elements.
-#
-# Results:
-#	List containing the result of applying cmdprefix to the elements of the
-#	sequence.
-#
-# Side effects:
-#       None of its own, but the command prefix can perform arbitry actions.
-
-proc ::struct::list::Lmap {sequence cmdprefix} {
-    # Shortcut when nothing is to be done.
-    if {[::llength $sequence] == 0} {return $sequence}
-
-    set res [::list]
-    foreach item $sequence {
-	lappend res [uplevel 1 [linsert $cmdprefix end $item]]
-    }
-    return $res
-}
-
-# ::struct::list::Lmapfor --
-#
-#	Apply a script to each element of a list and return concatenated results.
-#
-# Parameters:
-#	sequence	List to operate on
-#	script		The script to run on the elements.
-#
-# Results:
-#	List containing the result of running script on the elements of the
-#	sequence.
-#
-# Side effects:
-#       None of its own, but the script can perform arbitry actions.
-
-proc ::struct::list::Lmapfor {var sequence script} {
-    # Shortcut when nothing is to be done.
-    if {[::llength $sequence] == 0} {return $sequence}
-    upvar 1 $var item
-
-    set res [::list]
-    foreach item $sequence {
-	lappend res [uplevel 1 $script]
-    }
-    return $res
-}
-
-# ::struct::list::Lfilter --
-#
-#	Apply command to each element of a list and return elements passing the test.
-#
-# Parameters:
-#	sequence	List to operate on
-#	cmdprefix	Test to perform on the elements.
-#
-# Results:
-#	List containing the elements of the input passing the test command.
-#
-# Side effects:
-#       None of its own, but the command prefix can perform arbitrary actions.
-
-proc ::struct::list::Lfilter {sequence cmdprefix} {
-    # Shortcut when nothing is to be done.
-    if {[::llength $sequence] == 0} {return $sequence}
-    return [Lfold $sequence {} [::list ::struct::list::FTest $cmdprefix]]
-}
-
-proc ::struct::list::FTest {cmdprefix result item} {
-    set pass [uplevel 1 [::linsert $cmdprefix end $item]]
-    if {$pass} {::lappend result $item}
-    return $result
-}
-
-# ::struct::list::Lfilterfor --
-#
-#	Apply expr condition to each element of a list and return elements passing the test.
-#
-# Parameters:
-#	sequence	List to operate on
-#	expr		Test to perform on the elements.
-#
-# Results:
-#	List containing the elements of the input passing the test expression.
-#
-# Side effects:
-#       None of its own, but the command prefix can perform arbitrary actions.
-
-proc ::struct::list::Lfilterfor {var sequence expr} {
-    # Shortcut when nothing is to be done.
-    if {[::llength $sequence] == 0} {return $sequence}
-
-    upvar 1 $var item
-    set result {}
-    foreach item $sequence {
-	if {[uplevel 1 [::list ::expr $expr]]} {
-	    lappend result $item
-	}
-    }
-    return $result
-}
-
-# ::struct::list::Lsplit --
-#
-#	Apply command to each element of a list and return elements passing
-#	and failing the test. Basic idea by Salvatore Sanfilippo
-#	(http://wiki.tcl.tk/lsplit). The implementation here is mine (AK),
-#	and the interface is slightly different (Command prefix with the
-#	list element given to it as argument vs. variable + script).
-#
-# Parameters:
-#	sequence	List to operate on
-#	cmdprefix	Test to perform on the elements.
-#	args = empty | (varPass varFail)
-#
-# Results:
-#	If the variables are specified then a list containing the
-#	numbers of passing and failing elements, in this
-#	order. Otherwise a list having two elements, the lists of
-#	passing and failing elements, in this order.
-#
-# Side effects:
-#       None of its own, but the command prefix can perform arbitrary actions.
-
-proc ::struct::list::Lsplit {sequence cmdprefix args} {
-    set largs [::llength $args]
-    if {$largs == 0} {
-	# Shortcut when nothing is to be done.
-	if {[::llength $sequence] == 0} {return {{} {}}}
-	return [Lfold $sequence {} [::list ::struct::list::PFTest $cmdprefix]]
-    } elseif {$largs == 2} {
-	# Shortcut when nothing is to be done.
-	foreach {pv fv} $args break
-	upvar 1 $pv pass $fv fail
-	if {[::llength $sequence] == 0} {
-	    set pass {}
-	    set fail {}
-	    return {0 0}
-	}
-	foreach {pass fail} [Lfold $sequence {} [::list ::struct::list::PFTest $cmdprefix]] break
-	return [::list [llength $pass] [llength $fail]]
-    } else {
-	return -code error \
-		"wrong#args: should be \"::struct::list::Lsplit sequence cmdprefix ?passVar failVar?"
-    }
-}
-
-proc ::struct::list::PFTest {cmdprefix result item} {
-    set passing [uplevel 1 [::linsert $cmdprefix end $item]]
-    set pass {} ; set fail {}
-    foreach {pass fail} $result break
-    if {$passing} {
-	::lappend pass $item
-    } else {
-	::lappend fail $item
-    }
-    return [::list $pass $fail]
-}
-
-# ::struct::list::Lfold --
-#
-#	Fold list into one value.
-#
-# Parameters:
-#	sequence	List to operate on
-#	cmdprefix	Operation to perform on the elements.
-#
-# Results:
-#	Result of applying cmdprefix to the elements of the
-#	sequence.
-#
-# Side effects:
-#       None of its own, but the command prefix can perform arbitry actions.
-
-proc ::struct::list::Lfold {sequence initialvalue cmdprefix} {
-    # Shortcut when nothing is to be done.
-    if {[::llength $sequence] == 0} {return $initialvalue}
-
-    set res $initialvalue
-    foreach item $sequence {
-	set res [uplevel 1 [linsert $cmdprefix end $res $item]]
-    }
-    return $res
-}
-
-# ::struct::list::Liota --
-#
-#	Return a list containing the integer numbers 0 ... n-1
-#
-# Parameters:
-#	n	First number not in the generated list.
-#
-# Results:
-#	A list containing integer numbers.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Liota {n} {
-    set retval [::list]
-    for {set i 0} {$i < $n} {incr i} {
-	::lappend retval $i
-    }
-    return $retval
-}
-
-# ::struct::list::Lequal --
-#
-#	Compares two lists for equality
-#	(Same length, Same elements in same order).
-#
-# Parameters:
-#	a	First list to compare.
-#	b	Second list to compare.
-#
-# Results:
-#	A boolean. True if the lists are equal.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lequal {a b} {
-    # Author of this command is "Richard Suchenwirth"
-
-    if {[::llength $a] != [::llength $b]} {return 0}
-    if {[::lindex $a 0] == $a} {return [string equal $a $b]}
-    foreach i $a j $b {if {![Lequal $i $j]} {return 0}}
-    return 1
-}
-
-# ::struct::list::Lrepeatn --
-#
-#	Create a list repeating the same value over again.
-#
-# Parameters:
-#	value	value to use in the created list.
-#	args	Dimension(s) of the (nested) list to create.
-#
-# Results:
-#	A list
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lrepeatn {value args} {
-    if {[::llength $args] == 1} {set args [::lindex $args 0]}
-    set buf {}
-    foreach number $args {
-	incr number 0 ;# force integer (1)
-	set buf {}
-	for {set i 0} {$i<$number} {incr i} {
-	    ::lappend buf $value
-	}
-	set value $buf
-    }
-    return $buf
-    # (1): See 'Stress testing' (wiki) for why this makes the code safer.
-}
-
-# ::struct::list::Lrepeat --
-#
-#	Create a list repeating the same value over again.
-#	[Identical to the Tcl 8.5 lrepeat command]
-#
-# Parameters:
-#	n	Number of replications.
-#	args	values to use in the created list.
-#
-# Results:
-#	A list
-#
-# Side effects:
-#       None
-
-# Do a compatibility version of [repeat] for pre-8.5 versions of Tcl.
-
-if { [package vcompare [package provide Tcl] 8.5] < 0 } {
-
-    proc ::struct::list::Lrepeat {positiveCount value args} {
-	if {![string is integer -strict $positiveCount]} {
-	    return -code error "expected integer but got \"$positiveCount\""
-	} elseif {$positiveCount < 1} {
-	    return -code error {must have a count of at least 1}
-	}
-
-	set args   [linsert $args 0 $value]
-
-	if {$positiveCount == 1} {
-	    # Tcl itself has already listified the incoming parameters
-	    # via 'args'.
-	    return $args
-	}
-
-	set result [::list]
-	while {$positiveCount > 0} {
-	    if {($positiveCount % 2) == 0} {
-		set args [concat $args $args]
-		set positiveCount [expr {$positiveCount/2}]
-	    } else {
-		set result [concat $result $args]
-		incr positiveCount -1
-	    }
-	}
-	return $result
-    }
-
-} else {
-    # For 8.5 simply redirect the method to the core command.
-
-    interp alias {} ::struct::list::Lrepeat {} lrepeat
-}
-
-# ::struct::list::LdbJoin(Keyed) --
-#
-#	Relational table joins.
-#
-# Parameters:
-#	args	key specs and tables to join
-#
-# Results:
-#	A table/matrix as nested list. See
-#	struct/matrix set/get rect for structure.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::LdbJoin {args} {
-    # --------------------------------
-    # Process options ...
-
-    set mode   inner
-    set keyvar {}
-
-    while {[llength $args]} {
-        set err [::cmdline::getopt args {inner left right full keys.arg} opt arg]
-	if {$err == 1} {
-	    if {[string equal $opt keys]} {
-		set keyvar $arg
-	    } else {
-		set mode $opt
-	    }
-	} elseif {$err < 0} {
-	    return -code error "wrong#args: dbJoin ?-inner|-left|-right|-full? ?-keys varname? \{key table\}..."
-	} else {
-	    # Non-option argument found, stop processing.
-	    break
-	}
-    }
-
-    set inner       [string equal $mode inner]
-    set innerorleft [expr {$inner || [string equal $mode left]}]
-
-    # --------------------------------
-    # Process tables ...
-
-    if {([llength $args] % 2) != 0} {
-	return -code error "wrong#args: dbJoin ?-inner|-left|-right|-full? \{key table\}..."
-    }
-
-    # One table only, join is identity
-    if {[llength $args] == 2} {return [lindex $args 1]}
-
-    # Use first table for setup.
-
-    foreach {key table} $args break
-
-    # Check for possible early abort
-    if {$innerorleft && ([llength $table] == 0)} {return {}}
-
-    set width 0
-    array set state {}
-
-    set keylist [InitMap state width $key $table]
-
-    # Extend state with the remaining tables.
-
-    foreach {key table} [lrange $args 2 end] {
-	# Check for possible early abort
-	if {$inner && ([llength $table] == 0)} {return {}}
-
-	switch -exact -- $mode {
-	    inner {set keylist [MapExtendInner      state       $key $table]}
-	    left  {set keylist [MapExtendLeftOuter  state width $key $table]}
-	    right {set keylist [MapExtendRightOuter state width $key $table]}
-	    full  {set keylist [MapExtendFullOuter  state width $key $table]}
-	}
-
-	# Check for possible early abort
-	if {$inner && ([llength $keylist] == 0)} {return {}}
-    }
-
-    if {[string length $keyvar]} {
-	upvar 1 $keyvar keys
-	set             keys $keylist
-    }
-
-    return [MapToTable state $keylist]
-}
-
-proc ::struct::list::LdbJoinKeyed {args} {
-    # --------------------------------
-    # Process options ...
-
-    set mode   inner
-    set keyvar {}
-
-    while {[llength $args]} {
-        set err [::cmdline::getopt args {inner left right full keys.arg} opt arg]
-	if {$err == 1} {
-	    if {[string equal $opt keys]} {
-		set keyvar $arg
-	    } else {
-		set mode $opt
-	    }
-	} elseif {$err < 0} {
-	    return -code error "wrong#args: dbJoin ?-inner|-left|-right|-full? table..."
-	} else {
-	    # Non-option argument found, stop processing.
-	    break
-	}
-    }
-
-    set inner       [string equal $mode inner]
-    set innerorleft [expr {$inner || [string equal $mode left]}]
-
-    # --------------------------------
-    # Process tables ...
-
-    # One table only, join is identity
-    if {[llength $args] == 1} {
-	return [Dekey [lindex $args 0]]
-    }
-
-    # Use first table for setup.
-
-    set table [lindex $args 0]
-
-    # Check for possible early abort
-    if {$innerorleft && ([llength $table] == 0)} {return {}}
-
-    set width 0
-    array set state {}
-
-    set keylist [InitKeyedMap state width $table]
-
-    # Extend state with the remaining tables.
-
-    foreach table [lrange $args 1 end] {
-	# Check for possible early abort
-	if {$inner && ([llength $table] == 0)} {return {}}
-
-	switch -exact -- $mode {
-	    inner {set keylist [MapKeyedExtendInner      state       $table]}
-	    left  {set keylist [MapKeyedExtendLeftOuter  state width $table]}
-	    right {set keylist [MapKeyedExtendRightOuter state width $table]}
-	    full  {set keylist [MapKeyedExtendFullOuter  state width $table]}
-	}
-
-	# Check for possible early abort
-	if {$inner && ([llength $keylist] == 0)} {return {}}
-    }
-
-    if {[string length $keyvar]} {
-	upvar 1 $keyvar keys
-	set             keys $keylist
-    }
-
-    return [MapToTable state $keylist]
-}
-
-## Helpers for the relational joins.
-## Map is an array mapping from keys to a list
-## of rows with that key
-
-proc ::struct::list::Cartesian {leftmap rightmap key} {
-    upvar $leftmap left $rightmap right
-    set joined [::list]
-    foreach lrow $left($key) {
-	foreach row $right($key) {
-	    lappend joined [concat $lrow $row]
-	}
-    }
-    set left($key) $joined
-    return
-}
-
-proc ::struct::list::SingleRightCartesian {mapvar key rightrow} {
-    upvar $mapvar map
-    set joined [::list]
-    foreach lrow $map($key) {
-	lappend joined [concat $lrow $rightrow]
-    }
-    set map($key) $joined
-    return
-}
-
-proc ::struct::list::MapToTable {mapvar keys} {
-    # Note: keys must not appear multiple times in the list.
-
-    upvar $mapvar map
-    set table [::list]
-    foreach k $keys {
-	foreach row $map($k) {lappend table $row}
-    }
-    return $table
-}
-
-## More helpers, core join operations: Init, Extend.
-
-proc ::struct::list::InitMap {mapvar wvar key table} {
-    upvar $mapvar map $wvar width
-    set width [llength [lindex $table 0]]
-    foreach row $table {
-	set keyval [lindex $row $key]
-	if {[info exists map($keyval)]} {
-	    lappend map($keyval) $row
-	} else {
-	    set map($keyval) [::list $row]
-	}
-    }
-    return [array names map]
-}
-
-proc ::struct::list::MapExtendInner {mapvar key table} {
-    upvar $mapvar map
-    array set used {}
-
-    # Phase I - Find all keys in the second table matching keys in the
-    # first. Remember all their rows.
-    foreach row $table {
-	set keyval [lindex $row $key]
-	if {[info exists map($keyval)]} {
-	    if {[info exists used($keyval)]} {
-		lappend used($keyval) $row
-	    } else {
-		set used($keyval) [::list $row]
-	    }
-	} ; # else: Nothing to do for missing keys.
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map, and eliminate all entries which have no keys in
-    # the second table.
-    foreach k [array names map] {
-	if {[info exists  used($k)]} {
-	    Cartesian map used $k
-	} else {
-	    unset map($k)
-	}
-    }
-    return [array names map]
-}
-
-proc ::struct::list::MapExtendRightOuter {mapvar wvar key table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    # Phase I - We keep all keys of the right table, even if they are
-    # missing in the left one <=> Definition of right outer join.
-
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	set keyval [lindex $row $key]
-	if {[info exists used($keyval)]} {
-	    lappend used($keyval) $row
-	} else {
-	    set used($keyval) [::list $row]
-	}
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map, and eliminate all entries which have no keys in
-    # the second table. If there is nothing in the left table we
-    # create an appropriate empty row for the cartesian => definition
-    # of right outer join.
-
-    # We go through used, because map can be empty for outer
-
-    foreach k [array names map] {
-	if {![info exists used($k)]} {
-	    unset map($k)
-	}
-    }
-    foreach k [array names used] {
-	if {![info exists map($k)]} {
-	    set map($k) [::list [Lrepeatn {} $width]]
-	}
-	Cartesian map used $k
-    }
-
-    incr width $w
-    return [array names map]
-}
-
-proc ::struct::list::MapExtendLeftOuter {mapvar wvar key table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    ## Keys: All in inner join + additional left keys 
-    ##       == All left keys = array names map after
-    ##          all is said and done with it.
-
-    # Phase I - Find all keys in the second table matching keys in the
-    # first. Remember all their rows.
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	set keyval [lindex $row $key]
-	if {[info exists map($keyval)]} {
-	    if {[info exists used($keyval)]} {
-		lappend used($keyval) $row
-	    } else {
-		set used($keyval) [::list $row]
-	    }
-	} ; # else: Nothing to do for missing keys.
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map. We keep entries which have no keys in the second
-    # table, we actually extend them <=> Left outer join.
-
-    foreach k [array names map] {
-	if {[info exists  used($k)]} {
-	    Cartesian map used $k
-	} else {
-	    SingleRightCartesian map $k [Lrepeatn {} $w]
-	}
-    }
-    incr width $w
-    return [array names map]
-}
-
-proc ::struct::list::MapExtendFullOuter {mapvar wvar key table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    # Phase I - We keep all keys of the right table, even if they are
-    # missing in the left one <=> Definition of right outer join.
-
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	set keyval [lindex $row $key]
-	if {[info exists used($keyval)]} {
-	    lappend used($keyval) $row
-	} else {
-	    lappend keylist $keyval
-	    set used($keyval) [::list $row]
-	}
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map. We keep entries which have no keys in the second
-    # table, we actually extend them <=> Left outer join.
-    # If there is nothing in the left table we create an appropriate
-    # empty row for the cartesian => definition of right outer join.
-
-    # We go through used, because map can be empty for outer
-
-    foreach k [array names map] {
-	if {![info exists used($k)]} {
-	    SingleRightCartesian map $k [Lrepeatn {} $w]
-	}
-    }
-    foreach k [array names used] {
-	if {![info exists map($k)]} {
-	    set map($k) [::list [Lrepeatn {} $width]]
-	}
-	Cartesian map used $k
-    }
-
-    incr width $w
-    return [array names map]
-}
-
-## Keyed helpers
-
-proc ::struct::list::InitKeyedMap {mapvar wvar table} {
-    upvar $mapvar map $wvar width
-    set width [llength [lindex [lindex $table 0] 1]]
-    foreach row $table {
-	foreach {keyval rowdata} $row break
-	if {[info exists map($keyval)]} {
-	    lappend map($keyval) $rowdata
-	} else {
-	    set map($keyval) [::list $rowdata]
-	}
-    }
-    return [array names map]
-}
-
-proc ::struct::list::MapKeyedExtendInner {mapvar table} {
-    upvar $mapvar map
-    array set used {}
-
-    # Phase I - Find all keys in the second table matching keys in the
-    # first. Remember all their rows.
-    foreach row $table {
-	foreach {keyval rowdata} $row break
-	if {[info exists map($keyval)]} {
-	    if {[info exists used($keyval)]} {
-		lappend used($keyval) $rowdata
-	    } else {
-		set used($keyval) [::list $rowdata]
-	    }
-	} ; # else: Nothing to do for missing keys.
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map, and eliminate all entries which have no keys in
-    # the second table.
-    foreach k [array names map] {
-	if {[info exists  used($k)]} {
-	    Cartesian map used $k
-	} else {
-	    unset map($k)
-	}
-    }
-
-    return [array names map]
-}
-
-proc ::struct::list::MapKeyedExtendRightOuter {mapvar wvar table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    # Phase I - We keep all keys of the right table, even if they are
-    # missing in the left one <=> Definition of right outer join.
-
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	foreach {keyval rowdata} $row break
-	if {[info exists used($keyval)]} {
-	    lappend used($keyval) $rowdata
-	} else {
-	    set used($keyval) [::list $rowdata]
-	}
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map, and eliminate all entries which have no keys in
-    # the second table. If there is nothing in the left table we
-    # create an appropriate empty row for the cartesian => definition
-    # of right outer join.
-
-    # We go through used, because map can be empty for outer
-
-    foreach k [array names map] {
-	if {![info exists used($k)]} {
-	    unset map($k)
-	}
-    }
-    foreach k [array names used] {
-	if {![info exists map($k)]} {
-	    set map($k) [::list [Lrepeatn {} $width]]
-	}
-	Cartesian map used $k
-    }
-
-    incr width $w
-    return [array names map]
-}
-
-proc ::struct::list::MapKeyedExtendLeftOuter {mapvar wvar table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    ## Keys: All in inner join + additional left keys 
-    ##       == All left keys = array names map after
-    ##          all is said and done with it.
-
-    # Phase I - Find all keys in the second table matching keys in the
-    # first. Remember all their rows.
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	foreach {keyval rowdata} $row break
-	if {[info exists map($keyval)]} {
-	    if {[info exists used($keyval)]} {
-		lappend used($keyval) $rowdata
-	    } else {
-		set used($keyval) [::list $rowdata]
-	    }
-	} ; # else: Nothing to do for missing keys.
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map. We keep entries which have no keys in the second
-    # table, we actually extend them <=> Left outer join.
-
-    foreach k [array names map] {
-	if {[info exists  used($k)]} {
-	    Cartesian map used $k
-	} else {
-	    SingleRightCartesian map $k [Lrepeatn {} $w]
-	}
-    }
-    incr width $w
-    return [array names map]
-}
-
-proc ::struct::list::MapKeyedExtendFullOuter {mapvar wvar table} {
-    upvar $mapvar map $wvar width
-    array set used {}
-
-    # Phase I - We keep all keys of the right table, even if they are
-    # missing in the left one <=> Definition of right outer join.
-
-    set w [llength [lindex $table 0]]
-    foreach row $table {
-	foreach {keyval rowdata} $row break
-	if {[info exists used($keyval)]} {
-	    lappend used($keyval) $rowdata
-	} else {
-	    lappend keylist $keyval
-	    set used($keyval) [::list $rowdata]
-	}
-    }
-
-    # Phase II - Merge the collected rows of the second (right) table
-    # into the map. We keep entries which have no keys in the second
-    # table, we actually extend them <=> Left outer join.
-    # If there is nothing in the left table we create an appropriate
-    # empty row for the cartesian => definition of right outer join.
-
-    # We go through used, because map can be empty for outer
-
-    foreach k [array names map] {
-	if {![info exists used($k)]} {
-	    SingleRightCartesian map $k [Lrepeatn {} $w]
-	}
-    }
-    foreach k [array names used] {
-	if {![info exists map($k)]} {
-	    set map($k) [::list [Lrepeatn {} $width]]
-	}
-	Cartesian map used $k
-    }
-
-    incr width $w
-    return [array names map]
-}
-
-proc ::struct::list::Dekey {keyedtable} {
-    set table [::list]
-    foreach row $keyedtable {lappend table [lindex $row 1]}
-    return $table
-}
-
-# ::struct::list::Lswap --
-#
-#	Exchange two elements of a list.
-#
-# Parameters:
-#	listvar	Name of the variable containing the list to manipulate.
-#	i, j	Indices of the list elements to exchange.
-#
-# Results:
-#	The modified list
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lswap {listvar i j} {
-    upvar $listvar list
-
-    if {($i < 0) || ($j < 0)} {
-	return -code error {list index out of range}
-    }
-    set len [llength $list]
-    if {($i >= $len) || ($j >= $len)} {
-	return -code error {list index out of range}
-    }
-
-    if {$i != $j} {
-	set tmp      [lindex $list $i]
-	lset list $i [lindex $list $j]
-	lset list $j $tmp
-    }
-    return $list
-}
-
-# ::struct::list::Lfirstperm --
-#
-#	Returns the lexicographically first permutation of the
-#	specified list.
-#
-# Parameters:
-#	list	The list whose first permutation is sought.
-#
-# Results:
-#	A modified list containing the lexicographically first
-#	permutation of the input.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lfirstperm {list} {
-    return [lsort $list]
-}
-
-# ::struct::list::Lnextperm --
-#
-#	Accepts a permutation of a set of elements and returns the
-#	next permutatation in lexicographic sequence.
-#
-# Parameters:
-#	list	The list containing the current permutation.
-#
-# Results:
-#	A modified list containing the lexicographically next
-#	permutation after the input permutation.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lnextperm {perm} {
-    # Find the smallest subscript j such that we have already visited
-    # all permutations beginning with the first j elements.
-
-    set len [expr {[llength $perm] - 1}]
-
-    set j $len
-    set ajp1 [lindex $perm $j]
-    while { $j > 0 } {
-	incr j -1
-	set aj [lindex $perm $j]
-	if { [string compare $ajp1 $aj] > 0 } {
-	    set foundj {}
-	    break
-	}
-	set ajp1 $aj
-    }
-    if { ![info exists foundj] } return
-
-    # Find the smallest element greater than the j'th among the elements
-    # following aj. Let its index be l, and interchange aj and al.
-
-    set l $len
-    while { $aj >= [set al [lindex $perm $l]] } {
-	incr l -1
-    }
-    lset perm $j $al
-    lset perm $l $aj
-
-    # Reverse a_j+1 ... an
-
-    set k [expr {$j + 1}]
-    set l $len
-    while { $k < $l } {
-	set al [lindex $perm $l]
-	lset perm $l [lindex $perm $k]
-	lset perm $k $al
-	incr k
-	incr l -1
-    }
-
-    return $perm
-}
-
-# ::struct::list::Lpermutations --
-#
-#	Returns a list containing all the permutations of the
-#	specified list, in lexicographic order.
-#
-# Parameters:
-#	list	The list whose permutations are sought.
-#
-# Results:
-#	A list of lists, containing all	permutations of the
-#	input.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lpermutations {list} {
-
-    if {[llength $list] < 2} {
-	return [list $list]
-    }
-
-    set res {}
-    set p [Lfirstperm $list]
-    while {[llength $p]} {
-	lappend res $p
-	set p [Lnextperm $p]
-    }
-    return $res
-}
-
-# ::struct::list::Lforeachperm --
-#
-#	Executes a script for all the permutations of the
-#	specified list, in lexicographic order.
-#
-# Parameters:
-#	var	Name of the loop variable.
-#	list	The list whose permutations are sought.
-#	body	The tcl script to run per permutation of
-#		the input.
-#
-# Results:
-#	The empty string.
-#
-# Side effects:
-#       None
-
-proc ::struct::list::Lforeachperm {var list body} {
-    upvar $var loopvar
-
-    if {[llength $list] < 2} {
-	set loopvar $list
-	# TODO run body.
-
-	# The first invocation of the body, also the last, as only one
-	# permutation is possible. That makes handling of the result
-	# codes easier.
-
-	set code [catch {uplevel 1 $body} result]
-
-	# decide what to do upon the return code:
-	#
-	#               0 - the body executed successfully
-	#               1 - the body raised an error
-	#               2 - the body invoked [return]
-	#               3 - the body invoked [break]
-	#               4 - the body invoked [continue]
-	# everything else - return and pass on the results
-	#
-	switch -exact -- $code {
-	    0 {}
-	    1 {
-		return -errorinfo [ErrorInfoAsCaller uplevel foreachperm]  \
-		    -errorcode $::errorCode -code error $result
-	    }
-	    3 {}
-	    4 {}
-	    default {
-		# Includes code 2
-		return -code $code $result
-	    }
-	}
-	return
-    }
-
-    set p [Lfirstperm $list]
-    while {[llength $p]} {
-	set loopvar $p
-
-	set code [catch {uplevel 1 $body} result]
-
-	# decide what to do upon the return code:
-	#
-	#               0 - the body executed successfully
-	#               1 - the body raised an error
-	#               2 - the body invoked [return]
-	#               3 - the body invoked [break]
-	#               4 - the body invoked [continue]
-	# everything else - return and pass on the results
-	#
-	switch -exact -- $code {
-	    0 {}
-	    1 {
-		return -errorinfo [ErrorInfoAsCaller uplevel foreachperm]  \
-		    -errorcode $::errorCode -code error $result
-	    }
-	    3 {
-		# FRINK: nocheck
-		return
-	    }
-	    4 {}
-	    default {
-		return -code $code $result
-	    }
-	}
-	set p [Lnextperm $p]
-    }
-    return
-}
-
-proc ::struct::list::ErrorInfoAsCaller {find replace} {
-    set info $::errorInfo
-    set i [string last "\n    (\"$find" $info]
-    if {$i == -1} {return $info}
-    set result [string range $info 0 [incr i 6]]	;# keep "\n    (\""
-    append result $replace			;# $find -> $replace
-    incr i [string length $find]
-    set j [string first ) $info [incr i]]	;# keep rest of parenthetical
-    append result [string range $info $i $j]
-    return $result
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'list::list' into the general structure namespace.
-    namespace import -force list::list
-    namespace export list
-}
-package provide struct::list 1.6.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/matrix.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/matrix.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2787 +1,0 @@
-# matrix.tcl --
-#
-#	Implementation of a matrix data structure for Tcl.
-#
-# Copyright (c) 2001-2004 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# Heapsort code Copyright (c) 2003 by Edwin A. Suominen <ed@eepatents.com>,
-# based on concepts in "Introduction to Algorithms" by Thomas H. Cormen et al.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: matrix.tcl,v 1.22 2005/09/30 05:36:39 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::struct {}
-
-namespace eval ::struct::matrix {
-    # Data storage in the matrix module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #
-    # - Two scalar variables containing the current number of rows and columns.
-    # - Four array variables containing the array data, the caches for
-    #   row heights and column widths and the information about linked arrays.
-    #
-    # The variables are
-    # - columns #columns in data
-    # - rows    #rows in data
-    # - data    cell contents
-    # - colw    cache of column widths
-    # - rowh    cache of row heights
-    # - link    information about linked arrays
-    # - lock    boolean flag to disable MatTraceIn while in MatTraceOut [#532783]
-    # - unset   string used to convey information about 'unset' traces from MatTraceIn to MatTraceOut.
-
-    # counter is used to give a unique name for unnamed matrices
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new matrix
-    namespace export matrix
-}
-
-# ::struct::matrix::matrix --
-#
-#	Create a new matrix with a given name; if no name is given, use
-#	matrixX, where X is a number.
-#
-# Arguments:
-#	name	Optional name of the matrix; if null or not given, generate one.
-#
-# Results:
-#	name	Name of the matrix created
-
-proc ::struct::matrix::matrix {args} {
-    variable counter
-    
-    set src     {}
-    set srctype {}
-
-    switch -exact -- [llength [info level 0]] {
-	1 {
-	    # Missing name, generate one.
-	    incr counter
-	    set name "matrix${counter}"
-	}
-	2 {
-	    # Standard call. New empty matrix.
-	    set name [lindex $args 0]
-	}
-	4 {
-	    # Copy construction.
-	    foreach {name as src} $args break
-	    switch -exact -- $as {
-		= - := - as {
-		    set srctype matrix
-		}
-		deserialize {
-		    set srctype serial
-		}
-		default {
-		    return -code error \
-			    "wrong # args: should be \"matrix ?name ?=|:=|as|deserialize source??\""
-		}
-	    }
-	}
-	default {
-	    # Error.
-	    return -code error \
-		    "wrong # args: should be \"matrix ?name ?=|:=|as|deserialize source??\""
-	}
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-        set name "$ns$name"
-    }
-
-    if { [llength [info commands $name]] } {
-	return -code error "command \"$name\" already exists, unable to create matrix"
-    }
-
-    # Set up the namespace
-    namespace eval $name {
-	variable columns 0
-	variable rows    0
-
-	variable data
-	variable colw
-	variable rowh
-	variable link
-	variable lock
-	variable unset
-
-	array set data  {}
-	array set colw  {}
-	array set rowh  {}
-	array set link  {}
-	set       lock  0
-	set       unset {}
-    }
-
-    # Create the command to manipulate the matrix
-    interp alias {} $name {} ::struct::matrix::MatrixProc $name
-
-    # Automatic execution of assignment if a source
-    # is present.
-    if {$src != {}} {
-	switch -exact -- $srctype {
-	    matrix {_= $name $src}
-	    serial {_deserialize $name $src}
-	    default {
-		return -code error \
-			"Internal error, illegal srctype \"$srctype\""
-	    }
-	}
-    }
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::matrix::MatrixProc --
-#
-#	Command that processes all matrix object commands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::MatrixProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub _$cmd
-    if {[llength [info commands ::struct::matrix::$sub]] == 0} {
-	set optlist [lsort [info commands ::struct::matrix::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    if {[string match __* $p]} {continue}
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_= --
-#
-#	Assignment operator. Copies the source matrix into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the matrix object we are copying into.
-#	source	Name of the matrix object providing us with the
-#		data to copy.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::matrix::_= {name source} {
-    _deserialize $name [$source serialize]
-    return
-}
-
-# ::struct::matrix::_--> --
-#
-#	Reverse assignment operator. Copies this matrix into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the matrix object to copy
-#	dest	Name of the matrix object we are copying to.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::matrix::_--> {name dest} {
-    $dest deserialize [_serialize $name]
-    return
-}
-
-# ::struct::matrix::_add --
-#
-#	Command that processes all 'add' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'add' to invoke.
-#	args	Arguments for subcommand of 'add'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_add {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name add option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __add_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__add_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_delete --
-#
-#	Command that processes all 'delete' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'delete' to invoke.
-#	args	Arguments for subcommand of 'delete'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_delete {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name delete option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __delete_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__delete_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_format --
-#
-#	Command that processes all 'format' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'format' to invoke.
-#	args	Arguments for subcommand of 'format'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_format {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name format option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __format_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__format_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_get --
-#
-#	Command that processes all 'get' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'get' to invoke.
-#	args	Arguments for subcommand of 'get'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_get {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name get option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __get_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__get_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_insert --
-#
-#	Command that processes all 'insert' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'insert' to invoke.
-#	args	Arguments for subcommand of 'insert'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_insert {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name insert option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __insert_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__insert_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_search --
-#
-#	Command that processes all 'search' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	args	Arguments for search.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_search {name args} {
-    set mode   exact
-    set nocase 0
-
-    while {1} {
-	switch -glob -- [lindex $args 0] {
-	    -exact - -glob - -regexp {
-		set mode [string range [lindex $args 0] 1 end]
-		set args [lrange $args 1 end]
-	    }
-	    -nocase {
-		set nocase 1
-		set args [lrange $args 1 end]
-	    }
-	    -* {
-		return -code error \
-			"invalid option \"[lindex $args 0]\":\
-			should be -nocase, -exact, -glob, or -regexp"
-	    }
-	    default {
-		break
-	    }
-	}
-    }
-
-    # Possible argument signatures after option processing
-    #
-    # \ | args
-    # --+--------------------------------------------------------
-    # 2 | all pattern
-    # 3 | row row pattern, column col pattern
-    # 6 | rect ctl rtl cbr rbr pattern
-    #
-    # All range specifications are internally converted into a
-    # rectangle.
-
-    switch -exact -- [llength $args] {
-	2 - 3 - 6 {}
-	default {
-	    return -code error \
-		"wrong # args: should be\
-		\"$name search ?option...? (all|row row|column col|rect c r c r) pattern\""
-	}
-    }
-
-    set range   [lindex $args 0]
-    set pattern [lindex $args end]
-    set args    [lrange $args 1 end-1]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    switch -exact -- $range {
-	all {
-	    set ctl 0 ; set cbr $columns ; incr cbr -1
-	    set rtl 0 ; set rbr $rows    ; incr rbr -1
-	}
-	column {
-	    set ctl [ChkColumnIndex $name [lindex $args 0]]
-	    set cbr $ctl
-	    set rtl 0       ; set rbr $rows ; incr rbr -1
-	}
-	row {
-	    set rtl [ChkRowIndex $name [lindex $args 0]]
-	    set ctl 0    ; set cbr $columns ; incr cbr -1
-	    set rbr $rtl
-	}
-	rect {
-	    foreach {ctl rtl cbr rbr} $args break
-	    set ctl [ChkColumnIndex $name $ctl]
-	    set rtl [ChkRowIndex    $name $rtl]
-	    set cbr [ChkColumnIndex $name $cbr]
-	    set rbr [ChkRowIndex    $name $rbr]
-	    if {($ctl > $cbr) || ($rtl > $rbr)} {
-		return -code error "Invalid cell indices, wrong ordering"
-	    }
-	}
-	default {
-	    return -code error "invalid range spec \"$range\": should be all, column, row, or rect"
-	}
-    }
-
-    if {$nocase} {
-	set pattern [string tolower $pattern]
-    }
-
-    set matches [list]
-    for {set r $rtl} {$r <= $rbr} {incr r} {
-	for {set c $ctl} {$c <= $cbr} {incr c} {
-	    set v  $data($c,$r)
-	    if {$nocase} {
-		set v [string tolower $v]
-	    }
-	    switch -exact -- $mode {
-		exact  {set matched [string equal $pattern $v]}
-		glob   {set matched [string match $pattern $v]}
-		regexp {set matched [regexp --    $pattern $v]}
-	    }
-	    if {$matched} {
-		lappend matches [list $c $r]
-	    }
-	}
-    }
-    return $matches
-}
-
-# ::struct::matrix::_set --
-#
-#	Command that processes all 'set' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'set' to invoke.
-#	args	Arguments for subcommand of 'set'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_set {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name set option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __set_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__set_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_sort --
-#
-#	Command that processes all 'sort' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'sort' to invoke.
-#	args	Arguments for subcommand of 'sort'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_sort {name cmd args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name sort option ?arg arg ...?\""
-    }
-    if {[string equal $cmd "rows"]} {
-	set code   r
-	set byrows 1
-    } elseif {[string equal $cmd "columns"]} {
-	set code   c
-	set byrows 0
-    } else {
-	return -code error \
-		"bad option \"$cmd\": must be columns, or rows"
-    }
-
-    set revers 0 ;# Default: -increasing
-    while {1} {
-	switch -glob -- [lindex $args 0] {
-	    -increasing {set revers 0}
-	    -decreasing {set revers 1}
-	    default {
-		if {[llength $args] > 1} {
-		    return -code error \
-			"invalid option \"[lindex $args 0]\":\
-			should be -increasing, or -decreasing"
-		}
-		break
-	    }
-	}
-	set args [lrange $args 1 end]
-    }
-    # ASSERT: [llength $args] == 1
-
-    if {[llength $args] != 1} {
-	return -code error "wrong # args: should be \"$name sort option ?arg arg ...?\""
-    }
-
-    set key [lindex $args 0]
-
-    if {$byrows} {
-	set key [ChkColumnIndex $name $key]
-	variable ${name}::rows
-
-	# Adapted by EAS from BUILD-MAX-HEAP(A) of CRLS 6.3
-	set heapSize $rows
-    } else {
-	set key [ChkRowIndex $name $key]
-	variable ${name}::columns
-
-	# Adapted by EAS from BUILD-MAX-HEAP(A) of CRLS 6.3
-	set heapSize $columns
-    }
-
-    for {set i [expr {int($heapSize/2)-1}]} {$i>=0} {incr i -1} {
-	SortMaxHeapify $name $i $key $code $heapSize $revers
-    }
-
-    # Adapted by EAS from remainder of HEAPSORT(A) of CRLS 6.4
-    for {set i [expr {$heapSize-1}]} {$i>=1} {incr i -1} {
-	if {$byrows} {
-	    SwapRows $name 0 $i
-	} else {
-	    SwapColumns $name 0 $i
-	}
-	incr heapSize -1
-	SortMaxHeapify $name 0 $key $code $heapSize $revers
-    }
-    return
-}
-
-# ::struct::matrix::_swap --
-#
-#	Command that processes all 'swap' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'swap' to invoke.
-#	args	Arguments for subcommand of 'swap'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_swap {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name swap option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __swap_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__swap_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 7 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::__add_column --
-#
-#	Extends the matrix by one column and then acts like
-#	"setcolumn" (see below) on this new column if there were
-#	"values" supplied. Without "values" the new cells will be set
-#	to the empty string. The new column is appended immediately
-#	behind the last existing column.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	values	Optional values to set into the new row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_column {name {values {}}} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::rowh
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - The new column is not added to the width cache, the other
-    #   columns are not touched, the cache therefore unchanged.
-    # - The rows are either removed from the height cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set r 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset rowh($r)}
-	} ; # {else leave the row unchanged}
-	set data($columns,$r) $v
-	incr r
-    }
-    incr columns
-    return
-}
-
-# ::struct::matrix::__add_row --
-#
-#	Extends the matrix by one row and then acts like "setrow" (see
-#	below) on this new row if there were "values"
-#	supplied. Without "values" the new cells will be set to the
-#	empty string. The new row is appended immediately behind the
-#	last existing row.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	values	Optional values to set into the new row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_row {name {values {}}} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - The new row is not added to the height cache, the other
-    #   rows are not touched, the cache therefore unchanged.
-    # - The columns are either removed from the width cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set c 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset colw($c)}
-	} ; # {else leave the row unchanged}
-	set data($c,$rows) $v
-	incr c
-    }
-    incr rows
-    return
-}
-
-# ::struct::matrix::__add_columns --
-#
-#	Extends the matrix by "n" columns. The new cells will be set
-#	to the empty string. The new columns are appended immediately
-#	behind the last existing column. A value of "n" equal to or
-#	smaller than 0 is not allowed.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of new columns to create.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_columns {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-    AddColumns $name $n
-    return
-}
-
-proc ::struct::matrix::AddColumns {name n} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    # The new values set into the cell is always the empty
-    # string. These have a length and height of 0, i.e. the don't
-    # influence cached widths and heights as they are at least that
-    # big. IOW there is no need to touch and change the width and
-    # height caches.
-
-    while {$n > 0} {
-	for {set r 0} {$r < $rows} {incr r} {
-	    set data($columns,$r) ""
-	}
-	incr columns
-	incr n -1
-    }
-
-    return
-}
-
-# ::struct::matrix::__add_rows --
-#
-#	Extends the matrix by "n" rows. The new cells will be set to
-#	the empty string. The new rows are appended immediately behind
-#	the last existing row. A value of "n" equal to or smaller than
-#	0 is not allowed.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of new rows to create.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_rows {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-    AddRows $name $n
-    return
-}
-
-proc ::struct::matrix::AddRows {name n} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    # The new values set into the cell is always the empty
-    # string. These have a length and height of 0, i.e. the don't
-    # influence cached widths and heights as they are at least that
-    # big. IOW there is no need to touch and change the width and
-    # height caches.
-
-    while {$n > 0} {
-	for {set c 0} {$c < $columns} {incr c} {
-	    set data($c,$rows) ""
-	}
-	incr rows
-	incr n -1
-    }
-    return
-}
-
-# ::struct::matrix::_cells --
-#
-#	Returns the number of cells currently managed by the
-#	matrix. This is the product of "rows" and "columns".
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of cells in the matrix.
-
-proc ::struct::matrix::_cells {name} {
-    variable ${name}::rows
-    variable ${name}::columns
-    return [expr {$rows * $columns}]
-}
-
-# ::struct::matrix::_cellsize --
-#
-#	Returns the length of the string representation of the value
-#	currently contained in the addressed cell.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the cell to query
-#	row	Row index of the cell to query
-#
-# Results:
-#	The number of cells in the matrix.
-
-proc ::struct::matrix::_cellsize {name column row} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-    return [string length $data($column,$row)]
-}
-
-# ::struct::matrix::_columns --
-#
-#	Returns the number of columns currently managed by the
-#	matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of columns in the matrix.
-
-proc ::struct::matrix::_columns {name} {
-    variable ${name}::columns
-    return $columns
-}
-
-# ::struct::matrix::_columnwidth --
-#
-#	Returns the length of the longest string representation of all
-#	the values currently contained in the cells of the addressed
-#	column if these are all spanning only one line. For cell
-#	values spanning multiple lines the length of their longest
-#	line goes into the computation.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	The index of the column whose width is asked for.
-#
-# Results:
-#	See description.
-
-proc ::struct::matrix::_columnwidth {name column} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::colw
-
-    if {![info exists colw($column)]} {
-	variable ${name}::rows
-	variable ${name}::data
-
-	set width 0
-	for {set r 0} {$r < $rows} {incr r} {
-	    foreach line [split $data($column,$r) \n] {
-		set len [string length $line]
-		if {$len > $width} {
-		    set width $len
-		}
-	    }
-	}
-
-	set colw($column) $width
-    }
-
-    return $colw($column)
-}
-
-# ::struct::matrix::__delete_column --
-#
-#	Deletes the specified column from the matrix and shifts all
-#	columns with higher indices one index down.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	The index of the column to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_column {name column} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher columns down and then delete the
-    # superfluous data in the old last column. Move the data in the
-    # width cache too, take partial fill into account there too.
-    # Invalidate the height cache for all rows.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	for {set c $column; set cn [expr {$c + 1}]} {$cn < $columns} {incr c ; incr cn} {
-	    set data($c,$r) $data($cn,$r)
-	    if {[info exists colw($cn)]} {
-		set colw($c) $colw($cn)
-		unset colw($cn)
-	    }
-	}
-	unset data($c,$r)
-	catch {unset rowh($r)}
-    }
-    incr columns -1
-    return
-}
-
-# ::struct::matrix::__delete_columns --
-#
-#	Shrink the matrix by "n" columns (from the right).
-#	A value of "n" equal to or smaller than 0 is not
-#	allowed, nor is "n" allowed to be greater than the
-#	number of columns in the matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of columns to remove.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_columns {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-
-    variable ${name}::columns
-
-    if {$n > $columns} {
-	return -code error "A value of n > #columns is not allowed"
-    }
-
-    DeleteColumns $name $n
-    return
-}
-
-# ::struct::matrix::__delete_row --
-#
-#	Deletes the specified row from the matrix and shifts all
-#	row with higher indices one index down.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	The index of the row to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_row {name row} {
-    set row [ChkRowIndex $name $row]
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher rows down and then delete the
-    # superfluous data in the old last row. Move the data in the
-    # height cache too, take partial fill into account there too.
-    # Invalidate the width cache for all columns.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	for {set r $row; set rn [expr {$r + 1}]} {$rn < $rows} {incr r ; incr rn} {
-	    set data($c,$r) $data($c,$rn)
-	    if {[info exists rowh($rn)]} {
-		set rowh($r) $rowh($rn)
-		unset rowh($rn)
-	    }
-	}
-	unset data($c,$r)
-	catch {unset colw($c)}
-    }
-    incr rows -1
-    return
-}
-
-# ::struct::matrix::__delete_rows --
-#
-#	Shrink the matrix by "n" rows (from the bottom).
-#	A value of "n" equal to or smaller than 0 is not
-#	allowed, nor is "n" allowed to be greater than the
-#	number of rows in the matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of rows to remove.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_rows {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-
-    variable ${name}::rows
-
-    if {$n > $rows} {
-	return -code error "A value of n > #rows is not allowed"
-    }
-
-    DeleteRows $name $n
-    return
-}
-
-# ::struct::matrix::_deserialize --
-#
-#	Assignment operator. Copies a serialization into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the matrix object we are copying into.
-#	serial	Serialized matrix to copy from.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::matrix::_deserialize {name serial} {
-    # As we destroy the original matrix as part of
-    # the copying process we don't have to deal
-    # with issues like node names from the new matrix
-    # interfering with the old ...
-
-    # I. Get the serialization of the source matrix
-    #    and check it for validity.
-
-    CheckSerialization $serial r c values
-
-    # Get all the relevant data into the scope
-
-    variable ${name}::rows
-    variable ${name}::columns
-
-    # Resize the destination matrix for the new data
-
-    if {$r > $rows} {
-	AddRows $name [expr {$r - $rows}]
-    } elseif {$r < $rows} {
-	DeleteRows $name [expr {$rows - $r}]
-    }
-    if {$c > $columns} {
-	AddColumns $name [expr {$c - $columns}]
-    } elseif {$c < $columns} {
-	DeleteColumns $name [expr {$columns - $c}]
-    }
-
-    set rows    $r
-    set columns $c
-
-    # Copy the new data over the old information.
-
-    set row 0
-    foreach rv $values {
-	SetRow $name $row $rv
-	incr row
-    }
-    while {$row < $rows} {
-	# Fill with empty rows if there are not enough.
-	SetRow $name $row {}
-	incr row
-    }
-    return
-}
-
-# ::struct::matrix::_destroy --
-#
-#	Destroy a matrix, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the matrix to destroy.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::_destroy {name} {
-    variable ${name}::link
-
-    # Unlink all existing arrays before destroying the object so that
-    # we don't leave dangling references / traces.
-
-    foreach avar [array names link] {
-	_unlink $name $avar
-    }
-
-    namespace delete $name
-    interp alias {}  $name {}
-}
-
-# ::struct::matrix::__format_2string --
-#
-#	Formats the matrix using the specified report object and
-#	returns the string containing the result of this
-#	operation. The report has to support the "printmatrix" method.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	report	Name of the report object specifying the formatting.
-#
-# Results:
-#	A string containing the formatting result.
-
-proc ::struct::matrix::__format_2string {name {report {}}} {
-    if {$report == {}} {
-	# Use an internal hardwired simple report to format the matrix.
-	# 1. Go through all columns and compute the column widths.
-	# 2. Then iterate through all rows and dump then into a
-	#    string, formatted to the number of characters per columns
-
-	array set cw {}
-	set cols [_columns $name]
-	for {set c 0} {$c < $cols} {incr c} {
-	    set cw($c) [_columnwidth $name $c]
-	}
-
-	set result [list]
-	set n [_rows $name]
-	for {set r 0} {$r < $n} {incr r} {
-	    set rh [_rowheight $name $r]
-	    if {$rh < 2} {
-		# Simple row.
-		set line [list]
-		for {set c 0} {$c < $cols} {incr c} {
-		    set val [__get_cell $name $c $r]
-		    lappend line "$val[string repeat " " [expr {$cw($c)-[string length $val]}]]"
-		}
-		lappend result [join $line " "]
-	    } else {
-		# Complex row, multiple passes
-		for {set h 0} {$h < $rh} {incr h} {
-		    set line [list]
-		    for {set c 0} {$c < $cols} {incr c} {
-			set val [lindex [split [__get_cell $name $c $r] \n] $h]
-			lappend line "$val[string repeat " " [expr {$cw($c)-[string length $val]}]]"
-		    }
-		    lappend result [join $line " "]
-		}
-	    }
-	}
-	return [join $result \n]
-    } else {
-	return [$report printmatrix $name]
-    }
-}
-
-# ::struct::matrix::__format_2chan --
-#
-#	Formats the matrix using the specified report object and
-#	writes the string containing the result of this operation into
-#	the channel. The report has to support the
-#	"printmatrix2channel" method.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	report	Name of the report object specifying the formatting.
-#	chan	Handle of the channel to write to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__format_2chan {name {report {}} {chan stdout}} {
-    if {$report == {}} {
-	# Use an internal hardwired simple report to format the matrix.
-	# We delegate this to the string formatter and print its result.
-	puts -nonewline [__format_2string $name]
-    } else {
-	$report printmatrix2channel $name $chan
-    }
-    return
-}
-
-# ::struct::matrix::__get_cell --
-#
-#	Returns the value currently contained in the cell identified
-#	by row and column index.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Column index of the addressed cell.
-#	row	Row index of the addressed cell.
-#
-# Results:
-#	value	Value currently stored in the addressed cell.
-
-proc ::struct::matrix::__get_cell {name column row} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-    return $data($column,$row)
-}
-
-# ::struct::matrix::__get_column --
-#
-#	Returns a list containing the values from all cells in the
-#	column identified by the index. The contents of the cell in
-#	row 0 are stored as the first element of this list.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Column index of the addressed cell.
-#
-# Results:
-#	List of values stored in the addressed row.
-
-proc ::struct::matrix::__get_column {name column} {
-    set column [ChkColumnIndex $name $column]
-    return     [GetColumn      $name $column]
-}
-
-proc ::struct::matrix::GetColumn {name column} {
-    variable ${name}::data
-    variable ${name}::rows
-
-    set result [list]
-    for {set r 0} {$r < $rows} {incr r} {
-	lappend result $data($column,$r)
-    }
-    return $result
-}
-
-# ::struct::matrix::__get_rect --
-#
-#	Returns a list of lists of cell values. The values stored in
-#	the result come from the submatrix whose top-left and
-#	bottom-right cells are specified by "column_tl", "row_tl" and
-#	"column_br", "row_br" resp. Note that the following equations
-#	have to be true: column_tl <= column_br and row_tl <= row_br.
-#	The result is organized as follows: The outer list is the list
-#	of rows, its elements are lists representing a single row. The
-#	row with the smallest index is the first element of the outer
-#	list. The elements of the row lists represent the selected
-#	cell values. The cell with the smallest index is the first
-#	element in each row list.
-#
-# Arguments:
-#	name		Name of the matrix.
-#	column_tl	Column index of the top-left cell of the area.
-#	row_tl		Row index of the top-left cell of the the area
-#	column_br	Column index of the bottom-right cell of the area.
-#	row_br		Row index of the bottom-right cell of the the area
-#
-# Results:
-#	List of a list of values stored in the addressed area.
-
-proc ::struct::matrix::__get_rect {name column_tl row_tl column_br row_br} {
-    set column_tl [ChkColumnIndex $name $column_tl]
-    set row_tl    [ChkRowIndex    $name $row_tl]
-    set column_br [ChkColumnIndex $name $column_br]
-    set row_br    [ChkRowIndex    $name $row_br]
-
-    if {
-	($column_tl > $column_br) ||
-	($row_tl    > $row_br)
-    } {
-	return -code error "Invalid cell indices, wrong ordering"
-    }
-    return [GetRect $name $column_tl $row_tl $column_br $row_br]
-}
-
-proc ::struct::matrix::GetRect {name column_tl row_tl column_br row_br} {
-    variable ${name}::data
-    set result [list]
-
-    for {set r $row_tl} {$r <= $row_br} {incr r} {
-	set row [list]
-	for {set c $column_tl} {$c <= $column_br} {incr c} {
-	    lappend row $data($c,$r)
-	}
-	lappend result $row
-    }
-
-    return $result
-}
-
-# ::struct::matrix::__get_row --
-#
-#	Returns a list containing the values from all cells in the
-#	row identified by the index. The contents of the cell in
-#	column 0 are stored as the first element of this list.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Row index of the addressed cell.
-#
-# Results:
-#	List of values stored in the addressed row.
-
-proc ::struct::matrix::__get_row {name row} {
-    set row [ChkRowIndex $name $row]
-    return  [GetRow      $name $row]
-}
-
-proc ::struct::matrix::GetRow {name row} {
-    variable ${name}::data
-    variable ${name}::columns
-
-    set result [list]
-    for {set c 0} {$c < $columns} {incr c} {
-	lappend result $data($c,$row)
-    }
-    return $result
-}
-
-# ::struct::matrix::__insert_column --
-#
-#	Extends the matrix by one column and then acts like
-#	"setcolumn" (see below) on this new column if there were
-#	"values" supplied. Without "values" the new cells will be set
-#	to the empty string. The new column is inserted just before
-#	the column specified by the given index. This means, if
-#	"column" is less than or equal to zero, then the new column is
-#	inserted at the beginning of the matrix, before the first
-#	column. If "column" has the value "Bend", or if it is greater
-#	than or equal to the number of columns in the matrix, then the
-#	new column is appended to the matrix, behind the last
-#	column. The old column at the chosen index and all columns
-#	with higher indices are shifted one index upward.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Index of the column where to insert.
-#	values	Optional values to set the cells to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__insert_column {name column {values {}}} {
-    # Allow both negative and too big indices.
-    set column [ChkColumnIndexAll $name $column]
-
-    variable ${name}::columns
-
-    if {$column > $columns} {
-	# Same as 'addcolumn'
-	__add_column $name $values
-	return
-    }
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    set firstcol $column
-    if {$firstcol < 0} {
-	set firstcol 0
-    }
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-    # Invalidate all rows, move all columns
-
-    # Move all data from the higher columns one up and then insert the
-    # new data into the freed space. Move the data in the
-    # width cache too, take partial fill into account there too.
-    # Invalidate the height cache for all rows.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	for {set cn $columns ; set c [expr {$cn - 1}]} {$c >= $firstcol} {incr c -1 ; incr cn -1} {
-	    set data($cn,$r) $data($c,$r)
-	    if {[info exists colw($c)]} {
-		set colw($cn) $colw($c)
-		unset colw($c)
-	    }
-	}
-	set data($firstcol,$r) [lindex $values $r]
-	catch {unset rowh($r)}
-    }
-    incr columns
-    return
-}
-
-# ::struct::matrix::__insert_row --
-#
-#	Extends the matrix by one row and then acts like "setrow" (see
-#	below) on this new row if there were "values"
-#	supplied. Without "values" the new cells will be set to the
-#	empty string. The new row is inserted just before the row
-#	specified by the given index. This means, if "row" is less
-#	than or equal to zero, then the new row is inserted at the
-#	beginning of the matrix, before the first row. If "row" has
-#	the value "end", or if it is greater than or equal to the
-#	number of rows in the matrix, then the new row is appended to
-#	the matrix, behind the last row. The old row at that index and
-#	all rows with higher indices are shifted one index upward.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Index of the row where to insert.
-#	values	Optional values to set the cells to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__insert_row {name row {values {}}} {
-    # Allow both negative and too big indices.
-    set row [ChkRowIndexAll $name $row]
-
-    variable ${name}::rows
-
-    if {$row > $rows} {
-	# Same as 'addrow'
-	__add_row $name $values
-	return
-    }
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    set firstrow $row
-    if {$firstrow < 0} {
-	set firstrow 0
-    }
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-    # Invalidate all columns, move all rows
-
-    # Move all data from the higher rows one up and then insert the
-    # new data into the freed space. Move the data in the
-    # height cache too, take partial fill into account there too.
-    # Invalidate the width cache for all columns.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	for {set rn $rows ; set r [expr {$rn - 1}]} {$r >= $firstrow} {incr r -1 ; incr rn -1} {
-	    set data($c,$rn) $data($c,$r)
-	    if {[info exists rowh($r)]} {
-		set rowh($rn) $rowh($r)
-		unset rowh($r)
-	    }
-	}
-	set data($c,$firstrow) [lindex $values $c]
-	catch {unset colw($c)}
-    }
-    incr rows
-    return
-}
-
-# ::struct::matrix::_link --
-#
-#	Links the matrix to the specified array variable. This means
-#	that the contents of all cells in the matrix is stored in the
-#	array too, with all changes to the matrix propagated there
-#	too. The contents of the cell "(column,row)" is stored in the
-#	array using the key "column,row". If the option "-transpose"
-#	is specified the key "row,column" will be used instead. It is
-#	possible to link the matrix to more than one array. Note that
-#	the link is bidirectional, i.e. changes to the array are
-#	mirrored in the matrix too.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	option	Either empty of '-transpose'.
-#	avar	Name of the variable to link to
-#
-# Results:
-#	None
-
-proc ::struct::matrix::_link {name args} {
-    switch -exact -- [llength $args] {
-	0 {
-	    return -code error "$name: wrong # args: link ?-transpose? arrayvariable"
-	}
-	1 {
-	    set transpose 0
-	    set variable  [lindex $args 0]
-	}
-	2 {
-	    foreach {t variable} $args break
-	    if {[string compare $t -transpose]} {
-		return -code error "$name: illegal syntax: link ?-transpose? arrayvariable"
-	    }
-	    set transpose 1
-	}
-	default {
-	    return -code error "$name: wrong # args: link ?-transpose? arrayvariable"
-	}
-    }
-
-    variable ${name}::link
-
-    if {[info exists link($variable)]} {
-	return -code error "$name link: Variable \"$variable\" already linked to matrix"
-    }
-
-    # Ok, a new variable we are linked to. Record this information,
-    # dump our current contents into the array, at last generate the
-    # traces actually performing the link.
-
-    set link($variable) $transpose
-
-    upvar #0 $variable array
-    variable ${name}::data
-
-    foreach key [array names data] {
-	foreach {c r} [split $key ,] break
-	if {$transpose} {
-	    set array($r,$c) $data($key)
-	} else {
-	    set array($c,$r) $data($key)
-	}
-    }
-
-    trace variable array wu [list ::struct::matrix::MatTraceIn  $variable $name]
-    trace variable data  w  [list ::struct::matrix::MatTraceOut $variable $name]
-    return
-}
-
-# ::struct::matrix::_links --
-#
-#	Retrieves the names of all array variable the matrix is
-#	officially linked to.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	List of variables the matrix is linked to.
-
-proc ::struct::matrix::_links {name} {
-    variable ${name}::link
-    return [array names link]
-}
-
-# ::struct::matrix::_rowheight --
-#
-#	Returns the height of the specified row in lines. This is the
-#	highest number of lines spanned by a cell over all cells in
-#	the row.
-#
-# Arguments:
-#	name	Name of the matrix
-#	row	Index of the row queried for its height
-#
-# Results:
-#	The height of the specified row in lines.
-
-proc ::struct::matrix::_rowheight {name row} {
-    set row [ChkRowIndex $name $row]
-
-    variable ${name}::rowh
-
-    if {![info exists rowh($row)]} {
-	variable ${name}::columns
-	variable ${name}::data
-
-	set height 1
-	for {set c 0} {$c < $columns} {incr c} {
-	    set cheight [llength [split $data($c,$row) \n]]
-	    if {$cheight > $height} {
-		set height $cheight
-	    }
-	}
-
-	set rowh($row) $height
-    }
-    return $rowh($row)
-}
-
-# ::struct::matrix::_rows --
-#
-#	Returns the number of rows currently managed by the matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of rows in the matrix.
-
-proc ::struct::matrix::_rows {name} {
-    variable ${name}::rows
-    return $rows
-}
-
-# ::struct::matrix::_serialize --
-#
-#	Serialize a matrix object (partially) into a transportable value.
-#	If only a rectangle is serialized the result will be a sub-
-#	matrix in the mathematical sense of the word.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	args	rectangle to place into the serialized matrix
-#
-# Results:
-#	A list structure describing the part of the matrix which was serialized.
-
-proc ::struct::matrix::_serialize {name args} {
-
-    # all - boolean flag - set if and only if the all nodes of the
-    # matrix are chosen for serialization. Because if that is true we
-    # can skip the step finding the relevant arcs and simply take all
-    # arcs.
-
-    set nargs [llength $args]
-    if {($nargs != 0) && ($nargs != 4)} {
-	return -code error "$name: wrong # args: serialize ?column_tl row_tl column_br row_br?"
-    }
-
-    variable ${name}::rows
-    variable ${name}::columns
-
-    if {$nargs == 4} {
-	foreach {column_tl row_tl column_br row_br} $args break
-
-	set column_tl [ChkColumnIndex $name $column_tl]
-	set row_tl    [ChkRowIndex    $name $row_tl]
-	set column_br [ChkColumnIndex $name $column_br]
-	set row_br    [ChkRowIndex    $name $row_br]
-
-	if {
-	    ($column_tl > $column_br) ||
-	    ($row_tl    > $row_br)
-	} {
-	    return -code error "Invalid cell indices, wrong ordering"
-	}
-	set rn [expr {$row_br    - $row_tl    + 1}]
-	set cn [expr {$column_br - $column_tl + 1}]
-    } else {
-	set column_tl 0
-	set row_tl    0
-	set column_br [expr {$columns - 1}]
-	set row_br    [expr {$rows - 1}]
-	set rn $rows
-	set cn $columns
-    }
-
-    # We could optimize and remove empty cells to the right and rows
-    # to the bottom. For now we don't.
-
-    return [list \
-	    $rn $cn \
-	    [GetRect $name $column_tl $row_tl $column_br $row_br]]
-}
-
-# ::struct::matrix::__set_cell --
-#
-#	Sets the value in the cell identified by row and column index
-#	to the data in the third argument.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the cell to set.
-#	row	Row index of the cell to set.
-#	value	The new value of the cell.
-#
-# Results:
-#	None.
- 
-proc ::struct::matrix::__set_cell {name column row value} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-
-    if {![string compare $value $data($column,$row)]} {
-	# No change, ignore call!
-	return
-    }
-
-    set data($column,$row) $value
-
-    if {$value != {}} {
-	variable ${name}::colw
-	variable ${name}::rowh
-	catch {unset colw($column)}
-	catch {unset rowh($row)}
-    }
-    return
-}
-
-# ::struct::matrix::__set_column --
-#
-#	Sets the values in the cells identified by the column index to
-#	the elements of the list provided as the third argument. Each
-#	element of the list is assigned to one cell, with the first
-#	element going into the cell in row 0 and then upward. If there
-#	are less values in the list than there are rows the remaining
-#	rows are set to the empty string. If there are more values in
-#	the list than there are rows the superfluous elements are
-#	ignored. The matrix is not extended by this operation.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Index of the column to set.
-#	values	Values to set into the column.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_column {name column values} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - Invalidate the column in the width cache.
-    # - The rows are either removed from the height cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set r 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset rowh($r)}
-	} ; # {else leave the row unchanged}
-	set data($column,$r) $v
-	incr r
-    }
-    catch {unset colw($column)}
-    return
-}
-
-# ::struct::matrix::__set_rect --
-#
-#	Takes a list of lists of cell values and writes them into the
-#	submatrix whose top-left cell is specified by the two
-#	indices. If the sublists of the outer list are not of equal
-#	length the shorter sublists will be filled with empty strings
-#	to the length of the longest sublist. If the submatrix
-#	specified by the top-left cell and the number of rows and
-#	columns in the "values" extends beyond the matrix we are
-#	modifying the over-extending parts of the values are ignored,
-#	i.e. essentially cut off. This subcommand expects its input in
-#	the format as returned by "getrect".
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the topleft cell to set.
-#	row	Row index of the topleft cell to set.
-#	values	Values to set.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_rect {name column row values} {
-    # Allow negative indices!
-    set column [ChkColumnIndexNeg $name $column]
-    set row    [ChkRowIndexNeg    $name $row]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    if {$row < 0} {
-	# Remove rows from the head of values to restrict it to the
-	# overlapping area.
-
-	set values [lrange $values [expr {0 - $row}] end]
-	set row 0
-    }
-
-    # Restrict it at the end too.
-    if {($row + [llength $values]) > $rows} {
-	set values [lrange $values 0 [expr {$rows - $row - 1}]]
-    }
-
-    # Same for columns, but store it in some vars as this is required
-    # in a loop.
-    set firstcol 0
-    if {$column < 0} {
-	set firstcol [expr {0 - $column}]
-	set column 0
-    }
-
-    # Now pan through values and area and copy the external data into
-    # the matrix.
-
-    set r $row
-    foreach line $values {
-	set line [lrange $line $firstcol end]
-
-	set l [expr {$column + [llength $line]}]
-	if {$l > $columns} {
-	    set line [lrange $line 0 [expr {$columns - $column - 1}]]
-	} elseif {$l < [expr {$columns - $firstcol}]} {
-	    # We have to take the offset into the line into account
-	    # or we add fillers we don't need, overwriting part of the
-	    # data array we shouldn't.
-
-	    for {} {$l < [expr {$columns - $firstcol}]} {incr l} {
-		lappend line {}
-	    }
-	}
-
-	set c $column
-	foreach cell $line {
-	    if {$cell != {}} {
-		catch {unset rowh($r)}
-		catch {unset colw($c)}
-	    }
-	    set data($c,$r) $cell
-	    incr c
-	}
-	incr r
-    }
-    return
-}
-
-# ::struct::matrix::__set_row --
-#
-#	Sets the values in the cells identified by the row index to
-#	the elements of the list provided as the third argument. Each
-#	element of the list is assigned to one cell, with the first
-#	element going into the cell in column 0 and then upward. If
-#	there are less values in the list than there are columns the
-#	remaining columns are set to the empty string. If there are
-#	more values in the list than there are columns the superfluous
-#	elements are ignored. The matrix is not extended by this
-#	operation.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Index of the row to set.
-#	values	Values to set into the row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_row {name row values} {
-    set row [ChkRowIndex $name $row]
-    SetRow $name $row $values
-}
-
-proc ::struct::matrix::SetRow {name row values} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - Invalidate the row in the height cache.
-    # - The columns are either removed from the width cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set c 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset colw($c)}
-	} ; # {else leave the row unchanged}
-	set data($c,$row) $v
-	incr c
-    }
-    catch {unset rowh($row)}
-    return
-}
-
-# ::struct::matrix::__swap_columns --
-#
-#	Swaps the contents of the two specified columns.
-#
-# Arguments:
-#	name		Name of the matrix.
-#	column_a	Index of the first column to swap
-#	column_b	Index of the second column to swap
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__swap_columns {name column_a column_b} {
-    set column_a [ChkColumnIndex $name $column_a]
-    set column_b [ChkColumnIndex $name $column_b]
-    return [SwapColumns $name $column_a $column_b]
-}
-
-proc ::struct::matrix::SwapColumns {name column_a column_b} {
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::colw
-
-    # Note: This operation does not influence the height cache for all
-    # rows and the width cache only insofar as its contents has to be
-    # swapped too for the two columns we are touching. Note that the
-    # cache might be partially filled or not at all, so we don't have
-    # to "swap" in some situations.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	set tmp                $data($column_a,$r)
-	set data($column_a,$r) $data($column_b,$r)
-	set data($column_b,$r) $tmp
-    }
-
-    set cwa [info exists colw($column_a)]
-    set cwb [info exists colw($column_b)]
-
-    if {$cwa && $cwb} {
-	set tmp             $colw($column_a)
-	set colw($column_a) $colw($column_b)
-	set colw($column_b) $tmp
-    } elseif {$cwa} {
-	# Move contents, don't swap.
-	set   colw($column_b) $colw($column_a)
-	unset colw($column_a)
-    } elseif {$cwb} {
-	# Move contents, don't swap.
-	set   colw($column_a) $colw($column_b)
-	unset colw($column_b)
-    } ; # else {nothing to do at all}
-    return
-}
-
-# ::struct::matrix::__swap_rows --
-#
-#	Swaps the contents of the two specified rows.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row_a	Index of the first row to swap
-#	row_b	Index of the second row to swap
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__swap_rows {name row_a row_b} {
-    set row_a [ChkRowIndex $name $row_a]
-    set row_b [ChkRowIndex $name $row_b]
-    return [SwapRows $name $row_a $row_b]
-}
-
-proc ::struct::matrix::SwapRows {name row_a row_b} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rowh
-
-    # Note: This operation does not influence the width cache for all
-    # columns and the height cache only insofar as its contents has to be
-    # swapped too for the two rows we are touching. Note that the
-    # cache might be partially filled or not at all, so we don't have
-    # to "swap" in some situations.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	set tmp             $data($c,$row_a)
-	set data($c,$row_a) $data($c,$row_b)
-	set data($c,$row_b) $tmp
-    }
-
-    set rha [info exists rowh($row_a)]
-    set rhb [info exists rowh($row_b)]
-
-    if {$rha && $rhb} {
-	set tmp          $rowh($row_a)
-	set rowh($row_a) $rowh($row_b)
-	set rowh($row_b) $tmp
-    } elseif {$rha} {
-	# Move contents, don't swap.
-	set   rowh($row_b) $rowh($row_a)
-	unset rowh($row_a)
-    } elseif {$rhb} {
-	# Move contents, don't swap.
-	set   rowh($row_a) $rowh($row_b)
-	unset rowh($row_b)
-    } ; # else {nothing to do at all}
-    return
-}
-
-# ::struct::matrix::_transpose --
-#
-#	Exchanges rows and columns of the matrix
-#
-# Arguments:
-#	name		Name of the matrix.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::_transpose {name} {
-    variable ${name}::rows
-    variable ${name}::columns
-
-    if {$rows == 0} {
-	# Change the dimensions. 
-	# There is no data to shift.
-	# The row/col caches are empty too.
-
-	set rows    $columns 
-	set columns 0
-	return
-
-    } elseif {$columns == 0} {
-	# Change the dimensions. 
-	# There is no data to shift.
-	# The row/col caches are empty too.
-
-	set columns $rows
-	set rows    0
-	return
-    }
-
-    variable ${name}::data
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    # Exchanging the row/col caches is easy, independent of the actual
-    # dimensions of the matrix.
-
-    set rhc [array get rowh]
-    set cwc [array get colw]
-
-    unset rowh ; array set rowh $cwc
-    unset colw ; array set colw $rhc
-
-    if {$rows == $columns} {
-	# A square matrix. We have to swap data around, but there is
-	# need to resize any of the arrays. Only the core is present.
-
-	set n $columns
-
-    } elseif {$rows > $columns} {
-	# Rectangular matrix, we have to delete rows, and add columns.
-
-	for {set r $columns} {$r < $rows} {incr r} {
-	    for {set c 0} {$c < $columns} {incr c} {
-		set   data($r,$c) $data($c,$r)
-		unset data($c,$r)
-	    }
-	}
-
-	set n $columns ; # Size of the core.
-    } else {
-	# rows < columns. Rectangular matrix, we have to delete
-	# columns, and add rows.
-
-	for {set c $rows} {$c < $columns} {incr c} {
-	    for {set r 0} {$r < $rows} {incr r} {
-		set   data($r,$c) $data($c,$r)
-		unset data($c,$r)
-	    }
-	}
-
-	set n $rows ; # Size of the core.
-    }
-
-    set tmp     $rows
-    set rows    $columns
-    set columns $tmp
-
-    # Whatever the actual dimensions, a square core is always
-    # present. The data of this core is now shuffled
-
-    for {set i 0} {$i < $n} {incr i} {
-	for {set j $i ; incr j} {$j < $n} {incr j} {
-	    set tmp $data($i,$j)
-	    set data($i,$j) $data($j,$i)
-	    set data($j,$i) $tmp
-	}
-    }
-    return
-}
-
-# ::struct::matrix::_unlink --
-#
-#	Removes the link between the matrix and the specified
-#	arrayvariable, if there is one.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	avar	Name of the linked array.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::_unlink {name avar} {
-
-    variable ${name}::link
-
-    if {![info exists link($avar)]} {
-	# Ignore unlinking of unknown variables.
-	return
-    }
-
-    # Delete the traces first, then remove the link management
-    # information from the object.
-
-    upvar #0 $avar    array
-    variable ${name}::data
-
-    trace vdelete array wu [list ::struct::matrix::MatTraceIn  $avar $name]
-    trace vdelete date  w  [list ::struct::matrix::MatTraceOut $avar $name]
-
-    unset link($avar)
-    return
-}
-
-# ::struct::matrix::ChkColumnIndex --
-#
-#	Helper to check and transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of columns.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndex {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    if {($cc < 0) || ($cc >= $columns)} {
-		return -code error "bad column index end-$column, column does not exist"
-	    }
-	    return $cc
-	}
-	end {
-	    if {$columns <= 0} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return [expr {$columns - 1}]
-	}
-	{[0-9]+} {
-	    if {($column < 0) || ($column >= $columns)} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndex --
-#
-#	Helper to check and transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of rows.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndex {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    if {($rr < 0) || ($rr >= $rows)} {
-		return -code error "bad row index end-$row, row does not exist"
-	    }
-	    return $rr
-	}
-	end {
-	    if {$rows <= 0} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return [expr {$rows - 1}]
-	}
-	{[0-9]+} {
-	    if {($row < 0) || ($row >= $rows)} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkColumnIndexNeg --
-#
-#	Helper to check and transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of columns
-#	(Accepts negative indices).
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndexNeg {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    if {$cc >= $columns} {
-		return -code error "bad column index end-$column, column does not exist"
-	    }
-	    return $cc
-	}
-	end {
-	    return [expr {$columns - 1}]
-	}
-	{[0-9]+} {
-	    if {$column >= $columns} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndexNeg --
-#
-#	Helper to check and transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of rows
-#	(Accepts negative indices).
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndexNeg {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    if {$rr >= $rows} {
-		return -code error "bad row index end-$row, row does not exist"
-	    }
-	    return $rr
-	}
-	end {
-	    return [expr {$rows - 1}]
-	}
-	{[0-9]+} {
-	    if {$row >= $rows} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkColumnIndexAll --
-#
-#	Helper to transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndexAll {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    return $cc
-	}
-	end {
-	    return $columns
-	}
-	{[0-9]+} {
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndexAll --
-#
-#	Helper to transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndexAll {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    return $rr
-	}
-	end {
-	    return $rows
-	}
-	{[0-9]+} {
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::MatTraceIn --
-#
-#	Helper propagating changes made to an array
-#	into the matrix the array is linked to.
-#
-# Arguments:
-#	avar		Name of the array which was changed.
-#	name		Matrix to write the changes to.
-#	var,idx,op	Standard trace arguments
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::MatTraceIn {avar name var idx op} {
-    # Propagate changes in the linked array back into the matrix.
-
-    variable ${name}::lock
-    if {$lock} {return}
-
-    # We have to cover two possibilities when encountering an "unset" operation ...
-    # 1. The external array was destroyed: perform automatic unlink.
-    # 2. An individual element was unset:  Set the corresponding cell to the empty string.
-    #    See SF Tcllib Bug #532791.
-
-    if {(![string compare $op u]) && ($idx == {})} {
-	# Possibility 1: Array was destroyed
-	$name unlink $avar
-	return
-    }
-
-    upvar #0 $avar    array
-    variable ${name}::data
-    variable ${name}::link
-
-    set transpose $link($avar)
-    if {$transpose} {
-	foreach {r c} [split $idx ,] break
-    } else {
-	foreach {c r} [split $idx ,] break
-    }
-
-    # Use standard method to propagate the change.
-    # => Get automatically index checks, cache updates, ...
-
-    if {![string compare $op u]} {
-	# Unset possibility 2: Element was unset.
-	# Note: Setting the cell to the empty string will
-	# invoke MatTraceOut for this array and thus try
-	# to recreate the destroyed element of the array.
-	# We don't want this. But we do want to propagate
-	# the change to other arrays, as "unset". To do
-	# all of this we use another state variable to
-	# signal this situation.
-
-	variable ${name}::unset
-	set unset $avar
-
-	$name set cell $c $r ""
-
-	set unset {}
-	return
-    }
-
-    $name set cell $c $r $array($idx)
-    return
-}
-
-# ::struct::matrix::MatTraceOut --
-#
-#	Helper propagating changes made to the matrix into the linked arrays.
-#
-# Arguments:
-#	avar		Name of the array to write the changes to.
-#	name		Matrix which was changed.
-#	var,idx,op	Standard trace arguments
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::MatTraceOut {avar name var idx op} {
-    # Propagate changes in the matrix data array into the linked array.
-
-    variable ${name}::unset
-
-    if {![string compare $avar $unset]} {
-	# Do not change the variable currently unsetting
-	# one of its elements.
-	return
-    }
-
-    variable ${name}::lock
-    set lock 1 ; # Disable MatTraceIn [#532783]
-
-    upvar #0 $avar    array
-    variable ${name}::data
-    variable ${name}::link
-
-    set transpose $link($avar)
-
-    if {$transpose} {
-	foreach {r c} [split $idx ,] break
-    } else {
-	foreach {c r} [split $idx ,] break
-    }
-
-    if {$unset != {}} {
-	# We are currently propagating the unset of an
-	# element in a different linked array to this
-	# array. We make sure that this is an unset too.
-
-	unset array($c,$r)
-    } else {
-	set array($c,$r) $data($idx)
-    }
-    set lock 0
-    return
-}
-
-# ::struct::matrix::SortMaxHeapify --
-#
-#	Helper for the 'sort' method. Performs the central algorithm
-#	which converts the matrix into a heap, easily sortable.
-#
-# Arguments:
-#	name	Matrix object which is sorted.
-#	i	Index of the row/column currently being sorted.
-#	key	Index of the column/row to sort the rows/columns by.
-#	rowCol	Indicator if we are sorting rows ('r'), or columns ('c').
-#	heapSize Number of rows/columns to sort.
-#	rev	Boolean flag, set if sorting is done revers (-decreasing).
-#
-# Sideeffects:
-#	Transforms the matrix into a heap of rows/columns,
-#	swapping them around.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::SortMaxHeapify {name i key rowCol heapSize {rev 0}} {
-    # MAX-HEAPIFY, adapted by EAS from CLRS 6.2
-    switch  $rowCol {
-	r { set A [GetColumn $name $key] }
-	c { set A [GetRow    $name $key] }
-    }
-    # Weird expressions below for clarity, as CLRS uses A[1...n]
-    # format and TCL uses A[0...n-1]
-    set left  [expr {int(2*($i+1)    -1)}]
-    set right [expr {int(2*($i+1)+1  -1)}]
-
-    # left, right are tested as < rather than <= because they are
-    # in A[0...n-1]
-    if {
-	$left < $heapSize &&
-	( !$rev && [lindex $A $left] > [lindex $A $i] ||
-	   $rev && [lindex $A $left] < [lindex $A $i] )
-    } {
-	set largest $left
-    } else {
-	set largest $i
-    }
-
-    if {
-	$right < $heapSize &&
-	( !$rev && [lindex $A $right] > [lindex $A $largest] ||
-	   $rev && [lindex $A $right] < [lindex $A $largest] )
-    } {
-	set largest $right
-    }
-
-    if { $largest != $i } {
-	switch $rowCol {
-	    r { SwapRows    $name $i $largest }
-	    c { SwapColumns $name $i $largest }
-	}
-	SortMaxHeapify $name $largest $key $rowCol $heapSize $rev
-    }
-    return
-}
-
-# ::struct::matrix::CheckSerialization --
-#
-#	Validate the serialization of a matrix.
-#
-# Arguments:
-#	ser	Serialization to validate.
-#	rvar	Variable to store the number of rows into.
-#	cvar	Variable to store the number of columns into.
-#	dvar	Variable to store the matrix data into.
-#
-# Results:
-#	none
-
-proc ::struct::matrix::CheckSerialization {ser rvar cvar dvar} {
-    upvar 1 \
-	    $rvar   rows    \
-	    $cvar   columns \
-	    $dvar   data
-
-    # Overall length ok ?
-    if {[llength $ser] != 3} {
-	return -code error \
-		"error in serialization: list length not 3."
-    }
-
-    foreach {r c d} $ser break
-
-    # Check rows/columns information
-
-    if {![string is integer -strict $r] || ($r < 0)} {
-	return -code error \
-		"error in serialization: bad number of rows \"$r\"."
-    }
-    if {![string is integer -strict $c] || ($c < 0)} {
-	return -code error \
-		"error in serialization: bad number of columns \"$c\"."
-    }
-
-    # Validate data against rows/columns. We can have less data than
-    # rows or columns, the missing cells will be initialized to the
-    # empty string. But too many is considered as a signal of
-    # being something wrong.
-
-    if {[llength $d] > $r} {
-	return -code error \
-		"error in serialization: data for to many rows."	
-    }
-    foreach rv $d {
-	if {[llength $rv] > $c} {
-	    return -code error \
-		    "error in serialization: data for to many columns."	
-	}
-    }
-
-    # Ok. The data is now ready for the caller.
-
-    set data    $d
-    set rows    $r
-    set columns $c
-    return
-}
-
-# ::struct::matrix::DeleteRows --
-#
-#	Deletes n rows from the bottom of the matrix.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	n	The number of rows to delete (no greater than the number of rows).
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::DeleteRows {name n} {
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher rows down and then delete the
-    # superfluous data in the old last row. Move the data in the
-    # height cache too, take partial fill into account there too.
-    # Invalidate the width cache for all columns.
-
-    set rowstart [expr {$rows - $n}]
-
-    for {set c 0} {$c < $columns} {incr c} {
-	for {set r $rowstart} {$r < $rows} {incr r} {
-	    unset data($c,$r)
-	    catch {unset rowh($r)}
-	}
-	catch {unset colw($c)}
-    }
-    set rows $rowstart
-    return
-}
-
-# ::struct::matrix::DeleteColumns --
-#
-#	Deletes n columns from the right of the matrix.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	n	The number of columns to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::DeleteColumns {name n} {
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher columns down and then delete the
-    # superfluous data in the old last column. Move the data in the
-    # width cache too, take partial fill into account there too.
-    # Invalidate the height cache for all rows.
-
-    set colstart [expr {$columns - $n}]
-
-    for {set r 0} {$r < $rows} {incr r} {
-	for {set c $colstart} {$c < $columns} {incr c} {
-	    unset data($c,$r)
-	    catch {unset colw($c)}
-	}
-	catch {unset rowh($r)}
-    }
-    set columns $colstart
-    return
-}
-
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'matrix::matrix' into the general structure namespace.
-    namespace import -force matrix::matrix
-    namespace export matrix
-}
-package provide struct::matrix 2.0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/matrix1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/matrix1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2287 +1,0 @@
-# matrix.tcl --
-#
-#	Implementation of a matrix data structure for Tcl.
-#
-# Copyright (c) 2001 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# Heapsort code Copyright (c) 2003 by Edwin A. Suominen <ed@eepatents.com>,
-# based on concepts in "Introduction to Algorithms" by Thomas H. Cormen et al.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: matrix1.tcl,v 1.3 2005/09/28 04:51:24 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::struct {}
-
-namespace eval ::struct::matrix {
-    # Data storage in the matrix module
-    # -------------------------------
-    #
-    # One namespace per object, containing
-    #
-    # - Two scalar variables containing the current number of rows and columns.
-    # - Four array variables containing the array data, the caches for
-    #   rowheights and columnwidths and the information about linked arrays.
-    #
-    # The variables are
-    # - columns #columns in data
-    # - rows    #rows in data
-    # - data    cell contents
-    # - colw    cache of columnwidths
-    # - rowh    cache of rowheights
-    # - link    information about linked arrays
-    # - lock    boolean flag to disable MatTraceIn while in MatTraceOut [#532783]
-    # - unset   string used to convey information about 'unset' traces from MatTraceIn to MatTraceOut.
-
-    # counter is used to give a unique name for unnamed matrices
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new matrix
-    namespace export matrix
-}
-
-# ::struct::matrix::matrix --
-#
-#	Create a new matrix with a given name; if no name is given, use
-#	matrixX, where X is a number.
-#
-# Arguments:
-#	name	Optional name of the matrix; if null or not given, generate one.
-#
-# Results:
-#	name	Name of the matrix created
-
-proc ::struct::matrix::matrix {{name ""}} {
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "matrix${counter}"
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 namespace current]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-        set name "$ns$name"
-    }
-
-    if { [llength [info commands $name]] } {
-	return -code error "command \"$name\" already exists, unable to create matrix"
-    }
-
-    # Set up the namespace
-    namespace eval $name {
-	variable columns 0
-	variable rows    0
-
-	variable data
-	variable colw
-	variable rowh
-	variable link
-	variable lock
-	variable unset
-
-	array set data  {}
-	array set colw  {}
-	array set rowh  {}
-	array set link  {}
-	set       lock  0
-	set       unset {}
-    }
-
-    # Create the command to manipulate the matrix
-    interp alias {} $name {} ::struct::matrix::MatrixProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::matrix::MatrixProc --
-#
-#	Command that processes all matrix object commands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::MatrixProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub _$cmd
-    if {[llength [info commands ::struct::matrix::$sub]] == 0} {
-	set optlist [lsort [info commands ::struct::matrix::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    if {[string match __* $p]} {continue}
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_add --
-#
-#	Command that processes all 'add' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'add' to invoke.
-#	args	Arguments for subcommand of 'add'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_add {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name add option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __add_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__add_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_delete --
-#
-#	Command that processes all 'delete' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'delete' to invoke.
-#	args	Arguments for subcommand of 'delete'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_delete {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name delete option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __delete_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__delete_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_format --
-#
-#	Command that processes all 'format' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'format' to invoke.
-#	args	Arguments for subcommand of 'format'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_format {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name format option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __format_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__format_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_get --
-#
-#	Command that processes all 'get' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'get' to invoke.
-#	args	Arguments for subcommand of 'get'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_get {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name get option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __get_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__get_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_insert --
-#
-#	Command that processes all 'insert' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'insert' to invoke.
-#	args	Arguments for subcommand of 'insert'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_insert {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name insert option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __insert_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__insert_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 9 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_search --
-#
-#	Command that processes all 'search' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	args	Arguments for search.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_search {name args} {
-    set mode   exact
-    set nocase 0
-
-    while {1} {
-	switch -glob -- [lindex $args 0] {
-	    -exact - -glob - -regexp {
-		set mode [string range [lindex $args 0] 1 end]
-		set args [lrange $args 1 end]
-	    }
-	    -nocase {
-		set nocase 1
-	    }
-	    -* {
-		return -code error \
-			"invalid option \"[lindex $args 0]\":\
-			should be -nocase, -exact, -glob, or -regexp"
-	    }
-	    default {
-		break
-	    }
-	}
-    }
-
-    # Possible argument signatures after option processing
-    #
-    # \ | args
-    # --+--------------------------------------------------------
-    # 2 | all pattern
-    # 3 | row row pattern, column col pattern
-    # 6 | rect ctl rtl cbr rbr pattern
-    #
-    # All range specifications are internally converted into a
-    # rectangle.
-
-    switch -exact -- [llength $args] {
-	2 - 3 - 6 {}
-	default {
-	    return -code error \
-		"wrong # args: should be\
-		\"$name search ?option...? (all|row row|column col|rect c r c r) pattern\""
-	}
-    }
-
-    set range   [lindex $args 0]
-    set pattern [lindex $args end]
-    set args    [lrange $args 1 end-1]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    switch -exact -- $range {
-	all {
-	    set ctl 0 ; set cbr $columns ; incr cbr -1
-	    set rtl 0 ; set rbr $rows    ; incr rbr -1
-	}
-	column {
-	    set ctl [ChkColumnIndex $name [lindex $args 0]]
-	    set cbr $ctl
-	    set rtl 0       ; set rbr $rows ; incr rbr -1
-	}
-	row {
-	    set rtl [ChkRowIndex $name [lindex $args 0]]
-	    set ctl 0    ; set cbr $columns ; incr cbr -1
-	    set rbr $rtl
-	}
-	rect {
-	    foreach {ctl rtl cbr rbr} $args break
-	    set ctl [ChkColumnIndex $name $ctl]
-	    set rtl [ChkRowIndex    $name $rtl]
-	    set cbr [ChkColumnIndex $name $cbr]
-	    set rbr [ChkRowIndex    $name $rbr]
-	    if {($ctl > $cbr) || ($rtl > $rbr)} {
-		return -code error "Invalid cell indices, wrong ordering"
-	    }
-	}
-	default {
-	    return -code error "invalid range spec \"$range\": should be all, column, row, or rect"
-	}
-    }
-
-    if {$nocase} {
-	set pattern [string tolower $pattern]
-    }
-
-    set matches [list]
-    for {set r $rtl} {$r <= $rbr} {incr r} {
-	for {set c $ctl} {$c <= $cbr} {incr c} {
-	    set v  $data($c,$r)
-	    if {$nocase} {
-		set v [string tolower $v]
-	    }
-	    switch -exact -- $mode {
-		exact  {set matched [string equal $pattern $v]}
-		glob   {set matched [string match $pattern $v]}
-		regexp {set matched [regexp --    $pattern $v]}
-	    }
-	    if {$matched} {
-		lappend matches [list $c $r]
-	    }
-	}
-    }
-    return $matches
-}
-
-# ::struct::matrix::_set --
-#
-#	Command that processes all 'set' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'set' to invoke.
-#	args	Arguments for subcommand of 'set'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_set {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name set option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __set_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__set_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 6 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::_sort --
-#
-#	Command that processes all 'sort' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'sort' to invoke.
-#	args	Arguments for subcommand of 'sort'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_sort {name cmd args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name sort option ?arg arg ...?\""
-    }
-    if {[string equal $cmd "rows"]} {
-	set code   r
-	set byrows 1
-    } elseif {[string equal $cmd "columns"]} {
-	set code   c
-	set byrows 0
-    } else {
-	return -code error \
-		"bad option \"$cmd\": must be columns, or rows"
-    }
-
-    set revers 0 ;# Default: -increasing
-    while {1} {
-	switch -glob -- [lindex $args 0] {
-	    -increasing {set revers 0}
-	    -decreasing {set revers 1}
-	    default {
-		if {[llength $args] > 1} {
-		    return -code error \
-			"invalid option \"[lindex $args 0]\":\
-			should be -increasing, or -decreasing"
-		}
-		break
-	    }
-	}
-	set args [lrange $args 1 end]
-    }
-    # ASSERT: [llength $args] == 1
-
-    if {[llength $args] != 1} {
-	return -code error "wrong # args: should be \"$name sort option ?arg arg ...?\""
-    }
-
-    set key [lindex $args 0]
-
-    if {$byrows} {
-	set key [ChkColumnIndex $name $key]
-	variable ${name}::rows
-
-	# Adapted by EAS from BUILD-MAX-HEAP(A) of CRLS 6.3
-	set heapSize $rows
-    } else {
-	set key [ChkRowIndex $name $key]
-	variable ${name}::columns
-
-	# Adapted by EAS from BUILD-MAX-HEAP(A) of CRLS 6.3
-	set heapSize $columns
-    }
-
-    for {set i [expr {int($heapSize/2)-1}]} {$i>=0} {incr i -1} {
-	SortMaxHeapify $name $i $key $code $heapSize $revers
-    }
-
-    # Adapted by EAS from remainder of HEAPSORT(A) of CRLS 6.4
-    for {set i [expr {$heapSize-1}]} {$i>=1} {incr i -1} {
-	if {$byrows} {
-	    SwapRows $name 0 $i
-	} else {
-	    SwapColumns $name 0 $i
-	}
-	incr heapSize -1
-	SortMaxHeapify $name 0 $key $code $heapSize $revers
-    }
-    return
-}
-
-# ::struct::matrix::_swap --
-#
-#	Command that processes all 'swap' subcommands.
-#
-# Arguments:
-#	name	Name of the matrix object to manipulate.
-#	cmd	Subcommand of 'swap' to invoke.
-#	args	Arguments for subcommand of 'swap'.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::matrix::_swap {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name swap option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub __swap_$cmd
-    if { [llength [info commands ::struct::matrix::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::matrix::__swap_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 7 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    uplevel 1 [linsert $args 0 ::struct::matrix::$sub $name]
-}
-
-# ::struct::matrix::__add_column --
-#
-#	Extends the matrix by one column and then acts like
-#	"setcolumn" (see below) on this new column if there were
-#	"values" supplied. Without "values" the new cells will be set
-#	to the empty string. The new column is appended immediately
-#	behind the last existing column.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	values	Optional values to set into the new row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_column {name {values {}}} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::rowh
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - The new column is not added to the width cache, the other
-    #   columns are not touched, the cache therefore unchanged.
-    # - The rows are either removed from the height cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set r 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset rowh($r)}
-	} ; # {else leave the row unchanged}
-	set data($columns,$r) $v
-	incr r
-    }
-    incr columns
-    return
-}
-
-# ::struct::matrix::__add_row --
-#
-#	Extends the matrix by one row and then acts like "setrow" (see
-#	below) on this new row if there were "values"
-#	supplied. Without "values" the new cells will be set to the
-#	empty string. The new row is appended immediately behind the
-#	last existing row.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	values	Optional values to set into the new row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_row {name {values {}}} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - The new row is not added to the height cache, the other
-    #   rows are not touched, the cache therefore unchanged.
-    # - The columns are either removed from the width cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set c 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset colw($c)}
-	} ; # {else leave the row unchanged}
-	set data($c,$rows) $v
-	incr c
-    }
-    incr rows
-    return
-}
-
-# ::struct::matrix::__add_columns --
-#
-#	Extends the matrix by "n" columns. The new cells will be set
-#	to the empty string. The new columns are appended immediately
-#	behind the last existing column. A value of "n" equal to or
-#	smaller than 0 is not allowed.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of new columns to create.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_columns {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    # The new values set into the cell is always the empty
-    # string. These have a length and height of 0, i.e. the don't
-    # influence cached widths and heights as they are at least that
-    # big. IOW there is no need to touch and change the width and
-    # height caches.
-
-    while {$n > 0} {
-	for {set r 0} {$r < $rows} {incr r} {
-	    set data($columns,$r) ""
-	}
-	incr columns
-	incr n -1
-    }
-
-    return
-}
-
-# ::struct::matrix::__add_rows --
-#
-#	Extends the matrix by "n" rows. The new cells will be set to
-#	the empty string. The new rows are appended immediately behind
-#	the last existing row. A value of "n" equal to or smaller than
-#	0 is not allowed.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	n	The number of new rows to create.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__add_rows {name n} {
-    if {$n <= 0} {
-	return -code error "A value of n <= 0 is not allowed"
-    }
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-
-    # The new values set into the cell is always the empty
-    # string. These have a length and height of 0, i.e. the don't
-    # influence cached widths and heights as they are at least that
-    # big. IOW there is no need to touch and change the width and
-    # height caches.
-
-    while {$n > 0} {
-	for {set c 0} {$c < $columns} {incr c} {
-	    set data($c,$rows) ""
-	}
-	incr rows
-	incr n -1
-    }
-    return
-}
-
-# ::struct::matrix::_cells --
-#
-#	Returns the number of cells currently managed by the
-#	matrix. This is the product of "rows" and "columns".
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of cells in the matrix.
-
-proc ::struct::matrix::_cells {name} {
-    variable ${name}::rows
-    variable ${name}::columns
-    return [expr {$rows * $columns}]
-}
-
-# ::struct::matrix::_cellsize --
-#
-#	Returns the length of the string representation of the value
-#	currently contained in the addressed cell.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the cell to query
-#	row	Row index of the cell to query
-#
-# Results:
-#	The number of cells in the matrix.
-
-proc ::struct::matrix::_cellsize {name column row} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-    return [string length $data($column,$row)]
-}
-
-# ::struct::matrix::_columns --
-#
-#	Returns the number of columns currently managed by the
-#	matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of columns in the matrix.
-
-proc ::struct::matrix::_columns {name} {
-    variable ${name}::columns
-    return $columns
-}
-
-# ::struct::matrix::_columnwidth --
-#
-#	Returns the length of the longest string representation of all
-#	the values currently contained in the cells of the addressed
-#	column if these are all spanning only one line. For cell
-#	values spanning multiple lines the length of their longest
-#	line goes into the computation.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	The index of the column whose width is asked for.
-#
-# Results:
-#	See description.
-
-proc ::struct::matrix::_columnwidth {name column} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::colw
-
-    if {![info exists colw($column)]} {
-	variable ${name}::rows
-	variable ${name}::data
-
-	set width 0
-	for {set r 0} {$r < $rows} {incr r} {
-	    foreach line [split $data($column,$r) \n] {
-		set len [string length $line]
-		if {$len > $width} {
-		    set width $len
-		}
-	    }
-	}
-
-	set colw($column) $width
-    }
-
-    return $colw($column)
-}
-
-# ::struct::matrix::__delete_column --
-#
-#	Deletes the specified column from the matrix and shifts all
-#	columns with higher indices one index down.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	The index of the column to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_column {name column} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher columns down and then delete the
-    # superfluous data in the old last column. Move the data in the
-    # width cache too, take partial fill into account there too.
-    # Invalidate the height cache for all rows.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	for {set c $column; set cn [expr {$c + 1}]} {$cn < $columns} {incr c ; incr cn} {
-	    set data($c,$r) $data($cn,$r)
-	    if {[info exists colw($cn)]} {
-		set colw($c) $colw($cn)
-		unset colw($cn)
-	    }
-	}
-	unset data($c,$r)
-	catch {unset rowh($r)}
-    }
-    incr columns -1
-    return
-}
-
-# ::struct::matrix::__delete_row --
-#
-#	Deletes the specified row from the matrix and shifts all
-#	row with higher indices one index down.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	The index of the row to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__delete_row {name row} {
-    set row [ChkRowIndex $name $row]
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::columns
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    # Move all data from the higher rows down and then delete the
-    # superfluous data in the old last row. Move the data in the
-    # height cache too, take partial fill into account there too.
-    # Invalidate the width cache for all columns.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	for {set r $row; set rn [expr {$r + 1}]} {$rn < $rows} {incr r ; incr rn} {
-	    set data($c,$r) $data($c,$rn)
-	    if {[info exists rowh($rn)]} {
-		set rowh($r) $rowh($rn)
-		unset rowh($rn)
-	    }
-	}
-	unset data($c,$r)
-	catch {unset colw($c)}
-    }
-    incr rows -1
-    return
-}
-
-# ::struct::matrix::_destroy --
-#
-#	Destroy a matrix, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the matrix to destroy.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::_destroy {name} {
-    variable ${name}::link
-
-    # Unlink all existing arrays before destroying the object so that
-    # we don't leave dangling references / traces.
-
-    foreach avar [array names link] {
-	_unlink $name $avar
-    }
-
-    namespace delete $name
-    interp alias {}  $name {}
-}
-
-# ::struct::matrix::__format_2string --
-#
-#	Formats the matrix using the specified report object and
-#	returns the string containing the result of this
-#	operation. The report has to support the "printmatrix" method.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	report	Name of the report object specifying the formatting.
-#
-# Results:
-#	A string containing the formatting result.
-
-proc ::struct::matrix::__format_2string {name {report {}}} {
-    if {$report == {}} {
-	# Use an internal hardwired simple report to format the matrix.
-	# 1. Go through all columns and compute the column widths.
-	# 2. Then iterate through all rows and dump then into a
-	#    string, formatted to the number of characters per columns
-
-	array set cw {}
-	set cols [_columns $name]
-	for {set c 0} {$c < $cols} {incr c} {
-	    set cw($c) [_columnwidth $name $c]
-	}
-
-	set result [list]
-	set n [_rows $name]
-	for {set r 0} {$r < $n} {incr r} {
-	    set rh [_rowheight $name $r]
-	    if {$rh < 2} {
-		# Simple row.
-		set line [list]
-		for {set c 0} {$c < $cols} {incr c} {
-		    set val [__get_cell $name $c $r]
-		    lappend line "$val[string repeat " " [expr {$cw($c)-[string length $val]}]]"
-		}
-		lappend result [join $line " "]
-	    } else {
-		# Complex row, multiple passes
-		for {set h 0} {$h < $rh} {incr h} {
-		    set line [list]
-		    for {set c 0} {$c < $cols} {incr c} {
-			set val [lindex [split [__get_cell $name $c $r] \n] $h]
-			lappend line "$val[string repeat " " [expr {$cw($c)-[string length $val]}]]"
-		    }
-		    lappend result [join $line " "]
-		}
-	    }
-	}
-	return [join $result \n]
-    } else {
-	return [$report printmatrix $name]
-    }
-}
-
-# ::struct::matrix::__format_2chan --
-#
-#	Formats the matrix using the specified report object and
-#	writes the string containing the result of this operation into
-#	the channel. The report has to support the
-#	"printmatrix2channel" method.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	report	Name of the report object specifying the formatting.
-#	chan	Handle of the channel to write to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__format_2chan {name {report {}} {chan stdout}} {
-    if {$report == {}} {
-	# Use an internal hardwired simple report to format the matrix.
-	# We delegate this to the string formatter and print its result.
-	puts -nonewline [__format_2string $name]
-    } else {
-	$report printmatrix2channel $name $chan
-    }
-    return
-}
-
-# ::struct::matrix::__get_cell --
-#
-#	Returns the value currently contained in the cell identified
-#	by row and column index.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Column index of the addressed cell.
-#	row	Row index of the addressed cell.
-#
-# Results:
-#	value	Value currently stored in the addressed cell.
-
-proc ::struct::matrix::__get_cell {name column row} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-    return $data($column,$row)
-}
-
-# ::struct::matrix::__get_column --
-#
-#	Returns a list containing the values from all cells in the
-#	column identified by the index. The contents of the cell in
-#	row 0 are stored as the first element of this list.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Column index of the addressed cell.
-#
-# Results:
-#	List of values stored in the addressed row.
-
-proc ::struct::matrix::__get_column {name column} {
-    set column [ChkColumnIndex $name $column]
-    return     [GetColumn      $name $column]
-}
-
-proc ::struct::matrix::GetColumn {name column} {
-    variable ${name}::data
-    variable ${name}::rows
-
-    set result [list]
-    for {set r 0} {$r < $rows} {incr r} {
-	lappend result $data($column,$r)
-    }
-    return $result
-}
-
-# ::struct::matrix::__get_rect --
-#
-#	Returns a list of lists of cell values. The values stored in
-#	the result come from the submatrix whose top-left and
-#	bottom-right cells are specified by "column_tl", "row_tl" and
-#	"column_br", "row_br" resp. Note that the following equations
-#	have to be true: column_tl <= column_br and row_tl <= row_br.
-#	The result is organized as follows: The outer list is the list
-#	of rows, its elements are lists representing a single row. The
-#	row with the smallest index is the first element of the outer
-#	list. The elements of the row lists represent the selected
-#	cell values. The cell with the smallest index is the first
-#	element in each row list.
-#
-# Arguments:
-#	name		Name of the matrix.
-#	column_tl	Column index of the top-left cell of the area.
-#	row_tl		Row index of the top-left cell of the the area
-#	column_br	Column index of the bottom-right cell of the area.
-#	row_br		Row index of the bottom-right cell of the the area
-#
-# Results:
-#	List of a list of values stored in the addressed area.
-
-proc ::struct::matrix::__get_rect {name column_tl row_tl column_br row_br} {
-    set column_tl [ChkColumnIndex $name $column_tl]
-    set row_tl    [ChkRowIndex    $name $row_tl]
-    set column_br [ChkColumnIndex $name $column_br]
-    set row_br    [ChkRowIndex    $name $row_br]
-
-    if {
-	($column_tl > $column_br) ||
-	($row_tl    > $row_br)
-    } {
-	return -code error "Invalid cell indices, wrong ordering"
-    }
-
-    variable ${name}::data
-    set result [list]
-
-    for {set r $row_tl} {$r <= $row_br} {incr r} {
-	set row [list]
-	for {set c $column_tl} {$c <= $column_br} {incr c} {
-	    lappend row $data($c,$r)
-	}
-	lappend result $row
-    }
-
-    return $result
-}
-
-# ::struct::matrix::__get_row --
-#
-#	Returns a list containing the values from all cells in the
-#	row identified by the index. The contents of the cell in
-#	column 0 are stored as the first element of this list.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Row index of the addressed cell.
-#
-# Results:
-#	List of values stored in the addressed row.
-
-proc ::struct::matrix::__get_row {name row} {
-    set row [ChkRowIndex $name $row]
-    return  [GetRow      $name $row]
-}
-
-proc ::struct::matrix::GetRow {name row} {
-    variable ${name}::data
-    variable ${name}::columns
-
-    set result [list]
-    for {set c 0} {$c < $columns} {incr c} {
-	lappend result $data($c,$row)
-    }
-    return $result
-}
-
-# ::struct::matrix::__insert_column --
-#
-#	Extends the matrix by one column and then acts like
-#	"setcolumn" (see below) on this new column if there were
-#	"values" supplied. Without "values" the new cells will be set
-#	to the empty string. The new column is inserted just before
-#	the column specified by the given index. This means, if
-#	"column" is less than or equal to zero, then the new column is
-#	inserted at the beginning of the matrix, before the first
-#	column. If "column" has the value "Bend", or if it is greater
-#	than or equal to the number of columns in the matrix, then the
-#	new column is appended to the matrix, behind the last
-#	column. The old column at the chosen index and all columns
-#	with higher indices are shifted one index upward.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Index of the column where to insert.
-#	values	Optional values to set the cells to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__insert_column {name column {values {}}} {
-    # Allow both negative and too big indices.
-    set column [ChkColumnIndexAll $name $column]
-
-    variable ${name}::columns
-
-    if {$column > $columns} {
-	# Same as 'addcolumn'
-	__add_column $name $values
-	return
-    }
-
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    set firstcol $column
-    if {$firstcol < 0} {
-	set firstcol 0
-    }
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-    # Invalidate all rows, move all columns
-
-    # Move all data from the higher columns one up and then insert the
-    # new data into the freed space. Move the data in the
-    # width cache too, take partial fill into account there too.
-    # Invalidate the height cache for all rows.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	for {set cn $columns ; set c [expr {$cn - 1}]} {$c >= $firstcol} {incr c -1 ; incr cn -1} {
-	    set data($cn,$r) $data($c,$r)
-	    if {[info exists colw($c)]} {
-		set colw($cn) $colw($c)
-		unset colw($c)
-	    }
-	}
-	set data($firstcol,$r) [lindex $values $r]
-	catch {unset rowh($r)}
-    }
-    incr columns
-    return
-}
-
-# ::struct::matrix::__insert_row --
-#
-#	Extends the matrix by one row and then acts like "setrow" (see
-#	below) on this new row if there were "values"
-#	supplied. Without "values" the new cells will be set to the
-#	empty string. The new row is inserted just before the row
-#	specified by the given index. This means, if "row" is less
-#	than or equal to zero, then the new row is inserted at the
-#	beginning of the matrix, before the first row. If "row" has
-#	the value "end", or if it is greater than or equal to the
-#	number of rows in the matrix, then the new row is appended to
-#	the matrix, behind the last row. The old row at that index and
-#	all rows with higher indices are shifted one index upward.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Index of the row where to insert.
-#	values	Optional values to set the cells to.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__insert_row {name row {values {}}} {
-    # Allow both negative and too big indices.
-    set row [ChkRowIndexAll $name $row]
-
-    variable ${name}::rows
-
-    if {$row > $rows} {
-	# Same as 'addrow'
-	__add_row $name $values
-	return
-    }
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    set firstrow $row
-    if {$firstrow < 0} {
-	set firstrow 0
-    }
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-    # Invalidate all columns, move all rows
-
-    # Move all data from the higher rows one up and then insert the
-    # new data into the freed space. Move the data in the
-    # height cache too, take partial fill into account there too.
-    # Invalidate the width cache for all columns.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	for {set rn $rows ; set r [expr {$rn - 1}]} {$r >= $firstrow} {incr r -1 ; incr rn -1} {
-	    set data($c,$rn) $data($c,$r)
-	    if {[info exists rowh($r)]} {
-		set rowh($rn) $rowh($r)
-		unset rowh($r)
-	    }
-	}
-	set data($c,$firstrow) [lindex $values $c]
-	catch {unset colw($c)}
-    }
-    incr rows
-    return
-}
-
-# ::struct::matrix::_link --
-#
-#	Links the matrix to the specified array variable. This means
-#	that the contents of all cells in the matrix is stored in the
-#	array too, with all changes to the matrix propagated there
-#	too. The contents of the cell "(column,row)" is stored in the
-#	array using the key "column,row". If the option "-transpose"
-#	is specified the key "row,column" will be used instead. It is
-#	possible to link the matrix to more than one array. Note that
-#	the link is bidirectional, i.e. changes to the array are
-#	mirrored in the matrix too.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	option	Either empty of '-transpose'.
-#	avar	Name of the variable to link to
-#
-# Results:
-#	None
-
-proc ::struct::matrix::_link {name args} {
-    switch -exact -- [llength $args] {
-	0 {
-	    return -code error "$name: wrong # args: link ?-transpose? arrayvariable"
-	}
-	1 {
-	    set transpose 0
-	    set variable  [lindex $args 0]
-	}
-	2 {
-	    foreach {t variable} $args break
-	    if {[string compare $t -transpose]} {
-		return -code error "$name: illegal syntax: link ?-transpose? arrayvariable"
-	    }
-	    set transpose 1
-	}
-	default {
-	    return -code error "$name: wrong # args: link ?-transpose? arrayvariable"
-	}
-    }
-
-    variable ${name}::link
-
-    if {[info exists link($variable)]} {
-	return -code error "$name link: Variable \"$variable\" already linked to matrix"
-    }
-
-    # Ok, a new variable we are linked to. Record this information,
-    # dump our current contents into the array, at last generate the
-    # traces actually performing the link.
-
-    set link($variable) $transpose
-
-    upvar #0 $variable array
-    variable ${name}::data
-
-    foreach key [array names data] {
-	foreach {c r} [split $key ,] break
-	if {$transpose} {
-	    set array($r,$c) $data($key)
-	} else {
-	    set array($c,$r) $data($key)
-	}
-    }
-
-    trace variable array wu [list ::struct::matrix::MatTraceIn  $variable $name]
-    trace variable data  w  [list ::struct::matrix::MatTraceOut $variable $name]
-    return
-}
-
-# ::struct::matrix::_links --
-#
-#	Retrieves the names of all array variable the matrix is
-#	officialy linked to.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	List of variables the matrix is linked to.
-
-proc ::struct::matrix::_links {name} {
-    variable ${name}::link
-    return [array names link]
-}
-
-# ::struct::matrix::_rowheight --
-#
-#	Returns the height of the specified row in lines. This is the
-#	highest number of lines spanned by a cell over all cells in
-#	the row.
-#
-# Arguments:
-#	name	Name of the matrix
-#	row	Index of the row queried for its height
-#
-# Results:
-#	The height of the specified row in lines.
-
-proc ::struct::matrix::_rowheight {name row} {
-    set row [ChkRowIndex $name $row]
-
-    variable ${name}::rowh
-
-    if {![info exists rowh($row)]} {
-	variable ${name}::columns
-	variable ${name}::data
-
-	set height 1
-	for {set c 0} {$c < $columns} {incr c} {
-	    set cheight [llength [split $data($c,$row) \n]]
-	    if {$cheight > $height} {
-		set height $cheight
-	    }
-	}
-
-	set rowh($row) $height
-    }
-    return $rowh($row)
-}
-
-# ::struct::matrix::_rows --
-#
-#	Returns the number of rows currently managed by the matrix.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#
-# Results:
-#	The number of rows in the matrix.
-
-proc ::struct::matrix::_rows {name} {
-    variable ${name}::rows
-    return $rows
-}
-
-# ::struct::matrix::__set_cell --
-#
-#	Sets the value in the cell identified by row and column index
-#	to the data in the third argument.
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the cell to set.
-#	row	Row index of the cell to set.
-#	value	THe new value of the cell.
-#
-# Results:
-#	None.
- 
-proc ::struct::matrix::__set_cell {name column row value} {
-    set column [ChkColumnIndex $name $column]
-    set row    [ChkRowIndex    $name $row]
-
-    variable ${name}::data
-
-    if {![string compare $value $data($column,$row)]} {
-	# No change, ignore call!
-	return
-    }
-
-    set data($column,$row) $value
-
-    if {$value != {}} {
-	variable ${name}::colw
-	variable ${name}::rowh
-	catch {unset colw($column)}
-	catch {unset rowh($row)}
-    }
-    return
-}
-
-# ::struct::matrix::__set_column --
-#
-#	Sets the values in the cells identified by the column index to
-#	the elements of the list provided as the third argument. Each
-#	element of the list is assigned to one cell, with the first
-#	element going into the cell in row 0 and then upward. If there
-#	are less values in the list than there are rows the remaining
-#	rows are set to the empty string. If there are more values in
-#	the list than there are rows the superfluous elements are
-#	ignored. The matrix is not extended by this operation.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	column	Index of the column to set.
-#	values	Values to set into the column.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_column {name column values} {
-    set column [ChkColumnIndex $name $column]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::rowh
-    variable ${name}::colw
-
-    if {[set l [llength $values]] < $rows} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $rows} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $rows} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$rows - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - Invalidate the column in the width cache.
-    # - The rows are either removed from the height cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set r 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset rowh($r)}
-	} ; # {else leave the row unchanged}
-	set data($column,$r) $v
-	incr r
-    }
-    catch {unset colw($column)}
-    return
-}
-
-# ::struct::matrix::__set_rect --
-#
-#	Takes a list of lists of cell values and writes them into the
-#	submatrix whose top-left cell is specified by the two
-#	indices. If the sublists of the outerlist are not of equal
-#	length the shorter sublists will be filled with empty strings
-#	to the length of the longest sublist. If the submatrix
-#	specified by the top-left cell and the number of rows and
-#	columns in the "values" extends beyond the matrix we are
-#	modifying the over-extending parts of the values are ignored,
-#	i.e. essentially cut off. This subcommand expects its input in
-#	the format as returned by "getrect".
-#
-# Arguments:
-#	name	Name of the matrix object.
-#	column	Column index of the topleft cell to set.
-#	row	Row index of the topleft cell to set.
-#	values	Values to set.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_rect {name column row values} {
-    # Allow negative indices!
-    set column [ChkColumnIndexNeg $name $column]
-    set row    [ChkRowIndexNeg    $name $row]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    if {$row < 0} {
-	# Remove rows from the head of values to restrict it to the
-	# overlapping area.
-
-	set values [lrange $values [expr {0 - $row}] end]
-	set row 0
-    }
-
-    # Restrict it at the end too.
-    if {($row + [llength $values]) > $rows} {
-	set values [lrange $values 0 [expr {$rows - $row - 1}]]
-    }
-
-    # Same for columns, but store it in some vars as this is required
-    # in a loop.
-    set firstcol 0
-    if {$column < 0} {
-	set firstcol [expr {0 - $column}]
-	set column 0
-    }
-
-    # Now pan through values and area and copy the external data into
-    # the matrix.
-
-    set r $row
-    foreach line $values {
-	set line [lrange $line $firstcol end]
-
-	set l [expr {$column + [llength $line]}]
-	if {$l > $columns} {
-	    set line [lrange $line 0 [expr {$columns - $column - 1}]]
-	} elseif {$l < [expr {$columns - $firstcol}]} {
-	    # We have to take the offset into the line into account
-	    # or we add fillers we don't need, overwriting part of the
-	    # data array we shouldn't.
-
-	    for {} {$l < [expr {$columns - $firstcol}]} {incr l} {
-		lappend line {}
-	    }
-	}
-
-	set c $column
-	foreach cell $line {
-	    if {$cell != {}} {
-		catch {unset rowh($r)}
-		catch {unset colw($c)}
-	    }
-	    set data($c,$r) $cell
-	    incr c
-	}
-	incr r
-    }
-    return
-}
-
-# ::struct::matrix::__set_row --
-#
-#	Sets the values in the cells identified by the row index to
-#	the elements of the list provided as the third argument. Each
-#	element of the list is assigned to one cell, with the first
-#	element going into the cell in column 0 and then upward. If
-#	there are less values in the list than there are columns the
-#	remaining columns are set to the empty string. If there are
-#	more values in the list than there are columns the superfluous
-#	elements are ignored. The matrix is not extended by this
-#	operation.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row	Index of the row to set.
-#	values	Values to set into the row.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__set_row {name row values} {
-    set row [ChkRowIndex $name $row]
-
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rows
-    variable ${name}::colw
-    variable ${name}::rowh
-
-    if {[set l [llength $values]] < $columns} {
-	# Missing values. Fill up with empty strings
-
-	for {} {$l < $columns} {incr l} {
-	    lappend values {}
-	}
-    } elseif {[llength $values] > $columns} {
-	# To many values. Remove the superfluous items
-	set values [lrange $values 0 [expr {$columns - 1}]]
-    }
-
-    # "values" now contains the information to set into the array.
-    # Regarding the width and height caches:
-
-    # - Invalidate the row in the height cache.
-    # - The columns are either removed from the width cache or left
-    #   unchanged, depending on the contents set into the cell.
-
-    set c 0
-    foreach v $values {
-	if {$v != {}} {
-	    # Data changed unpredictably, invalidate cache
-	    catch {unset colw($c)}
-	} ; # {else leave the row unchanged}
-	set data($c,$row) $v
-	incr c
-    }
-    catch {unset rowh($row)}
-    return
-}
-
-# ::struct::matrix::__swap_columns --
-#
-#	Swaps the contents of the two specified columns.
-#
-# Arguments:
-#	name		Name of the matrix.
-#	column_a	Index of the first column to swap
-#	column_b	Index of the second column to swap
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__swap_columns {name column_a column_b} {
-    set column_a [ChkColumnIndex $name $column_a]
-    set column_b [ChkColumnIndex $name $column_b]
-    return [SwapColumns $name $column_a $column_b]
-}
-
-proc ::struct::matrix::SwapColumns {name column_a column_b} {
-    variable ${name}::data
-    variable ${name}::rows
-    variable ${name}::colw
-
-    # Note: This operation does not influence the height cache for all
-    # rows and the width cache only insofar as its contents has to be
-    # swapped too for the two columns we are touching. Note that the
-    # cache might be partially filled or not at all, so we don't have
-    # to "swap" in some situations.
-
-    for {set r 0} {$r < $rows} {incr r} {
-	set tmp                $data($column_a,$r)
-	set data($column_a,$r) $data($column_b,$r)
-	set data($column_b,$r) $tmp
-    }
-
-    set cwa [info exists colw($column_a)]
-    set cwb [info exists colw($column_b)]
-
-    if {$cwa && $cwb} {
-	set tmp             $colw($column_a)
-	set colw($column_a) $colw($column_b)
-	set colw($column_b) $tmp
-    } elseif {$cwa} {
-	# Move contents, don't swap.
-	set   colw($column_b) $colw($column_a)
-	unset colw($column_a)
-    } elseif {$cwb} {
-	# Move contents, don't swap.
-	set   colw($column_a) $colw($column_b)
-	unset colw($column_b)
-    } ; # else {nothing to do at all}
-    return
-}
-
-# ::struct::matrix::__swap_rows --
-#
-#	Swaps the contents of the two specified rows.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	row_a	Index of the first row to swap
-#	row_b	Index of the second row to swap
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::__swap_rows {name row_a row_b} {
-    set row_a [ChkRowIndex $name $row_a]
-    set row_b [ChkRowIndex $name $row_b]
-    return [SwapRows $name $row_a $row_b]
-}
-
-proc ::struct::matrix::SwapRows {name row_a row_b} {
-    variable ${name}::data
-    variable ${name}::columns
-    variable ${name}::rowh
-
-    # Note: This operation does not influence the width cache for all
-    # columns and the height cache only insofar as its contents has to be
-    # swapped too for the two rows we are touching. Note that the
-    # cache might be partially filled or not at all, so we don't have
-    # to "swap" in some situations.
-
-    for {set c 0} {$c < $columns} {incr c} {
-	set tmp             $data($c,$row_a)
-	set data($c,$row_a) $data($c,$row_b)
-	set data($c,$row_b) $tmp
-    }
-
-    set rha [info exists rowh($row_a)]
-    set rhb [info exists rowh($row_b)]
-
-    if {$rha && $rhb} {
-	set tmp          $rowh($row_a)
-	set rowh($row_a) $rowh($row_b)
-	set rowh($row_b) $tmp
-    } elseif {$rha} {
-	# Move contents, don't swap.
-	set   rowh($row_b) $rowh($row_a)
-	unset rowh($row_a)
-    } elseif {$rhb} {
-	# Move contents, don't swap.
-	set   rowh($row_a) $rowh($row_b)
-	unset rowh($row_b)
-    } ; # else {nothing to do at all}
-    return
-}
-
-# ::struct::matrix::_unlink --
-#
-#	Removes the link between the matrix and the specified
-#	arrayvariable, if there is one.
-#
-# Arguments:
-#	name	Name of the matrix.
-#	avar	Name of the linked array.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::_unlink {name avar} {
-
-    variable ${name}::link
-
-    if {![info exists link($avar)]} {
-	# Ignore unlinking of unkown variables.
-	return
-    }
-
-    # Delete the traces first, then remove the link management
-    # information from the object.
-
-    upvar #0 $avar    array
-    variable ${name}::data
-
-    trace vdelete array wu [list ::struct::matrix::MatTraceIn  $avar $name]
-    trace vdelete date  w  [list ::struct::matrix::MatTraceOut $avar $name]
-
-    unset link($avar)
-    return
-}
-
-# ::struct::matrix::ChkColumnIndex --
-#
-#	Helper to check and transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of columns.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndex {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    if {($cc < 0) || ($cc >= $columns)} {
-		return -code error "bad column index end-$column, column does not exist"
-	    }
-	    return $cc
-	}
-	end {
-	    if {$columns <= 0} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return [expr {$columns - 1}]
-	}
-	{[0-9]+} {
-	    if {($column < 0) || ($column >= $columns)} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndex --
-#
-#	Helper to check and transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of rows.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndex {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    if {($rr < 0) || ($rr >= $rows)} {
-		return -code error "bad row index end-$row, row does not exist"
-	    }
-	    return $rr
-	}
-	end {
-	    if {$rows <= 0} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return [expr {$rows - 1}]
-	}
-	{[0-9]+} {
-	    if {($row < 0) || ($row >= $rows)} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkColumnIndexNeg --
-#
-#	Helper to check and transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of columns
-#	(Accepts negative indices).
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndexNeg {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    if {$cc >= $columns} {
-		return -code error "bad column index end-$column, column does not exist"
-	    }
-	    return $cc
-	}
-	end {
-	    return [expr {$columns - 1}]
-	}
-	{[0-9]+} {
-	    if {$column >= $columns} {
-		return -code error "bad column index $column, column does not exist"
-	    }
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndexNeg --
-#
-#	Helper to check and transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index. Rejects indices out of the valid range of rows
-#	(Accepts negative indices).
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndexNeg {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    if {$rr >= $rows} {
-		return -code error "bad row index end-$row, row does not exist"
-	    }
-	    return $rr
-	}
-	end {
-	    return [expr {$rows - 1}]
-	}
-	{[0-9]+} {
-	    if {$row >= $rows} {
-		return -code error "bad row index $row, row does not exist"
-	    }
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkColumnIndexAll --
-#
-#	Helper to transform column indices. Returns the
-#	absolute index number belonging to the specified
-#	index.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	column	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the column
-
-proc ::struct::matrix::ChkColumnIndexAll {name column} {
-    variable ${name}::columns
-
-    switch -regex -- $column {
-	{end-[0-9]+} {
-	    set column [string map {end- ""} $column]
-	    set cc [expr {$columns - 1 - $column}]
-	    return $cc
-	}
-	end {
-	    return $columns
-	}
-	{[0-9]+} {
-	    return $column
-	}
-	default {
-	    return -code error "bad column index \"$column\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::ChkRowIndexAll --
-#
-#	Helper to transform row indices. Returns the
-#	absolute index number belonging to the specified
-#	index.
-#
-# Arguments:
-#	matrix	Matrix to look at
-#	row	The incoming index to check and transform
-#
-# Results:
-#	The absolute index to the row
-
-proc ::struct::matrix::ChkRowIndexAll {name row} {
-    variable ${name}::rows
-
-    switch -regex -- $row {
-	{end-[0-9]+} {
-	    set row [string map {end- ""} $row]
-	    set rr [expr {$rows - 1 - $row}]
-	    return $rr
-	}
-	end {
-	    return $rows
-	}
-	{[0-9]+} {
-	    return $row
-	}
-	default {
-	    return -code error "bad row index \"$row\", syntax error"
-	}
-    }
-    # Will not come to this place
-}
-
-# ::struct::matrix::MatTraceIn --
-#
-#	Helper propagating changes made to an array
-#	into the matrix the array is linked to.
-#
-# Arguments:
-#	avar		Name of the array which was changed.
-#	name		Matrix to write the changes to.
-#	var,idx,op	Standard trace arguments
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::MatTraceIn {avar name var idx op} {
-    # Propagate changes in the linked array back into the matrix.
-
-    variable ${name}::lock
-    if {$lock} {return}
-
-    # We have to cover two possibilities when encountering an "unset" operation ...
-    # 1. The external array was destroyed: perform automatic unlink.
-    # 2. An individual element was unset:  Set the corresponding cell to the empty string.
-    #    See SF Tcllib Bug #532791.
-
-    if {(![string compare $op u]) && ($idx == {})} {
-	# Possibility 1: Array was destroyed
-	$name unlink $avar
-	return
-    }
-
-    upvar #0 $avar    array
-    variable ${name}::data
-    variable ${name}::link
-
-    set transpose $link($avar)
-    if {$transpose} {
-	foreach {r c} [split $idx ,] break
-    } else {
-	foreach {c r} [split $idx ,] break
-    }
-
-    # Use standard method to propagate the change.
-    # => Get automatically index checks, cache updates, ...
-
-    if {![string compare $op u]} {
-	# Unset possibility 2: Element was unset.
-	# Note: Setting the cell to the empty string will
-	# invoke MatTraceOut for this array and thus try
-	# to recreate the destroyed element of the array.
-	# We don't want this. But we do want to propagate
-	# the change to other arrays, as "unset". To do
-	# all of this we use another state variable to
-	# signal this situation.
-
-	variable ${name}::unset
-	set unset $avar
-
-	$name set cell $c $r ""
-
-	set unset {}
-	return
-    }
-
-    $name set cell $c $r $array($idx)
-    return
-}
-
-# ::struct::matrix::MatTraceOut --
-#
-#	Helper propagating changes made to the matrix into the linked arrays.
-#
-# Arguments:
-#	avar		Name of the array to write the changes to.
-#	name		Matrix which was changed.
-#	var,idx,op	Standard trace arguments
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::MatTraceOut {avar name var idx op} {
-    # Propagate changes in the matrix data array into the linked array.
-
-    variable ${name}::unset
-
-    if {![string compare $avar $unset]} {
-	# Do not change the variable currently unsetting
-	# one of its elements.
-	return
-    }
-
-    variable ${name}::lock
-    set lock 1 ; # Disable MatTraceIn [#532783]
-
-    upvar #0 $avar    array
-    variable ${name}::data
-    variable ${name}::link
-
-    set transpose $link($avar)
-
-    if {$transpose} {
-	foreach {r c} [split $idx ,] break
-    } else {
-	foreach {c r} [split $idx ,] break
-    }
-
-    if {$unset != {}} {
-	# We are currently propagating the unset of an
-	# element in a different linked array to this
-	# array. We make sure that this is an unset too.
-
-	unset array($c,$r)
-    } else {
-	set array($c,$r) $data($idx)
-    }
-    set lock 0
-    return
-}
-
-# ::struct::matrix::SortMaxHeapify --
-#
-#	Helper for the 'sort' method. Performs the central algorithm
-#	which converts the matrix into a heap, easily sortable.
-#
-# Arguments:
-#	name	Matrix object which is sorted.
-#	i	Index of the row/column currently being sorted.
-#	key	Index of the column/row to sort the rows/columns by.
-#	rowCol	Indicator if we are sorting rows ('r'), or columns ('c').
-#	heapSize Number of rows/columns to sort.
-#	rev	Boolean flag, set if sorting is done revers (-decreasing).
-#
-# Sideeffects:
-#	Transforms the matrix into a heap of rows/columns,
-#	swapping them around.
-#
-# Results:
-#	None.
-
-proc ::struct::matrix::SortMaxHeapify {name i key rowCol heapSize {rev 0}} {
-    # MAX-HEAPIFY, adapted by EAS from CLRS 6.2
-    switch  $rowCol {
-	r { set A [GetColumn $name $key] }
-	c { set A [GetRow    $name $key] }
-    }
-    # Weird expressions below for clarity, as CLRS uses A[1...n]
-    # format and TCL uses A[0...n-1]
-    set left  [expr {int(2*($i+1)    -1)}]
-    set right [expr {int(2*($i+1)+1  -1)}]
-
-    # left, right are tested as < rather than <= because they are
-    # in A[0...n-1]
-    if {
-	$left < $heapSize &&
-	( !$rev && [lindex $A $left] > [lindex $A $i] ||
-	   $rev && [lindex $A $left] < [lindex $A $i] )
-    } {
-	set largest $left
-    } else {
-	set largest $i
-    }
-
-    if {
-	$right < $heapSize &&
-	( !$rev && [lindex $A $right] > [lindex $A $largest] ||
-	   $rev && [lindex $A $right] < [lindex $A $largest] )
-    } {
-	set largest $right
-    }
-
-    if { $largest != $i } {
-	switch $rowCol {
-	    r { SwapRows    $name $i $largest }
-	    c { SwapColumns $name $i $largest }
-	}
-	SortMaxHeapify $name $largest $key $rowCol $heapSize $rev
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'matrix::matrix' into the general structure namespace.
-    namespace import -force matrix::matrix
-    namespace export matrix
-}
-package provide struct::matrix 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,19 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded struct            2.1   [list source [file join $dir struct.tcl]]
-package ifneeded struct            1.4   [list source [file join $dir struct1.tcl]]
-
-package ifneeded struct::graph     2.2   [list source [file join $dir graph.tcl]]
-package ifneeded struct::queue     1.4   [list source [file join $dir queue.tcl]]
-package ifneeded struct::stack     1.3.1 [list source [file join $dir stack.tcl]]
-package ifneeded struct::tree      2.1.1 [list source [file join $dir tree.tcl]]
-package ifneeded struct::matrix    2.0.1 [list source [file join $dir matrix.tcl]]
-package ifneeded struct::pool      1.2.1 [list source [file join $dir pool.tcl]]
-package ifneeded struct::record    1.2.1 [list source [file join $dir record.tcl]]
-package ifneeded struct::list      1.6.1 [list source [file join $dir list.tcl]]
-package ifneeded struct::set       2.2.1 [list source [file join $dir sets.tcl]]
-package ifneeded struct::prioqueue 1.3.1 [list source [file join $dir prioqueue.tcl]]
-package ifneeded struct::skiplist  1.3   [list source [file join $dir skiplist.tcl]]
-
-package ifneeded struct::graph     1.2.1 [list source [file join $dir graph1.tcl]]
-package ifneeded struct::tree      1.2.2 [list source [file join $dir tree1.tcl]]
-package ifneeded struct::matrix    1.2.1 [list source [file join $dir matrix1.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/pool.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/pool.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,709 +1,0 @@
-################################################################################
-# pool.tcl
-#
-#
-# Author: Erik Leunissen
-#
-#
-# Acknowledgement:
-#     The author is grateful for the advice provided by
-#     Andreas Kupries during the development of this code.
-#
-#
-# $Id: pool.tcl,v 1.8 2005/09/28 04:51:24 andreas_kupries Exp $
-#
-################################################################################
-
-package require cmdline
-
-namespace eval ::struct {}
-namespace eval ::struct::pool {
-
-    # a list of all current pool names
-    variable pools {}
-
-    # counter is used to give a unique name to a pool if
-    # no name was supplied, e.g. pool1, pool2 etc.
-    variable counter 0
-
-    # `commands' is the list of subcommands recognized by a pool-object command
-    variable commands {add clear destroy info maxsize release remove request}
-
-    # All errors with corresponding (unformatted) messages.
-    # The format strings will be replaced by the appropriate
-    # values when an error occurs.
-    variable  Errors
-    array set Errors {
-	BAD_SUBCMD {bad subcommand "%s": must be %s}
-	DUPLICATE_ITEM_IN_ARGS {Duplicate item `%s' in arguments.}
-	DUPLICATE_POOLNAME {The pool `%s' already exists.}
-	EXCEED_MAXSIZE "This command would increase the total number of items\
-		\nbeyond the maximum size of the pool. No items registered."
-	FORBIDDEN_ALLOCID "The value -1 is not allowed as an allocID."
-	INVALID_POOLSIZE {The pool currently holds %s items.\
-		Can't set maxsize to a value less than that.}
-	ITEM_ALREADY_IN_POOL {`%s' already is a member of the pool. No items registered.}
-	ITEM_NOT_IN_POOL {`%s' is not a member of %s.}
-	ITEM_NOT_ALLOCATED {Can't release `%s' because it isn't allocated.}
-	ITEM_STILL_ALLOCATED {Can't remove `%s' because it is still allocated.}
-	NONINT_REQSIZE {The second argument must be a positive integer value}
-	SOME_ITEMS_NOT_FREE {Couldn't %s `%s' because some items are still allocated.}
-	UNKNOWN_ARG {Unknown argument `%s'}
-	UNKNOWN_POOL {Nothing known about `%s'.}
-	VARNAME_EXISTS "A variable `::struct::pool::%s' already exists."
-	WRONG_INFO_TYPE "Expected second argument to be one of:\
-		\n     allitems, allocstate, cursize, freeitems, maxsize,\
-		\nbut received: `%s'."
-	WRONG_NARGS {Wrong nr. of arguments.}
-    }
-    
-    namespace export pool
-}
-
-
-# A small helper routine to check list membership
-proc ::struct::pool::lmember {list element} {
-    if { [lsearch -exact $list $element] >= 0 } {
-        return 1
-    } else  {
-        return 0
-    }
-}
-
-
-# General note
-# ============
-#
-# All procedures below use the following method to reference
-# a particular pool-object:
-#
-#    variable $poolname
-#    upvar #0 ::struct::pool::$poolname pool
-#    upvar #0 ::struct::pool::Allocstate_$poolname state
-#
-# Therefore, the names `pool' and `state' refer to a particular
-# instance of a pool.
-#
-# In the comments to the code below, the words `pool' and `state'
-# also refer to a particular pool.
-#
-
-# ::struct::pool::create
-#
-#    Creates a new instance of a pool (a pool-object).
-#    ::struct::pool::pool (see right below) is an alias to this procedure.
-#
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    maxsize:  the maximum number of elements that the pool is allowed
-#              consist of.
-#
-#
-# Results:
-#    the name of the newly created pool
-#
-#
-# Side effects:
-#    - Registers the pool-name in the variable `pools'.
-#
-#    - Creates the pool array which holds general state about the pool.
-#      The following elements are initialized:
-#          pool(freeitems): a list of non-allocated items
-#          pool(cursize):   the current number of elements in the pool
-#          pool(maxsize):   the maximum allowable number of pool elements
-#      Additional state may be hung off this array as long as the three
-#      elements above are not corrupted.
-#
-#    - Creates a separate array `state' that will hold allocation state
-#      of the pool elements.
-#
-#    - Creates an object-procedure that has the same name as the pool.
-#
-proc ::struct::pool::create { {poolname ""} {maxsize 10} } {
-    variable pools
-    variable counter
-    variable Errors
-    
-    # check maxsize argument
-    if { ![string equal $maxsize 10] } {
-        if { ![regexp {^\+?[1-9][0-9]*$} $maxsize] } {
-            return -code error $Errors(NONINT_REQSIZE)
-        }
-    }
-    
-    # create a name if no name was supplied
-    if { [string length $poolname]==0 } {
-        incr counter
-        set poolname pool$counter
-        set incrcnt 1
-    }
-    
-    # check whether there exists a pool named $poolname
-    if { [lmember $pools $poolname] } {
-        if { [::info exists incrcnt] } {
-            incr counter -1
-        }
-        return -code error [format $Errors(DUPLICATE_POOLNAME) $poolname]
-    }
-    
-    # check whether the namespace variable exists
-    if { [::info exists ::struct::pool::$poolname] } {
-        if { [::info exists incrcnt] } {
-            incr counter -1
-        }
-        return -code error [format $Errors(VARNAME_EXISTS) $poolname]
-    }
-    
-    variable $poolname
-    
-    # register
-    lappend pools $poolname
-    
-    # create and initialize the new pool data structure
-    upvar #0 ::struct::pool::$poolname pool
-    set pool(freeitems) {}
-    set pool(maxsize) $maxsize
-    set pool(cursize) 0
-    
-    # the array that holds allocation state
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    array set state {}
-    
-    # create a pool-object command and map it to the pool commands
-    interp alias {} ::$poolname {} ::struct::pool::poolCmd $poolname
-    return $poolname
-}
-
-#
-# This alias provides compatibility with the implementation of the
-# other data structures (stack, queue etc...) in the tcllib::struct package.
-#
-proc ::struct::pool::pool { {poolname ""} {maxsize 10} } {
-    ::struct::pool::create $poolname $maxsize
-}
-
-
-# ::struct::pool::poolCmd
-#
-#    This proc constitutes a level of indirection between the pool-object
-#    subcommand and the pool commands (below); it's sole function is to pass
-#    the command along to one of the pool commands, and receive any results.
-#
-# Arguments:
-#    poolname:    name of the pool-object
-#    subcmd:      the subcommand, which identifies the pool-command to
-#                 which calls will be passed.
-#    args:        any arguments. They will be inspected by the pool-command
-#                 to which this call will be passed along.
-#
-# Results:
-#    Whatever result the pool command returns, is once more returned.
-#
-# Side effects:
-#    Dispatches the call onto a specific pool command and receives any results.
-#
-proc ::struct::pool::poolCmd {poolname subcmd args} {
-    variable Errors
-    
-    # check the subcmd argument
-    if { [lsearch -exact $::struct::pool::commands $subcmd] == -1 } {
-        set optlist [join $::struct::pool::commands ", "]
-        set optlist [linsert $optlist "end-1" "or"]
-        return -code error [format $Errors(BAD_SUBCMD) $subcmd $optlist]
-    }
-    
-    # pass the call to the pool command indicated by the subcmd argument,
-    # and return the result from that command.
-    return [eval [linsert $args 0 ::struct::pool::$subcmd $poolname]]
-}
-
-
-# ::struct::pool::destroy
-#
-#    Destroys a pool-object, its associated variables and "object-command"
-#
-# Arguments:
-#    poolname:    name of the pool-object
-#    forceArg:    if set to `-force', the pool-object will be destroyed
-#                 regardless the allocation state of its objects.
-#
-# Results:
-#    none
-#
-# Side effects:
-#    - unregisters the pool name in the variable `pools'.
-#    - unsets `pool' and `state' (poolname specific variables)
-#    - destroys the "object-procedure" that was associated with the pool.
-#
-proc ::struct::pool::destroy {poolname {forceArg ""}} {
-    variable pools
-    variable Errors
-    
-    # check forceArg argument
-    if { [string length $forceArg] } {
-        if { [string equal $forceArg -force] } {
-            set force 1
-        } else {
-            return -code error [format $Errors(UNKNOWN_ARG) $forceArg]
-        }
-    } else {
-        set force 0
-    }
-    
-    set index [lsearch -exact $pools $poolname]
-    if {$index == -1 } {
-        return -code error [format $Errors(UNKNOWN_POOL) $poolname]
-    }
-    
-    if { !$force } {
-        # check for any lingering allocated items
-        variable $poolname
-        upvar #0 ::struct::pool::$poolname pool
-        upvar #0 ::struct::pool::Allocstate_$poolname state
-        if { [llength $pool(freeitems)] != $pool(cursize) } {
-            return -code error [format $Errors(SOME_ITEMS_NOT_FREE) destroy $poolname]
-        }
-    }
-    
-    rename ::$poolname {}
-    unset ::struct::pool::$poolname
-    catch {unset ::struct::pool::Allocstate_$poolname}
-    set pools [lreplace $pools $index $index]
-    
-    return
-}
-
-
-# ::struct::pool::add
-#
-#    Add items to the pool
-#
-# Arguments:
-#    poolname:    name of the pool-object
-#    args:        the items to add
-#
-# Results:
-#    none
-#
-# Side effects:
-#    sets the initial allocation state of the added items to -1 (free)
-#
-proc ::struct::pool::add {poolname args} {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # argument check
-    if { [llength $args] == 0 } {
-        return -code error $Errors(WRONG_NARGS)
-    }
-    
-    # will this operation exceed the size limit of the pool?
-    if {[expr { $pool(cursize) + [llength $args] }] > $pool(maxsize) } {
-        return -code error $Errors(EXCEED_MAXSIZE)
-    }
-    
-    
-    # check for duplicate items on the command line
-    set N [llength $args]
-    if { $N > 1} {
-        for {set i 0} {$i<=$N} {incr i} {
-            foreach item [lrange $args [expr {$i+1}] end] {
-                if { [string equal [lindex $args $i] $item]} {
-                    return -code error [format $Errors(DUPLICATE_ITEM_IN_ARGS) $item]
-                }
-            }
-        }
-    }
-    
-    # check whether the items exist yet in the pool
-    foreach item $args {
-        if { [lmember [array names state] $item] } {
-            return -code error [format $Errors(ITEM_ALREADY_IN_POOL) $item]
-        }
-    }
-    
-    # add items to the pool, and initialize their allocation state
-    foreach item $args {
-        lappend pool(freeitems) $item
-        set state($item) -1
-        incr pool(cursize)
-    }
-    return
-}
-
-
-
-# ::struct::pool::clear
-#
-#    Removes all items from the pool and clears corresponding
-#    allocation state.
-#
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    forceArg: if set to `-force', all items are removed
-#              regardless their allocation state.
-#
-# Results:
-#    none
-#
-# Side effects:
-#    see description above
-#
-proc ::struct::pool::clear {poolname {forceArg ""} } {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # check forceArg argument
-    if { [string length $forceArg] } {
-        if { [string equal $forceArg -force] } {
-            set force 1
-        } else {
-            return -code error [format $Errors(UNKNOWN_ARG) $forceArg]
-        }
-    } else {
-        set force 0
-    }
-    
-    # check whether some items are still allocated
-    if { !$force } {
-        if { [llength $pool(freeitems)] != $pool(cursize) } {
-            return -code error [format $Errors(SOME_ITEMS_NOT_FREE) clear $poolname]
-        }
-    }
-    
-    # clear the pool, clean up state and adjust the pool size
-    set pool(freeitems) {}
-    array unset state
-    array set state {}
-    set pool(cursize) 0
-    return
-}
-
-
-
-# ::struct::pool::info
-#
-#    Returns information about the pool in data structures that allow
-#    further programmatic use.
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    type:     the type of info requested
-#
-#
-# Results:
-#    The info requested
-#
-#
-# Side effects:
-#    none
-#
-proc ::struct::pool::info {poolname type args} {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # check the number of arguments
-    if { [string equal $type allocID] } {
-        if { [llength $args]!=1 } {
-            return -code error $Errors(WRONG_NARGS)
-        }
-    } elseif { [llength $args] > 0 } {
-        return -code error $Errors(WRONG_NARGS)
-    }
-    
-    switch $type {
-        allitems {
-            return [array names state]
-        }
-        allocstate {
-            return [array get state]
-        }
-        allocID {
-            set item [lindex $args 0]
-            if {![lmember [array names state] $item]} {
-                return -code error [format $Errors(ITEM_NOT_IN_POOL) $item $poolname]
-            }
-            return $state($item)
-        }
-        cursize {
-            return $pool(cursize)
-        }
-        freeitems {
-            return $pool(freeitems)
-        }
-        maxsize {
-            return $pool(maxsize)
-        }
-        default {
-            return -code error [format $Errors(WRONG_INFO_TYPE) $type]
-        }
-    }
-}
-
-
-# ::struct::pool::maxsize
-#
-#    Returns the current or sets a new maximum size of the pool.
-#    As far as querying only is concerned, this is an alias for
-#    `::struct::pool::info maxsize'.
-#
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    reqsize:  if supplied, it is the requested size of the pool, i.e.
-#              the maximum number of elements in the pool.
-#
-#
-# Results:
-#    The current/new maximum size of the pool.
-#
-#
-# Side effects:
-#    Sets pool(maxsize) if a new size is supplied.
-#
-proc ::struct::pool::maxsize {poolname {reqsize ""} } {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    if { [string length $reqsize] } {
-        if { [regexp {^\+?[1-9][0-9]*$} $reqsize] } {
-            if { $pool(cursize) <= $reqsize } {
-                set pool(maxsize) $reqsize
-            } else  {
-                return -code error [format $Errors(INVALID_POOLSIZE) $pool(cursize)]
-            }
-        } else  {
-            return -code error $Errors(NONINT_REQSIZE)
-        }
-    }
-    return $pool(maxsize)
-}
-
-
-# ::struct::pool::release
-#
-#    Deallocates an item
-#
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    item:     name of the item to be released
-#
-#
-# Results:
-#    none
-#
-# Side effects:
-#    - sets the item's allocation state to free (-1)
-#    - appends item to the list of free items
-#
-proc ::struct::pool::release {poolname item} {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # Is item in the pool?
-    if {![lmember [array names state] $item]} {
-        return -code error [format $Errors(ITEM_NOT_IN_POOL) $item $poolname]
-    }
-    
-    # check whether item was allocated
-    if { $state($item) == -1 } {
-        return -code error [format $Errors(ITEM_NOT_ALLOCATED) $item]
-    } else  {
-        
-        # set item free and return it to the pool of free items
-        set state($item) -1
-        lappend pool(freeitems) $item
-        
-    }
-    return
-}
-
-# ::struct::pool::remove
-#
-#    Removes an item from the pool
-#
-#
-# Arguments:
-#    poolname: name of the pool-object
-#    item:     the item to be removed
-#    forceArg: if set to `-force', the item is removed
-#              regardless its allocation state.
-#
-# Results:
-#    none
-#
-# Side effects:
-#    - cleans up allocation state related to the item
-#
-proc ::struct::pool::remove {poolname item {forceArg ""} } {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # check forceArg argument
-    if { [string length $forceArg] } {
-        if { [string equal $forceArg -force] } {
-            set force 1
-        } else {
-            return -code error [format $Errors(UNKNOWN_ARG) $forceArg]
-        }
-    } else {
-        set force 0
-    }
-    
-    # Is item in the pool?
-    if {![lmember [array names state] $item]} {
-        return -code error [format $Errors(ITEM_NOT_IN_POOL) $item $poolname]
-    }
-    
-    set index [lsearch $pool(freeitems) $item]
-    if { $index >= 0} {
-        
-        # actual removal
-        set pool(freeitems) [lreplace $pool(freeitems) $index $index]
-        
-    } elseif { !$force }  {
-        return -code error [format $Errors(ITEM_STILL_ALLOCATED) $item]
-    }
-    
-    # clean up state and adjust the pool size
-    unset state($item)
-    incr pool(cursize) -1
-    return
-}
-
-
-
-# ::struct::pool::request
-#
-#     Handles requests for an item, taking into account a preference
-#     for a particular item if supplied.
-#
-#
-# Arguments:
-#    poolname:    name of the pool-object
-#
-#    itemvar:     variable to which the item-name will be assigned
-#                 if the request is honored.
-#
-#    args:        an optional sequence of key-value pairs, indicating the
-#                 following options:
-#                 -prefer:  the preferred item to allocate.
-#                 -allocID: An ID for the entity to which the item will be
-#                           allocated. This facilitates reverse lookups.
-#
-# Results:
-#
-#    1 if the request was honored; an item is allocated
-#    0 if the request couldn't be honored; no item is allocated
-#
-#    The user is strongly advised to check the return values
-#    when calling this procedure.
-#
-#
-# Side effects:
-#
-#   if the request is honored:
-#    - sets allocation state to $allocID (or dummyID if it was not supplied)
-#      if allocation was succesful. Allocation state is maintained in the
-#      namespace variable state (see: `General note' above)
-#    - sets the variable passed via `itemvar' to the allocated item.
-#
-#   if the request is denied, no side effects occur.
-#
-proc ::struct::pool::request {poolname itemvar args} {
-    variable Errors
-    variable $poolname
-    upvar #0 ::struct::pool::$poolname pool
-    upvar #0 ::struct::pool::Allocstate_$poolname state
-    
-    # check args
-    set nargs [llength $args]
-    if { ! ($nargs==0 || $nargs==2 || $nargs==4) } {
-        if { ![string equal $args -?] && ![string equal $args -help]} {
-            return -code error $Errors(WRONG_NARGS)
-        }
-    } elseif { $nargs } {
-        foreach {name value} $args {
-            if { ![string match -* $name] } {
-                return -code error [format $Errors(UNKNOWN_ARG) $name]
-            }
-        }
-    }
-    
-    set allocated 0
-    
-    # are there any items available?
-    if { [llength $pool(freeitems)] > 0} {
-        
-        # process command options
-        set options [cmdline::getoptions args { \
-            {prefer.arg {} {The preference for a particular item}} \
-            {allocID.arg {} {An ID for the entity to which the item will be allocated} } \
-                } \
-                "usage: $poolname request itemvar ?options?:"]
-        foreach {key value} $options {
-            set $key $value
-        }
-        
-        if { $allocID == -1 } {
-            return -code error $Errors(FORBIDDEN_ALLOCID)
-        }
-        
-        # let `item' point to a variable two levels up the call stack
-        upvar 2 $itemvar item
-        
-        # check whether a preference was supplied
-        if { [string length $prefer] } {
-            if {![lmember [array names state] $prefer]} {
-                return -code error [format $Errors(ITEM_NOT_IN_POOL) $prefer $poolname]
-            }
-            if { $state($prefer) == -1 } {
-                set index [lsearch $pool(freeitems) $prefer]
-                set item $prefer
-            } else {
-		return 0
-	    }
-        } else  {
-            set index 0
-            set item [lindex $pool(freeitems) 0]
-        }
-        
-        # do the actual allocation
-        set pool(freeitems) [lreplace $pool(freeitems) $index $index]
-        if { [string length $allocID] } {
-            set state($item) $allocID
-        } else  {
-            set state($item) dummyID
-        }
-        set allocated 1
-    }
-    return $allocated
-}
-
-
-# EOF pool.tcl
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'pool::pool' into the general structure namespace.
-    namespace import -force pool::pool
-    namespace export pool
-}
-package provide struct::pool 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/prioqueue.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/prioqueue.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,486 +1,0 @@
-# prioqueue.tcl --
-#
-#  Priority Queue implementation for Tcl.
-#
-# adapted from queue.tcl
-# Copyright (c) 2002,2003 Michael Schlenker
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: prioqueue.tcl,v 1.9 2005/09/23 16:17:26 mic42 Exp $
-
-package require Tcl 8.2
-
-namespace eval ::struct {}
-
-namespace eval ::struct::prioqueue {
-    # The queues array holds all of the queues you've made
-    variable queues
-
-    # counter is used to give a unique name for unnamed queues
-    variable counter 0
-
-    # commands is the list of subcommands recognized by the queue
-    variable commands [list \
-        "clear" \
-        "destroy"   \
-        "get"   \
-        "peek"  \
-        "put"   \
-        "size"  \
-        "peekpriority" \
-        ]
-
-    variable sortopt [list \
-        "-integer" \
-        "-real" \
-        "-ascii" \
-        "-dictionary" \
-        ]
-
-    # this is a simple design decision, that integer and real
-    # are sorted decreasing (-1), and -ascii and -dictionary are sorted -increasing (1)
-    # the values here map to the sortopt list
-    # could be changed to something configurable.
-    variable sortdir [list \
-        "-1" \
-        "-1" \
-        "1" \
-        "1" \
-        ]
-
-
-
-    # Only export one command, the one used to instantiate a new queue
-    namespace export prioqueue
-
-    proc K {x y} {set x} ;# DKF's K combinator
-}
-
-# ::struct::prioqueue::prioqueue --
-#
-#   Create a new prioqueue with a given name; if no name is given, use
-#   prioqueueX, where X is a number.
-#
-# Arguments:
-#   sorting sorting option for lsort to use, no -command option
-#           defaults to integer
-#   name    name of the queue; if null, generate one.
-#           names may not begin with -
-#
-#
-# Results:
-#   name    name of the queue created
-
-proc ::struct::prioqueue::prioqueue {args} {
-    variable queues
-    variable counter
-    variable queues_sorting
-    variable sortopt
-
-    # check args
-    if {[llength $args] > 2} {
-        error "wrong # args: should be \"[lindex [info level 0] 0] ?-ascii|-dictionary|-integer|-real? ?name?\""
-    }
-    if {[llength $args] == 0} {
-        # defaulting to integer priorities
-        set sorting -integer
-    } else {
-        if {[llength $args] == 1} {
-            if {[string match "-*" [lindex $args 0]]==1} {
-                set sorting [lindex $args 0]
-            } else {
-                set sorting -integer
-                set name [lindex $args 0]
-            }
-        } else {
-            if {[llength $args] == 2} {
-                foreach {sorting name} $args {break}
-            }
-        }
-    }
-    # check option (like lsort sorting options without -command)
-    if {[lsearch $sortopt $sorting] == -1} {
-        # if sortoption is unknown, but name is a sortoption we give a better error message
-        if {[info exists name] && [lsearch $sortopt $name]!=-1} {
-            error "wrong argument position: should be \"[lindex [info level 0] 0] ?-ascii|-dictionary|-integer|-real? ?name?\""
-        }
-        error "unknown sort option \"$sorting\""
-    }
-    # create name if not given
-    if {![info exists name]} {
-        incr counter
-        set name "prioqueue${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-    error "command \"$name\" already exists, unable to create prioqueue"
-    }
-
-    # Initialize the queue as empty
-    set queues($name) [list ]
-    switch -exact -- $sorting {
-    -integer { set queues_sorting($name) 0}
-    -real    { set queues_sorting($name) 1}
-    -ascii   { set queues_sorting($name) 2}
-    -dictionary { set queues_sorting($name) 3}
-    }
-
-    # Create the command to manipulate the queue
-    interp alias {} ::$name {} ::struct::prioqueue::QueueProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::prioqueue::QueueProc --
-#
-#   Command that processes all queue object commands.
-#
-# Arguments:
-#   name    name of the queue object to manipulate.
-#   args    command name and args for the command
-#
-# Results:
-#   Varies based on command to perform
-
-proc ::struct::prioqueue::QueueProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-    error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-
-    # Split the args into command and args components
-    if { [string equal [info commands ::struct::prioqueue::_$cmd] ""] } {
-    variable commands
-    set optlist [join $commands ", "]
-    set optlist [linsert $optlist "end-1" "or"]
-    error "bad option \"$cmd\": must be $optlist"
-    }
-    return [eval [linsert $args 0 ::struct::prioqueue::_$cmd $name]]
-}
-
-# ::struct::prioqueue::_clear --
-#
-#   Clear a queue.
-#
-# Arguments:
-#   name    name of the queue object.
-#
-# Results:
-#   None.
-
-proc ::struct::prioqueue::_clear {name} {
-    variable queues
-    set queues($name) [list]
-    return
-}
-
-# ::struct::prioqueue::_destroy --
-#
-#   Destroy a queue object by removing it's storage space and
-#   eliminating it's proc.
-#
-# Arguments:
-#   name    name of the queue object.
-#
-# Results:
-#   None.
-
-proc ::struct::prioqueue::_destroy {name} {
-    variable queues
-    variable queues_sorting
-    unset queues($name)
-    unset queues_sorting($name)
-    interp alias {} ::$name {}
-    return
-}
-
-# ::struct::prioqueue::_get --
-#
-#   Get an item from a queue.
-#
-# Arguments:
-#   name    name of the queue object.
-#   count   number of items to get; defaults to 1
-#
-# Results:
-#   item    first count items from the queue; if there are not enough
-#           items in the queue, throws an error.
-#
-
-proc ::struct::prioqueue::_get {name {count 1}} {
-    variable queues
-    if { $count < 1 } {
-    error "invalid item count $count"
-    }
-
-    if { $count > [llength $queues($name)] } {
-    error "insufficient items in prioqueue to fill request"
-    }
-
-    if { $count == 1 } {
-    # Handle this as a special case, so single item gets aren't listified
-    set item [lindex [lindex $queues($name) 0] 1]
-    set queues($name) [lreplace [K $queues($name) [set queues($name) ""]] 0 0]
-    return $item
-    }
-
-    # Otherwise, return a list of items
-    incr count -1
-    set items [lrange $queues($name) 0 $count]
-    foreach item $items {
-        lappend result [lindex $item 1]
-    }
-    set items ""
-
-    set queues($name) [lreplace [K $queues($name) [set queues($name) ""]] 0 $count]
-    return $result
-}
-
-# ::struct::prioqueue::_peek --
-#
-#   Retrive the value of an item on the queue without removing it.
-#
-# Arguments:
-#   name    name of the queue object.
-#   count   number of items to peek; defaults to 1
-#
-# Results:
-#   items   top count items from the queue; if there are not enough items
-#       to fufill the request, throws an error.
-
-proc ::struct::prioqueue::_peek {name {count 1}} {
-    variable queues
-    if { $count < 1 } {
-    error "invalid item count $count"
-    }
-
-    if { $count > [llength $queues($name)] } {
-    error "insufficient items in prioqueue to fill request"
-    }
-
-    if { $count == 1 } {
-    # Handle this as a special case, so single item pops aren't listified
-    return [lindex [lindex $queues($name) 0] 1]
-    }
-
-    # Otherwise, return a list of items
-    set index [expr {$count - 1}]
-    foreach item [lrange $queues($name) 0 $index] {
-        lappend result [lindex $item 1]
-    }
-    return $result
-}
-
-# ::struct::prioqueue::_peekpriority --
-#
-#   Retrive the priority of an item on the queue without removing it.
-#
-# Arguments:
-#   name    name of the queue object.
-#   count   number of items to peek; defaults to 1
-#
-# Results:
-#   items   top count items from the queue; if there are not enough items
-#       to fufill the request, throws an error.
-
-proc ::struct::prioqueue::_peekpriority {name {count 1}} {
-    variable queues
-    if { $count < 1 } {
-    error "invalid item count $count"
-    }
-
-    if { $count > [llength $queues($name)] } {
-    error "insufficient items in prioqueue to fill request"
-    }
-
-    if { $count == 1 } {
-    # Handle this as a special case, so single item pops aren't listified
-    return [lindex [lindex $queues($name) 0] 0]
-    }
-
-    # Otherwise, return a list of items
-    set index [expr {$count - 1}]
-    foreach item [lrange $queues($name) 0 $index] {
-        lappend result [lindex $item 0]
-    }
-    return $result
-}
-
-
-# ::struct::prioqueue::_put --
-#
-#   Put an item into a queue.
-#
-# Arguments:
-#   name    name of the queue object
-#   args    list of the form "item1 prio1 item2 prio2 item3 prio3"
-#
-# Results:
-#   None.
-
-proc ::struct::prioqueue::_put {name args} {
-    variable queues
-    variable queues_sorting
-    variable sortopt
-    variable sortdir
-
-    if { [llength $args] == 0 || [llength $args] % 2} {
-    error "wrong # args: should be \"$name put item prio ?item prio ...?\""
-    }
-
-    # check for prio type before adding
-    switch -exact -- $queues_sorting($name) {
-        0    {
-        foreach {item prio} $args {
-        if {![string is integer -strict $prio]} {
-            error "priority \"$prio\" is not an integer type value"
-        }
-        }
-    }
-        1    {
-        foreach {item prio} $args {
-        if {![string is double -strict $prio]} {
-            error "priority \"$prio\" is not a real type value"
-        }
-        }
-    }
-        default {
-        #no restrictions for -ascii and -dictionary
-    }
-    }
-
-    # sort by priorities
-    set opt [lindex $sortopt $queues_sorting($name)]
-    set dir [lindex $sortdir $queues_sorting($name)]
-
-    # add only if check has passed
-    foreach {item prio} $args {
-        set new [list $prio $item]
-        set queues($name) [__linsertsorted [K $queues($name) [set queues($name) ""]] $new $opt $dir]
-    }
-    return
-}
-
-# ::struct::prioqueue::_size --
-#
-#   Return the number of objects on a queue.
-#
-# Arguments:
-#   name    name of the queue object.
-#
-# Results:
-#   count   number of items on the queue.
-
-proc ::struct::prioqueue::_size {name} {
-    variable queues
-    return [llength $queues($name)]
-}
-
-# ::struct::prioqueue::__linsertsorted
-#
-# Helper proc for inserting into a sorted list.
-#
-#
-
-proc ::struct::prioqueue::__linsertsorted {list newElement sortopt sortdir} {
-    
-    set cmpcmd __elementcompare${sortopt}
-    set pos -1
-    set newPrio [lindex $newElement 0]
-
-    # do a binary search
-    set lower -1
-    set upper [llength $list]
-    set bound [expr {$upper+1}]
-    set pivot 0
-    
-    if {$upper > 0} {
-        while {$lower +1 != $upper } {
-           
-           # get the pivot element
-           set pivot [expr {($lower + $upper) / 2}]
-           set element [lindex $list $pivot]
-        set prio [lindex $element 0]
-           
-           # check
-           set test [$cmpcmd $prio $newPrio $sortdir]
-           if {$test == 0} {
-                set pos $pivot
-                set upper $pivot
-                # now break as we need the last item
-                break
-           } elseif {$test > 0 } {
-                # search lower section
-                set upper $pivot
-                set bound $upper
-                set pos -1
-           } else {
-                # search upper section
-                set lower $pivot
-                set pos $bound
-           }
-        }
-        
-        
-        if {$pos == -1} {
-            # we do an insert before the pivot element
-            set pos $pivot
-        }
-        
-        # loop to the last matching element to 
-        # keep a stable insertion order
-        while {[$cmpcmd $prio $newPrio $sortdir]==0} {
-        incr pos
-            if {$pos > [llength $list]} {break}
-            set element [lindex $list $pos]
-            set prio [lindex $element 0]
-        }            
-        
-    } else {
-        set pos 0
-    }
-    
-    # do the insert without copying
-    linsert [K $list [set list ""]] $pos $newElement
-}
-
-# ::struct::prioqueue::__elementcompare
-#
-# Compare helpers with the sort options.
-#
-#
-
-proc ::struct::prioqueue::__elementcompare-integer {prio newPrio sortdir} {
-    return [expr {$prio < $newPrio ? -1*$sortdir : ($prio != $newPrio)*$sortdir}]
-}
-
-proc ::struct::prioqueue::__elementcompare-real {prio newPrio sortdir} {
-    return [expr {$prio < $newPrio ? -1*$sortdir : ($prio != $newPrio)*$sortdir}] 
-}
-
-proc ::struct::prioqueue::__elementcompare-ascii {prio newPrio sortdir} {
-    return [expr {[string compare $prio $newPrio]*$sortdir}]
-}
-
-proc ::struct::prioqueue::__elementcompare-dictionary {prio newPrio sortdir} {
-    # need to use lsort to access -dictionary sorting
-    set tlist [lsort -increasing -dictionary [list $prio $newPrio]]
-    set e1 [string equal [lindex $tlist 0]  $prio]
-    set e2 [string equal [lindex $tlist 1]  $prio]    
-    return [expr {$e1 > $e2 ? -1*$sortdir : ($e1 != $e2)*$sortdir}]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'prioqueue::prioqueue' into the general structure namespace.
-    namespace import -force prioqueue::prioqueue
-    namespace export prioqueue
-}
-package provide struct::prioqueue 1.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/queue.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/queue.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,286 +1,0 @@
-# queue.tcl --
-#
-#	Queue implementation for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: queue.tcl,v 1.13 2005/09/30 23:48:41 andreas_kupries Exp $
-
-namespace eval ::struct {}
-namespace eval ::struct::queue {
-    # The queues array holds all of the queues you've made
-    variable queues
-    
-    # counter is used to give a unique name for unnamed queues
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new queue
-    namespace export queue
-}
-
-# ::struct::queue::queue --
-#
-#	Create a new queue with a given name; if no name is given, use
-#	queueX, where X is a number.
-#
-# Arguments:
-#	name	name of the queue; if null, generate one.
-#
-# Results:
-#	name	name of the queue created
-
-proc ::struct::queue::queue {args} {
-    variable queues
-    variable counter
-
-    switch -exact -- [llength [info level 0]] {
-	1 {
-	    # Missing name, generate one.
-	    incr counter
-	    set name "queue${counter}"
-	}
-	2 {
-	    # Standard call. New empty queue.
-	    set name [lindex $args 0]
-	}
-	default {
-	    # Error.
-	    return -code error \
-		    "wrong # args: should be \"queue ?name?\""
-	}
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-    if {[llength [info commands $name]]} {
-	return -code error \
-		"command \"$name\" already exists, unable to create queue"
-    }
-
-    # Initialize the queue as empty
-    set queues($name) [list ]
-
-    # Create the command to manipulate the queue
-    interp alias {} $name {} ::struct::queue::QueueProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::queue::QueueProc --
-#
-#	Command that processes all queue object commands.
-#
-# Arguments:
-#	name	name of the queue object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::queue::QueueProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    set sub _$cmd
-    if { [llength [info commands ::struct::queue::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::queue::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-
-    uplevel 1 [linsert $args 0 ::struct::queue::_$cmd $name]
-}
-
-# ::struct::queue::_clear --
-#
-#	Clear a queue.
-#
-# Arguments:
-#	name	name of the queue object.
-#
-# Results:
-#	None.
-
-proc ::struct::queue::_clear {name} {
-    variable queues
-    set queues($name) [list ]
-    return
-}
-
-# ::struct::queue::_destroy --
-#
-#	Destroy a queue object by removing it's storage space and 
-#	eliminating it's proc.
-#
-# Arguments:
-#	name	name of the queue object.
-#
-# Results:
-#	None.
-
-proc ::struct::queue::_destroy {name} {
-    variable queues
-    unset queues($name)
-    interp alias {} $name {}
-    return
-}
-
-# ::struct::queue::_get --
-#
-#	Get an item from a queue.
-#
-# Arguments:
-#	name	name of the queue object.
-#	count	number of items to get; defaults to 1
-#
-# Results:
-#	item	first count items from the queue; if there are not enough 
-#		items in the queue, throws an error.
-
-proc ::struct::queue::_get {name {count 1}} {
-    variable queues
-    if { $count < 1 } {
-	error "invalid item count $count"
-    }
-
-    if { $count > [llength $queues($name)] } {
-	error "insufficient items in queue to fill request"
-    }
-
-    if { $count == 1 } {
-	# Handle this as a special case, so single item gets aren't listified
-	set item [lindex $queues($name) 0]
-	set queues($name) [lreplace $queues($name) 0 0]
-	return $item
-    }
-
-    # Otherwise, return a list of items
-    set index [expr {$count - 1}]
-    set result [lrange $queues($name) 0 $index]
-    set queues($name) [lreplace $queues($name) 0 $index]
-
-    return $result
-}
-
-# ::struct::queue::_peek --
-#
-#	Retrieve the value of an item on the queue without removing it.
-#
-# Arguments:
-#	name	name of the queue object.
-#	count	number of items to peek; defaults to 1
-#
-# Results:
-#	items	top count items from the queue; if there are not enough items
-#		to fulfill the request, throws an error.
-
-proc ::struct::queue::_peek {name {count 1}} {
-    variable queues
-    if { $count < 1 } {
-	error "invalid item count $count"
-    }
-
-    if { $count > [llength $queues($name)] } {
-	error "insufficient items in queue to fill request"
-    }
-
-    if { $count == 1 } {
-	# Handle this as a special case, so single item pops aren't listified
-	return [lindex $queues($name) 0]
-    }
-
-    # Otherwise, return a list of items
-    set index [expr {$count - 1}]
-    return [lrange $queues($name) 0 $index]
-}
-
-# ::struct::queue::_put --
-#
-#	Put an item into a queue.
-#
-# Arguments:
-#	name	name of the queue object
-#	args	items to put.
-#
-# Results:
-#	None.
-
-proc ::struct::queue::_put {name args} {
-    variable queues
-    if { [llength $args] == 0 } {
-	error "wrong # args: should be \"$name put item ?item ...?\""
-    }
-    foreach item $args {
-	lappend queues($name) $item
-    }
-    return
-}
-
-# ::struct::queue::_unget --
-#
-#	Put an item into a queue. At the _front_!
-#
-# Arguments:
-#	name	name of the queue object
-#	item	item to put at the front of the queue
-#
-# Results:
-#	None.
-
-proc ::struct::queue::_unget {name item} {
-    variable queues
-    if {![llength $queues($name)]} {
-	set queues($name) [list $item]
-    } else {
-	set queues($name) [linsert $queues($name) 0 $item]
-    }
-    return
-}
-
-# ::struct::queue::_size --
-#
-#	Return the number of objects on a queue.
-#
-# Arguments:
-#	name	name of the queue object.
-#
-# Results:
-#	count	number of items on the queue.
-
-proc ::struct::queue::_size {name} {
-    variable queues
-    return [llength $queues($name)]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'queue::queue' into the general structure namespace.
-    namespace import -force queue::queue
-    namespace export queue
-}
-package provide struct::queue 1.4
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/record.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/record.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,788 +1,0 @@
-#============================================================
-# ::struct::record --
-#
-#    Implements a container data structure similar to a 'C' 
-#    structure. It hides the ugly details about keeping the
-#    data organized by using a combination of arrays, lists
-#    and namespaces.
-#   
-#    Each record definition is kept in a master array 
-#    (_recorddefn) under the ::struct::record namespace. Each
-#    instance of a record is kept within a separate namespace
-#    for each record definition. Hence, instances of
-#    the same record definition are managed under the
-#    same namespace. This avoids possible collisions, and
-#    also limits one big global array mechanism.
-#
-# Copyright (c) 2002 by Brett Schwarz
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# This code may be distributed under the same terms as Tcl.
-#
-# $Id: record.tcl,v 1.10 2004/09/29 20:56:18 andreas_kupries Exp $
-#
-#============================================================
-#
-####  FIX ERROR MESSAGES SO THEY MAKE SENSE (Wrong args)
-
-namespace eval ::struct {}
-
-namespace eval ::struct::record {
-
-    ##
-    ##  array of lists that holds the 
-    ##  definition (variables) for each 
-    ##  record
-    ##
-    ##  _recorddefn(some_record) var1 var2 var3 ...
-    ##
-    variable _recorddefn
-
-    ##
-    ##  holds the count for each record
-    ##  in cases where the instance is
-    ##  automatically generated
-    ##
-    ##  _count(some_record) 0
-    ##
-
-    ## This is not a count, but an id generator. Its value has to
-    ## increase monotonicaly.
-
-    variable _count
-
-    ##
-    ##  array that holds the defining record's
-    ##  name for each instances
-    ##
-    ##  _defn(some_instances) name_of_defining_record
-    ##
-    variable  _defn
-    array set _defn {}
-
-    ##
-    ##  This holds the defaults for a record definition.
-    ##  If no default is given for a member of a record,
-    ##  then the value is assigned to the empty string
-    ##
-    variable _defaults
-
-    ##
-    ##  These are the possible sub commands
-    ##
-    variable commands
-    set commands [list define delete exists show]
-
-    ##
-    ##  This keeps track of the level that we are in
-    ##  when handling nested records. This is kind of
-    ##  a hack, and probably can be handled better
-    ##
-    set _level 0
-
-    namespace export record
-}
-
-
-#------------------------------------------------------------
-# ::struct::record::record --
-#
-#    main command used to access the other sub commands
-#
-# Arguments:
-#    cmd_   The sub command (i.e. define, show, delete, exists)
-#    args   arguments to pass to the sub command
-#
-# Results:
-#  none returned
-#------------------------------------------------------------
-#
-proc ::struct::record::record {cmd_ args} {
-    variable commands
-
-    if {[lsearch $commands $cmd_] < 0} {
-        error "Sub command \"$cmd_\" is not recognized. Must be [join $commands ,]"
-    }
-
-    set cmd_ [string totitle "$cmd_"]
-    return [uplevel 1 ::struct::record::${cmd_} $args]
-
-}; # end proc ::struct::record::record
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Define --
-#
-#    Used to define a record
-#
-# Arguments:
-#    defn_    the name of the record definition
-#    vars_    the variables of the record (as a list)
-#    args     instances to be create during definition
-#
-# Results:
-#   Returns the name of the definition during successful
-#   creation.
-#------------------------------------------------------------
-#
-proc ::struct::record::Define {defn_ vars_ args} {
-
-    variable _recorddefn
-    variable _count
-    variable _defaults
-
-    set defn_ [Qualify $defn_]
-
-    if {[info exists _recorddefn($defn_)]} {
-        error "Record definition $defn_ already exists"
-    }
-
-    if {[lsearch [info commands] $defn_] >= 0} {
-        error "Structure definition name can not be a Tcl command name"
-    }
-
-    set _defaults($defn_)   [list]
-    set _recorddefn($defn_) [list]
-
-
-    ##
-    ##  Loop through the members of the record
-    ##  definition
-    ##
-    foreach V $vars_ {
-
-        set len [llength $V]
-        set D ""
-
-        ##
-        ##  2 --> there is a default value
-        ##        assigned to the member
-        ##
-        ##  3 --> there is a nested record
-        ##        definition given as a member
-        ##
-        if {$len == 2} {
-
-            set D [lindex $V 1]
-            set V [lindex $V 0]
-
-        } elseif {$len == 3} {
-
-            if {![string match "record" "[lindex $V 0]"]} {
-
-                Delete record $defn_
-                error "$V is a Bad member for record definition
-                definition creation aborted."
-            }
-
-            set new [lindex $V 1]
-
-            set new [Qualify $new]
-
-            ##
-            ##  Right now, there can not be circular records
-            ##  so, we abort the creation
-            ##
-            if {[string match "$defn_" "$new"]} {
-                Delete record $defn_
-                error "Can not have circular records. Structure was not created."
-            }
-
-            ##
-            ##  Will take care of the nested record later
-            ##  We just join by :: because this is how it
-            ##  use to be declared, so the parsing code
-            ##  is already there.
-            ##
-            set V [join [lrange $V 1 2] "::"]
-        }
-
-        lappend _recorddefn($defn_) $V
-        lappend _defaults($defn_)   $D
-    }
-    
-
-    uplevel #0 [list interp alias {} $defn_ {} ::struct::record::Create $defn_]
-
-    set _count($defn_) 0
-
-    namespace eval ::struct::record${defn_} {
-        variable values
-        variable instances
-
-        set instances [list]
-    }
-
-    ##
-    ##    If there were args given (instances), then
-    ##    create them now
-    ##
-    foreach A $args {
-
-        uplevel 1 [list ::struct::record::Create $defn_ $A]
-    }
-
-    return $defn_
-
-}; # end proc ::struct::record::Define
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Create --
-#
-#    Creates an instance of a record definition
-#
-# Arguments:
-#    defn_    the name of the record definition
-#    inst_    the name of the instances to create
-#    args     values to set to the record's members
-#
-# Results:
-#   Returns the name of the instance for a successful creation
-#------------------------------------------------------------
-#
-proc ::struct::record::Create {defn_ inst_ args} {
-
-    variable _recorddefn
-    variable _count
-    variable _defn
-    variable _defaults
-    variable _level
-
-    set inst_ [Qualify "$inst_"]
-
-    ##
-    ##    test to see if the record
-    ##    definition has been defined yet
-    ##
-    if {![info exists _recorddefn($defn_)]} {
-        error "Structure $defn_ does not exist"
-    }
-
-
-    ##
-    ##    if there was no argument given,
-    ##    then assume that the record
-    ##    variable is automatically
-    ##    generated
-    ##
-    if {[string match "[Qualify #auto]" "$inst_"]} {
-        set c $_count($defn_)
-        set inst_ [format "%s%s" ${defn_} $_count($defn_)]
-        incr _count($defn_)
-    }
-
-    ##
-    ##    Test to see if this instance is already
-    ##    created. This avoids any collisions with
-    ##    previously created instances
-    ##
-    if {[info exists _defn($inst_)]} {
-        incr _count($defn_) -1
-        error "Instances $inst_ already exists"
-    }
-
-    set _defn($inst_) $defn_
-
-    ##
-    ##    Initialize record variables to
-    ##    defaults
-    ##
-
-    uplevel #0 [list interp alias {} ${inst_} {} ::struct::record::Cmd $inst_]
-
-    set cnt 0
-    foreach V $_recorddefn($defn_) D $_defaults($defn_) {
-
-        set [Ns $inst_]values($inst_,$V) $D
-
-        ##
-        ##  Test to see if there is a nested record
-        ##
-        if {[regexp -- {([\w]*)::([\w]*)} $V m def inst]} {
-
-            if {$_level == 0} {
-                set _level 2
-            }
-
-            ##
-            ##  This is to guard against if the creation
-            ##  had failed, that there isn't any
-            ##  lingering variables/alias around
-            ##
-            set def [Qualify $def $_level]
-
-            if {![info exists _recorddefn($def)]} {
-
-                Delete inst "$inst_"
-
-                return
-            }
-
-            ##
-            ##    evaluate the nested record. If there
-            ##    were values for the variables passed
-            ##    in, then we assume that the value for
-            ##    this nested record is a list 
-            ##    corresponding the the nested list's
-            ##    variables, and so we pass that to
-            ##    the nested record's instantiation.
-            ##    We then get rid of those args for later
-            ##    processing.
-            ##
-            set cnt_plus [expr {$cnt + 1}]
-            set mem [lindex $args $cnt]
-            if {![string match "" "$mem"]} {
-                 if {![string match "-$inst" "$mem"]} {
-                    Delete inst "$inst_"
-                    error "$inst is not a member of $defn_"
-                }
-            }
-            incr _level
-            set narg [lindex $args $cnt_plus]
-            eval [linsert $narg 0 Create $def ${inst_}.${inst}]
-            set args [lreplace $args $cnt $cnt_plus]
-
-            incr _level -1
-        } else {
-
-            uplevel #0 [list interp alias {} ${inst_}.$V {} ::struct::record::Access $defn_ $inst_ $V]
-            incr cnt 2
-        }
-
-    }; # end foreach variable
-
-    lappend [Ns $inst_]instances $inst_
-
-    foreach {k v} $args {
-
-        Access $defn_ $inst_ [string trimleft "$k" -] $v
-
-    }; # end foreach arg {}
-
-    if {$_level == 2} {
-	set _level 0
-    }
-
-    return $inst_
-
-}; # end proc ::struct::record::Create
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Access --
-#
-#    Provides a common proc to access the variables
-#    from the aliases create for each variable in the record
-#
-# Arguments:
-#    defn_    the name of the record to access
-#    inst_    the name of the instance to create
-#    var_     the variable of the record to access
-#    args     a value to set to var_ (if any)
-#
-# Results:
-#    Returns the value of the record member (var_)
-#------------------------------------------------------------
-#
-proc ::struct::record::Access {defn_ inst_ var_ args} {
-
-    variable _recorddefn
-    variable _defn
-
-    set i [lsearch $_recorddefn($defn_) $var_]
-
-    if {$i < 0} {
-         error "$var_ does not exist in record $defn_"
-    }
-
-    if {![info exists _defn($inst_)]} {
-
-         error "$inst_ does not exist"
-    }
-
-    if {[set idx [lsearch $args "="]] >= 0} {
-        set args [lreplace $args $idx $idx]
-    } 
-
-    ##
-    ##    If a value was given, then set it
-    ##
-    if {[llength $args] != 0} {
-
-        set val_ [lindex $args 0]
-
-        set [Ns $inst_]values($inst_,$var_) $val_
-    }
-
-    return [set [Ns $inst_]values($inst_,$var_)]
-     
-}; # end proc ::struct::record::Access
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Cmd --
-#
-#    Used to process the set/get requests.
-#
-# Arguments:
-#    inst_    the record instance name
-#    args     For 'get' this is the record members to
-#             retrieve. For 'set' this is a member/value
-#             pair.
-#
-# Results:
-#   For 'set' returns the empty string. For 'get' it returns
-#   the member values.
-#------------------------------------------------------------
-#
-proc ::struct::record::Cmd {inst_ args} {
-
-    variable _defn
-
-    set result [list]
-
-    set len [llength $args]
-    if {$len <= 1} {return [Show values "$inst_"]}
-
-    set cmd [lindex $args 0]
-
-    if {[string match "cget" "$cmd"]} {
-
-            set cnt 0
-            foreach k [lrange $args 1 end] {
-                if {[catch {set r [${inst_}.[string trimleft ${k} -]]} err]} {
-                    error "Bad option \"$k\""
-                }
-
-                lappend result $r
-                incr cnt
-            }
-            if {$cnt == 1} {set result [lindex $result 0]}
-            return $result
-
-    } elseif {[string match "config*" "$cmd"]} {
-
-            set L [lrange $args 1 end]
-            foreach {k v} $L {
-                 ${inst_}.[string trimleft ${k} -] $v
-            }
-
-    } else {
-            error "Wrong argument.
-            must be \"object cget|configure args\""
-    }
-
-    return [list]
-
-}; # end proc ::struct::record::Cmd
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Ns --
-#
-#    This just constructs a fully qualified namespace for a
-#    particular instance.
-#
-# Arguments;
-#    inst_    instance to construct the namespace for.
-#
-# Results:
-#    Returns the fully qualified namespace for the instance
-#------------------------------------------------------------
-#
-proc ::struct::record::Ns {inst_} {
-
-    variable _defn
-
-    if {[catch {set ret $_defn($inst_)} err]} {
-        return $inst_
-    }
-
-    return [format "%s%s%s" "::struct::record" $ret "::"]
-
-}; # end proc ::struct::record::Ns
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Show --
-#
-#     Display info about the record that exist
-#
-# Arguments:
-#    what_    subcommand
-#    record_  record or instance to process
-#
-# Results:
-#    if what_ = record, then return list of records
-#               definition names.
-#    if what_ = members, then return list of members
-#               or members of the record.
-#    if what_ = instance, then return a list of instances
-#               with record definition of record_
-#    if what_ = values, then it will return the values
-#               for a particular instance
-#------------------------------------------------------------
-#
-proc ::struct::record::Show {what_ {record_ ""}} {
-
-    variable _recorddefn
-    variable _defn
-    variable _defaults
-
-    ##
-    ## We just prepend :: to the record_ argument
-    ##
-    if {![string match "::*" "$record_"]} {set record_ "::$record_"}
-
-    if {[string match "record*" "$what_"]} {
-        return [lsort [array names _recorddefn]]
-    } elseif {[string match "mem*" "$what_"]} {
-
-       if {[string match "" "$record_"] || ![info exists _recorddefn($record_)]} {
-           error "Bad arguments while accessing members. Bad record name"
-       }
-
-       set res [list]
-       set cnt 0
-       foreach m $_recorddefn($record_) {
-           set def [lindex $_defaults($record_) $cnt]
-           if {[regexp -- {([\w]+)::([\w]+)} $m m d i]} {
-               lappend res [list record $d $i]
-           } elseif {![string match "" "$def"]} {
-               lappend res [list $m $def]
-           } else {
-               lappend res $m
-           }
-
-           incr cnt
-       }
-
-       return $res
-
-    } elseif {[string match "inst*" "$what_"]} {
-
-        if {![info exists ::struct::record${record_}::instances]} {
-            return [list]
-        }
-        return [lsort [set ::struct::record${record_}::instances]]
-
-    } elseif {[string match "val*" "$what_"]} {
-
-           set ns $_defn($record_)
-
-           if {[string match "" "$record_"] || ([lsearch [set [Ns $record_]instances] $record_] < 0)} {
-
-               error "Wrong arguments to values. Bad instance name"
-           }
-
-           set ret [list]
-           foreach k $_recorddefn($ns) {
-
-              set v [set [Ns $record_]values($record_,$k)]
-
-              if {[regexp -- {([\w]*)::([\w]*)} $k m def inst]} {
-                  set v [::struct::record::Show values ${record_}.${inst}]
-              }
-
-              lappend ret -[namespace tail $k] $v
-           }
-           return $ret
-
-    }
-
-    return [list]
-
-}; # end proc ::struct::record::Show
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Delete --
-#
-#    Deletes a record instance or a record definition
-#
-# Arguments:
-#    sub_    what to delete. Either 'instance' or 'record'
-#    item_   the specific record instance or definition
-#            delete.
-#
-# Returns:
-#    none
-#
-#------------------------------------------------------------
-#
-proc ::struct::record::Delete {sub_ item_} {
-
-    variable _recorddefn
-    variable _defn
-    variable _count
-    variable _defaults
-
-    ##
-    ## We just semi-blindly prepend :: to the record_ argument
-    ##
-    if {![string match "::*" "$item_"]} {set item_ "::$item_"}
-
-    switch -- $sub_ {
-
-        instance -
-        instances -
-        inst    {
-
-
-            if {[Exists instance $item_]} {
-        
-		set ns $_defn($item_)
-                foreach A [info commands ${item_}.*] {
-		    Delete inst $A
-                }
-        
-                catch {
-                    foreach {k v} [array get [Ns $item_]values $item_,*] {
-                        
-                        unset [Ns $item_]values($k)
-                    }
-                    set i [lsearch [set [Ns $item_]instances] $item_]
-                    set [Ns $item_]instances [lreplace [set [Ns $item_]instances] $i $i]
-                    unset _defn($item_)
-                }
-
-		# Auto-generated id numbers increase monotonically.
-		# Reverting here causes the next auto to fail, claiming
-		# that the instance exists.
-                # incr _count($ns) -1
-        
-            } else {
-                #error "$item_ is not a instance"
-            }
-        }
-        record  -
-        records   {
-
-
-            ##
-            ##  Delete the instances for this
-            ##  record
-            ##
-            foreach I [Show instance "$item_"] {
-                catch {Delete instance "$I"}
-            }
-
-            catch {
-                unset _recorddefn($item_)
-                unset _defaults($item_)
-                unset _count($item_)
-                namespace delete ::struct::record${item_}
-            }
-
-            
-        }
-        default   {
-            error "Wrong arguments to delete"
-        }
-
-    }; # end switch
-
-    catch { uplevel #0 [list interp alias {} $item_ {}]}
-
-    return
-
-}; # end proc ::struct::record::Delete
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Exists --
-#
-#    Tests whether a record definition or record
-#    instance exists.
-#
-# Arguments:
-#    sub_    what to test. Either 'instance' or 'record'
-#    item_   the specific record instance or definition
-#            that needs to be tested.
-#    
-# Tests to see if a particular instance exists
-#
-#------------------------------------------------------------
-#
-proc ::struct::record::Exists {sub_ item_} {
-
-
-    switch -glob -- $sub_ {
-        inst*    {
-    
-            if {([lsearch ::[Ns $item_]instances $item_] >=0) || [llength [info commands ::${item_}.*]]} {
-                return 1
-            } else {
-                return 0
-            }
-        }
-        record  {
-    
-            set item_ "::$item_"
-            if {[info exists _recorddefn($item_)] || [llength [info commands ${item_}]]} {
-                return 1
-            } else {
-                return 0
-            }
-        }
-        default  {
-            error "Wrong arguments. Must be exists record|instance target"
-        }
-    }; # end switch
-
-}; # end proc ::struct::record::Exists
-
-
-
-#------------------------------------------------------------
-# ::struct::record::Qualify --
-#
-#    Contructs the qualified name of the calling scope. This
-#    defaults to 2 levels since there is an extra proc call in
-#    between.
-#
-# Arguments:
-#    item_   the command that needs to be qualified
-#    level_  how many levels to go up (default = 2)
-#    
-# Results:
-#    the item_ passed in fully qualified
-#
-#------------------------------------------------------------
-#
-proc ::struct::record::Qualify {item_ {level_ 2}} {
-
-    if {![string match "::*" "$item_"]} {
-        set ns [uplevel $level_ [list namespace current]]
-
-        if {![string match "::" "$ns"]} {
-            append ns "::"
-        }
-     
-        set item_ "$ns${item_}"
-    }
-
-    return "$item_"
-
-}; # end proc ::struct::record::Qualify
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'record::record' into the general structure namespace.
-    namespace import -force record::record
-    namespace export record
-}
-package provide struct::record 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,189 +1,0 @@
-#----------------------------------------------------------------------
-#
-# sets.tcl --
-#
-#	Definitions for the processing of sets.
-#
-# Copyright (c) 2004-2007 by Andreas Kupries.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: sets.tcl,v 1.15 2007/08/29 22:10:31 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-# @mdgen EXCLUDE: sets_c.tcl
-
-package require Tcl 8.2
-
-namespace eval ::struct::set {}
-
-# ### ### ### ######### ######### #########
-## Management of set implementations.
-
-# ::struct::set::LoadAccelerator --
-#
-#	Loads a named implementation, if possible.
-#
-# Arguments:
-#	key	Name of the implementation to load.
-#
-# Results:
-#	A boolean flag. True if the implementation
-#	was successfully loaded; and False otherwise.
-
-proc ::struct::set::LoadAccelerator {key} {
-    variable accel
-    set r 0
-    switch -exact -- $key {
-	critcl {
-	    # Critcl implementation of set requires Tcl 8.4.
-	    if {![package vsatisfies [package provide Tcl] 8.4]} {return 0}
-	    if {[catch {package require tcllibc}]} {return 0}
-	    set r [llength [info commands ::struct::set_critcl]]
-	}
-	tcl {
-	    variable selfdir
-	    source [file join $selfdir sets_tcl.tcl]
-	    set r 1
-	}
-        default {
-            return -code error "invalid accelerator/impl. package $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($key) $r
-    return $r
-}
-
-# ::struct::set::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::struct::set::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-	rename ::struct::set ::struct::set_$loaded
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-	rename ::struct::set_$key ::struct::set
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-proc ::struct::set::Loaded {} {
-    variable loaded
-    return  $loaded
-}
-
-# ::struct::set::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::struct::set::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::struct::set::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::struct::set::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-proc ::struct::set::Names {} {
-    return {
-	critcl {tcllibc based}
-	tcl    {pure Tcl}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Data structures.
-
-namespace eval ::struct::set {
-    variable  selfdir [file dirname [info script]]
-    variable  accel
-    array set accel   {tcl 0 critcl 0}
-    variable  loaded  {}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Choose an implementation,
-## most prefered first. Loads only one of the
-## possible implementations. And activates it.
-
-namespace eval ::struct::set {
-    variable e
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Export the constructor command.
-    namespace export set
-}
-
-package provide struct::set 2.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets_c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets_c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#----------------------------------------------------------------------
-#
-# sets_tcl.tcl --
-#
-#       Definitions for the processing of sets. C implementation.
-#
-# Copyright (c) 2007 by Andreas Kupries.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: sets_c.tcl,v 1.1 2007/01/21 22:15:59 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-package require critcl
-package provide struct_setc 2.1.1
-package require Tcl 8.4
-
-namespace eval ::struct {
-    # Supporting code for the main command.
-
-    catch {
-        critcl::cheaders -g
-        critcl::debug memory symbols
-    }
-
-    critcl::cheaders sets/*.h
-    critcl::csources sets/*.c
-
-    critcl::ccode {
-        /* -*- c -*- */
-
-        #include <m.h>
-    }
-
-    # Main command, set creation.
-
-    critcl::ccommand set_critcl {dummy interp objc objv} {
-	/* Syntax - dispatcher to the sub commands.
-	 */
-
-        static CONST char* methods [] = {
-            "add",      "contains",     "difference",   "empty",
-            "equal","exclude",  "include",      "intersect",
-            "intersect3",       "size", "subsetof",     "subtract",
-            "symdiff",  "union",
-            NULL
-        };
-        enum methods {
-            S_add,      S_contains,     S_difference,   S_empty,
-            S_equal,S_exclude,  S_include,      S_intersect,
-            S_intersect3,       S_size, S_subsetof,     S_subtract,
-            S_symdiff,  S_union
-        };
-
-	int m;
-
-        if (objc < 2) {
-            Tcl_WrongNumArgs (interp, objc, objv, "cmd ?arg ...?");
-            return TCL_ERROR;
-        } else if (Tcl_GetIndexFromObj (interp, objv [1], methods, "option",
-            0, &m) != TCL_OK) {
-            return TCL_ERROR;
-        }
-
-        /* Dispatch to methods. They check the #args in detail before performing
-         * the requested functionality
-         */
-
-        switch (m) {
-            case S_add:        return sm_ADD        (NULL, interp, objc, objv);
-            case S_contains:   return sm_CONTAINS   (NULL, interp, objc, objv);
-            case S_difference: return sm_DIFFERENCE (NULL, interp, objc, objv);
-            case S_empty:      return sm_EMPTY      (NULL, interp, objc, objv);
-            case S_equal:      return sm_EQUAL      (NULL, interp, objc, objv);
-            case S_exclude:    return sm_EXCLUDE    (NULL, interp, objc, objv);
-            case S_include:    return sm_INCLUDE    (NULL, interp, objc, objv);
-            case S_intersect:  return sm_INTERSECT  (NULL, interp, objc, objv);
-            case S_intersect3: return sm_INTERSECT3 (NULL, interp, objc, objv);
-            case S_size:       return sm_SIZE       (NULL, interp, objc, objv);
-            case S_subsetof:   return sm_SUBSETOF   (NULL, interp, objc, objv);
-            case S_subtract:   return sm_SUBTRACT   (NULL, interp, objc, objv);
-            case S_symdiff:    return sm_SYMDIFF    (NULL, interp, objc, objv);
-            case S_union:      return sm_UNION      (NULL, interp, objc, objv);
-        }
-        /* Not coming to this place */
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/sets_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,445 +1,0 @@
-#----------------------------------------------------------------------
-#
-# sets_tcl.tcl --
-#
-#	Definitions for the processing of sets.
-#
-# Copyright (c) 2004-2007 by Andreas Kupries.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: sets_tcl.tcl,v 1.1 2007/01/21 22:15:59 andreas_kupries Exp $
-#
-#----------------------------------------------------------------------
-
-package require Tcl 8.0
-
-namespace eval ::struct::set {
-    # Only export one command, the one used to instantiate a new tree
-    namespace export set_tcl
-}
-
-##########################
-# Public functions
-
-# ::struct::set::set --
-#
-#	Command that access all set commands.
-#
-# Arguments:
-#	cmd	Name of the subcommand to dispatch to.
-#	args	Arguments for the subcommand.
-#
-# Results:
-#	Whatever the result of the subcommand is.
-
-proc ::struct::set::set_tcl {cmd args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 1 } {
-	return -code error "wrong # args: should be \"$cmd ?arg arg ...?\""
-    }
-    ::set sub S_$cmd
-    if { [llength [info commands ::struct::set::$sub]] == 0 } {
-	::set optlist [info commands ::struct::set::S_*]
-	::set xlist {}
-	foreach p $optlist {
-	    lappend xlist [string range $p 17 end]
-	}
-	return -code error \
-		"bad option \"$cmd\": must be [linsert [join [lsort $xlist] ", "] "end-1" "or"]"
-    }
-    return [uplevel 1 [linsert $args 0 ::struct::set::$sub]]
-}
-
-##########################
-# Implementations of the functionality.
-#
-
-# ::struct::set::S_empty --
-#
-#       Determines emptiness of the set
-#
-# Parameters:
-#       set	-- The set to check for emptiness.
-#
-# Results:
-#       A boolean value. True indicates that the set is empty.
-#
-# Side effects:
-#       None.
-#
-# Notes:
-
-proc ::struct::set::S_empty {set} {
-    return [expr {[llength $set] == 0}]
-}
-
-# ::struct::set::S_size --
-#
-#	Computes the cardinality of the set.
-#
-# Parameters:
-#	set	-- The set to inspect.
-#
-# Results:
-#       An integer greater than or equal to zero.
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_size {set} {
-    return [llength [Cleanup $set]]
-}
-
-# ::struct::set::S_contains --
-#
-#	Determines if the item is in the set.
-#
-# Parameters:
-#	set	-- The set to inspect.
-#	item	-- The element to look for.
-#
-# Results:
-#	A boolean value. True indicates that the element is present.
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_contains {set item} {
-    return [expr {[lsearch -exact $set $item] >= 0}]
-}
-
-# ::struct::set::S_union --
-#
-#	Computes the union of the arguments.
-#
-# Parameters:
-#	args	-- List of sets to unify.
-#
-# Results:
-#	The union of the arguments.
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_union {args} {
-    switch -exact -- [llength $args] {
-	0 {return {}}
-	1 {return [lindex $args 0]}
-    }
-    foreach setX $args {
-	foreach x $setX {::set ($x) {}}
-    }
-    return [array names {}]
-}
-
-
-# ::struct::set::S_intersect --
-#
-#	Computes the intersection of the arguments.
-#
-# Parameters:
-#	args	-- List of sets to intersect.
-#
-# Results:
-#	The intersection of the arguments
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_intersect {args} {
-    switch -exact -- [llength $args] {
-	0 {return {}}
-	1 {return [lindex $args 0]}
-    }
-    ::set res [lindex $args 0]
-    foreach set [lrange $args 1 end] {
-	if {[llength $res] && [llength $set]} {
-	    ::set res [Intersect $res $set]
-	} else {
-	    # Squash 'res'. Otherwise we get the wrong result if res
-	    # is not empty, but 'set' is.
-	    ::set res {}
-	    break
-	}
-    }
-    return $res
-}
-
-proc ::struct::set::Intersect {A B} {
-    if {[llength $A] == 0} {return {}}
-    if {[llength $B] == 0} {return {}}
-
-    # This is slower than local vars, but more robust
-    if {[llength $B] > [llength $A]} {
-	::set res $A
-	::set A $B
-	::set B $res
-    }
-    ::set res {}
-    foreach x $A {::set ($x) {}}
-    foreach x $B {
-	if {[info exists ($x)]} {
-	    lappend res $x
-	}
-    }
-    return $res
-}
-
-# ::struct::set::S_difference --
-#
-#	Compute difference of two sets.
-#
-# Parameters:
-#	A, B	-- Sets to compute the difference for.
-#
-# Results:
-#	A - B
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_difference {A B} {
-    if {[llength $A] == 0} {return {}}
-    if {[llength $B] == 0} {return $A}
-
-    array set tmp {}
-    foreach x $A {::set tmp($x) .}
-    foreach x $B {catch {unset tmp($x)}}
-    return [array names tmp]
-}
-
-if {0} {
-    # Tcllib SF Bug 1002143. We cannot use the implementation below.
-    # It will treat set elements containing '(' and ')' as array
-    # elements, and this screws up the storage of elements as the name
-    # of local vars something fierce. No way around this. Disabling
-    # this code and always using the other implementation (s.a.) is
-    # the only possible fix.
-
-    if {[package vcompare [package provide Tcl] 8.4] < 0} {
-	# Tcl 8.[23]. Use explicit array to perform the operation.
-    } else {
-	# Tcl 8.4+, has 'unset -nocomplain'
-
-	proc ::struct::set::S_difference {A B} {
-	    if {[llength $A] == 0} {return {}}
-	    if {[llength $B] == 0} {return $A}
-
-	    # Get the variable B out of the way, avoid collisions
-	    # prepare for "pure list optimization"
-	    ::set ::struct::set::tmp [lreplace $B -1 -1 unset -nocomplain]
-	    unset B
-
-	    # unset A early: no local variables left
-	    foreach [lindex [list $A [unset A]] 0] {.} {break}
-
-	    eval $::struct::set::tmp
-	    return [info locals]
-	}
-    }
-}
-
-# ::struct::set::S_symdiff --
-#
-#	Compute symmetric difference of two sets.
-#
-# Parameters:
-#	A, B	-- The sets to compute the s.difference for.
-#
-# Results:
-#	The symmetric difference of the two input sets.
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_symdiff {A B} {
-    # symdiff == (A-B) + (B-A) == (A+B)-(A*B)
-    if {[llength $A] == 0} {return $B}
-    if {[llength $B] == 0} {return $A}
-    return [S_union \
-	    [S_difference $A $B] \
-	    [S_difference $B $A]]
-}
-
-# ::struct::set::S_intersect3 --
-#
-#	Return intersection and differences for two sets.
-#
-# Parameters:
-#	A, B	-- The sets to inspect.
-#
-# Results:
-#	List containing A*B, A-B, and B-A
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_intersect3 {A B} {
-    return [list \
-	    [S_intersect $A $B] \
-	    [S_difference $A $B] \
-	    [S_difference $B $A]]
-}
-
-# ::struct::set::S_equal --
-#
-#	Compares two sets for equality.
-#
-# Parameters:
-#	a	First set to compare.
-#	b	Second set to compare.
-#
-# Results:
-#	A boolean. True if the lists are equal.
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_equal {A B} {
-    ::set A [Cleanup $A]
-    ::set B [Cleanup $B]
-
-    # Equal if of same cardinality and difference is empty.
-
-    if {[::llength $A] != [::llength $B]} {return 0}
-    return [expr {[llength [S_difference $A $B]] == 0}]
-}
-
-
-proc ::struct::set::Cleanup {A} {
-    # unset A to avoid collisions
-    if {[llength $A] < 2} {return $A}
-    foreach [lindex [list $A [unset A]] 0] {.} {break}
-    return [info locals]
-}
-
-# ::struct::set::S_include --
-#
-#	Add an element to a set.
-#
-# Parameters:
-#	Avar	-- Reference to the set variable to extend.
-#	element	-- The item to add to the set.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#       The set in the variable referenced by Avar is extended
-#	by the element (if the element was not already present).
-
-proc ::struct::set::S_include {Avar element} {
-    # Avar = Avar + {element}
-    upvar 1 $Avar A
-    if {![info exists A] || ![S_contains $A $element]} {
-	lappend A $element
-    }
-    return
-}
-
-# ::struct::set::S_exclude --
-#
-#	Remove an element from a set.
-#
-# Parameters:
-#	Avar	-- Reference to the set variable to shrink.
-#	element	-- The item to remove from the set.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#       The set in the variable referenced by Avar is shrunk,
-#	the element remove (if the element was actually present).
-
-proc ::struct::set::S_exclude {Avar element} {
-    # Avar = Avar + {element}
-    upvar 1 $Avar A
-    while {[::set pos [lsearch -exact $A $element]] >= 0} {
-	::set A [lreplace [K $A [::set A {}]] $pos $pos]
-    }
-    return
-}
-
-# ::struct::set::S_add --
-#
-#	Add a set to a set. Similar to 'union', but the first argument
-#	is a variable.
-#
-# Parameters:
-#	Avar	-- Reference to the set variable to extend.
-#	B	-- The set to add to the set in Avar.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#       The set in the variable referenced by Avar is extended
-#	by all the elements in B.
-
-proc ::struct::set::S_add {Avar B} {
-    # Avar = Avar + B
-    upvar 1 $Avar A
-    ::set A [S_union [K $A [::set A {}]] $B]
-    return
-}
-
-# ::struct::set::S_subtract --
-#
-#	Remove a set from a set. Similar to 'difference', but the first argument
-#	is a variable.
-#
-# Parameters:
-#	Avar	-- Reference to the set variable to shrink.
-#	B	-- The set to remove from the set in Avar.
-#
-# Results:
-#	None.
-#
-# Side effects:
-#       The set in the variable referenced by Avar is shrunk,
-#	all elements of B are removed.
-
-proc ::struct::set::S_subtract {Avar B} {
-    # Avar = Avar - B
-    upvar 1 $Avar A
-    ::set A [S_difference [K $A [::set A {}]] $B]
-    return
-}
-
-# ::struct::set::S_subsetof --
-#
-#	A predicate checking if the first set is a subset
-#	or equal to the second set.
-#
-# Parameters:
-#	A	-- The possible subset.
-#	B	-- The set to compare to.
-#
-# Results:
-#	A boolean value, true if A is subset of or equal to B
-#
-# Side effects:
-#       None.
-
-proc ::struct::set::S_subsetof {A B} {
-    # A subset|== B <=> (A == A*B)
-    return [S_equal $A [S_intersect $A $B]]
-}
-
-# ::struct::set::K --
-# Performance helper command.
-
-proc ::struct::set::K {x y} {::set x}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Put 'set::set' into the general structure namespace
-    # for pickup by the main management.
-
-    namespace import -force set::set_tcl
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/skiplist.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/skiplist.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,437 +1,0 @@
-# skiplist.tcl --
-#
-#	Implementation of a skiplist data structure for Tcl.
-#
-#	To quote the inventor of skip lists, William Pugh:
-#		Skip lists are a probabilistic data structure that seem likely
-#		to supplant balanced trees as the implementation method of
-#		choice for many applications. Skip list algorithms have the
-#		same asymptotic expected time bounds as balanced trees and are
-#		simpler, faster and use less space.
-#
-#	For more details on how skip lists work, see Pugh, William. Skip
-#	lists: a probabilistic alternative to balanced trees in
-#	Communications of the ACM, June 1990, 33(6) 668-676. Also, see
-#	ftp://ftp.cs.umd.edu/pub/skipLists/
-# 
-# Copyright (c) 2000 by Keith Vetter
-# This software is licensed under a BSD license as described in tcl/tk
-# license.txt file but with the copyright held by Keith Vetter.
-#
-# TODO:
-#	customize key comparison to a user supplied routine
-
-namespace eval ::struct {}
-
-namespace eval ::struct::skiplist {
-    # Data storage in the skiplist module
-    # -------------------------------
-    #
-    # For each skiplist, we have the following arrays
-    #   state - holds the current level plus some magic constants
-    #	nodes - all the nodes in the skiplist, including a dummy header node
-    
-    # counter is used to give a unique name for unnamed skiplists
-    variable counter 0
-
-    # Internal constants
-    variable MAXLEVEL 16
-    variable PROB .5
-    variable MAXINT [expr {0x7FFFFFFF}]
-
-    # commands is the list of subcommands recognized by the skiplist
-    variable commands [list \
-	    "destroy"	\
-	    "delete"	\
-	    "insert"	\
-	    "search"	\
-	    "size"	\
-	    "walk"	\
-	    ]
-
-    # State variables that can be set in the instantiation
-    variable vars [list maxlevel probability]
-    
-    # Only export one command, the one used to instantiate a new skiplist
-    namespace export skiplist
-}
-
-# ::struct::skiplist::skiplist --
-#
-#	Create a new skiplist with a given name; if no name is given, use
-#	skiplistX, where X is a number.
-#
-# Arguments:
-#	name	name of the skiplist; if null, generate one.
-#
-# Results:
-#	name	name of the skiplist created
-
-proc ::struct::skiplist::skiplist {{name ""} args} {
-    set usage "skiplist name ?-maxlevel ##? ?-probability ##?"
-    variable counter
-    
-    if { [llength [info level 0]] == 1 } {
-	incr counter
-	set name "skiplist${counter}"
-    }
-
-    if { ![string equal [info commands ::$name] ""] } {
-	error "command \"$name\" already exists, unable to create skiplist"
-    }
-
-    # Handle the optional arguments
-    set more_eval ""
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set flag [lindex $args $i]
-	incr i
-	if { $i >= [llength $args] } {
-	    error "value for \"$flag\" missing: should be \"$usage\""
-	}
-	set value [lindex $args $i]
-	switch -glob -- $flag {
-	    "-maxl*" {
-		set n [catch {set value [expr $value]}]
-		if {$n || $value <= 0} {
-		    error "value for the maxlevel option must be greater than 0"
-		}
-		append more_eval "; set state(maxlevel) $value"
-	    }
-	    "-prob*" {
-		set n [catch {set value [expr $value]}]
-		if {$n || $value <= 0 || $value >= 1} {
-		    error "probability must be between 0 and 1"
-		}
-		append more_eval "; set state(prob) $value"
-	    }
-	    default {
-		error "unknown option \"$flag\": should be \"$usage\""
-	    }
-	}
-    }
-    
-    # Set up the namespace for this skiplist
-    namespace eval ::struct::skiplist::skiplist$name {
-	variable state
-	variable nodes
-
-	# NB. maxlevel and prob may be overridden by $more_eval at the end
-	set state(maxlevel) $::struct::skiplist::MAXLEVEL
-	set state(prob) $::struct::skiplist::PROB
-	set state(level) 1
-	set state(cnt) 0
-	set state(size) 0
-
-	set nodes(nil,key) $::struct::skiplist::MAXINT
-	set nodes(header,key) "---"
-	set nodes(header,value) "---"
-
-	for {set i 1} {$i < $state(maxlevel)} {incr i} {
-	    set nodes(header,$i) nil
-	}
-    } $more_eval
-
-    # Create the command to manipulate the skiplist
-    interp alias {} ::$name {} ::struct::skiplist::SkiplistProc $name
-
-    return $name
-}
-
-###########################
-# Private functions follow
-
-# ::struct::skiplist::SkiplistProc --
-#
-#	Command that processes all skiplist object commands.
-#
-# Arguments:
-#	name	name of the skiplist object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::skiplist::SkiplistProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-    
-    # Split the args into command and args components
-    if { [llength [info commands ::struct::skiplist::_$cmd]] == 0 } {
-	variable commands
-	set optlist [join $commands ", "]
-	set optlist [linsert $optlist "end-1" "or"]
-	error "bad option \"$cmd\": must be $optlist"
-    }
-    eval [linsert $args 0 ::struct::skiplist::_$cmd $name]
-}
-
-## ::struct::skiplist::_destroy --
-#
-#	Destroy a skiplist, including its associated command and data storage.
-#
-# Arguments:
-#	name	name of the skiplist.
-#
-# Results:
-#	None.
-
-proc ::struct::skiplist::_destroy {name} {
-    namespace delete ::struct::skiplist::skiplist$name
-    interp alias {} ::$name {}
-}
-
-# ::struct::skiplist::_search --
-#
-#	Searches for a key in a skiplist
-#
-# Arguments:
-#	name		name of the skiplist.
-#	key		key for the node to search for
-#
-# Results:
-#	0 if not found
-#	[list 1 node_value] if found
-
-proc ::struct::skiplist::_search {name key} {
-    upvar ::struct::skiplist::skiplist${name}::state state
-    upvar ::struct::skiplist::skiplist${name}::nodes nodes
-
-    set x header
-    for {set i $state(level)} {$i >= 1} {incr i -1} {
-	while {1} {
-	    set fwd $nodes($x,$i)
-	    if {$nodes($fwd,key) == $::struct::skiplist::MAXINT} break
-	    if {$nodes($fwd,key) >= $key} break
-	    set x $fwd
-	}
-    }
-    set x $nodes($x,1)
-    if {$nodes($x,key) == $key} {
-	return [list 1 $nodes($x,value)]
-    }
-    return 0
-}
-
-# ::struct::skiplist::_insert --
-#
-#	Add a node to a skiplist.
-#
-# Arguments:
-#	name		name of the skiplist.
-#	key		key for the node to insert
-#	value		value of the node to insert
-#
-# Results:
-#	0      if new node was created
-#       level  if existing node was updated
-
-proc ::struct::skiplist::_insert {name key value} {
-    upvar ::struct::skiplist::skiplist${name}::state state
-    upvar ::struct::skiplist::skiplist${name}::nodes nodes
-    
-    set x header
-    for {set i $state(level)} {$i >= 1} {incr i -1} {
-	while {1} {
-	    set fwd $nodes($x,$i)
-	    if {$nodes($fwd,key) == $::struct::skiplist::MAXINT} break
-	    if {$nodes($fwd,key) >= $key} break
-	    set x $fwd
-	}
-	set update($i) $x
-    }
-    set x $nodes($x,1)
-
-    # Does the node already exist?
-    if {$nodes($x,key) == $key} {
-	set nodes($x,value) $value
-	return 0
-    }
-
-    # Here to insert item
-    incr state(size)
-    set lvl [randomLevel $state(prob) $state(level) $state(maxlevel)]
-
-    # Did the skip list level increase???
-    if {$lvl > $state(level)} {
-	for {set i [expr {$state(level) + 1}]} {$i <= $lvl} {incr i} {
-	    set update($i) header
-	}
-	set state(level) $lvl
-    }
-
-    # Create a unique new node name and fill in the key, value parts
-    set x [incr state(cnt)] 
-    set nodes($x,key) $key
-    set nodes($x,value) $value
-
-    for {set i 1} {$i <= $lvl} {incr i} {
-	set nodes($x,$i) $nodes($update($i),$i)
-	set nodes($update($i),$i) $x
-    }
-
-    return $lvl
-}
-
-# ::struct::skiplist::_delete --
-#
-#	Deletes a node from a skiplist
-#
-# Arguments:
-#	name		name of the skiplist.
-#	key		key for the node to delete
-#
-# Results:
-#	1 if we deleted a node
-#       0 otherwise
-
-proc ::struct::skiplist::_delete {name key} {
-    upvar ::struct::skiplist::skiplist${name}::state state
-    upvar ::struct::skiplist::skiplist${name}::nodes nodes
-    
-    set x header
-    for {set i $state(level)} {$i >= 1} {incr i -1} {
-	while {1} {
-	    set fwd $nodes($x,$i)
-	    if {$nodes($fwd,key) >= $key} break
-	    set x $fwd
-	}
-	set update($i) $x
-    }
-    set x $nodes($x,1)
-
-    # Did we find a node to delete?
-    if {$nodes($x,key) != $key} {
-	return 0
-    }
-    
-    # Here when we found a node to delete
-    incr state(size) -1
-    
-    # Unlink this node from all the linked lists that include to it
-    for {set i 1} {$i <= $state(level)} {incr i} {
-	set fwd $nodes($update($i),$i)
-	if {$nodes($fwd,key) != $key} break
-	set nodes($update($i),$i) $nodes($x,$i)
-    }
-    
-    # Delete all traces of this node
-    foreach v [array names nodes($x,*)] {
-	unset nodes($v)
-    }
-
-    # Fix up the level in case it went down
-    while {$state(level) > 1} {
-	if {! [string equal "nil" $nodes(header,$state(level))]} break
-	incr state(level) -1
-    }
-
-    return 1
-}
-
-# ::struct::skiplist::_size --
-#
-#	Returns how many nodes are in the skiplist
-#
-# Arguments:
-#	name		name of the skiplist.
-#
-# Results:
-#	number of nodes in the skiplist
-
-proc ::struct::skiplist::_size {name} {
-    upvar ::struct::skiplist::skiplist${name}::state state
-
-    return $state(size)
-}
-
-# ::struct::skiplist::_walk --
-#
-#	Walks a skiplist performing a specified command on each node.
-#	Command is executed at the global level with the actual command
-#	executed is:  command key value
-#
-# Arguments:
-#	name	name of the skiplist.
-#	cmd		command to run on each node
-#
-# Results:
-#	none.
-
-proc ::struct::skiplist::_walk {name cmd} {
-    upvar ::struct::skiplist::skiplist${name}::nodes nodes
-
-    for {set x $nodes(header,1)} {$x != "nil"} {set x $nodes($x,1)} {
-	# Evaluate the command at this node
-	set cmdcpy $cmd
-	lappend cmdcpy $nodes($x,key) $nodes($x,value)
-	uplevel 2 $cmdcpy
-    }
-}
-
-# ::struct::skiplist::randomLevel --
-#
-#	Generates a random level for a new node. We limit it to 1 greater
-#	than the current level. 
-#
-# Arguments:
-#	prob		probability to use in generating level
-#	level		current biggest level
-#	maxlevel	biggest possible level
-#
-# Results:
-#	an integer between 1 and $maxlevel
-
-proc ::struct::skiplist::randomLevel {prob level maxlevel} {
-
-    set lvl 1
-    while {(rand() < $prob) && ($lvl < $maxlevel)} {
-	incr lvl
-    }
-
-    if {$lvl > $level} {
-	set lvl [expr {$level + 1}]
-    }
-    
-    return $lvl
-}
-
-# ::struct::skiplist::_dump --
-#
-#	Dumps out a skip list. Useful for debugging.
-#
-# Arguments:
-#	name	name of the skiplist.
-#
-# Results:
-#	none.
-
-proc ::struct::skiplist::_dump {name} {
-    upvar ::struct::skiplist::skiplist${name}::state state
-    upvar ::struct::skiplist::skiplist${name}::nodes nodes
-
-
-    puts "Current level $state(level)"
-    puts "Maxlevel:     $state(maxlevel)"
-    puts "Probability:  $state(prob)"
-    puts ""
-    puts "NODE    KEY  FORWARD"
-    for {set x header} {$x != "nil"} {set x $nodes($x,1)} {
-	puts -nonewline [format "%-6s  %3s %4s" $x $nodes($x,key) $nodes($x,1)]
-	for {set i 2} {[info exists nodes($x,$i)]} {incr i} {
-	    puts -nonewline [format %4s $nodes($x,$i)]
-	}
-	puts ""
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'skiplist::skiplist' into the general structure namespace.
-    namespace import -force skiplist::skiplist
-    namespace export skiplist
-}
-package provide struct::skiplist 1.3
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/stack.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/stack.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,302 +1,0 @@
-# stack.tcl --
-#
-#	Stack implementation for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: stack.tcl,v 1.13 2005/10/03 17:52:22 andreas_kupries Exp $
-
-namespace eval ::struct {}
-
-namespace eval ::struct::stack {
-    # The stacks array holds all of the stacks you've made
-    variable stacks
-    
-    # counter is used to give a unique name for unnamed stacks
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new stack
-    namespace export stack
-}
-
-# ::struct::stack::stack --
-#
-#	Create a new stack with a given name; if no name is given, use
-#	stackX, where X is a number.
-#
-# Arguments:
-#	name	name of the stack; if null, generate one.
-#
-# Results:
-#	name	name of the stack created
-
-proc ::struct::stack::stack {args} {
-    variable stacks
-    variable counter
-    
-    switch -exact -- [llength [info level 0]] {
-	1 {
-	    # Missing name, generate one.
-	    incr counter
-	    set name "stack${counter}"
-	}
-	2 {
-	    # Standard call. New empty stack.
-	    set name [lindex $args 0]
-	}
-	default {
-	    # Error.
-	    return -code error \
-		    "wrong # args: should be \"stack ?name?\""
-	}
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-    if {[llength [info commands $name]]} {
-	return -code error \
-		"command \"$name\" already exists, unable to create stack"
-    }
-
-    set stacks($name) [list ]
-
-    # Create the command to manipulate the stack
-    interp alias {} $name {} ::struct::stack::StackProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::stack::StackProc --
-#
-#	Command that processes all stack object commands.
-#
-# Arguments:
-#	name	name of the stack object to manipulate.
-#	args	command name and args for the command
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::stack::StackProc {name cmd args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-
-    # Split the args into command and args components
-    set sub _$cmd
-    if { [llength [info commands ::struct::stack::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::stack::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-
-    uplevel 1 [linsert $args 0 ::struct::stack::$sub $name]
-}
-
-# ::struct::stack::_clear --
-#
-#	Clear a stack.
-#
-# Arguments:
-#	name	name of the stack object.
-#
-# Results:
-#	None.
-
-proc ::struct::stack::_clear {name} {
-    set ::struct::stack::stacks($name) [list ]
-    return
-}
-
-# ::struct::stack::_destroy --
-#
-#	Destroy a stack object by removing it's storage space and 
-#	eliminating it's proc.
-#
-# Arguments:
-#	name	name of the stack object.
-#
-# Results:
-#	None.
-
-proc ::struct::stack::_destroy {name} {
-    unset ::struct::stack::stacks($name)
-    interp alias {} $name {}
-    return
-}
-
-# ::struct::stack::_peek --
-#
-#	Retrieve the value of an item on the stack without popping it.
-#
-# Arguments:
-#	name	name of the stack object.
-#	count	number of items to pop; defaults to 1
-#
-# Results:
-#	items	top count items from the stack; if there are not enough items
-#		to fulfill the request, throws an error.
-
-proc ::struct::stack::_peek {name {count 1}} {
-    variable stacks
-    if { $count < 1 } {
-	error "invalid item count $count"
-    }
-
-    if { $count > [llength $stacks($name)] } {
-	error "insufficient items on stack to fill request"
-    }
-
-    if { $count == 1 } {
-	# Handle this as a special case, so single item pops aren't listified
-	set item [lindex $stacks($name) end]
-	return $item
-    }
-
-    # Otherwise, return a list of items
-    set result [list ]
-    for {set i 0} {$i < $count} {incr i} {
-	lappend result [lindex $stacks($name) "end-${i}"]
-    }
-    return $result
-}
-
-# ::struct::stack::_pop --
-#
-#	Pop an item off a stack.
-#
-# Arguments:
-#	name	name of the stack object.
-#	count	number of items to pop; defaults to 1
-#
-# Results:
-#	item	top count items from the stack; if the stack is empty, 
-#		returns a list of count nulls.
-
-proc ::struct::stack::_pop {name {count 1}} {
-    variable stacks
-    if { $count > [llength $stacks($name)] } {
-	error "insufficient items on stack to fill request"
-    } elseif { $count < 1 } {
-	error "invalid item count $count"
-    }
-
-    if { $count == 1 } {
-	# Handle this as a special case, so single item pops aren't listified
-	set item [lindex $stacks($name) end]
-	set stacks($name) [lreplace $stacks($name) end end]
-	return $item
-    }
-
-    # Otherwise, return a list of items
-    set result [list ]
-    for {set i 0} {$i < $count} {incr i} {
-	lappend result [lindex $stacks($name) "end-${i}"]
-    }
-
-    # Remove these items from the stack
-    incr i -1
-    set stacks($name) [lreplace $stacks($name) "end-${i}" end]
-
-    return $result
-}
-
-# ::struct::stack::_push --
-#
-#	Push an item onto a stack.
-#
-# Arguments:
-#	name	name of the stack object
-#	args	items to push.
-#
-# Results:
-#	None.
-
-proc ::struct::stack::_push {name args} {
-    if { [llength $args] == 0 } {
-	error "wrong # args: should be \"$name push item ?item ...?\""
-    }
-    foreach item $args {
-	lappend ::struct::stack::stacks($name) $item
-    }
-}
-
-# ::struct::stack::_rotate --
-#
-#	Rotate the top count number of items by step number of steps.
-#
-# Arguments:
-#	name	name of the stack object.
-#	count	number of items to rotate.
-#	steps	number of steps to rotate.
-#
-# Results:
-#	None.
-
-proc ::struct::stack::_rotate {name count steps} {
-    variable stacks
-    set len [llength $stacks($name)]
-    if { $count > $len } {
-	error "insufficient items on stack to fill request"
-    }
-
-    # Rotation algorithm:
-    # do
-    #   Find the insertion point in the stack
-    #   Move the end item to the insertion point
-    # repeat $steps times
-
-    set start [expr {$len - $count}]
-    set steps [expr {$steps % $count}]
-    for {set i 0} {$i < $steps} {incr i} {
-	set item [lindex $stacks($name) end]
-	set stacks($name) [lreplace $stacks($name) end end]
-	set stacks($name) [linsert $stacks($name) $start $item]
-    }
-    return
-}
-
-# ::struct::stack::_size --
-#
-#	Return the number of objects on a stack.
-#
-# Arguments:
-#	name	name of the stack object.
-#
-# Results:
-#	count	number of items on the stack.
-
-proc ::struct::stack::_size {name} {
-    return [llength $::struct::stack::stacks($name)]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'stack::stack' into the general structure namespace.
-    namespace import -force stack::stack
-    namespace export stack
-}
-package provide struct::stack 1.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/struct.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/struct.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,18 +1,0 @@
-package require Tcl 8.2
-package require struct::graph     2.0
-package require struct::queue     1.2.1
-package require struct::stack     1.2.1
-package require struct::tree      2.0
-package require struct::matrix    2.0
-package require struct::pool      1.2.1
-package require struct::record    1.2.1
-package require struct::list      1.4
-package require struct::set       2.1
-package require struct::prioqueue 1.3
-package require struct::skiplist  1.3
-
-namespace eval ::struct {
-    namespace export *
-}
-
-package provide struct 2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/struct1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/struct1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package require Tcl 8.2
-package require struct::graph     1.2.1
-package require struct::queue     1.2.1
-package require struct::stack     1.2.1
-package require struct::tree      1.2.1
-package require struct::matrix    1.2.1
-package require struct::pool      1.2.1
-package require struct::record    1.2.1
-package require struct::list      1.4
-package require struct::prioqueue 1.3
-package require struct::skiplist  1.3
-
-namespace eval ::struct {
-    namespace export *
-}
-
-package provide struct 1.4
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,183 +1,0 @@
-# tree.tcl --
-#
-#	Implementation of a tree data structure for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: tree.tcl,v 1.44 2007/06/17 01:22:18 andreas_kupries Exp $
-
-# @mdgen EXCLUDE: tree_c.tcl
-
-package require Tcl 8.2
-package require struct::list
-
-namespace eval ::struct::tree {}
-
-# ### ### ### ######### ######### #########
-## Management of tree implementations.
-
-# ::struct::tree::LoadAccelerator --
-#
-#	Loads a named implementation, if possible.
-#
-# Arguments:
-#	key	Name of the implementation to load.
-#
-# Results:
-#	A boolean flag. True if the implementation
-#	was successfully loaded; and False otherwise.
-
-proc ::struct::tree::LoadAccelerator {key} {
-    variable accel
-    set r 0
-    switch -exact -- $key {
-	critcl {
-	    # Critcl implementation of tree requires Tcl 8.4.
-	    if {![package vsatisfies [package provide Tcl] 8.4]} {return 0}
-	    if {[catch {package require tcllibc}]} {return 0}
-	    set r [llength [info commands ::struct::tree_critcl]]
-	}
-	tcl {
-	    variable selfdir
-	    source [file join $selfdir tree_tcl.tcl]
-	    set r 1
-	}
-        default {
-            return -code error "invalid accelerator/impl. package $key:\
-                must be one of [join [KnownImplementations] {, }]"
-        }
-    }
-    set accel($key) $r
-    return $r
-}
-
-# ::struct::tree::SwitchTo --
-#
-#	Activates a loaded named implementation.
-#
-# Arguments:
-#	key	Name of the implementation to activate.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::SwitchTo {key} {
-    variable accel
-    variable loaded
-
-    if {[string equal $key $loaded]} {
-	# No change, nothing to do.
-	return
-    } elseif {![string equal $key ""]} {
-	# Validate the target implementation of the switch.
-
-	if {![info exists accel($key)]} {
-	    return -code error "Unable to activate unknown implementation \"$key\""
-	} elseif {![info exists accel($key)] || !$accel($key)} {
-	    return -code error "Unable to activate missing implementation \"$key\""
-	}
-    }
-
-    # Deactivate the previous implementation, if there was any.
-
-    if {![string equal $loaded ""]} {
-	rename ::struct::tree        ::struct::tree_$loaded
-	rename ::struct::tree::prune ::struct::tree::prune_$loaded
-    }
-
-    # Activate the new implementation, if there is any.
-
-    if {![string equal $key ""]} {
-	rename ::struct::tree_$key        ::struct::tree
-	rename ::struct::tree::prune_$key ::struct::tree::prune
-    }
-
-    # Remember the active implementation, for deactivation by future
-    # switches.
-
-    set loaded $key
-    return
-}
-
-# ::struct::tree::Implementations --
-#
-#	Determines which implementations are
-#	present, i.e. loaded.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys.
-
-proc ::struct::tree::Implementations {} {
-    variable accel
-    set res {}
-    foreach n [array names accel] {
-	if {!$accel($n)} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::struct::tree::KnownImplementations --
-#
-#	Determines which implementations are known
-#	as possible implementations.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	A list of implementation keys. In the order
-#	of preference, most prefered first.
-
-proc ::struct::tree::KnownImplementations {} {
-    return {critcl tcl}
-}
-
-proc ::struct::tree::Names {} {
-    return {
-	critcl {tcllibc based}
-	tcl    {pure Tcl}
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Data structures.
-
-namespace eval ::struct::tree {
-    variable  selfdir [file dirname [info script]]
-    variable  accel
-    array set accel   {tcl 0 critcl 0}
-    variable  loaded  {}
-}
-
-# ### ### ### ######### ######### #########
-## Initialization: Choose an implementation,
-## most prefered first. Loads only one of the
-## possible implementations. And activates it.
-
-namespace eval ::struct::tree {
-    variable e
-    foreach e [KnownImplementations] {
-	if {[LoadAccelerator $e]} {
-	    SwitchTo $e
-	    break
-	}
-    }
-    unset e
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Export the constructor command.
-    namespace export tree
-}
-
-package provide struct::tree 2.1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree1.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree1.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1485 +1,0 @@
-# tree.tcl --
-#
-#	Implementation of a tree data structure for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: tree1.tcl,v 1.5 2005/10/04 17:15:05 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::struct {}
-
-namespace eval ::struct::tree {
-    # Data storage in the tree module
-    # -------------------------------
-    #
-    # There's a lot of bits to keep track of for each tree:
-    #	nodes
-    #	node values
-    #	node relationships
-    #
-    # It would quickly become unwieldy to try to keep these in arrays or lists
-    # within the tree namespace itself.  Instead, each tree structure will get
-    # its own namespace.  Each namespace contains:
-    #	children	array mapping nodes to their children list
-    #	parent		array mapping nodes to their parent node
-    #	node:$node	array mapping keys to values for the node $node
-
-    # counter is used to give a unique name for unnamed trees
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new tree
-    namespace export tree
-}
-
-# ::struct::tree::tree --
-#
-#	Create a new tree with a given name; if no name is given, use
-#	treeX, where X is a number.
-#
-# Arguments:
-#	name	Optional name of the tree; if null or not given, generate one.
-#
-# Results:
-#	name	Name of the tree created
-
-proc ::struct::tree::tree {{name ""}} {
-    variable counter
-
-    if {[llength [info level 0]] == 1} {
-	incr counter
-	set name "tree${counter}"
-    }
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 namespace current]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-    if {[llength [info commands $name]]} {
-	return -code error \
-		"command \"$name\" already exists, unable to create tree"
-    }
-
-    # Set up the namespace for the object,
-    # identical to the object command.
-    namespace eval $name {
-	# Set up root node's child list
-	variable children
-	set      children(root) [list]
-
-	# Set root node's parent
-	variable parent
-	set      parent(root) [list]
-
-	# Set up the node attribute mapping
-	variable  attribute
-	array set attribute {}
-
-	# Set up a counter for use in creating unique node names
-	variable nextUnusedNode
-	set      nextUnusedNode 1
-
-	# Set up a counter for use in creating node attribute arrays.
-	variable nextAttr
-	set      nextAttr 0
-    }
-
-    # Create the command to manipulate the tree
-    interp alias {} ::$name {} ::struct::tree::TreeProc $name
-
-    return $name
-}
-
-##########################
-# Private functions follow
-
-# ::struct::tree::TreeProc --
-#
-#	Command that processes all tree object commands.
-#
-# Arguments:
-#	name	Name of the tree object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::tree::TreeProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-
-    # Split the args into command and args components
-    set sub _$cmd
-    if { [llength [info commands ::struct::tree::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::tree::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-    return [uplevel 1 [linsert $args 0 ::struct::tree::$sub $name]]
-}
-
-# ::struct::tree::_children --
-#
-#	Return the child list for a given node of a tree.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up.
-#
-# Results:
-#	children	List of children for the node.
-
-proc ::struct::tree::_children {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    return $children($node)
-}
-
-# ::struct::tree::_cut --
-#
-#	Destroys the specified node of a tree, but not its children.
-#	These children are made into children of the parent of the
-#	destroyed node at the index of the destroyed node.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up and cut.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_cut {name node} {
-    if { [string equal $node "root"] } {
-	# Can't delete the special root node
-	return -code error "cannot cut root node"
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-
-    # Locate our parent, children and our location in the parent
-    set parentNode $parent($node)
-    set childNodes $children($node)
-
-    set index [lsearch -exact $children($parentNode) $node]
-
-    # Excise this node from the parent list,
-    set newChildren [lreplace $children($parentNode) $index $index]
-
-    # Put each of the children of $node into the parent's children list,
-    # in the place of $node, and update the parent pointer of those nodes.
-    foreach child $childNodes {
-	set newChildren [linsert $newChildren $index $child]
-	set parent($child) $parentNode
-	incr index
-    }
-    set children($parentNode) $newChildren
-
-    KillNode $name $node
-    return
-}
-
-# ::struct::tree::_delete --
-#
-#	Remove a node from a tree, including all of its values.  Recursively
-#	removes the node's children.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_delete {name node} {
-    if { [string equal $node "root"] } {
-	# Can't delete the special root node
-	return -code error "cannot delete root node"
-    }
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    # Remove this node from its parent's children list
-    set parentNode $parent($node)
-    set index [lsearch -exact $children($parentNode) $node]
-    set children($parentNode) [lreplace $children($parentNode) $index $index]
-
-    # Yes, we could use the stack structure implemented in ::struct::stack,
-    # but it's slower than inlining it.  Since we don't need a sophisticated
-    # stack, don't bother.
-    set st [list]
-    foreach child $children($node) {
-	lappend st $child
-    }
-
-    KillNode $name $node
-
-    while { [llength $st] > 0 } {
-	set node [lindex   $st end]
-	set st   [lreplace $st end end]
-	foreach child $children($node) {
-	    lappend st $child
-	}
-
-	KillNode $name $node
-    }
-    return
-}
-
-# ::struct::tree::_depth --
-#
-#	Return the depth (distance from the root node) of a given node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to find.
-#
-# Results:
-#	depth	Number of steps from node to the root node.
-
-proc ::struct::tree::_depth {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    variable ${name}::parent
-    set depth 0
-    while { ![string equal $node "root"] } {
-	incr depth
-	set node $parent($node)
-    }
-    return $depth
-}
-
-# ::struct::tree::_destroy --
-#
-#	Destroy a tree, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the tree to destroy.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_destroy {name} {
-    namespace delete $name
-    interp alias {} ::$name {}
-}
-
-# ::struct::tree::_exists --
-#
-#	Test for existance of a given node in a tree.
-#
-# Arguments:
-#	name	Name of the tree to query.
-#	node	Node to look for.
-#
-# Results:
-#	1 if the node exists, 0 else.
-
-proc ::struct::tree::_exists {name node} {
-    return [info exists ${name}::parent($node)]
-}
-
-# ::struct::tree::_get --
-#
-#	Get a keyed value from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#	flag	Optional flag specifier; if present, must be "-key".
-#	key	Optional key to lookup; defaults to data.
-#
-# Results:
-#	value	Value associated with the key given.
-
-proc ::struct::tree::_get {name node {flag -key} {key data}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# except for the default key 'data'.
-
-	if {[string equal $key data]} {
-	    return ""
-	}
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-
-    upvar ${name}::$attribute($node) data
-    if {![info exists data($key)]} {
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-    return $data($key)
-}
-
-# ::struct::tree::_getall --
-#
-#	Get a serialized list of key/value pairs from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#
-# Results:
-#	value	A serialized list of key/value pairs.
-
-proc ::struct::tree::_getall {name node args} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {[llength $args]} {
-	return -code error "wrong # args: should be \"$name getall $node\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# Only default key is present, invisibly.
-	return {data {}}
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [array get data]
-}
-
-# ::struct::tree::_keys --
-#
-#	Get a list of keys from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#
-# Results:
-#	value	A serialized list of key/value pairs.
-
-proc ::struct::tree::_keys {name node args} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {[llength $args]} {
-	return -code error "wrong # args: should be \"$name keys $node\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# except for the default key 'data'.
-	return {data}
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [array names data]
-}
-
-# ::struct::tree::_keyexists --
-#
-#	Test for existance of a given key for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#	flag	Optional flag specifier; if present, must be "-key".
-#	key	Optional key to lookup; defaults to data.
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::tree::_keyexists {name node {flag -key} {key data}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {![string equal $flag "-key"]} {
-	return -code error "invalid option \"$flag\": should be -key"
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# except for the default key 'data'.
-
-	return [string equal $key data]
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [info exists data($key)]
-}
-
-# ::struct::tree::_index --
-#
-#	Determine the index of node with in its parent's list of children.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look up.
-#
-# Results:
-#	index	The index of the node in its parent
-
-proc ::struct::tree::_index {name node} {
-    if { [string equal $node "root"] } {
-	# The special root node has no parent, thus no index in it either.
-	return -code error "cannot determine index of root node"
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    # Locate the parent and ourself in its list of children
-    set parentNode $parent($node)
-
-    return [lsearch -exact $children($parentNode) $node]
-}
-
-# ::struct::tree::_insert --
-#
-#	Add a node to a tree; if the node(s) specified already exist, they
-#	will be moved to the given location.
-#
-# Arguments:
-#	name		Name of the tree.
-#	parentNode	Parent to add the node to.
-#	index		Index at which to insert.
-#	args		Node(s) to insert.  If none is given, the routine
-#			will insert a single node with a unique name.
-#
-# Results:
-#	nodes		List of nodes inserted.
-
-proc ::struct::tree::_insert {name parentNode index args} {
-    if { [llength $args] == 0 } {
-	# No node name was given; generate a unique one
-	set args [list [GenerateUniqueNodeName $name]]
-    }
-    if { ![_exists $name $parentNode] } {
-	return -code error "parent node \"$parentNode\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-
-    # Make sure the index is numeric
-    if { ![string is integer $index] } {
-	# If the index is not numeric, make it numeric by lsearch'ing for
-	# the value at index, then incrementing index (because "end" means
-	# just past the end for inserts)
-	set val [lindex $children($parentNode) $index]
-	set index [expr {[lsearch -exact $children($parentNode) $val] + 1}]
-    }
-
-    foreach node $args {
-	if {[_exists $name $node] } {
-	    # Move the node to its new home
-	    if { [string equal $node "root"] } {
-		return -code error "cannot move root node"
-	    }
-	
-	    # Cannot make a node its own descendant (I'm my own grandpaw...)
-	    set ancestor $parentNode
-	    while { ![string equal $ancestor "root"] } {
-		if { [string equal $ancestor $node] } {
-		    return -code error "node \"$node\" cannot be its own descendant"
-		}
-		set ancestor $parent($ancestor)
-	    }
-	    # Remove this node from its parent's children list
-	    set oldParent $parent($node)
-	    set ind [lsearch -exact $children($oldParent) $node]
-	    set children($oldParent) [lreplace $children($oldParent) $ind $ind]
-	
-	    # If the node is moving within its parent, and its old location
-	    # was before the new location, decrement the new location, so that
-	    # it gets put in the right spot
-	    if { [string equal $oldParent $parentNode] && $ind < $index } {
-		incr index -1
-	    }
-	} else {
-	    # Set up the new node
-	    set children($node) [list]
-	}
-
-	# Add this node to its parent's children list
-	set children($parentNode) [linsert $children($parentNode) $index $node]
-
-	# Update the parent pointer for this node
-	set parent($node) $parentNode
-	incr index
-    }
-
-    return $args
-}
-
-# ::struct::tree::_isleaf --
-#
-#	Return whether the given node of a tree is a leaf or not.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up.
-#
-# Results:
-#	isleaf	True if the node is a leaf; false otherwise.
-
-proc ::struct::tree::_isleaf {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    return [expr {[llength $children($node)] == 0}]
-}
-
-# ::struct::tree::_move --
-#
-#	Move a node (and all its subnodes) from where ever it is to a new
-#	location in the tree.
-#
-# Arguments:
-#	name		Name of the tree
-#	parentNode	Parent to add the node to.
-#	index		Index at which to insert.
-#	node		Node to move; the node must exist in the tree.
-#	args		Additional nodes to move; these nodes must exist
-#			in the tree.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_move {name parentNode index node args} {
-    set args [linsert $args 0 $node]
-
-    # Can only move a node to a real location in the tree
-    if { ![_exists $name $parentNode] } {
-	return -code error "parent node \"$parentNode\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-
-    # Make sure the index is numeric
-    if { ![string is integer $index] } {
-	# If the index is not numeric, make it numeric by lsearch'ing for
-	# the value at index, then incrementing index (because "end" means
-	# just past the end for inserts)
-	set val [lindex $children($parentNode) $index]
-	set index [expr {[lsearch -exact $children($parentNode) $val] + 1}]
-    }
-
-    # Validate all nodes to move before trying to move any.
-    foreach node $args {
-	if { [string equal $node "root"] } {
-	    return -code error "cannot move root node"
-	}
-
-	# Can only move real nodes
-	if { ![_exists $name $node] } {
-	    return -code error "node \"$node\" does not exist in tree \"$name\""
-	}
-
-	# Cannot move a node to be a descendant of itself
-	set ancestor $parentNode
-	while { ![string equal $ancestor "root"] } {
-	    if { [string equal $ancestor $node] } {
-		return -code error "node \"$node\" cannot be its own descendant"
-	    }
-	    set ancestor $parent($ancestor)
-	}
-    }
-
-    # Remove all nodes from their current parent's children list
-    foreach node $args {
-	set oldParent $parent($node)
-	set ind [lsearch -exact $children($oldParent) $node]
-
-	set children($oldParent) [lreplace $children($oldParent) $ind $ind]
-
-	# Update the nodes parent value
-	set parent($node) $parentNode
-    }
-
-    # Add all nodes to their new parent's children list
-    set children($parentNode) \
-	[eval [list linsert $children($parentNode) $index] $args]
-
-    return
-}
-
-# ::struct::tree::_next --
-#
-#	Return the right sibling for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to retrieve right sibling for.
-#
-# Results:
-#	sibling		The right sibling for the node, or null if node was
-#			the rightmost child of its parent.
-
-proc ::struct::tree::_next {name node} {
-    # The 'root' has no siblings.
-    if { [string equal $node "root"] } {
-	return {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Locate the parent and our place in its list of children.
-    variable ${name}::parent
-    variable ${name}::children
-
-    set parentNode $parent($node)
-    set  index [lsearch -exact $children($parentNode) $node]
-
-    # Go to the node to the right and return its name.
-    return [lindex $children($parentNode) [incr index]]
-}
-
-# ::struct::tree::_numchildren --
-#
-#	Return the number of immediate children for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to look up.
-#
-# Results:
-#	numchildren	Number of immediate children for the node.
-
-proc ::struct::tree::_numchildren {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    return [llength $children($node)]
-}
-
-# ::struct::tree::_parent --
-#
-#	Return the name of the parent node of a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look up.
-#
-# Results:
-#	parent	Parent of node $node
-
-proc ::struct::tree::_parent {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    # FRINK: nocheck
-    return [set ${name}::parent($node)]
-}
-
-# ::struct::tree::_previous --
-#
-#	Return the left sibling for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to look up.
-#
-# Results:
-#	sibling		The left sibling for the node, or null if node was
-#			the leftmost child of its parent.
-
-proc ::struct::tree::_previous {name node} {
-    # The 'root' has no siblings.
-    if { [string equal $node "root"] } {
-	return {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Locate the parent and our place in its list of children.
-    variable ${name}::parent
-    variable ${name}::children
-
-    set parentNode $parent($node)
-    set  index [lsearch -exact $children($parentNode) $node]
-
-    # Go to the node to the right and return its name.
-    return [lindex $children($parentNode) [incr index -1]]
-}
-
-# ::struct::tree::_serialize --
-#
-#	Serialize a tree object (partially) into a transportable value.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Root node of the serialized tree.
-#
-# Results:
-#	A list structure describing the part of the tree which was serialized.
-
-proc ::struct::tree::_serialize {name {node root}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    Serialize $name $node tree attr
-    return [list $tree [array get attr]]
-}
-
-# ::struct::tree::_set --
-#
-#	Set or get a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify or query.
-#	args	Optional arguments specifying a key and a value.  Format is
-#			?-key key? ?value?
-#		If no key is specified, the key "data" is used.
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_set {name node args} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {[llength $args] > 3} {
-	return -code error "wrong # args: should be \"$name set [list $node] ?-key key?\
-		?value?\""
-    }
-
-    # Process the arguments ...
-
-    set key "data"
-    set haveValue 0
-    if {[llength $args] > 1} {
-	foreach {flag key} $args break
-	if {![string match "${flag}*" "-key"]} {
-	    return -code error "invalid option \"$flag\": should be key"
-	}
-	if {[llength $args] == 3} {
-	    set haveValue 1
-	    set value [lindex $args end]
-	}
-    } elseif {[llength $args] == 1} {
-	set haveValue 1
-	set value [lindex $args end]
-    }
-
-    if {$haveValue} {
-	# Setting a value. This may have to create
-	# the attribute array for this particular
-	# node
-
-	variable ${name}::attribute
-	if {![info exists attribute($node)]} {
-	    # No attribute data for this node,
-	    # so create it as we need it.
-	    GenAttributeStorage $name $node
-	}
-	upvar ${name}::$attribute($node) data
-
-	return [set data($key) $value]
-    } else {
-	# Getting a value
-
-	return [_get $name $node -key $key]
-    }
-}
-
-# ::struct::tree::_append --
-#
-#	Append a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify or query.
-#	args	Optional arguments specifying a key and a value.  Format is
-#			?-key key? ?value?
-#		If no key is specified, the key "data" is used.
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_append {name node args} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {
-	([llength $args] != 1) &&
-	([llength $args] != 3)
-    } {
-	return -code error "wrong # args: should be \"$name set [list $node] ?-key key?\
-		value\""
-    }
-    if {[llength $args] == 3} {
-	foreach {flag key} $args break
-	if {![string equal $flag "-key"]} {
-	    return -code error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name $node
-    }
-    upvar ${name}::$attribute($node) data
-
-    return [append data($key) $value]
-}
-
-# ::struct::tree::_lappend --
-#
-#	lappend a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify or query.
-#	args	Optional arguments specifying a key and a value.  Format is
-#			?-key key? ?value?
-#		If no key is specified, the key "data" is used.
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_lappend {name node args} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {
-	([llength $args] != 1) &&
-	([llength $args] != 3)
-    } {
-	return -code error "wrong # args: should be \"$name lappend [list $node] ?-key key?\
-		value\""
-    }
-    if {[llength $args] == 3} {
-	foreach {flag key} $args break
-	if {![string equal $flag "-key"]} {
-	    return -code error "invalid option \"$flag\": should be -key"
-	}
-    } else {
-	set key "data"
-    }
-
-    set value [lindex $args end]
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name $node
-    }
-    upvar ${name}::$attribute($node) data
-
-    return [lappend data($key) $value]
-}
-
-# ::struct::tree::_size --
-#
-#	Return the number of descendants of a given node.  The default node
-#	is the special root node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Optional node to start counting from (default is root).
-#
-# Results:
-#	size	Number of descendants of the node.
-
-proc ::struct::tree::_size {name {node root}} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # If the node is the root, we can do the cheap thing and just count the
-    # number of nodes (excluding the root node) that we have in the tree with
-    # array names
-    if { [string equal $node "root"] } {
-	set size [llength [array names ${name}::parent]]
-	return [expr {$size - 1}]
-    }
-
-    # Otherwise we have to do it the hard way and do a full tree search
-    variable ${name}::children
-    set size 0
-    set st [list ]
-    foreach child $children($node) {
-	lappend st $child
-    }
-    while { [llength $st] > 0 } {
-	set node [lindex $st end]
-	set st [lreplace $st end end]
-	incr size
-	foreach child $children($node) {
-	    lappend st $child
-	}
-    }
-    return $size
-}
-
-# ::struct::tree::_splice --
-#
-#	Add a node to a tree, making a range of children from the given
-#	parent children of the new node.
-#
-# Arguments:
-#	name		Name of the tree.
-#	parentNode	Parent to add the node to.
-#	from		Index at which to insert.
-#	to		Optional end of the range of children to replace.
-#			Defaults to 'end'.
-#	node		Optional node name; if given, must be unique.  If not
-#			given, a unique name will be generated.
-#
-# Results:
-#	node		Name of the node added to the tree.
-
-proc ::struct::tree::_splice {name parentNode from {to end} args} {
-    if { [llength $args] == 0 } {
-	# No node name given; generate a unique node name
-	set node [GenerateUniqueNodeName $name]
-    } else {
-	set node [lindex $args 0]
-    }
-
-    if { [_exists $name $node] } {
-	return -code error "node \"$node\" already exists in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    # Save the list of children that are moving
-    set moveChildren [lrange $children($parentNode) $from $to]
-
-    # Remove those children from the parent
-    set children($parentNode) [lreplace $children($parentNode) $from $to]
-
-    # Add the new node
-    _insert $name $parentNode $from $node
-
-    # Move the children
-    set children($node) $moveChildren
-    foreach child $moveChildren {
-	set parent($child) $node
-    }
-
-    return $node
-}
-
-# ::struct::tree::_swap --
-#
-#	Swap two nodes in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node1	First node to swap.
-#	node2	Second node to swap.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_swap {name node1 node2} {
-    # Can't swap the magic root node
-    if {[string equal $node1 "root"] || [string equal $node2 "root"]} {
-	return -code error "cannot swap root node"
-    }
-
-    # Can only swap two real nodes
-    if {![_exists $name $node1]} {
-	return -code error "node \"$node1\" does not exist in tree \"$name\""
-    }
-    if {![_exists $name $node2]} {
-	return -code error "node \"$node2\" does not exist in tree \"$name\""
-    }
-
-    # Can't swap a node with itself
-    if {[string equal $node1 $node2]} {
-	return -code error "cannot swap node \"$node1\" with itself"
-    }
-
-    # Swapping nodes means swapping their labels and values
-    variable ${name}::children
-    variable ${name}::parent
-
-    set parent1 $parent($node1)
-    set parent2 $parent($node2)
-
-    # Replace node1 with node2 in node1's parent's children list, and
-    # node2 with node1 in node2's parent's children list
-    set i1 [lsearch -exact $children($parent1) $node1]
-    set i2 [lsearch -exact $children($parent2) $node2]
-
-    set children($parent1) [lreplace $children($parent1) $i1 $i1 $node2]
-    set children($parent2) [lreplace $children($parent2) $i2 $i2 $node1]
-
-    # Make node1 the parent of node2's children, and vis versa
-    foreach child $children($node2) {
-	set parent($child) $node1
-    }
-    foreach child $children($node1) {
-	set parent($child) $node2
-    }
-
-    # Swap the children lists
-    set children1 $children($node1)
-    set children($node1) $children($node2)
-    set children($node2) $children1
-
-    if { [string equal $node1 $parent2] } {
-	set parent($node1) $node2
-	set parent($node2) $parent1
-    } elseif { [string equal $node2 $parent1] } {
-	set parent($node1) $parent2
-	set parent($node2) $node1
-    } else {
-	set parent($node1) $parent2
-	set parent($node2) $parent1
-    }
-
-    # Swap the values
-    # More complicated now with the possibility that nodes do not have
-    # attribute storage associated with them.
-
-    variable ${name}::attribute
-
-    if {
-	[set ia [info exists attribute($node1)]] ||
-	[set ib [info exists attribute($node2)]]
-    } {
-	# At least one of the nodes has attribute data. We simply swap
-	# the references to the arrays containing them. No need to
-	# copy the actual data around.
-
-	if {$ia && $ib} {
-	    set tmp               $attribute($node1)
-	    set attribute($node1) $attribute($node2)
-	    set attribute($node2) $tmp
-	} elseif {$ia} {
-	    set   attribute($node2) $attribute($node1)
-	    unset attribute($node1)
-	} elseif {$ib} {
-	    set   attribute($node1) $attribute($node2)
-	    unset attribute($node2)
-	} else {
-	    return -code error "Impossible condition."
-	}
-    } ; # else: No attribute storage => Nothing to do {}
-
-    return
-}
-
-# ::struct::tree::_unset --
-#
-#	Remove a keyed value from a node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify.
-#	args	Optional additional args specifying which key to unset;
-#		if given, must be of the form "-key key".  If not given,
-#		the key "data" is unset.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_unset {name node {flag -key} {key data}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {![string match "${flag}*" "-key"]} {
-	return -code error "invalid option \"$flag\": should be \"$name unset\
-		[list $node] ?-key key?\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# except for the default key 'data'.
-	GenAttributeStorage $name $node
-    }
-    upvar ${name}::$attribute($node) data
-
-    catch {unset data($key)}
-    return
-}
-
-# ::struct::tree::_walk --
-#
-#	Walk a tree using a pre-order depth or breadth first
-#	search. Pre-order DFS is the default.  At each node that is visited,
-#	a command will be called with the name of the tree and the node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node at which to start.
-#	args	Optional additional arguments specifying the type and order of
-#		the tree walk, and the command to execute at each node.
-#		Format is
-#		    ?-type {bfs|dfs}? ?-order {pre|post|in|both}? -command cmd
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_walk {name node args} {
-    set usage "$name walk $node ?-type {bfs|dfs}? ?-order {pre|post|in|both}? -command cmd"
-
-    if {[llength $args] > 6 || [llength $args] < 2} {
-	return -code error "wrong # args: should be \"$usage\""
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Set defaults
-    set type dfs
-    set order pre
-    set cmd ""
-
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set flag [lindex $args $i]
-	incr i
-	if { $i >= [llength $args] } {
-	    return -code error "value for \"$flag\" missing: should be \"$usage\""
-	}
-	switch -glob -- $flag {
-	    "-type" {
-		set type [string tolower [lindex $args $i]]
-	    }
-	    "-order" {
-		set order [string tolower [lindex $args $i]]
-	    }
-	    "-command" {
-		set cmd [lindex $args $i]
-	    }
-	    default {
-		return -code error "unknown option \"$flag\": should be \"$usage\""
-	    }
-	}
-    }
-
-    # Make sure we have a command to run, otherwise what's the point?
-    if { [string equal $cmd ""] } {
-	return -code error "no command specified: should be \"$usage\""
-    }
-
-    # Validate that the given type is good
-    switch -exact -- $type {
-	"dfs" - "bfs" {
-	    set type $type
-	}
-	default {
-	    return -code error "invalid search type \"$type\": should be dfs, or bfs"
-	}
-    }
-
-    # Validate that the given order is good
-    switch -exact -- $order {
-	"pre" - "post" - "in" - "both" {
-	    set order $order
-	}
-	default {
-	    return -code error "invalid search order \"$order\":\
-		    should be pre, post, both, or in"
-	}
-    }
-
-    if {[string equal $order "in"] && [string equal $type "bfs"]} {
-	return -code error "unable to do a ${order}-order breadth first walk"
-    }
-
-    # Do the walk
-    variable ${name}::children
-    set st [list ]
-    lappend st $node
-
-    # Compute some flags for the possible places of command evaluation
-    set leave [expr {[string equal $order post] || [string equal $order both]}]
-    set enter [expr {[string equal $order pre]  || [string equal $order both]}]
-    set touch [string equal $order in]
-
-    if {$leave} {
-	set lvlabel leave
-    } elseif {$touch} {
-	# in-order does not provide a sense
-	# of nesting for the parent, hence
-	# no enter/leave, just 'visit'.
-	set lvlabel visit
-    }
-
-    if { [string equal $type "dfs"] } {
-	# Depth-first walk, several orders of visiting nodes
-	# (pre, post, both, in)
-
-	array set visited {}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex $st end]
-
-	    if {[info exists visited($node)]} {
-		# Second time we are looking at this 'node'.
-		# Pop it, then evaluate the command (post, both, in).
-
-		set st [lreplace $st end end]
-
-		if {$leave || $touch} {
-		    # Evaluate the command at this node
-		    WalkCall $name $node $lvlabel $cmd
-		}
-	    } else {
-		# First visit of this 'node'.
-		# Do *not* pop it from the stack so that we are able
-		# to visit again after its children
-
-		# Remember it.
-		set visited($node) .
-
-		if {$enter} {
-		    # Evaluate the command at this node (pre, both)
-		    WalkCall $name $node "enter" $cmd
-		}
-
-		# Add the children of this node to the stack.
-		# The exact behaviour depends on the chosen
-		# order. For pre, post, both-order we just
-		# have to add them in reverse-order so that
-		# they will be popped left-to-right. For in-order
-		# we have rearrange the stack so that the parent
-		# is revisited immediately after the first child.
-		# (but only if there is ore than one child,)
-
-		set clist        $children($node)
-		set len [llength $clist]
-
-		if {$touch && ($len > 1)} {
-		    # Pop node from stack, insert into list of children
-		    set st    [lreplace $st end end]
-		    set clist [linsert $clist 1 $node]
-		    incr len
-		}
-
-		for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-		    lappend st [lindex $clist $i]
-		}
-	    }
-	}
-    } else {
-	# Breadth first walk (pre, post, both)
-	# No in-order possible. Already captured.
-
-	if {$leave} {
-	    set backward $st
-	}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex   $st 0]
-	    set st   [lreplace $st 0 0]
-
-	    if {$enter} {
-		# Evaluate the command at this node
-		WalkCall $name $node "enter" $cmd
-	    }
-
-	    # Add this node's children
-	    # And create a mirrored version in case of post/both order.
-
-	    foreach child $children($node) {
-		lappend st $child
-		if {$leave} {
-		    set backward [linsert $backward 0 $child]
-		}
-	    }
-	}
-
-	if {$leave} {
-	    foreach node $backward {
-		# Evaluate the command at this node
-		WalkCall $name $node "leave" $cmd
-	    }
-	}
-    }
-    return
-}
-
-# ::struct::tree::WalkCall --
-#
-#	Helper command to 'walk' handling the evaluation
-#	of the user-specified command. Information about
-#	the tree, node and current action are substituted
-#	into the command before it evaluation.
-#
-# Arguments:
-#	tree	Tree we are walking
-#	node	Node we are at.
-#	action	The current action.
-#	cmd	The command to call, already partially substituted.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::WalkCall {tree node action cmd} {
-    set subs [list %n [list $node] %a [list $action] %t [list $tree] %% %]
-    uplevel 2 [string map $subs $cmd]
-    return
-}
-
-# ::struct::tree::GenerateUniqueNodeName --
-#
-#	Generate a unique node name for the given tree.
-#
-# Arguments:
-#	name	Name of the tree to generate a unique node name for.
-#
-# Results:
-#	node	Name of a node guaranteed to not exist in the tree.
-
-proc ::struct::tree::GenerateUniqueNodeName {name} {
-    variable ${name}::nextUnusedNode
-    while {[_exists $name "node${nextUnusedNode}"]} {
-	incr nextUnusedNode
-    }
-    return "node${nextUnusedNode}"
-}
-
-# ::struct::tree::KillNode --
-#
-#	Delete all data of a node.
-#
-# Arguments:
-#	name	Name of the tree containing the node
-#	node	Name of the node to delete.
-#
-# Results:
-#	none
-
-proc ::struct::tree::KillNode {name node} {
-    variable ${name}::parent
-    variable ${name}::children
-    variable ${name}::attribute
-
-    # Remove all record of $node
-    unset parent($node)
-    unset children($node)
-
-    if {[info exists attribute($node)]} {
-	# FRINK: nocheck
-	unset ${name}::$attribute($node)
-	unset attribute($node)
-    }
-    return
-}
-
-# ::struct::tree::GenAttributeStorage --
-#
-#	Create an array to store the attrributes of a node in.
-#
-# Arguments:
-#	name	Name of the tree containing the node
-#	node	Name of the node which got attributes.
-#
-# Results:
-#	none
-
-proc ::struct::tree::GenAttributeStorage {name node} {
-    variable ${name}::nextAttr
-    variable ${name}::attribute
-
-    set   attr "a[incr nextAttr]"
-    set   attribute($node) $attr
-    upvar ${name}::$attr data
-    set   data(data) ""
-    return
-}
-
-# ::struct::tree::Serialize --
-#
-#	Serialize a tree object (partially) into a transportable value.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Root node of the serialized tree.
-#
-# Results:
-#	None
-
-proc ::struct::tree::Serialize {name node tvar avar} {
-    upvar 1 $tvar tree $avar attr
-
-    variable ${name}::children
-    variable ${name}::attribute
-
-    # Store attribute data
-    if {[info exists attribute($node)]} {
-	set attr($node) [array get ${name}::$attribute($node)]
-    } else {
-	set attr($node) {}
-    }
-
-    # Build tree structure as nested list.
-
-    set subtrees [list]
-    foreach c $children($node) {
-	Serialize $name $c sub attr
-	lappend subtrees $sub
-    }
-
-    set tree [list $node $subtrees]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Get 'tree::tree' into the general structure namespace.
-    namespace import -force tree::tree
-    namespace export tree
-}
-package provide struct::tree 1.2.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree_c.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree_c.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,207 +1,0 @@
-# treec.tcl --
-#
-#       Implementation of a tree data structure for Tcl.
-#       This code based on critcl, API compatible to the PTI [x].
-#       [x] Pure Tcl Implementation.
-#
-# Copyright (c) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: tree_c.tcl,v 1.4 2007/01/21 22:15:59 andreas_kupries Exp $
-
-package require critcl
-package provide struct_treec 2.1.1
-package require Tcl 8.2
-
-namespace eval ::struct {
-    # Supporting code for the main command.
-
-    catch {
-	critcl::cheaders -g
-	critcl::debug memory symbols
-    }
-
-    critcl::cheaders tree/*.h
-    critcl::csources tree/*.c
-
-    critcl::ccode {
-	/* -*- c -*- */
-
-	#include <util.h>
-	#include <t.h>
-	#include <tn.h>
-	#include <ms.h>
-	#include <m.h>
-
-	/* .................................................. */
-	/* Global tree management, per interp
-	*/
-
-	typedef struct TDg {
-	    long int counter;
-	    char buf [50];
-	} TDg;
-
-	static void
-	TDgrelease (ClientData cd, Tcl_Interp* interp)
-	{
-	    ckfree((char*) cd);
-	}
-
-	static CONST char*
-	TDnewName (Tcl_Interp* interp)
-	{
-#define KEY "tcllib/struct::tree/critcl"
-
-	    Tcl_InterpDeleteProc* proc = TDgrelease;
-	    TDg*                  tdg;
-
-	    tdg = Tcl_GetAssocData (interp, KEY, &proc);
-	    if (tdg  == NULL) {
-		tdg = (TDg*) ckalloc (sizeof (TDg));
-		tdg->counter = 0;
-
-		Tcl_SetAssocData (interp, KEY, proc,
-				  (ClientData) tdg);
-	    }
-	    
-	    tdg->counter ++;
-	    sprintf (tdg->buf, "tree%d", tdg->counter);
-	    return tdg->buf;
-
-#undef  KEY
-	}
-
-	static void
-	TDdeleteCmd (ClientData clientData)
-	{
-	    /* Release the whole tree. */
-	    t_delete ((T*) clientData);
-	}
-    }
-
-    # Main command, tree creation.
-
-    critcl::ccommand tree_critcl {dummy interp objc objv} {
-      /* Syntax
-       *  - epsilon                         |1
-       *  - name                            |2
-       *  - name =|:=|as|deserialize source |4
-       */
-
-      CONST char* name;
-      T*          td;
-      Tcl_Obj*    fqn;
-      Tcl_CmdInfo ci;
-
-#define USAGE "?name ?=|:=|as|deserialize source??"
-
-      if ((objc != 4) && (objc != 2) && (objc != 1)) {
-        Tcl_WrongNumArgs (interp, 1, objv, USAGE);
-        return TCL_ERROR;
-      }
-
-      if (objc < 2) {
-        name = TDnewName (interp);
-      } else {
-        name = Tcl_GetString (objv [1]);
-      }
-
-      if (!Tcl_StringMatch (name, "::*")) {
-        /* Relative name. Prefix with current namespace */
-
-        Tcl_Eval (interp, "namespace current");
-        fqn = Tcl_GetObjResult (interp);
-        fqn = Tcl_DuplicateObj (fqn);
-        Tcl_IncrRefCount (fqn);
-
-        if (!Tcl_StringMatch (Tcl_GetString (fqn), "::")) {
-          Tcl_AppendToObj (fqn, "::", -1);
-        }
-        Tcl_AppendToObj (fqn, name, -1);
-      } else {
-        fqn = Tcl_NewStringObj (name, -1);
-        Tcl_IncrRefCount (fqn);
-      }
-      Tcl_ResetResult (interp);
-
-      if (Tcl_GetCommandInfo (interp,
-                              Tcl_GetString (fqn),
-                              &ci)) {
-        Tcl_Obj* err;
-
-        err = Tcl_NewObj ();
-        Tcl_AppendToObj    (err, "command \"", -1);
-        Tcl_AppendObjToObj (err, fqn);
-        Tcl_AppendToObj    (err, "\" already exists, unable to create tree", -1);
-
-        Tcl_DecrRefCount (fqn);
-        Tcl_SetObjResult (interp, err);
-        return TCL_ERROR;
-      }
-
-      if (objc == 4) {
-        Tcl_Obj* type = objv[2];
-        Tcl_Obj* src  = objv[3];
-        int srctype;
-
-        static CONST char* types [] = {
-          ":=", "=", "as", "deserialize", NULL
-        };
-        enum types {
-          T_ASSIGN, T_IS, T_AS, T_DESER
-        };
-
-        if (Tcl_GetIndexFromObj (interp, type, types, "type",
-                                 0, &srctype) != TCL_OK) {
-          Tcl_DecrRefCount (fqn);
-          Tcl_ResetResult (interp);
-          Tcl_WrongNumArgs (interp, 1, objv, USAGE);
-          return TCL_ERROR;
-        }
-
-        td = t_new ();
-
-        switch (srctype) {
-        case T_ASSIGN:
-        case T_AS:
-        case T_IS:
-          if (tms_assign (interp, td, src) != TCL_OK) {
-            t_delete (td);
-            Tcl_DecrRefCount (fqn);
-            return TCL_ERROR;
-          }
-          break;
-
-        case T_DESER:
-          if (t_deserialize (td, interp, src) != TCL_OK) {
-            t_delete (td);
-            Tcl_DecrRefCount (fqn);
-            return TCL_ERROR;
-          }
-          break;
-        }
-      } else {
-        td = t_new ();
-      }
-
-      td->cmd = Tcl_CreateObjCommand (interp, Tcl_GetString (fqn),
-                                      tms_objcmd, (ClientData) td,
-                                      TDdeleteCmd);
-
-      Tcl_SetObjResult (interp, fqn);
-      Tcl_DecrRefCount (fqn);
-      return TCL_OK;
-    }
-
-  namespace eval tree {
-    critcl::ccommand prune_critcl {dummy interp objc objv} {
-      return 5;
-    }
-  }
-}
-
-# ### ### ### ######### ######### #########
-## Ready
Index: tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree_tcl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/struct/tree_tcl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2471 +1,0 @@
-# tree.tcl --
-#
-#	Implementation of a tree data structure for Tcl.
-#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: tree_tcl.tcl,v 1.4 2005/10/27 21:56:04 andreas_kupries Exp $
-
-package require Tcl 8.2
-package require struct::list
-
-namespace eval ::struct::tree {
-    # Data storage in the tree module
-    # -------------------------------
-    #
-    # There's a lot of bits to keep track of for each tree:
-    #	nodes
-    #	node values
-    #	node relationships
-    #
-    # It would quickly become unwieldy to try to keep these in arrays or lists
-    # within the tree namespace itself.  Instead, each tree structure will get
-    # its own namespace.  Each namespace contains:
-    #	children	array mapping nodes to their children list
-    #	parent		array mapping nodes to their parent node
-    #	node:$node	array mapping keys to values for the node $node
-
-    # counter is used to give a unique name for unnamed trees
-    variable counter 0
-
-    # Only export one command, the one used to instantiate a new tree
-    namespace export tree_tcl
-}
-
-# ::struct::tree::tree_tcl --
-#
-#	Create a new tree with a given name; if no name is given, use
-#	treeX, where X is a number.
-#
-# Arguments:
-#	name	Optional name of the tree; if null or not given, generate one.
-#
-# Results:
-#	name	Name of the tree created
-
-proc ::struct::tree::tree_tcl {args} {
-    variable counter
-
-    set src     {}
-    set srctype {}
-
-    switch -exact -- [llength [info level 0]] {
-	1 {
-	    # Missing name, generate one.
-	    incr counter
-	    set name "tree${counter}"
-	}
-	2 {
-	    # Standard call. New empty tree.
-	    set name [lindex $args 0]
-	}
-	4 {
-	    # Copy construction.
-	    foreach {name as src} $args break
-	    switch -exact -- $as {
-		= - := - as {
-		    set srctype tree
-		}
-		deserialize {
-		    set srctype serial
-		}
-		default {
-		    return -code error \
-			    "wrong # args: should be \"tree ?name ?=|:=|as|deserialize source??\""
-		}
-	    }
-	}
-	default {
-	    # Error.
-	    return -code error \
-		    "wrong # args: should be \"tree ?name ?=|:=|as|deserialize source??\""
-	}
-    }
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 [list namespace current]]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-
-        set name "$ns$name"
-    }
-    if {[llength [info commands $name]]} {
-	return -code error \
-		"command \"$name\" already exists, unable to create tree"
-    }
-
-    # Set up the namespace for the object,
-    # identical to the object command.
-    namespace eval $name {
-	variable rootname
-	set      rootname root
-
-	# Set up root node's child list
-	variable children
-	set      children(root) [list]
-
-	# Set root node's parent
-	variable parent
-	set      parent(root) [list]
-
-	# Set up the node attribute mapping
-	variable  attribute
-	array set attribute {}
-
-	# Set up a counter for use in creating unique node names
-	variable nextUnusedNode
-	set      nextUnusedNode 1
-
-	# Set up a counter for use in creating node attribute arrays.
-	variable nextAttr
-	set      nextAttr 0
-    }
-
-    # Create the command to manipulate the tree
-    interp alias {} $name {} ::struct::tree::TreeProc $name
-
-    # Automatic execution of assignment if a source
-    # is present.
-    if {$src != {}} {
-	switch -exact -- $srctype {
-	    tree   {
-		set code [catch {_= $name $src} msg]
-		if {$code} {
-		    namespace delete $name
-		    interp alias {} $name {}
-		    return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $msg
-		}
-	    }
-	    serial {
-		set code [catch {_deserialize $name $src} msg]
-		if {$code} {
-		    namespace delete $name
-		    interp alias {} $name {}
-		    return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $msg
-		}
-	    }
-	    default {
-		return -code error \
-			"Internal error, illegal srctype \"$srctype\""
-	    }
-	}
-    }
-
-    # Give object to caller for use.
-    return $name
-}
-
-# ::struct::tree::prune_tcl --
-#
-#	Abort the walk script, and ignore any children of the
-#	node we are currently at.
-#
-# Arguments:
-#	None.
-#
-# Results:
-#	None.
-#
-# Sideeffects:
-#
-#	Stops the execution of the script and throws a signal to the
-#	surrounding walker to go to the next node, and ignore the
-#	children of the current node.
-
-proc ::struct::tree::prune_tcl {} {
-    return -code 5
-}
-
-##########################
-# Private functions follow
-
-# ::struct::tree::TreeProc --
-#
-#	Command that processes all tree object commands.
-#
-# Arguments:
-#	name	Name of the tree object to manipulate.
-#	cmd	Subcommand to invoke.
-#	args	Arguments for subcommand.
-#
-# Results:
-#	Varies based on command to perform
-
-proc ::struct::tree::TreeProc {name {cmd ""} args} {
-    # Do minimal args checks here
-    if { [llength [info level 0]] == 2 } {
-	return -code error "wrong # args: should be \"$name option ?arg arg ...?\""
-    }
-
-    # Split the args into command and args components
-    set sub _$cmd
-    if { [llength [info commands ::struct::tree::$sub]] == 0 } {
-	set optlist [lsort [info commands ::struct::tree::_*]]
-	set xlist {}
-	foreach p $optlist {
-	    set p [namespace tail $p]
-	    lappend xlist [string range $p 1 end]
-	}
-	set optlist [linsert [join $xlist ", "] "end-1" "or"]
-	return -code error \
-		"bad option \"$cmd\": must be $optlist"
-    }
-
-    set code [catch {uplevel 1 [linsert $args 0 ::struct::tree::$sub $name]} result]
-
-    if {$code == 1} {
-	return -errorinfo [ErrorInfoAsCaller uplevel $sub]  \
-		-errorcode $::errorCode -code error $result
-    } elseif {$code == 2} {
-	return -code $code $result
-    }
-    return $result
-}
-
-# ::struct::tree::_:= --
-#
-#	Assignment operator. Copies the source tree into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the tree object we are copying into.
-#	source	Name of the tree object providing us with the
-#		data to copy.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::tree::_= {name source} {
-    _deserialize $name [$source serialize]
-    return
-}
-
-# ::struct::tree::_--> --
-#
-#	Reverse assignment operator. Copies this tree into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the tree object to copy
-#	dest	Name of the tree object we are copying to.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::tree::_--> {name dest} {
-    $dest deserialize [_serialize $name]
-    return
-}
-
-# ::struct::tree::_ancestors --
-#
-#	Return the list of all parent nodes of a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look up.
-#
-# Results:
-#	parents	List of parents of node $node.
-#		Immediate ancestor (parent) first,
-#		Root of tree (ancestor of all) last.
-
-proc ::struct::tree::_ancestors {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    set a {}
-    while {[info exists parent($node)]} {
-	set node $parent($node)
-	if {$node == {}} break
-	lappend a $node
-    }
-    return $a
-}
-
-# ::struct::tree::_attr --
-#
-#	Return attribute data for one key and multiple nodes, possibly all.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	key	Name of the attribute to retrieve.
-#
-# Results:
-#	children	Dictionary mapping nodes to attribute data.
-
-proc ::struct::tree::_attr {name key args} {
-    # Syntax:
-    #
-    # t attr key
-    # t attr key -nodes {nodelist}
-    # t attr key -glob nodepattern
-    # t attr key -regexp nodepattern
-
-    variable ${name}::attribute
-
-    set usage "wrong # args: should be \"[list $name] attr key ?-nodes list|-glob pattern|-regexp pattern?\""
-    if {([llength $args] != 0) && ([llength $args] != 2)} {
-	return -code error $usage
-    } elseif {[llength $args] == 0} {
-	# This automatically restricts the list
-	# to nodes which can have the attribute
-	# in question.
-
-	set nodes [array names attribute]
-    } else {
-	# Determine a list of nodes to look at
-	# based on the chosen restriction.
-
-	foreach {mode value} $args break
-	switch -exact -- $mode {
-	    -nodes {
-		# This is the only branch where we have to
-		# perform an explicit restriction to the
-		# nodes which have attributes.
-		set nodes {}
-		foreach n $value {
-		    if {![info exists attribute($n)]} continue
-		    lappend nodes $n
-		}
-	    }
-	    -glob {
-		set nodes [array names attribute $value]
-	    }
-	    -regexp {
-		set nodes {}
-		foreach n [array names attribute] {
-		    if {![regexp -- $value $n]} continue
-		    lappend nodes $n
-		}
-	    }
-	    default {
-		return -code error $usage
-	    }
-	}
-    }
-
-    # Without possibly matching nodes
-    # the result has to be empty.
-
-    if {![llength $nodes]} {
-	return {}
-    }
-
-    # Now locate matching keys and their values.
-
-    set result {}
-    foreach n $nodes {
-	upvar ${name}::$attribute($n) data
-	if {[info exists data($key)]} {
-	    lappend result $n $data($key)
-	}
-    }
-
-    return $result
-}
-
-# ::struct::tree::_deserialize --
-#
-#	Assignment operator. Copies a serialization into the
-#       destination, destroying the original information.
-#
-# Arguments:
-#	name	Name of the tree object we are copying into.
-#	serial	Serialized tree to copy from.
-#
-# Results:
-#	Nothing.
-
-proc ::struct::tree::_deserialize {name serial} {
-    # As we destroy the original tree as part of
-    # the copying process we don't have to deal
-    # with issues like node names from the new tree
-    # interfering with the old ...
-
-    # I. Get the serialization of the source tree
-    #    and check it for validity.
-
-    CheckSerialization $serial attr p c rn
-
-    # Get all the relevant data into the scope
-
-    variable ${name}::rootname
-    variable ${name}::children
-    variable ${name}::parent
-    variable ${name}::attribute
-    variable ${name}::nextAttr
-
-    # Kill the existing parent/children information and insert the new
-    # data in their place.
-
-    foreach n [array names parent] {
-	unset parent($n) children($n)
-    }
-    array set parent   [array get p]
-    array set children [array get c]
-    unset p c
-
-    set nextAttr 0
-    foreach a [array names attribute] {
-	unset ${name}::$attribute($a)
-    }
-    foreach n [array names attr] {
-	GenAttributeStorage $name $n
-	array set ${name}::$attribute($n) $attr($n)
-    }
-
-    set rootname $rn
-
-    ## Debug ## Dump internals ...
-    if {0} {
-	puts "___________________________________ $name"
-	puts $rootname
-	parray children
-	parray parent
-	parray attribute
-	puts ___________________________________
-    }
-    return
-}
-
-# ::struct::tree::_children --
-#
-#	Return the list of children for a given node of a tree.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up.
-#
-# Results:
-#	children	List of children for the node.
-
-proc ::struct::tree::_children {name args} {
-    # args := ?-all? node ?filter cmdprefix?
-
-    # '-all' implies that not only the direct children of the
-    # node, but all their children, and so on, are returned.
-    #
-    # 'filter cmd' implies that only those nodes in the result list
-    # which pass the test 'cmd' are placed into the final result. 
-
-    set usage "wrong # args: should be \"[list $name] children ?-all? node ?filter cmd?\""
-
-    if {([llength $args] < 1) || ([llength $args] > 4)} {
-	return -code error $usage
-    }
-    if {[string equal [lindex $args 0] -all]} {
-	set all 1
-	set args [lrange $args 1 end]
-    } else {
-	set all 0
-    }
-
-    # args := node ?filter cmdprefix?
-
-    if {([llength $args] != 1) && ([llength $args] != 3)} {
-	return -code error $usage
-    }
-    if {[llength $args] == 3} {
-	foreach {node _const_ cmd} $args break
-	if {![string equal $_const_ filter] || ![llength $cmd]} {
-	    return -code error $usage
-	}
-    } else {
-	set node [lindex $args 0]
-	set cmd {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    if {$all} {
-	set result [DescendantsCore $name $node]
-    } else {
-	variable ${name}::children
-	set result $children($node)
-    }
-
-    if {[llength $cmd]} {
-	lappend cmd $name
-	set result [uplevel 1 [list ::struct::list filter $result $cmd]]
-    }
-
-    return $result
-}
-
-# ::struct::tree::_cut --
-#
-#	Destroys the specified node of a tree, but not its children.
-#	These children are made into children of the parent of the
-#	destroyed node at the index of the destroyed node.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up and cut.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_cut {name node} {
-    variable ${name}::rootname
-
-    if { [string equal $node $rootname] } {
-	# Can't delete the special root node
-	return -code error "cannot cut root node"
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-
-    # Locate our parent, children and our location in the parent
-    set parentNode $parent($node)
-    set childNodes $children($node)
-
-    set index [lsearch -exact $children($parentNode) $node]
-
-    # Excise this node from the parent list,
-    set newChildren [lreplace $children($parentNode) $index $index]
-
-    # Put each of the children of $node into the parent's children list,
-    # in the place of $node, and update the parent pointer of those nodes.
-    foreach child $childNodes {
-	set newChildren [linsert $newChildren $index $child]
-	set parent($child) $parentNode
-	incr index
-    }
-    set children($parentNode) $newChildren
-
-    KillNode $name $node
-    return
-}
-
-# ::struct::tree::_delete --
-#
-#	Remove a node from a tree, including all of its values.  Recursively
-#	removes the node's children.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to delete.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_delete {name node} {
-    variable ${name}::rootname
-    if { [string equal $node $rootname] } {
-	# Can't delete the special root node
-	return -code error "cannot delete root node"
-    }
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    # Remove this node from its parent's children list
-    set parentNode $parent($node)
-    set index [lsearch -exact $children($parentNode) $node]
-    ldelete children($parentNode) $index
-
-    # Yes, we could use the stack structure implemented in ::struct::stack,
-    # but it's slower than inlining it.  Since we don't need a sophisticated
-    # stack, don't bother.
-    set st [list]
-    foreach child $children($node) {
-	lappend st $child
-    }
-
-    KillNode $name $node
-
-    while {[llength $st] > 0} {
-	set node [lindex $st end]
-	ldelete           st end
-	foreach child $children($node) {
-	    lappend st $child
-	}
-
-	KillNode $name $node
-    }
-    return
-}
-
-# ::struct::tree::_depth --
-#
-#	Return the depth (distance from the root node) of a given node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to find.
-#
-# Results:
-#	depth	Number of steps from node to the root node.
-
-proc ::struct::tree::_depth {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    variable ${name}::parent
-    variable ${name}::rootname
-    set depth 0
-    while { ![string equal $node $rootname] } {
-	incr depth
-	set node $parent($node)
-    }
-    return $depth
-}
-
-# ::struct::tree::_descendants --
-#
-#	Return the list containing all descendants of a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look at.
-#
-# Results:
-#	desc	(filtered) List of nodes descending from 'node'.
-
-proc ::struct::tree::_descendants {name node args} {
-    # children -all sucessor, allows filtering.
-
-    set usage "wrong # args: should be \"[list $name] descendants node ?filter cmd?\""
-
-    if {[llength $args] > 2} {
-	return -code error $usage
-    } elseif {[llength $args] == 2} {
-	foreach {_const_ cmd} $args break
-	if {![string equal $_const_ filter] || ![llength $cmd]} {
-	    return -code error $usage
-	}
-    } else {
-	set cmd {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    set result [DescendantsCore $name $node]
-
-    if {[llength $cmd]} {
-	lappend cmd $name
-	set result [uplevel 1 [list ::struct::list filter $result $cmd]]
-    }
-
-    return $result
-}
-
-proc ::struct::tree::DescendantsCore {name node} {
-    # CORE for listing of node descendants.
-    # No checks ...
-    # No filtering ...
-
-    variable ${name}::children
-
-    # New implementation. Instead of keeping a second, and explicit,
-    # list of pending nodes to shift through (= copying of array data
-    # around), we reuse the result list for that, using a counter and
-    # direct access to list elements to keep track of what nodes have
-    # not been handled yet. This eliminates a whole lot of array
-    # copying within the list implementation in the Tcl core. The
-    # result is unchanged, i.e. the nodes are in the same order as
-    # before.
-
-    set result  $children($node)
-    set at      0
-
-    while {$at < [llength $result]} {
-	set n [lindex $result $at]
-	incr at
-	foreach c $children($n) {
-	    lappend result $c
-	}
-    }
-
-    return $result
-}
-
-# ::struct::tree::_destroy --
-#
-#	Destroy a tree, including its associated command and data storage.
-#
-# Arguments:
-#	name	Name of the tree to destroy.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_destroy {name} {
-    namespace delete $name
-    interp alias {} $name {}
-}
-
-# ::struct::tree::_exists --
-#
-#	Test for existence of a given node in a tree.
-#
-# Arguments:
-#	name	Name of the tree to query.
-#	node	Node to look for.
-#
-# Results:
-#	1 if the node exists, 0 else.
-
-proc ::struct::tree::_exists {name node} {
-    return [info exists ${name}::parent($node)]
-}
-
-# ::struct::tree::_get --
-#
-#	Get a keyed value from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#	key	Key to lookup.
-#
-# Results:
-#	value	Value associated with the key given.
-
-proc ::struct::tree::_get {name node key} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node, key has to be invalid.
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-
-    upvar ${name}::$attribute($node) data
-    if {![info exists data($key)]} {
-	return -code error "invalid key \"$key\" for node \"$node\""
-    }
-    return $data($key)
-}
-
-# ::struct::tree::_getall --
-#
-#	Get a serialized list of key/value pairs from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#
-# Results:
-#	value	A serialized list of key/value pairs.
-
-proc ::struct::tree::_getall {name node {pattern *}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attributes ...
-	return {}
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [array get data $pattern]
-}
-
-# ::struct::tree::_height --
-#
-#	Return the height (distance from the given node to its deepest child)
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node we wish to know the height for..
-#
-# Results:
-#	height	Distance to deepest child of the node.
-
-proc ::struct::tree::_height {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    if {[llength $children($node)] == 0} {
-	# No children, is a leaf, height is 0.
-	return 0
-    }
-
-    # New implementation. We iteratively compute the height for each
-    # node under the specified one, from the bottom up. The previous
-    # implementation, using recursion will fail if the encountered
-    # subtree has a height greater than the currently set recursion
-    # limit.
-
-    array set h {}
-
-    # NOTE: Check out if a for loop doing direct access, i.e. without
-    #       list reversal, is faster.
-
-    foreach n [struct::list reverse [DescendantsCore $name $node]] {
-	# Height of leafs
-	if {![llength $children($n)]} {set h($n) 0}
-
-	# Height of our parent is max of our and previous height.
-	set p $parent($n)
-	if {![info exists h($p)] || ($h($n) >= $h($p))} {
-	    set h($p) [expr {$h($n) + 1}]
-	}
-    }
-
-    # NOTE: Check out how much we gain by caching the result.
-    #       For all nodes we have this computed. Use cache here
-    #       as well to cut the inspection of descendants down.
-    #       This may degenerate into a recursive solution again
-    #       however.
-
-    return $h($node)
-}
-
-# ::struct::tree::_keys --
-#
-#	Get a list of keys from a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#
-# Results:
-#	value	A serialized list of key/value pairs.
-
-proc ::struct::tree::_keys {name node {pattern *}} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node.
-	return {}
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [array names data $pattern]
-}
-
-# ::struct::tree::_keyexists --
-#
-#	Test for existence of a given key for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to query.
-#	key	Key to lookup.
-#
-# Results:
-#	1 if the key exists, 0 else.
-
-proc ::struct::tree::_keyexists {name node key} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node, key cannot exist
-	return 0
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [info exists data($key)]
-}
-
-# ::struct::tree::_index --
-#
-#	Determine the index of node with in its parent's list of children.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look up.
-#
-# Results:
-#	index	The index of the node in its parent
-
-proc ::struct::tree::_index {name node} {
-    variable ${name}::rootname
-    if { [string equal $node $rootname] } {
-	# The special root node has no parent, thus no index in it either.
-	return -code error "cannot determine index of root node"
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    # Locate the parent and ourself in its list of children
-    set parentNode $parent($node)
-
-    return [lsearch -exact $children($parentNode) $node]
-}
-
-# ::struct::tree::_insert --
-#
-#	Add a node to a tree; if the node(s) specified already exist, they
-#	will be moved to the given location.
-#
-# Arguments:
-#	name		Name of the tree.
-#	parentNode	Parent to add the node to.
-#	index		Index at which to insert.
-#	args		Node(s) to insert.  If none is given, the routine
-#			will insert a single node with a unique name.
-#
-# Results:
-#	nodes		List of nodes inserted.
-
-proc ::struct::tree::_insert {name parentNode index args} {
-    if { [llength $args] == 0 } {
-	# No node name was given; generate a unique one
-	set args [list [GenerateUniqueNodeName $name]]
-    }
-    if { ![_exists $name $parentNode] } {
-	return -code error "parent node \"$parentNode\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-    variable ${name}::rootname
-
-    # Make sure the index is numeric
-
-    if {[string equal $index "end"]} {
-	set index [llength $children($parentNode)]
-    } elseif {[regexp {^end-([0-9]+)$} $index -> n]} {
-	set index [expr {[llength $children($parentNode)] - $n}]
-    }
-
-    foreach node $args {
-	if {[_exists $name $node] } {
-	    # Move the node to its new home
-	    if { [string equal $node $rootname] } {
-		return -code error "cannot move root node"
-	    }
-	
-	    # Cannot make a node its own descendant (I'm my own grandpa...)
-	    set ancestor $parentNode
-	    while { ![string equal $ancestor $rootname] } {
-		if { [string equal $ancestor $node] } {
-		    return -code error "node \"$node\" cannot be its own descendant"
-		}
-		set ancestor $parent($ancestor)
-	    }
-	    # Remove this node from its parent's children list
-	    set oldParent $parent($node)
-	    set ind [lsearch -exact $children($oldParent) $node]
-	    ldelete children($oldParent) $ind
-	
-	    # If the node is moving within its parent, and its old location
-	    # was before the new location, decrement the new location, so that
-	    # it gets put in the right spot
-	    if { [string equal $oldParent $parentNode] && $ind < $index } {
-		incr index -1
-	    }
-	} else {
-	    # Set up the new node
-	    set children($node) [list]
-	}
-
-	# Add this node to its parent's children list
-	set children($parentNode) [linsert $children($parentNode) $index $node]
-
-	# Update the parent pointer for this node
-	set parent($node) $parentNode
-	incr index
-    }
-
-    return $args
-}
-
-# ::struct::tree::_isleaf --
-#
-#	Return whether the given node of a tree is a leaf or not.
-#
-# Arguments:
-#	name	Name of the tree object.
-#	node	Node to look up.
-#
-# Results:
-#	isleaf	True if the node is a leaf; false otherwise.
-
-proc ::struct::tree::_isleaf {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    return [expr {[llength $children($node)] == 0}]
-}
-
-# ::struct::tree::_move --
-#
-#	Move a node (and all its subnodes) from where ever it is to a new
-#	location in the tree.
-#
-# Arguments:
-#	name		Name of the tree
-#	parentNode	Parent to add the node to.
-#	index		Index at which to insert.
-#	node		Node to move; the node must exist in the tree.
-#	args		Additional nodes to move; these nodes must exist
-#			in the tree.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_move {name parentNode index node args} {
-    set args [linsert $args 0 $node]
-
-    # Can only move a node to a real location in the tree
-    if { ![_exists $name $parentNode] } {
-	return -code error "parent node \"$parentNode\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::parent
-    variable ${name}::children
-    variable ${name}::rootname
-
-    # Make sure the index is numeric
-
-    if {[string equal $index "end"]} {
-	set index [llength $children($parentNode)]
-    } elseif {[regexp {^end-([0-9]+)$} $index -> n]} {
-	set index [expr {[llength $children($parentNode)] - $n}]
-    }
-
-    # Validate all nodes to move before trying to move any.
-    foreach node $args {
-	if { [string equal $node $rootname] } {
-	    return -code error "cannot move root node"
-	}
-
-	# Can only move real nodes
-	if { ![_exists $name $node] } {
-	    return -code error "node \"$node\" does not exist in tree \"$name\""
-	}
-
-	# Cannot move a node to be a descendant of itself
-	set ancestor $parentNode
-	while { ![string equal $ancestor $rootname] } {
-	    if { [string equal $ancestor $node] } {
-		return -code error "node \"$node\" cannot be its own descendant"
-	    }
-	    set ancestor $parent($ancestor)
-	}
-    }
-
-    # Remove all nodes from their current parent's children list
-    foreach node $args {
-	set oldParent $parent($node)
-	set ind [lsearch -exact $children($oldParent) $node]
-
-	ldelete children($oldParent) $ind
-
-	# Update the nodes parent value
-	set parent($node) $parentNode
-    }
-
-    # Add all nodes to their new parent's children list
-    set children($parentNode) \
-	[eval [list linsert $children($parentNode) $index] $args]
-
-    return
-}
-
-# ::struct::tree::_next --
-#
-#	Return the right sibling for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to retrieve right sibling for.
-#
-# Results:
-#	sibling		The right sibling for the node, or null if node was
-#			the rightmost child of its parent.
-
-proc ::struct::tree::_next {name node} {
-    # The 'root' has no siblings.
-    variable ${name}::rootname
-    if { [string equal $node $rootname] } {
-	return {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Locate the parent and our place in its list of children.
-    variable ${name}::parent
-    variable ${name}::children
-
-    set parentNode $parent($node)
-    set  index [lsearch -exact $children($parentNode) $node]
-
-    # Go to the node to the right and return its name.
-    return [lindex $children($parentNode) [incr index]]
-}
-
-# ::struct::tree::_numchildren --
-#
-#	Return the number of immediate children for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to look up.
-#
-# Results:
-#	numchildren	Number of immediate children for the node.
-
-proc ::struct::tree::_numchildren {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::children
-    return [llength $children($node)]
-}
-
-# ::struct::tree::_nodes --
-#
-#	Return a list containing all nodes known to the tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#
-# Results:
-#	nodes	List of nodes in the tree.
-
-proc ::struct::tree::_nodes {name} {
-    variable ${name}::children
-    return [array names children]
-}
-
-# ::struct::tree::_parent --
-#
-#	Return the name of the parent node of a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to look up.
-#
-# Results:
-#	parent	Parent of node $node
-
-proc ::struct::tree::_parent {name node} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    # FRINK: nocheck
-    return [set ${name}::parent($node)]
-}
-
-# ::struct::tree::_previous --
-#
-#	Return the left sibling for a given node of a tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#	node		Node to look up.
-#
-# Results:
-#	sibling		The left sibling for the node, or null if node was
-#			the leftmost child of its parent.
-
-proc ::struct::tree::_previous {name node} {
-    # The 'root' has no siblings.
-    variable ${name}::rootname
-    if { [string equal $node $rootname] } {
-	return {}
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Locate the parent and our place in its list of children.
-    variable ${name}::parent
-    variable ${name}::children
-
-    set parentNode $parent($node)
-    set  index [lsearch -exact $children($parentNode) $node]
-
-    # Go to the node to the right and return its name.
-    return [lindex $children($parentNode) [incr index -1]]
-}
-
-# ::struct::tree::_rootname --
-#
-#	Query or change the name of the root node.
-#
-# Arguments:
-#	name	Name of the tree.
-#
-# Results:
-#	The name of the root node
-
-proc ::struct::tree::_rootname {name} {
-    variable ${name}::rootname
-    return $rootname
-}
-
-# ::struct::tree::_rename --
-#
-#	Change the name of any node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Name of node to be renamed
-#	newname	New name for the node.
-#
-# Results:
-#	The new name of the node.
-
-proc ::struct::tree::_rename {name node newname} {
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-    if {[_exists $name $newname]} {
-	return -code error "unable to rename node to \"$newname\",\
-		node of that name already present in the tree \"$name\""
-    }
-
-    set oldname  $node
-
-    # Perform the rename in the internal
-    # data structures.
-
-    variable ${name}::rootname
-    variable ${name}::children
-    variable ${name}::parent
-    variable ${name}::attribute
-
-    set children($newname) $children($oldname)
-    unset                   children($oldname)
-    set parent($newname)     $parent($oldname)
-    unset                     parent($oldname)
-
-    foreach c $children($newname) {
-	set parent($c) $newname
-    }
-
-    if {[string equal $oldname $rootname]} {
-	set rootname $newname
-    } else {
-	set p $parent($newname)
-	set pos  [lsearch -exact $children($p) $oldname]
-	lset children($p) $pos $newname
-    }
-
-    if {[info exists attribute($oldname)]} {
-	set attribute($newname) $attribute($oldname)
-	unset                    attribute($oldname)
-    }
-
-    return $newname
-}
-
-# ::struct::tree::_serialize --
-#
-#	Serialize a tree object (partially) into a transportable value.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Root node of the serialized tree.
-#
-# Results:
-#	A list structure describing the part of the tree which was serialized.
-
-proc ::struct::tree::_serialize {name args} {
-    if {[llength $args] > 1} {
-	return -code error \
-		"wrong # args: should be \"[list $name] serialize ?node?\""
-    } elseif {[llength $args] == 1} {
-	set node [lindex $args 0]
-
-	if {![_exists $name $node]} {
-	    return -code error "node \"$node\" does not exist in tree \"$name\""
-	}
-    } else {
-	variable ${name}::rootname
-	set node $rootname
-    }
-
-    set                   tree [list]
-    Serialize $name $node tree
-    return               $tree
-}
-
-# ::struct::tree::_set --
-#
-#	Set or get a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify or query.
-#	args	Optional argument specifying a value.
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_set {name node key args} {
-    if {[llength $args] > 1} {
-	return -code error "wrong # args: should be \"$name set node key\
-		?value?\""
-    }
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    # Process the arguments ...
-
-    if {[llength $args] > 0} {
-	# Setting the value. This may have to create
-	# the attribute array for this particular
-	# node
-
-	variable ${name}::attribute
-	if {![info exists attribute($node)]} {
-	    # No attribute data for this node,
-	    # so create it as we need it now.
-	    GenAttributeStorage $name $node
-	}
-	upvar ${name}::$attribute($node) data
-
-	return [set data($key) [lindex $args end]]
-    } else {
-	# Getting the value
-
-	return [_get $name $node $key]
-    }
-}
-
-# ::struct::tree::_append --
-#
-#	Append a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify.
-#	key	Name of attribute to modify.
-#	value	Value to append
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_append {name node key value} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name $node
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [append data($key) $value]
-}
-
-# ::struct::tree::_lappend --
-#
-#	lappend a value for a node in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify or query.
-#	key	Name of attribute to modify.
-#	value	Value to append
-#
-# Results:
-#	val	Value associated with the given key of the given node
-
-proc ::struct::tree::_lappend {name node key value} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# so create it as we need it.
-	GenAttributeStorage $name $node
-    }
-
-    upvar ${name}::$attribute($node) data
-    return [lappend data($key) $value]
-}
-
-# ::struct::tree::_leaves --
-#
-#	Return a list containing all leaf nodes known to the tree.
-#
-# Arguments:
-#	name		Name of the tree object.
-#
-# Results:
-#	nodes	List of leaf nodes in the tree.
-
-proc ::struct::tree::_leaves {name} {
-    variable ${name}::children
-
-    set res {}
-    foreach n [array names children] {
-	if {[llength $children($n)]} continue
-	lappend res $n
-    }
-    return $res
-}
-
-# ::struct::tree::_size --
-#
-#	Return the number of descendants of a given node.  The default node
-#	is the special root node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Optional node to start counting from (default is root).
-#
-# Results:
-#	size	Number of descendants of the node.
-
-proc ::struct::tree::_size {name args} {
-    variable ${name}::rootname
-    if {[llength $args] > 1} {
-	return -code error \
-		"wrong # args: should be \"[list $name] size ?node?\""
-    } elseif {[llength $args] == 1} {
-	set node [lindex $args 0]
-
-	if { ![_exists $name $node] } {
-	    return -code error "node \"$node\" does not exist in tree \"$name\""
-	}
-    } else {
-	# If the node is the root, we can do the cheap thing and just count the
-	# number of nodes (excluding the root node) that we have in the tree with
-	# array size.
-
-	return [expr {[array size ${name}::parent] - 1}]
-    }
-
-    # If the node is the root, we can do the cheap thing and just count the
-    # number of nodes (excluding the root node) that we have in the tree with
-    # array size.
-
-    if { [string equal $node $rootname] } {
-	return [expr {[array size ${name}::parent] - 1}]
-    }
-
-    # Otherwise we have to do it the hard way and do a full tree search
-    variable ${name}::children
-    set size 0
-    set st [list ]
-    foreach child $children($node) {
-	lappend st $child
-    }
-    while { [llength $st] > 0 } {
-	set node [lindex $st end]
-	ldelete st end
-	incr size
-	foreach child $children($node) {
-	    lappend st $child
-	}
-    }
-    return $size
-}
-
-# ::struct::tree::_splice --
-#
-#	Add a node to a tree, making a range of children from the given
-#	parent children of the new node.
-#
-# Arguments:
-#	name		Name of the tree.
-#	parentNode	Parent to add the node to.
-#	from		Index at which to insert.
-#	to		Optional end of the range of children to replace.
-#			Defaults to 'end'.
-#	args		Optional node name; if given, must be unique.  If not
-#			given, a unique name will be generated.
-#
-# Results:
-#	node		Name of the node added to the tree.
-
-proc ::struct::tree::_splice {name parentNode from {to end} args} {
-
-    if { ![_exists $name $parentNode] } {
-	return -code error "node \"$parentNode\" does not exist in tree \"$name\""
-    }
-
-    if { [llength $args] == 0 } {
-	# No node name given; generate a unique node name
-	set node [GenerateUniqueNodeName $name]
-    } else {
-	set node [lindex $args 0]
-    }
-
-    if { [_exists $name $node] } {
-	return -code error "node \"$node\" already exists in tree \"$name\""
-    }
-
-    variable ${name}::children
-    variable ${name}::parent
-
-    if {[string equal $from "end"]} {
-	set from [expr {[llength $children($parentNode)] - 1}]
-    } elseif {[regexp {^end-([0-9]+)$} $from -> n]} {
-	set from [expr {[llength $children($parentNode)] - 1 - $n}]
-    }
-    if {[string equal $to "end"]} {
-	set to [expr {[llength $children($parentNode)] - 1}]
-    } elseif {[regexp {^end-([0-9]+)$} $to -> n]} {
-	set to   [expr {[llength $children($parentNode)] - 1 - $n}]
-    }
-
-    # Save the list of children that are moving
-    set moveChildren [lrange $children($parentNode) $from $to]
-
-    # Remove those children from the parent
-    ldelete children($parentNode) $from $to
-
-    # Add the new node
-    _insert $name $parentNode $from $node
-
-    # Move the children
-    set children($node) $moveChildren
-    foreach child $moveChildren {
-	set parent($child) $node
-    }
-
-    return $node
-}
-
-# ::struct::tree::_swap --
-#
-#	Swap two nodes in a tree.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node1	First node to swap.
-#	node2	Second node to swap.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_swap {name node1 node2} {
-    # Can't swap the magic root node
-    variable ${name}::rootname
-    if {[string equal $node1 $rootname] || [string equal $node2 $rootname]} {
-	return -code error "cannot swap root node"
-    }
-
-    # Can only swap two real nodes
-    if {![_exists $name $node1]} {
-	return -code error "node \"$node1\" does not exist in tree \"$name\""
-    }
-    if {![_exists $name $node2]} {
-	return -code error "node \"$node2\" does not exist in tree \"$name\""
-    }
-
-    # Can't swap a node with itself
-    if {[string equal $node1 $node2]} {
-	return -code error "cannot swap node \"$node1\" with itself"
-    }
-
-    # Swapping nodes means swapping their labels and values
-    variable ${name}::children
-    variable ${name}::parent
-
-    set parent1 $parent($node1)
-    set parent2 $parent($node2)
-
-    # Replace node1 with node2 in node1's parent's children list, and
-    # node2 with node1 in node2's parent's children list
-    set i1 [lsearch -exact $children($parent1) $node1]
-    set i2 [lsearch -exact $children($parent2) $node2]
-
-    lset children($parent1) $i1 $node2
-    lset children($parent2) $i2 $node1
-
-    # Make node1 the parent of node2's children, and vis versa
-    foreach child $children($node2) {
-	set parent($child) $node1
-    }
-    foreach child $children($node1) {
-	set parent($child) $node2
-    }
-
-    # Swap the children lists
-    set children1 $children($node1)
-    set children($node1) $children($node2)
-    set children($node2) $children1
-
-    if { [string equal $node1 $parent2] } {
-	set parent($node1) $node2
-	set parent($node2) $parent1
-    } elseif { [string equal $node2 $parent1] } {
-	set parent($node1) $parent2
-	set parent($node2) $node1
-    } else {
-	set parent($node1) $parent2
-	set parent($node2) $parent1
-    }
-
-    # Swap the values
-    # More complicated now with the possibility that nodes do not have
-    # attribute storage associated with them.
-
-    variable ${name}::attribute
-
-    if {
-	[set ia [info exists attribute($node1)]] ||
-	[set ib [info exists attribute($node2)]]
-    } {
-	# At least one of the nodes has attribute data. We simply swap
-	# the references to the arrays containing them. No need to
-	# copy the actual data around.
-
-	if {$ia && $ib} {
-	    set tmp               $attribute($node1)
-	    set attribute($node1) $attribute($node2)
-	    set attribute($node2) $tmp
-	} elseif {$ia} {
-	    set   attribute($node2) $attribute($node1)
-	    unset attribute($node1)
-	} elseif {$ib} {
-	    set   attribute($node1) $attribute($node2)
-	    unset attribute($node2)
-	} else {
-	    return -code error "Impossible condition."
-	}
-    } ; # else: No attribute storage => Nothing to do {}
-
-    return
-}
-
-# ::struct::tree::_unset --
-#
-#	Remove a keyed value from a node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node to modify.
-#	key	Name of attribute to unset.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_unset {name node key} {
-    if {![_exists $name $node]} {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    variable ${name}::attribute
-    if {![info exists attribute($node)]} {
-	# No attribute data for this node,
-	# nothing to do.
-	return
-    }
-
-    upvar ${name}::$attribute($node) data
-    catch {unset data($key)}
-
-    if {[array size data] == 0} {
-	# No attributes stored for this node, squash the whole array.
-	unset attribute($node)
-	unset data
-    }
-    return
-}
-
-# ::struct::tree::_walk --
-#
-#	Walk a tree using a pre-order depth or breadth first
-#	search. Pre-order DFS is the default.  At each node that is visited,
-#	a command will be called with the name of the tree and the node.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Node at which to start.
-#	args	Optional additional arguments specifying the type and order of
-#		the tree walk, and the command to execute at each node.
-#		Format is
-#		    ?-type {bfs|dfs}? ?-order {pre|post|in|both}? a n script
-#
-# Results:
-#	None.
-
-proc ::struct::tree::_walk {name node args} {
-    set usage "$name walk node ?-type {bfs|dfs}? ?-order {pre|post|in|both}? ?--? loopvar script"
-
-    if {[llength $args] > 7 || [llength $args] < 2} {
-	return -code error "wrong # args: should be \"$usage\""
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    set args [WalkOptions $args 2 $usage]
-    # Remainder is 'a n script'
-
-    foreach {loopvariables script} $args break
-
-    if {[llength $loopvariables] > 2} {
-	return -code error "too many loop variables, at most two allowed"
-    } elseif {[llength $loopvariables] == 2} {
-	foreach {avar nvar} $loopvariables break
-    } else {
-	set nvar [lindex $loopvariables 0]
-	set avar {}
-    }
-
-    # Make sure we have a script to run, otherwise what's the point?
-    if { [string equal $script ""] } {
-	return -code error "no script specified, or empty"
-    }
-
-    # Do the walk
-    variable ${name}::children
-    set st [list ]
-    lappend st $node
-
-    # Compute some flags for the possible places of command evaluation
-    set leave [expr {[string equal $order post] || [string equal $order both]}]
-    set enter [expr {[string equal $order pre]  || [string equal $order both]}]
-    set touch [string equal $order in]
-
-    if {$leave} {
-	set lvlabel leave
-    } elseif {$touch} {
-	# in-order does not provide a sense
-	# of nesting for the parent, hence
-	# no enter/leave, just 'visit'.
-	set lvlabel visit
-    }
-
-    set rcode 0
-    set rvalue {}
-
-    if {[string equal $type "dfs"]} {
-	# Depth-first walk, several orders of visiting nodes
-	# (pre, post, both, in)
-
-	array set visited {}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex $st end]
-
-	    if {[info exists visited($node)]} {
-		# Second time we are looking at this 'node'.
-		# Pop it, then evaluate the command (post, both, in).
-
-		ldelete st end
-
-		if {$leave || $touch} {
-		    # Evaluate the script at this node
-		    WalkCall $avar $nvar $name $node $lvlabel $script
-		    # prune stops execution of loop here.
-		}
-	    } else {
-		# First visit of this 'node'.
-		# Do *not* pop it from the stack so that we are able
-		# to visit again after its children
-
-		# Remember it.
-		set visited($node) .
-
-		if {$enter} {
-		    # Evaluate the script at this node (pre, both).
-		    #
-		    # Note: As this is done before the children are
-		    # looked at the script may change the children of
-		    # this node and thus affect the walk.
-
-		    WalkCall $avar $nvar $name $node "enter" $script
-		    # prune stops execution of loop here.
-		}
-
-		# Add the children of this node to the stack.
-		# The exact behaviour depends on the chosen
-		# order. For pre, post, both-order we just
-		# have to add them in reverse-order so that
-		# they will be popped left-to-right. For in-order
-		# we have rearrange the stack so that the parent
-		# is revisited immediately after the first child.
-		# (but only if there is ore than one child,)
-
-		set clist        $children($node)
-		set len [llength $clist]
-
-		if {$touch && ($len > 1)} {
-		    # Pop node from stack, insert into list of children
-		    ldelete st end
-		    set clist [linsert $clist 1 $node]
-		    incr len
-		}
-
-		for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-		    lappend st [lindex $clist $i]
-		}
-	    }
-	}
-    } else {
-	# Breadth first walk (pre, post, both)
-	# No in-order possible. Already captured.
-
-	if {$leave} {
-	    set backward $st
-	}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex   $st 0]
-	    ldelete st 0
-
-	    if {$enter} {
-		# Evaluate the script at this node
-		WalkCall $avar $nvar $name $node "enter" $script
-		# prune stops execution of loop here.
-	    }
-
-	    # Add this node's children
-	    # And create a mirrored version in case of post/both order.
-
-	    foreach child $children($node) {
-		lappend st $child
-		if {$leave} {
-		    set backward [linsert $backward 0 $child]
-		}
-	    }
-	}
-
-	if {$leave} {
-	    foreach node $backward {
-		# Evaluate the script at this node
-		WalkCall $avar $nvar $name $node "leave" $script
-	    }
-	}
-    }
-
-    if {$rcode != 0} {
-	return -code $rcode $rvalue
-    }
-    return
-}
-
-proc ::struct::tree::_walkproc {name node args} {
-    set usage "$name walkproc node ?-type {bfs|dfs}? ?-order {pre|post|in|both}? ?--? cmdprefix"
-
-    if {[llength $args] > 6 || [llength $args] < 1} {
-	return -code error "wrong # args: should be \"$usage\""
-    }
-
-    if { ![_exists $name $node] } {
-	return -code error "node \"$node\" does not exist in tree \"$name\""
-    }
-
-    set args [WalkOptions $args 1 $usage]
-    # Remainder is 'n cmdprefix'
-
-    set script [lindex $args 0]
-
-    # Make sure we have a script to run, otherwise what's the point?
-    if { ![llength $script] } {
-	return -code error "no script specified, or empty"
-    }
-
-    # Do the walk
-    variable ${name}::children
-    set st [list ]
-    lappend st $node
-
-    # Compute some flags for the possible places of command evaluation
-    set leave [expr {[string equal $order post] || [string equal $order both]}]
-    set enter [expr {[string equal $order pre]  || [string equal $order both]}]
-    set touch [string equal $order in]
-
-    if {$leave} {
-	set lvlabel leave
-    } elseif {$touch} {
-	# in-order does not provide a sense
-	# of nesting for the parent, hence
-	# no enter/leave, just 'visit'.
-	set lvlabel visit
-    }
-
-    set rcode 0
-    set rvalue {}
-
-    if {[string equal $type "dfs"]} {
-	# Depth-first walk, several orders of visiting nodes
-	# (pre, post, both, in)
-
-	array set visited {}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex $st end]
-
-	    if {[info exists visited($node)]} {
-		# Second time we are looking at this 'node'.
-		# Pop it, then evaluate the command (post, both, in).
-
-		ldelete st end
-
-		if {$leave || $touch} {
-		    # Evaluate the script at this node
-		    WalkCallProc $name $node $lvlabel $script
-		    # prune stops execution of loop here.
-		}
-	    } else {
-		# First visit of this 'node'.
-		# Do *not* pop it from the stack so that we are able
-		# to visit again after its children
-
-		# Remember it.
-		set visited($node) .
-
-		if {$enter} {
-		    # Evaluate the script at this node (pre, both).
-		    #
-		    # Note: As this is done before the children are
-		    # looked at the script may change the children of
-		    # this node and thus affect the walk.
-
-		    WalkCallProc $name $node "enter" $script
-		    # prune stops execution of loop here.
-		}
-
-		# Add the children of this node to the stack.
-		# The exact behaviour depends on the chosen
-		# order. For pre, post, both-order we just
-		# have to add them in reverse-order so that
-		# they will be popped left-to-right. For in-order
-		# we have rearrange the stack so that the parent
-		# is revisited immediately after the first child.
-		# (but only if there is ore than one child,)
-
-		set clist        $children($node)
-		set len [llength $clist]
-
-		if {$touch && ($len > 1)} {
-		    # Pop node from stack, insert into list of children
-		    ldelete st end
-		    set clist [linsert $clist 1 $node]
-		    incr len
-		}
-
-		for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
-		    lappend st [lindex $clist $i]
-		}
-	    }
-	}
-    } else {
-	# Breadth first walk (pre, post, both)
-	# No in-order possible. Already captured.
-
-	if {$leave} {
-	    set backward $st
-	}
-
-	while { [llength $st] > 0 } {
-	    set node [lindex   $st 0]
-	    ldelete st 0
-
-	    if {$enter} {
-		# Evaluate the script at this node
-		WalkCallProc $name $node "enter" $script
-		# prune stops execution of loop here.
-	    }
-
-	    # Add this node's children
-	    # And create a mirrored version in case of post/both order.
-
-	    foreach child $children($node) {
-		lappend st $child
-		if {$leave} {
-		    set backward [linsert $backward 0 $child]
-		}
-	    }
-	}
-
-	if {$leave} {
-	    foreach node $backward {
-		# Evaluate the script at this node
-		WalkCallProc $name $node "leave" $script
-	    }
-	}
-    }
-
-    if {$rcode != 0} {
-	return -code $rcode $rvalue
-    }
-    return
-}
-
-proc ::struct::tree::WalkOptions {theargs n usage} {
-    upvar 1 type type order order
-
-    # Set defaults
-    set type dfs
-    set order pre
-
-    while {[llength $theargs]} {
-	set flag [lindex $theargs 0]
-	switch -exact -- $flag {
-	    "-type" {
-		if {[llength $theargs] < 2} {
-		    return -code error "value for \"$flag\" missing"
-		}
-		set type [string tolower [lindex $theargs 1]]
-		set theargs [lrange $theargs 2 end]
-	    }
-	    "-order" {
-		if {[llength $theargs] < 2} {
-		    return -code error "value for \"$flag\" missing"
-		}
-		set order [string tolower [lindex $theargs 1]]
-		set theargs [lrange $theargs 2 end]
-	    }
-	    "--" {
-		set theargs [lrange $theargs 1 end]
-		break
-	    }
-	    default {
-		break
-	    }
-	}
-    }
-
-    if {[llength $theargs] == 0} {
-	return -code error "wrong # args: should be \"$usage\""
-    }
-    if {[llength $theargs] != $n} {
-	return -code error "unknown option \"$flag\""
-    }
-
-    # Validate that the given type is good
-    switch -exact -- $type {
-	"dfs" - "bfs" {
-	    set type $type
-	}
-	default {
-	    return -code error "bad search type \"$type\": must be bfs or dfs"
-	}
-    }
-
-    # Validate that the given order is good
-    switch -exact -- $order {
-	"pre" - "post" - "in" - "both" {
-	    set order $order
-	}
-	default {
-	    return -code error "bad search order \"$order\":\
-		    must be both, in, pre, or post"
-	}
-    }
-
-    if {[string equal $order "in"] && [string equal $type "bfs"]} {
-	return -code error "unable to do a ${order}-order breadth first walk"
-    }
-
-    return $theargs
-}
-
-# ::struct::tree::WalkCall --
-#
-#	Helper command to 'walk' handling the evaluation
-#	of the user-specified command. Information about
-#	the tree, node and current action are substituted
-#	into the command before it evaluation.
-#
-# Arguments:
-#	tree	Tree we are walking
-#	node	Node we are at.
-#	action	The current action.
-#	cmd	The command to call, already partially substituted.
-#
-# Results:
-#	None.
-
-proc ::struct::tree::WalkCall {avar nvar tree node action cmd} {
-
-    if {$avar != {}} {
-	upvar 2 $avar a ; set a $action
-    }
-    upvar 2 $nvar n ; set n $node
-
-    set code [catch {uplevel 2 $cmd} result]
-
-    # decide what to do upon the return code:
-    #
-    #               0 - the body executed successfully
-    #               1 - the body raised an error
-    #               2 - the body invoked [return]
-    #               3 - the body invoked [break]
-    #               4 - the body invoked [continue]
-    #               5 - the body invoked [struct::tree::prune]
-    # everything else - return and pass on the results
-    #
-    switch -exact -- $code {
-	0 {}
-	1 {
-	    return -errorinfo [ErrorInfoAsCaller uplevel WalkCall]  \
-		    -errorcode $::errorCode -code error $result
-	}
-	3 {
-	    # FRINK: nocheck
-	    return -code break
-	}
-	4 {}
-	5 {
-	    upvar order order
-	    if {[string equal $order post] || [string equal $order in]} {
-		return -code error "Illegal attempt to prune ${order}-order walking"
-	    }
-	    return -code continue
-	}
-	default {
-	    upvar 1 rcode rcode rvalue rvalue
-	    set rcode $code
-	    set rvalue $result
-	    return -code break
-	    #return -code $code $result
-	}
-    }
-    return {}
-}
-
-proc ::struct::tree::WalkCallProc {tree node action cmd} {
-
-    lappend cmd $tree $node $action
-    set code [catch {uplevel 2 $cmd} result]
-
-    # decide what to do upon the return code:
-    #
-    #               0 - the body executed successfully
-    #               1 - the body raised an error
-    #               2 - the body invoked [return]
-    #               3 - the body invoked [break]
-    #               4 - the body invoked [continue]
-    #               5 - the body invoked [struct::tree::prune]
-    # everything else - return and pass on the results
-    #
-    switch -exact -- $code {
-	0 {}
-	1 {
-	    return -errorinfo [ErrorInfoAsCaller uplevel WalkCallProc]  \
-		    -errorcode $::errorCode -code error $result
-	}
-	3 {
-	    # FRINK: nocheck
-	    return -code break
-	}
-	4 {}
-	5 {
-	    upvar order order
-	    if {[string equal $order post] || [string equal $order in]} {
-		return -code error "Illegal attempt to prune ${order}-order walking"
-	    }
-	    return -code continue
-	}
-	default {
-	    upvar 1 rcode rcode rvalue rvalue
-	    set rcode $code
-	    set rvalue $result
-	    return -code break
-	}
-    }
-    return {}
-}
-
-proc ::struct::tree::ErrorInfoAsCaller {find replace} {
-    set info $::errorInfo
-    set i [string last "\n    (\"$find" $info]
-    if {$i == -1} {return $info}
-    set result [string range $info 0 [incr i 6]]	;# keep "\n    (\""
-    append result $replace			;# $find -> $replace
-    incr i [string length $find]
-    set j [string first ) $info [incr i]]	;# keep rest of parenthetical
-    append result [string range $info $i $j]
-    return $result
-}
-
-# ::struct::tree::GenerateUniqueNodeName --
-#
-#	Generate a unique node name for the given tree.
-#
-# Arguments:
-#	name	Name of the tree to generate a unique node name for.
-#
-# Results:
-#	node	Name of a node guaranteed to not exist in the tree.
-
-proc ::struct::tree::GenerateUniqueNodeName {name} {
-    variable ${name}::nextUnusedNode
-    while {[_exists $name "node${nextUnusedNode}"]} {
-	incr nextUnusedNode
-    }
-    return "node${nextUnusedNode}"
-}
-
-# ::struct::tree::KillNode --
-#
-#	Delete all data of a node.
-#
-# Arguments:
-#	name	Name of the tree containing the node
-#	node	Name of the node to delete.
-#
-# Results:
-#	none
-
-proc ::struct::tree::KillNode {name node} {
-    variable ${name}::parent
-    variable ${name}::children
-    variable ${name}::attribute
-
-    # Remove all record of $node
-    unset parent($node)
-    unset children($node)
-
-    if {[info exists attribute($node)]} {
-	# FRINK: nocheck
-	unset ${name}::$attribute($node)
-	unset attribute($node)
-    }
-    return
-}
-
-# ::struct::tree::GenAttributeStorage --
-#
-#	Create an array to store the attributes of a node in.
-#
-# Arguments:
-#	name	Name of the tree containing the node
-#	node	Name of the node which got attributes.
-#
-# Results:
-#	none
-
-proc ::struct::tree::GenAttributeStorage {name node} {
-    variable ${name}::nextAttr
-    variable ${name}::attribute
-
-    set   attr "a[incr nextAttr]"
-    set   attribute($node) $attr
-    return
-}
-
-# ::struct::tree::Serialize --
-#
-#	Serialize a tree object (partially) into a transportable value.
-#
-# Arguments:
-#	name	Name of the tree.
-#	node	Root node of the serialized tree.
-#
-# Results:
-#	None
-
-proc ::struct::tree::Serialize {name node tvar} {
-    upvar 1 $tvar tree
-
-    variable ${name}::attribute
-    variable ${name}::parent
-
-    # 'node' is the root of the tree to serialize. The precondition
-    # for the call is that this node is already stored in the list
-    # 'tvar', at index 'rootidx'.
-
-    # The attribute data for 'node' goes immediately after the 'node'
-    # data. the node information is _not_ yet stored, and this command
-    # has to do this.
-
-
-    array set r {}
-    set loc($node) 0
-
-    lappend tree $node {}
-    if {[info exists attribute($node)]} {
-	upvar ${name}::$attribute($node) data
-	lappend tree [array get data]
-    } else {
-	# Encode nodes without attributes.
-	lappend tree {}
-    }
-
-    foreach n [DescendantsCore $name $node] {
-	set loc($n) [llength $tree]
-	lappend tree $n $loc($parent($n))
-
-	if {[info exists attribute($n)]} {
-	    upvar ${name}::$attribute($n) data
-	    lappend tree [array get data]
-	} else {
-	    # Encode nodes without attributes.
-	    lappend tree {}
-	}
-    }
-
-    return $tree
-}
-
-
-proc ::struct::tree::CheckSerialization {ser avar pvar cvar rnvar} {
-    upvar 1 $avar attr $pvar p $cvar ch $rnvar rn
-
-    # Overall length ok ?
-
-    if {[llength $ser] % 3} {
-	return -code error \
-		"error in serialization: list length not a multiple of 3."
-    }
-
-    set rn {}
-    array set p    {}
-    array set ch   {}
-    array set attr {}
-
-    # Basic decoder pass
-
-    foreach {node parent nattr} $ser {
-
-	# Initialize children data, if not already done
-	if {![info exists ch($node)]} {
-	    set ch($node) {}
-	}
-	# Attribute length ok ? Dictionary!
-	if {[llength $nattr] % 2} {
-	    return -code error \
-		    "error in serialization: malformed attribute dictionary."
-	}
-	# Remember attribute data only for non-empty nodes
-	if {[llength $nattr]} {
-	    set attr($node) $nattr
-	}
-	# Remember root
-	if {$parent == {}} {
-	    lappend rn $node
-	    set p($node) {}
-	    continue
-	}
-	# Parent reference ok ?
-	if {
-	    ![string is integer -strict $parent] ||
-	    ($parent % 3) ||
-	    ($parent < 0) ||
-	    ($parent >= [llength $ser])
-	} {
-	    return -code error \
-		    "error in serialization: bad parent reference \"$parent\"."
-	}
-	# Remember parent, and reconstruct children
-
-	set p($node) [lindex $ser $parent]
-	lappend ch($p($node)) $node
-    }
-
-    # Root node information ok ?
-
-    if {[llength $rn] < 1} {
-	return -code error \
-		"error in serialization: no root specified."
-    } elseif {[llength $rn] > 1} {
-	return -code error \
-		"error in serialization: multiple root nodes."
-    }
-    set rn [lindex $rn 0]
-
-    # Duplicate node names ?
-
-    if {[array size ch] < ([llength $ser] / 3)} {
-	return -code error \
-		"error in serialization: duplicate node names."
-    }
-
-    # Cycles in the parent relationship ?
-
-    array set visited {}
-    foreach n [array names p] {
-	if {[info exists visited($n)]} {continue}
-	array set _ {}
-	while {$n != {}} {
-	    if {[info exists _($n)]} {
-		# Node already converted, cycle.
-		return -code error \
-			"error in serialization: cycle detected."
-	    }
-	    set _($n)       .
-	    # root ?
-	    if {$p($n) == {}} {break}
-	    set n $p($n)
-	    if {[info exists visited($n)]} {break}
-	    set visited($n) .
-	}
-	unset _
-    }
-    # Ok. The data is now ready for the caller.
-
-    return
-}
-
-##########################
-# Private functions follow
-#
-# Do a compatibility version of [lset] for pre-8.4 versions of Tcl.
-# This version does not do multi-arg [lset]!
-
-proc ::struct::tree::K { x y } { set x }
-
-if { [package vcompare [package provide Tcl] 8.4] < 0 } {
-    proc ::struct::tree::lset { var index arg } {
-	upvar 1 $var list
-	set list [::lreplace [K $list [set list {}]] $index $index $arg]
-    }
-}
-
-proc ::struct::tree::ldelete {var index {end {}}} {
-    upvar 1 $var list
-    if {$end == {}} {set end $index}
-    set list [lreplace [K $list [set list {}]] $index $end]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::struct {
-    # Put 'tree::tree' into the general structure namespace
-    # for pickup by the main management.
-
-    namespace import -force tree::tree_tcl
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tar/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tar/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded tar 0.4 [list source [file join $dir tar.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tar/tar.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tar/tar.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,308 +1,0 @@
-# tar.tcl --
-#
-#       Creating, extracting, and listing posix tar archives
-#
-# Copyright (c) 2004    Aaron Faupell <afaupell@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tar.tcl,v 1.11 2007/02/09 06:03:56 afaupell Exp $
-
-package provide tar 0.4
-
-namespace eval ::tar {}
-
-proc ::tar::parseOpts {acc opts} {
-    array set flags $acc
-    foreach {x y} $acc {upvar $x $x}
-    
-    set len [llength $opts]
-    set i 0
-    while {$i < $len} {
-        set name [string trimleft [lindex $opts $i] -]
-        if {![info exists flags($name)]} {return -code error "unknown option \"$name\""}
-        if {$flags($name) == 1} {
-            set $name [lindex $opts [expr {$i + 1}]]
-            incr i $flags($name)
-        } elseif {$flags($name) > 1} {
-            set $name [lrange $opts [expr {$i + 1}] [expr {$i + $flags($name)}]]
-            incr i $flags($name)
-        } else {
-            set $name 1
-        }
-        incr i
-    }
-}
-
-proc ::tar::pad {size} {
-    set pad [expr {512 - ($size % 512)}]
-    if {$pad == 512} {return 0}
-    return $pad
-}
-
-proc ::tar::readHeader {data} {
-    binary scan $data a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155 \
-                      name mode uid gid size mtime cksum type \
-                      linkname magic version uname gname devmajor devminor prefix
-                               
-    foreach x {name mode type linkname magic uname gname prefix mode uid gid size mtime cksum version devmajor devminor} {
-        set $x [string trim [set $x] "\x00"]
-    }
-    set mode [string trim $mode " \x00"]
-    foreach x {uid gid size mtime cksum version devmajor devminor} {
-        set $x [format %d 0[string trim [set $x] " \x00"]]
-    }
-
-    return [list name $name mode $mode uid $uid gid $gid size $size mtime $mtime \
-                 cksum $cksum type $type linkname $linkname magic $magic \
-                 version $version uname $uname gname $gname devmajor $devmajor \
-                 devminor $devminor prefix $prefix]
-}
-
-proc ::tar::contents {file} {
-    set fh [::open $file]
-    while {![eof $fh]} {
-        array set header [readHeader [read $fh 512]]
-        if {$header(name) == ""} break
-        lappend ret $header(prefix)$header(name)
-        seek $fh [expr {$header(size) + [pad $header(size)]}] current
-    }
-    close $fh
-    return $ret
-}
-
-proc ::tar::stat {tar {file {}}} {
-    set fh [::open $tar]
-    while {![eof $fh]} {
-        array set header [readHeader [read $fh 512]]
-        if {$header(name) == ""} break
-        seek $fh [expr {$header(size) + [pad $header(size)]}] current
-        if {$file != "" && "$header(prefix)$header(name)" != $file} {continue}
-        set header(type) [string map {0 file 5 directory 3 characterSpecial 4 blockSpecial 6 fifo 2 link} $header(type)]
-        set header(mode) [string range $header(mode) 2 end]
-        lappend ret $header(prefix)$header(name) [list mode $header(mode) uid $header(uid) gid $header(gid) \
-                    size $header(size) mtime $header(mtime) type $header(type) linkname $header(linkname) \
-                    uname $header(uname) gname $header(gname) devmajor $header(devmajor) devminor $header(devminor)]
-    }
-    close $fh
-    return $ret
-}
-
-proc ::tar::get {tar file} {
-    set fh [::open $tar]
-    fconfigure $fh -encoding binary -translation lf -eofchar {}
-    while {![eof $fh]} {
-        array set header [readHeader [read $fh 512]]
-        if {$header(name) == ""} break
-        set name [string trimleft $header(prefix)$header(name) /]
-        if {$name == $file} {
-            set file [read $fh $header(size)]
-            close $fh
-            return $file
-        }
-        seek $fh [expr {$header(size) + [pad $header(size)]}] current
-    }
-    close $fh
-    return {}
-}
-
-proc ::tar::untar {tar args} {
-    set nooverwrite 0
-    set data 0
-    set nomtime 0
-    set noperms 0
-    parseOpts {dir 1 file 1 glob 1 nooverwrite 0 nomtime 0 noperms 0} $args
-    if {![info exists dir]} {set dir [pwd]}
-    set pattern *
-    if {[info exists file]} {
-        set pattern [string map {* \\* ? \\? \\ \\\\ \[ \\\[ \] \\\]} $file]
-    } elseif {[info exists glob]} {
-        set pattern $glob
-    }
-
-    set ret {}
-    set fh [::open $tar]
-    fconfigure $fh -encoding binary -translation lf -eofchar {}
-    while {![eof $fh]} {
-        array set header [readHeader [read $fh 512]]
-        if {$header(name) == ""} break
-        set name [string trimleft $header(prefix)$header(name) /]
-        if {![string match $pattern $name] || ($nooverwrite && [file exists $name])} {
-            seek $fh [expr {$header(size) + [pad $header(size)]}] current
-            continue
-        }
-
-        set name [file join $dir $name]
-        if {![file isdirectory [file dirname $name]]} {
-            file mkdir [file dirname $name]
-            lappend ret [file dirname $name] {}
-        }
-        if {[string match {[0346]} $header(type)]} {
-            set new [::open $name w+]
-            fconfigure $new -encoding binary -translation lf -eofchar {}
-            fcopy $fh $new -size $header(size)
-            close $new
-            lappend ret $name $header(size)
-        } elseif {$header(type) == 5} {
-            file mkdir $name
-            lappend ret $name {}
-        } elseif {[string match {[12]} $header(type)] && $::tcl_platform(platform) == "unix"} {
-            catch {file delete $name}
-            if {![catch {file link [string map {1 -hard 2 -symbolic} $header(type)] $name $header(linkname)}]} {
-                lappend ret $name {}
-            }
-        }
-        seek $fh [pad $header(size)] current
-        if {![file exists $name]} continue
-
-        if {$::tcl_platform(platform) == "unix"} {
-            if {!$noperms} {
-                catch {file attributes $name -permissions [string range $header(mode) 2 end]}
-            }
-            catch {file attributes $name -owner $header(uid) -group $header(gid)}
-            catch {file attributes $name -owner $header(uname) -group $header(gname)}
-        }
-        if {!$nomtime} {
-            file mtime $name $header(mtime)
-        }
-    }
-    close $fh
-    return $ret
-}
-
-proc ::tar::createHeader {name followlinks} {
-    foreach x {linkname uname gname prefix devmajor devminor} {set $x ""}
-    
-    if {$followlinks} {
-        file stat $name stat
-    } else {
-        file lstat $name stat
-    }
-    
-    set type [string map {file 0 directory 5 characterSpecial 3 blockSpecial 4 fifo 6 link 2 socket A} $stat(type)]
-    set gid [format %o $stat(gid)]
-    set uid [format %o $stat(uid)]
-    set mtime [format %o $stat(mtime)]
-    
-    if {$::tcl_platform(platform) == "unix"} {
-        set uname [file attributes $name -owner]
-        set gname [file attributes $name -group]
-        set mode 1[file attributes $name -permissions]
-        if {$stat(type) == "link"} {set linkname [file link $name]}
-    } else {
-        set mode 100644
-        if {$stat(type) == "directory"} {set mode 100755}
-    }
-    
-    set size 0
-    if {$stat(type) == "file"} {
-        set size [format %o $stat(size)]
-    }
-    
-    set name [string trimleft $name /]
-    if {[string length $name] > 255} {
-        return -code error "path name over 255 chars"
-    } elseif {[string length $name] > 100} {
-        set prefix [string range $name 0 end-100]
-        set name [string range $name end-99 end]
-    }
-
-    set header [binary format a100A8A8A8A12A12A8a1a100A6a2a32a32a8a8a155a12 \
-                              $name $mode\x00 $uid\x00 $gid\x00 $size\x00 $mtime\x00 {} $type \
-                              $linkname ustar\x00 00 $uname $gname $devmajor $devminor $prefix {}]
-
-    binary scan $header c* tmp
-    set cksum 0
-    foreach x $tmp {incr cksum $x}
-
-    return [string replace $header 148 155 [binary format A8 [format %o $cksum]\x00]]
-}
-
-proc ::tar::recurseDirs {files followlinks} {
-    foreach x $files {
-        if {[file isdirectory $x] && ([file type $x] != "link" || $followlinks)} {
-            if {[set more [glob -dir $x -nocomplain *]] != ""} {
-                eval lappend files [recurseDirs $more $followlinks]
-            } else {
-                lappend files $x
-            }
-        }
-    }
-    return $files
-}
-
-proc ::tar::writefile {in out followlinks} {
-     puts -nonewline $out [createHeader $in $followlinks]
-     set size 0
-     if {[file type $in] == "file" || ($followlinks && [file type $in] == "link")} {
-         set in [::open $in]
-         fconfigure $in -encoding binary -translation lf -eofchar {}
-         set size [fcopy $in $out]
-         close $in
-     }
-     puts -nonewline $out [string repeat \x00 [pad $size]]
-}
-
-proc ::tar::create {tar files args} {
-    set dereference 0
-    parseOpts {dereference 0} $args
-    
-    set fh [::open $tar w+]
-    fconfigure $fh -encoding binary -translation lf -eofchar {}
-    foreach x [recurseDirs $files $dereference] {
-        writefile $x $fh $dereference
-    }
-    puts -nonewline $fh [string repeat \x00 1024]
-
-    close $fh
-    return $tar
-}
-
-proc ::tar::add {tar files args} {
-    set dereference 0
-    parseOpts {dereference 0} $args
-    
-    set fh [::open $tar r+]
-    fconfigure $fh -encoding binary -translation lf -eofchar {}
-    seek $fh -1024 end
-
-    foreach x [recurseDirs $files $dereference] {
-        writefile $x $fh $dereference
-    }
-    puts -nonewline $fh [string repeat \x00 1024]
-
-    close $fh
-    return $tar
-}
-
-proc ::tar::remove {tar files} {
-    set n 0
-    while {[file exists $tar$n.tmp]} {incr n}
-    set tfh [::open $tar$n.tmp w]
-    set fh [::open $tar r]
-
-    fconfigure $fh  -encoding binary -translation lf -eofchar {}
-    fconfigure $tfh -encoding binary -translation lf -eofchar {}
-
-    while {![eof $fh]} {
-        array set header [readHeader [read $fh 512]]
-        if {$header(name) == ""} {
-            puts -nonewline $tfh [string repeat \x00 1024]
-            break
-        }
-        set name $header(prefix)$header(name)
-        set len [expr {$header(size) + [pad $header(size)]}]
-        if {[lsearch $files $name] > -1} {
-            seek $fh $len current
-        } else {
-            seek $fh -512 current
-            fcopy $fh $tfh -size [expr {$len + 512}]
-        }
-    }
-
-    close $fh
-    close $tfh
-
-    file rename -force $tar$n.tmp $tar
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,56 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI
-## Generic commands to define commands for code sequences.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::term::ansi::code {}
-
-# ### ### ### ######### ######### #########
-## API. Escape clauses, plain and bracket
-##      Used by 'define'd commands.
-
-proc ::term::ansi::code::esc  {str} {return \033${str}}
-proc ::term::ansi::code::escb {str} {esc    \[${str}}
-
-# ### ### ### ######### ######### #########
-## API. Define command for named control code, or constant.
-##      (Simple definitions without arguments)
-
-proc ::term::ansi::code::define {name escape code} {
-    proc [Qualified $name] {} [list ::term::ansi::code::$escape $code]
-}
-
-proc ::term::ansi::code::const {name code} {
-    proc [Qualified $name] {} [list return $code]
-}
-
-# ### ### ### ######### ######### #########
-## Internal helper to construct fully-qualified names.
-
-proc ::term::ansi::code::Qualified {name} {
-    if {![string match "::*" $name]} {
-        # Get the caller's namespace; append :: if it is not the
-	# global namespace, for separation from the actual name.
-        set ns [uplevel 2 [list namespace current]]
-        if {![string equal "::" $ns]} {append ns "::"}
-        set name "$ns$name"
-    }
-    return $name
-}
-
-# ### ### ### ######### ######### #########
-
-namespace eval ::term::ansi::code {
-    namespace export esc escb define const
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::code 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/attr.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/attr.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,108 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI - Attribute codes
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require  term::ansi::code ; # Constants
-
-namespace eval ::term::ansi::code::attr {}
-
-# ### ### ### ######### ######### #########
-## API. Symbolic names.
-
-proc ::term::ansi::code::attr::names {} {
-    variable attr
-    return  $attr
-}
-
-proc ::term::ansi::code::attr::import {{ns attr} args} {
-    if {![llength $args]} {set args *}
-    set args ::term::ansi::code::attr::[join $args " ::term::ansi::code::attr::"]
-    uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal - Setup
-
-proc ::term::ansi::code::attr::DEF {name value} {
-    variable  attr
-    const            $name $value
-    lappend   attr   $name
-    namespace export $name
-    return
-}
-
-proc ::term::ansi::code::attr::INIT {} {
-    # ### ### ### ######### ######### #########
-    ##
-
-    # Colors. Foreground <=> Text
-    DEF	fgblack   30	; # Black  
-    DEF	fgred     31	; # Red    
-    DEF	fggreen   32	; # Green  
-    DEF	fgyellow  33	; # Yellow 
-    DEF	fgblue    34	; # Blue   
-    DEF	fgmagenta 35	; # Magenta
-    DEF	fgcyan    36	; # Cyan   
-    DEF	fgwhite   37	; # White  
-    DEF	fgdefault 39    ; # Default (Black)
-
-    # Colors. Background.
-    DEF	bgblack   40	; # Black  
-    DEF	bgred     41	; # Red    
-    DEF	bggreen   42	; # Green  
-    DEF	bgyellow  43	; # Yellow 
-    DEF	bgblue    44	; # Blue   
-    DEF	bgmagenta 45	; # Magenta
-    DEF	bgcyan    46	; # Cyan   
-    DEF	bgwhite   47	; # White  
-    DEF	bgdefault 49    ; # Default (Transparent)
-
-    # Non-color attributes. Activation.
-    DEF	bold      1	; # Bold  
-    DEF	dim       2	; # Dim
-    DEF	italic    3     ; # Italics      
-    DEF	underline 4	; # Underscore   
-    DEF	blink     5	; # Blink
-    DEF	revers    7	; # Reverse      
-    DEF	hidden    8	; # Hidden
-    DEF	strike    9     ; # StrikeThrough
-
-    # Non-color attributes. Deactivation.
-    DEF	nobold      22	; # Bold  
-    DEF	nodim       __	; # Dim
-    DEF	noitalic    23  ; # Italics      
-    DEF	nounderline 24	; # Underscore   
-    DEF	noblink     25	; # Blink
-    DEF	norevers    27	; # Reverse      
-    DEF	nohidden    28	; # Hidden
-    DEF	nostrike    29  ; # StrikeThrough
-
-    # Remainder
-    DEF	reset       0   ; # Reset
-
-    ##
-    # ### ### ### ######### ######### #########
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Data structures.
-
-namespace eval ::term::ansi::code::attr {
-    namespace import ::term::ansi::code::const
-    variable attr {}
-}
-
-::term::ansi::code::attr::INIT
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::code::attr 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/ctrl.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/ctrl.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,269 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI - Control codes
-
-## References
-# [0] Google: ansi terminal control
-# [1] http://vt100.net/docs/vt100-ug/chapter3.html
-# [2] http://www.termsys.demon.co.uk/vtansi.htm
-# [3] http://rrbrandt.dyndns.org:60000/docs/tut/redes/ansi.php
-# [4] http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html
-# [5] http://www.ecma-international.org/publications/standards/Ecma-048.htm
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require  term::ansi::code
-package require  term::ansi::code::attr
-
-namespace eval ::term::ansi::code::ctrl {}
-
-# ### ### ### ######### ######### #########
-## API. Symbolic names.
-
-proc ::term::ansi::code::ctrl::names {} {
-    variable ctrl
-    return  $ctrl
-}
-
-proc ::term::ansi::code::ctrl::import {{ns ctrl} args} {
-    if {![llength $args]} {set args *}
-    set args ::term::ansi::code::ctrl::[join $args " ::term::ansi::code::ctrl::"]
-    uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-
-## TODO = symbolic key codes for skd.
-
-# ### ### ### ######### ######### #########
-## Internal - Setup
-
-proc ::term::ansi::code::ctrl::DEF {name esc value} {
-    variable  ctrl
-    define           $name $esc $value
-    lappend   ctrl   $name
-    namespace export $name
-    return
-}
-
-proc ::term::ansi::code::ctrl::DEFC {name args script} {
-    variable  ctrl
-    proc             $name $args $script
-    lappend   ctrl   $name
-    namespace export $name
-    return
-}
-
-proc ::term::ansi::code::ctrl::INIT {} {
-    # ### ### ### ######### ######### #########
-    ##
-
-    # Erasing
-
-    DEF	eeol    escb K  ; # Erase (to) End Of Line
-    DEF	esol    escb 1K ; # Erase (to) Start Of Line
-    DEF	el      escb 2K ; # Erase (current) Line
-    DEF	ed      escb J  ; # Erase Down (to bottom)
-    DEF	eu      escb 1J ; # Erase Up (to top)
-    DEF	es      escb 2J ; # Erase Screen
-
-    # Scrolling
-
-    DEF	sd      esc D    ; # Scroll Down
-    DEF	su      esc M    ; # Scroll Up
-
-    # Cursor Handling
-
-    DEF	ch      escb H  ; # Cursor Home
-    DEF	sc      escb s  ; # Save Cursor
-    DEF	rc      escb u  ; # Restore Cursor (Unsave)
-    DEF	sca     esc  7  ; # Save Cursor + Attributes
-    DEF	rca     esc  8  ; # Restore Cursor + Attributes
-
-    # Tabbing
-
-    DEF	st      esc  H  ; # Set Tab (@ current position)
-    DEF	ct      escb g  ; # Clear Tab (@ current position)
-    DEF	cat     escb 3g ; # Clear All Tabs
-
-    # Device Introspection
-
-    DEF	qdc     escb c  ; # Query Device Code
-    DEF	qds     escb 5n ; # Query Device Status
-    DEF	qcp     escb 6n ; # Query Cursor Position
-    DEF	rd      esc  c  ; # Reset Device
-
-    # Linewrap on/off
-
-    DEF	elw     escb 7h ; # Enable Line Wrap
-    DEF	dlw     escb 7l ; # Disable Line Wrap
-
-    # Graphics Mode (aka use alternate font on/off)
-
-    DEF eg      esc F   ; # Enter Graphics Mode
-    DEF lg      esc G   ; # Exit Graphics Mode
-
-    ##
-    # ### ### ### ######### ######### #########
-
-    # ### ### ### ######### ######### #########
-    ## Complex, parameterized codes
-
-    # Select Character Set
-    # Choose which char set is used for default and
-    # alternate font. This does not change whether
-    # default or alternate font are used
-
-    DEFC scs0 {tag} {esc  ($tag}  ; # Set default character set
-    DEFC scs1 {tag} {esc  )$tag}  ; # Set alternate character set
-
-    # tags in A : United Kingdom Set
-    #         B : ASCII Set
-    #         0 : Special Graphics
-    #         1 : Alternate Character ROM Standard Character Set
-    #         2 : Alternate Character ROM Special Graphics
-
-    # Set Display Attributes
-
-    DEFC sda {args} {escb [join $args ";"]m}
-
-    # Force Cursor Position (aka Go To)
-
-    DEFC fcp {r c}  {escb ${r}\;${c}f}
-
-    # Cursor Up, Down, Forward, Backward
-
-    DEFC cu {{n 1}} {escb [expr {$n == 1 ? "A" : "${n}A"}]}
-    DEFC cd {{n 1}} {escb [expr {$n == 1 ? "B" : "${n}B"}]}
-    DEFC cf {{n 1}} {escb [expr {$n == 1 ? "C" : "${n}C"}]}
-    DEFC cb {{n 1}} {escb [expr {$n == 1 ? "D" : "${n}D"}]}
-
-    # Scroll Screen (entire display, or between rows start end, inclusive).
-
-    DEFC ss {args} {
-	if {[llength $args] == 0} {return [escb r]}
-	if {[llength $args] == 2} {foreach {s e} $args break ; return [escb ${s};${e}r]}
-	return -code error "wrong\#args"
-    }
-
-    # Set Key Definition
-
-    DEFC skd {code str} {escb "${code};\"${str}\"p"}
-
-    # Terminal title
-
-    DEFC title {str} {esc "\]0;${str}\007"}
-
-    # Switch to and from character/box graphics.
-
-    DEFC gron  {} {return \016}
-    DEFC groff {} {return \017}
-
-    # Character graphics, box symbols
-    # - 4 corners, 4 t-junctions,
-    #   one 4-way junction, 2 lines
-
-    DEFC tlc   {} {return [gron]l[groff]} ; # Top    Left  Corner
-    DEFC trc   {} {return [gron]k[groff]} ; # Top    Right Corner
-    DEFC brc   {} {return [gron]j[groff]} ; # Bottom Right Corner
-    DEFC blc   {} {return [gron]m[groff]} ; # Bottom Left  Corner
-
-    DEFC ltj   {} {return [gron]t[groff]} ; # Left   T Junction
-    DEFC ttj   {} {return [gron]w[groff]} ; # Top    T Junction
-    DEFC rtj   {} {return [gron]u[groff]} ; # Right  T Junction
-    DEFC btj   {} {return [gron]v[groff]} ; # Bottom T Junction
-
-    DEFC fwj   {} {return [gron]n[groff]} ; # Four-Way Junction
-
-    DEFC hl    {} {return [gron]q[groff]} ; # Horizontal Line
-    DEFC vl    {} {return [gron]x[groff]} ; # Vertical   Line
-
-    # Optimize character graphics. The generator commands above create
-    # way to many superfluous commands shifting into and out of the
-    # graphics mode. The command below removes all shifts which are
-    # not needed. To this end it also knows which characters will look
-    # the same in both modes, to handle strings created outside this
-    # package.
-
-    DEFC groptim {string} {
-	variable grforw
-	variable grback
-	while {![string equal $string [set new [string map \
-		"\017\016 {} \016\017 {}" [string map \
-		$grback [string map \
-		$grforw $string]]]]]} {
-	    set string $new
-	}
-	return $string
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-
-    # ### ### ### ######### ######### #########
-    ## Higher level operations
-
-    # Clear screen <=> CursorHome + EraseDown
-    # Init (Fonts): Default ASCII, Alternate Graphics
-    # Show a block of text at a specific location.
-
-    DEFC clear {} {return [ch][ed]}
-    DEFC init  {} {return [scs0 B][scs1 0]}
-
-    DEFC showat {r c text} {
-	if {![string length $text]} {return {}}
-	return [fcp $r $c][sca][join \
-		[split $text \n] \
-		[rca][cd][sca]][rca][cd]
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-
-    # ### ### ### ######### ######### #########
-    ## Attribute control (single attributes)
-
-    foreach a [::term::ansi::code::attr::names] {
-	DEF sda_$a escb "[::term::ansi::code::attr::$a]m"
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Data structures.
-
-namespace eval ::term::ansi::code::ctrl {
-    namespace import ::term::ansi::code::define
-    namespace import ::term::ansi::code::esc
-    namespace import ::term::ansi::code::escb
-
-    variable grforw
-    variable grback
-    variable _
-    foreach _ {
-	! \" # $ % & ' ( ) * + , - . /
-	0 1 2 3 4 5 6 7 8 9 : ; < = >
-	? @ A B C D E F G H I J K L M
-	N O P Q R S T U V W X Y Z [ \\ 
-	] ^
-    } {
-	lappend grforw \016$_ $_\016
-	lappend grback $_\017 \017$_
-    }
-    unset _
-}
-
-::term::ansi::code::ctrl::INIT
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::code::ctrl 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/macros.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/code/macros.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,93 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI - Higher level macros
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require textutil::repeat
-package require textutil::tabify
-package require term::ansi::code::ctrl
-
-namespace eval ::term::ansi::code::macros {}
-
-# ### ### ### ######### ######### #########
-## API. Symbolic names.
-
-proc ::term::ansi::code::macros::import {{ns macros} args} {
-    if {![llength $args]} {set args *}
-    set args ::term::ansi::code::macros::[join $args " ::term::ansi::code::macros::"]
-    uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Higher level operations
-
-# Format a menu / framed block of text
-
-proc ::term::ansi::code::macros::menu {menu} {
-    # Menu = dict (label => char)
-    array set _ {}
-    set shift 0
-    foreach {label c} $menu {
-	if {[string first $c $label] < 0} {
-	    set shift 1
-	    break
-	}
-    }
-    set max 0
-    foreach {label c} $menu {
-	set pos [string first $c $label]
-	if {$shift || ($pos < 0)} {
-	    set xlabel "$c $label"
-	    set pos 0
-	} else {
-	    set xlabel $label
-	}
-	set len [string length $xlabel]
-	if {$len > $max} {set max $len}
-	set _($label) " [string replace $xlabel $pos $pos \
-		[cd::sda_fgred][cd::sda_bold][string index $xlabel $pos][cd::sda_reset]]"
-    }
-
-    append ms [cd::tlc][textutil::repeat::strRepeat [cd::hl] $max][cd::trc]\n
-    foreach {l c} $menu {append ms $_($l)\n}
-    append ms [cd::blc][textutil::repeat::strRepeat [cd::hl] $max][cd::brc]
-
-    return [cd::groptim $ms]
-}
-
-proc ::term::ansi::code::macros::frame {string} {
-    set lines [split [textutil::tabify::untabify2 $string] \n]
-    set max 0
-    foreach l $lines {
-	if {[set len [string length $l]] > $max} {set max $len}
-    }
-    append fs [cd::tlc][textutil::repeat::strRepeat [cd::hl] $max][cd::trc]\n
-    foreach l $lines {
-	append fs [cd::vl]${l}[textutil::repeat::strRepeat " " [expr {$max-[string length $l]}]][cd::vl]\n
-    }
-    append fs [cd::blc][textutil::repeat::strRepeat [cd::hl] $max][cd::brc]
-    return [cd::groptim $fs]
-}
-
-##
-# ### ### ### ######### ######### #########
-
-# ### ### ### ######### ######### #########
-## Data structures.
-
-namespace eval ::term::ansi::code::macros {
-    term::ansi::code::ctrl::import cd
-
-    namespace export menu frame
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::code::macros 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/ctrlunix.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/ctrlunix.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,86 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI - Control operations
-## (Unix specific implementation).
-
-## This was originally taken from page 11820 (Pure Tcl Console Editor)
-## of the Tcler's Wiki, however page 14693 (Reading a single character
-## ...) is the same in a more self-contained manner.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::term::ansi::ctrl::unix {}
-
-# ### ### ### ######### ######### #########
-## Make command easily available
-
-proc ::term::ansi::ctrl::unix::import {{ns ctrl} args} {
-    if {![llength $args]} {set args *}
-    set args ::term::ansi::ctrl::unix::[join $args " ::term::ansi::ctrl::unix::"]
-    uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## API
-
-# We use the <@stdin because stty works out what terminal to work with
-# using standard input on some platforms. On others it prefers
-# /dev/tty instead, but putting in the redirection makes the code more
-# portable
-
-proc ::term::ansi::ctrl::unix::raw {} {
-    variable stty
-    exec $stty raw -echo <@stdin
-    return
-}
-
-proc ::term::ansi::ctrl::unix::cooked {} {
-    variable stty
-    exec $stty -raw echo <@stdin
-    return
-}
-
-proc ::term::ansi::ctrl::unix::columns {} {
-    variable tput
-    return [exec $tput cols <@stdin]
-}
-
-proc ::term::ansi::ctrl::unix::rows {} {
-    variable tput
-    return [exec $tput lines <@stdin]
-}
-
-# ### ### ### ######### ######### #########
-## Package setup
-
-proc ::term::ansi::ctrl::unix::INIT {} {
-    variable tput [auto_execok tput]
-    variable stty [auto_execok stty]
-
-    if {($tput eq "") || ($stty eq "")} {
-	return -code error \
-		"The external requirements for the \
-		use of this package (tput, stty in \
-		\$PATH) are not met."
-    }
-    return
-}
-
-namespace eval ::term::ansi::ctrl::unix {
-    variable tput {}
-    variable stty {}
-
-    namespace export columns rows raw cooked
-}
-
-::term::ansi::ctrl::unix::INIT
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::ctrl::unix 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/send.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ansi/send.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,85 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - ANSI - Control codes
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require  term::send
-package require  term::ansi::code::ctrl
-
-namespace eval ::term::ansi::send {}
-
-# ### ### ### ######### ######### #########
-## Make command easily available
-
-proc ::term::ansi::send::import {{ns send} args} {
-    if {![llength $args]} {set args *}
-    set args ::term::ansi::send::[join $args " ::term::ansi::send::"]
-    uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal - Setup.
-
-proc ::term::ansi::send::ChName {n} {
-    if {![string match *-* $n]} {
-	return ${n}ch
-    }
-    set nl   [split $n -]
-    set stem [lindex       $nl 0]
-    set sfx  [join [lrange $nl 1 end] -]
-    return ${stem}ch-$sfx
-}
-
-proc ::term::ansi::send::Args {n -> arv achv avv} {
-    upvar 1 $arv a $achv ach $avv av
-    set code ::term::ansi::code::ctrl::$n
-    set a   [info args $code]
-    set ach [linsert $a 0 ch]
-    set av  [expr {
-	[llength $a]
-	? " \$[join $a " \$"]"
-	: $a
-    }]
-    return $code
-}
-
-proc ::term::ansi::send::INIT {} {
-    foreach n [::term::ansi::code::ctrl::names] {
-	set nch  [ChName $n]
-	set code [Args $n -> a ach av]
-
-	if {[string equal [lindex $a end] args]} {
-	    # An args argument requires more care, and an eval
-	    set av [lrange $av 0 end-1]
-	    if {![string equal $av ""]} {set av " $av"}
-	    set gen "eval \[linsert \$args 0 $code$av\]"
-
-	    #8.5: set gen "$code$av \{expand\}\$args"
-	} else {
-	    set gen $code$av
-	}
-
-	proc $n   $a   "wr        \[$gen\]" ; namespace export $n
-	proc $nch $ach "wrch \$ch \[$gen\]" ; namespace export $nch
-    }
-    return
-}
-
-namespace eval ::term::ansi::send {
-    namespace import ::term::send::wr
-    namespace import ::term::send::wrch
-    namespace export wr wrch
-}
-
-::term::ansi::send::INIT
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::ansi::send 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/bind.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/bind.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,132 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - string -> action mappings
-## (bind objects). For use with 'receive listen'.
-## In essence a DFA with tree structure.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require  snit
-package require  term::receive
-namespace eval ::term::receive::bind {}
-
-# ### ### ### ######### ######### #########
-
-snit::type ::term::receive::bind {
-
-    constructor {{dict {}}} {
-	foreach {str cmd} $dict {Register $str $cmd}
-	return
-    }
-
-    method map {str cmd} {
-	Register $str $cmd
-	return
-    }
-
-    method default {cmd} {
-	set default $cmd
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    method listen {{chan stdin}} {
-	#parray dfa
-	::term::receive::listen $self $chan
-	return
-    }
-
-    method unlisten {{chan stdin}} {
-	::term::receive::unlisten $chan
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    variable default {}
-    variable state   {}
-
-    method reset {} {
-	set state {}
-	return
-    }
-
-    method next {c} {Next $c ; return}
-    method process {str} {
-	foreach c [split $str {}] {Next $c}
-	return
-    }
-
-    method eof {} {Eof ; return}
-
-    proc Next {c} {
-	upvar 1 dfa dfa state state default default
-	set key [list $state $c]
-
-	#puts -nonewline stderr "('$state' x '$c')"
-
-	if {![info exists dfa($key)]} {
-	    # Unknown sequence. Reset. Restart.
-	    # Run it through the default action. 
-
-	    if {$default ne ""} {
-		uplevel #0 [linsert $default end $state$c]
-	    }
-
-	    #puts stderr =\ RESET
-	    set state {}
-	} else {
-	    foreach {what detail} $dfa($key) break
-	    #puts -nonewline stderr "= $what '$detail'"
-	    if {$what eq "t"} {
-		# Incomplete sequence. Next state.
-		set state $detail
-		#puts stderr " goto ('$state')"
-	    } elseif {$what eq "a"} {
-		# Action, then reset.
-		set state {}
-		#puts stderr " run ($detail)"
-		uplevel #0 [linsert $detail end $state$c]
-	    } else {
-		return -code error \
-			"Internal error. Bad DFA."
-	    }
-	}
-	return
-    }
-
-    proc Eof {} {}
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    proc Register {str cmd} {
-	upvar 1 dfa dfa
-	set prefix {}
-	set last   {{} {}}
-	foreach c [split $str {}] {
-	    set key [list $prefix $c]
-	    set next $prefix$c
-	    set dfa($key) [list t $next]
-	    set last $key
-	    set prefix $next
-	}
-	set dfa($last) [list a $cmd]
-    }
-    variable dfa -array {}
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::receive::bind 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/imenu.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/imenu.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,202 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - string -> action mappings
-## (menu objects). For use with 'receive listen'.
-## In essence a DFA with tree structure.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-package require textutil::repeat
-package require textutil::tabify
-package require term::ansi::send
-package require term::receive::bind
-package require term::ansi::code::ctrl
-
-namespace eval ::term::receive::menu {}
-
-# ### ### ### ######### ######### #########
-
-snit::type ::term::interact::menu {
-
-    option -in          -default stdin
-    option -out         -default stdout
-    option -column      -default 0
-    option -line        -default 0
-    option -height      -default 25
-    option -actions     -default {}
-    option -hilitleft   -default 0
-    option -hilitright  -default end
-    option -framed      -default 0 -readonly 1
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    constructor {dict args} {
-	$self configurelist $args
-	Save $dict
-
-	install bind using ::term::receive::bind \
-	    ${selfns}::bind $options(-actions)
-
-	$bind map [cd::cu] [mymethod Up]
-	$bind map [cd::cd] [mymethod Down]
-	$bind map \n       [mymethod Select]
-	#$bind default [mymethod DEF]
-
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    method interact {} {
-	Show
-	$bind listen   $options(-in)
-	vwait [myvar done]
-	$bind unlisten $options(-in)
-	return $map($done)
-    }
-
-    method done  {} {set done $at ; return}
-    method clear {} {Clear        ; return}
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    component bind
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    variable map -array {}
-    variable header
-    variable labels
-    variable footer
-    variable empty
-
-    proc Save {dict} {
-	upvar 1 header header labels labels footer footer
-	upvar 1 empty empty at at map map top top
-	upvar 1 options(-height) height
-
-	set max 0
-	foreach {l code} $dict {
-	    if {[set len [string length $l]] > $max} {set max $len}
-	}
-
-	set header [cd::groptim [cd::tlc][textutil::repeat::strRepeat [cd::hl] $max][cd::trc]]
-	set footer [cd::groptim [cd::blc][textutil::repeat::strRepeat [cd::hl] $max][cd::brc]]
-
-	set labels {}
-	set at 0 
-	foreach {l code} $dict {
-	    set map($at) $code
-	    lappend labels ${l}[textutil::repeat::strRepeat " " [expr {$max-[string length $l]}]]
-	    incr at
-	}
-
-	set h $height
-	if {$h > [llength $labels]} {set h [llength $labels]}
-
-	set eline "  [textutil::repeat::strRepeat {  } $max]"
-	set empty $eline
-	for {set i 0} {$i <= $h} {incr i} {
-	    append empty \n$eline
-	}
-
-	set at  0
-	set top 0
-	return
-    }
-
-    variable top  0
-    variable at   0
-    variable done .
-
-    proc Show {} {
-	upvar 1 header header labels labels footer footer at at
-	upvar 1 options(-in)     in  options(-column) col top top
-	upvar 1 options(-out)    out options(-line)   row
-	upvar 1 options(-height) height options(-framed) framed
-	upvar 1 options(-hilitleft)  left
-	upvar 1 options(-hilitright) right
-
-	set bot [expr {$top + $height - 1}]
-	set fr  [expr {$framed ? [cd::vl] : { }}]
-
-	set text $header\n
-	set i $top
-	foreach l [lrange $labels $top $bot] {
-	    append text $fr
-	    if {$i != $at} {
-		append text $l
-	    } else {
-		append text [string replace $l $left $right \
-			[cd::sda_revers][string range $l $left $right][cd::sda_reset]]
-	    }
-	    append text $fr \n
-	    incr i
-	}
-	append text $footer
-
-	vt::wrch $out [cd::showat $row $col $text]
-	return
-    }
-
-    proc Clear {} {
-	upvar 1 empty         empty options(-column) col
-	upvar 1 options(-out) out   options(-line)   row
-
-	vt::wrch $out [cd::showat $row $col $empty]
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    method Up {str} {
-	if {$at == 0} return
-	incr at -1
-	if {$at < $top} {incr top -1}
-	Show
-	return
-    }
-
-    method Down {str} {
-	upvar 0 options(-height) height
-	if {$at == ([llength $labels]-1)} return
-	incr at
-	set bot [expr {$top + $height - 1}]
-	if {$at > $bot} {incr top}
-	Show
-	return
-    }
-
-    method Select {str} {
-	$self done
-	return
-    }
-
-    method DEF {str} {
-	puts stderr "($str)"
-	exit
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::term::interact::menu {
-    term::ansi::code::ctrl::import cd
-    term::ansi::send::import       vt
-}
-
-package provide term::interact::menu 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/ipager.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/ipager.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,206 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - string -> action mappings
-## (pager objects). For use with 'receive listen'.
-## In essence a DFA with tree structure.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-package require textutil::repeat
-package require textutil::tabify
-package require term::ansi::send
-package require term::receive::bind
-package require term::ansi::code::ctrl
-
-namespace eval ::term::receive::pager {}
-
-# ### ### ### ######### ######### #########
-
-snit::type ::term::interact::pager {
-
-    option -in      -default stdin
-    option -out     -default stdout
-    option -column  -default 0
-    option -line    -default 0
-    option -height  -default 25
-    option -actions -default {}
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    constructor {str args} {
-	$self configurelist $args
-	Save $str
-
-	install bind using ::term::receive::bind \
-	    ${selfns}::bind $options(-actions)
-
-	$bind map [cd::cu] [mymethod Up]
-	$bind map [cd::cd] [mymethod Down]
-	$bind map \033\[5~ [mymethod PageUp]
-	$bind map \033\[6~ [mymethod PageDown]
-	$bind map \n       [mymethod Done]
-	#$bind default [mymethod DEF]
-
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    method interact {} {
-	Show
-	$bind listen   $options(-in)
-	set interacting 1
-	vwait [myvar done]
-	set interacting 0
-	$bind unlisten $options(-in)
-	return
-    }
-
-    method done  {} {set done . ; return}
-    method clear {} {Clear      ; return}
-
-    method text {str} {
-	if {$interacting} {Clear}
-	Save $str
-	if {$interacting} {Show}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    component bind
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    variable header
-    variable text
-    variable footer
-    variable empty
-
-    proc Save {str} {
-	upvar 1 header header text text footer footer maxline maxline
-	upvar 1 options(-height) height empty empty at at
-
-	set lines [split [textutil::tabify::untabify2 $str] \n]
-
-	set max 0
-	foreach l $lines {
-	    if {[set len [string length $l]] > $max} {set max $len}
-	}
-
-	set header [cd::groptim [cd::tlc][textutil::repeat::strRepeat [cd::hl] $max][cd::trc]]
-	set footer [cd::groptim [cd::blc][textutil::repeat::strRepeat [cd::hl] $max][cd::brc]]
-
-	set text {}
-	foreach l $lines {
-	    lappend text [cd::vl]${l}[textutil::repeat::strRepeat " " [expr {$max-[string length $l]}]][cd::vl]
-	}
-
-	set h $height
-	if {$h > [llength $text]} {set h [llength $text]}
-
-	set eline "  [textutil::repeat::strRepeat {  } $max]"
-	set empty $eline
-	for {set i 0} {$i <= $h} {incr i} {
-	    append empty \n$eline
-	}
-
-	set maxline [expr {[llength $text] - $height}]
-	if {$maxline < 0} {set maxline 0}
-	set at 0
-	return
-    }
-
-    variable interacting 0
-    variable at   0
-    variable maxline -1
-    variable done .
-
-    proc Show {} {
-	upvar 1 header header text text footer footer at at
-	upvar 1 options(-in)     in  options(-column) col
-	upvar 1 options(-out)    out options(-line)   row
-	upvar 1 options(-height) height
-
-	set to [expr {$at + $height -1}]
-
-	vt::wrch $out [cd::showat $row $col \
-			   $header\n[join [lrange $text $at $to] \n]\n$footer]
-	return
-    }
-
-    proc Clear {} {
-	upvar 1 empty         empty options(-column) col
-	upvar 1 options(-out) out   options(-line)   row
-
-	vt::wrch $out [cd::showat $row $col $empty]
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ##
-
-    method Up {str} {
-	if {$at == 0} return
-	incr at -1
-	Show
-	return
-    }
-
-    method Down {str} {
-	if {$at >= $maxline} return
-	incr at
-	Show
-	return
-    }
-
-    method PageUp {str} {
-	set newat [expr {$at - $options(-height) + 1}]
-	if {$newat < 0} {set newat 0}
-	if {$newat == $at} return
-	set at $newat
-	Show
-	return
-    }
-
-    method PageDown {str} {
-	set newat [expr {$at + $options(-height) - 1}]
-	if {$newat >= $maxline} {set newat $maxline}
-	if {$newat == $at} return
-	set at $newat
-	Show
-	return
-    }
-
-    method Done {str} {
-	$self done
-	return
-    }
-
-    method DEF {str} {
-	puts stderr "($str)"
-	exit
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-namespace eval ::term::interact::pager {
-    term::ansi::code::ctrl::import cd
-    term::ansi::send::import       vt
-}
-
-package provide term::interact::pager 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,13 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} return
-package ifneeded term                     0.1 [list source [file join $dir term.tcl]]
-package ifneeded term::ansi::code         0.1 [list source [file join $dir ansi/code.tcl]]
-package ifneeded term::ansi::code::attr   0.1 [list source [file join $dir ansi/code/attr.tcl]]
-package ifneeded term::ansi::code::ctrl   0.1 [list source [file join $dir ansi/code/ctrl.tcl]]
-package ifneeded term::ansi::code::macros 0.1 [list source [file join $dir ansi/code/macros.tcl]]
-package ifneeded term::ansi::ctrl::unix   0.1 [list source [file join $dir ansi/ctrlunix.tcl]]
-package ifneeded term::ansi::send         0.1 [list source [file join $dir ansi/send.tcl]]
-package ifneeded term::interact::menu     0.1 [list source [file join $dir imenu.tcl]]
-package ifneeded term::interact::pager    0.1 [list source [file join $dir ipager.tcl]]
-package ifneeded term::receive            0.1 [list source [file join $dir receive.tcl]]
-package ifneeded term::receive::bind      0.1 [list source [file join $dir bind.tcl]]
-package ifneeded term::send               0.1 [list source [file join $dir send.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/receive.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/receive.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,60 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - Generic receiver operations
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::term::receive {}
-
-# ### ### ### ######### ######### #########
-## API. Read character from specific channel,
-##      or default (stdin). Processing of
-##      character sequences.
-
-proc ::term::receive::getch {{chan stdin}} {
-    return [read $chan 1]
-}
-
-proc ::term::receive::listen {cmd {chan stdin}} {
-    fconfigure $chan -blocking 0
-    fileevent  $chan readable \
-	    [list ::term::receive::Foreach $chan $cmd]
-    return
-}
-
-proc ::term::receive::unlisten {{chan stdin}} {
-    fileevent $chan readable {}
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internals
-
-proc ::term::receive::Foreach {chan cmd} {
-    set string [read $chan]
-    if {[string length $string]} {
-	#puts stderr "F($string)"
-	uplevel #0 [linsert $cmd end process $string]
-    }
-    if {[eof $chan]} {
-	close $chan
-	uplevel #0 [linsert $cmd end eof]
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization
-
-namespace eval ::term::receive {
-    namespace export getch listen
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::receive 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/send.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/send.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,34 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - Generic sender operations
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::term::send {}
-
-# ### ### ### ######### ######### #########
-## API. Write to channel, or default (stdout)
-
-proc ::term::send::wr {str} {
-    wrch stdout $str
-    return
-}
-
-proc ::term::send::wrch {ch str} {
-    puts -nonewline $ch $str
-    flush           $ch
-    return
-}
-
-namespace eval ::term::send {
-    namespace export wr wrch
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term::send 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/term/term.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/term/term.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,19 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## Terminal packages - Main :: Generic operations
-
-# Currently we have no generica at all. We make the package, but it
-# provides nothing for now.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-namespace eval ::term {}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide term 0.1
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/adjust.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/adjust.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,758 +1,0 @@
-# trim.tcl --
-#
-#	Various ways of trimming a string.
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2000      by Eric Melski <ericm@ajubasolutions.com>
-# Copyright (c) 2002-2004 by Johannes-Heinrich Vogeler <vogeler@users.sourceforge.net>
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: adjust.tcl,v 1.15 2006/04/21 04:42:27 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-package require textutil::repeat
-package require textutil::string
-
-namespace eval ::textutil::adjust {}
-
-# ### ### ### ######### ######### #########
-## API implementation
-
-namespace eval ::textutil::adjust {
-    namespace import -force ::textutil::repeat::strRepeat
-}
-
-proc ::textutil::adjust::adjust {text args} {
-    if {[string length [string trim $text]] == 0} {
-        return ""
-    }
-
-    Configure $args
-    Adjust text newtext
-
-    return $newtext
-}
-
-proc ::textutil::adjust::Configure {args} {
-    variable Justify      left
-    variable Length       72
-    variable FullLine     0
-    variable StrictLength 0
-    variable Hyphenate    0
-    variable HyphPatterns    ; # hyphenation patterns (TeX)
-
-    set args [ lindex $args 0 ]
-    foreach { option value } $args {
-	switch -exact -- $option {
-	    -full {
-		if { ![ string is boolean -strict $value ] } then {
-		    error "expected boolean but got \"$value\""
-		}
-		set FullLine [ string is true $value ]
-	    }
-	    -hyphenate {
-		# the word exceeding the length of line is tried to be
-		# hyphenated; if a word cannot be hyphenated to fit into
-		# the line processing stops! The length of the line should
-		# be set to a reasonable value!
-
-		if { ![ string is boolean -strict $value ] } then {
-		    error "expected boolean but got \"$value\""
-		}
-		set Hyphenate [string is true $value]
-		if { $Hyphenate && ![info exists HyphPatterns(_LOADED_)]} {
-		    error "hyphenation patterns not loaded!"
-		}
-	    }
-	    -justify {
-		set lovalue [ string tolower $value ]
-		switch -exact -- $lovalue {
-		    left -
-		    right -
-		    center -
-		    plain {
-			set Justify $lovalue
-		    }
-		    default {
-			error "bad value \"$value\": should be center, left, plain or right"
-		    }
-		}
-	    }
-	    -length {
-		if { ![ string is integer $value ] } then {
-		    error "expected positive integer but got \"$value\""
-		}
-		if { $value < 1 } then {
-		    error "expected positive integer but got \"$value\""
-		}
-		set Length $value
-	    }
-	    -strictlength {
-		# the word exceeding the length of line is moved to the
-		# next line without hyphenation; words longer than given
-		# line length are cut into smaller pieces
-
-		if { ![ string is boolean -strict $value ] } then {
-		    error "expected boolean but got \"$value\""
-		}
-		set StrictLength [ string is true $value ]
-	    }
-	    default {
-		error "bad option \"$option\": must be -full, -hyphenate, \
-			-justify, -length, or -strictlength"
-	    }
-	}
-    }
-
-    return ""
-}
-
-# ::textutil::adjust::Adjust
-#
-# History:
-#      rewritten on 2004-04-13 for bugfix tcllib-bugs-882402 (jhv)
-
-proc ::textutil::adjust::Adjust { varOrigName varNewName } {
-    variable Length
-    variable FullLine
-    variable StrictLength
-    variable Hyphenate
-
-    upvar $varOrigName orig
-    upvar $varNewName  text
-
-    set pos 0;                                   # Cursor after writing
-    set line ""
-    set text ""
-
-
-    if {!$FullLine} {
-	regsub -all -- "(\n)|(\t)"     $orig   " "  orig
-	regsub -all -- " +"            $orig  " "   orig
-	regsub -all -- "(^ *)|( *\$)"  $orig  ""    orig
-    }
-
-    set words [split $orig]
-    set numWords [llength $words]
-    set numline 0
-
-    for {set cnt 0} {$cnt < $numWords} {incr cnt} {
-
-	set w [lindex $words $cnt]
-	set wLen [string length $w]
-
-	# the word $w doesn't fit into the present line
-	# case #1: we try to hyphenate
-
-	if {$Hyphenate && ($pos+$wLen >= $Length)} {
-	    # Hyphenation instructions
-	    set w2 [textutil::adjust::Hyphenation $w]
-
-	    set iMax [llength $w2]
-	    if {$iMax == 1 && [string length $w] > $Length} {
-		# word cannot be hyphenated and exceeds linesize
-
-		error "Word \"$w2\" can\'t be hyphenated\
-			and exceeds linesize $Length!"
-	    } else {
-		# hyphenating of $w was successfull, but we have to look
-		# that every sylable would fit into the line
-
-		foreach x $w2 {
-		    if {[string length $x] >= $Length} {
-			error "Word \"$w\" can\'t be hyphenated\
-				to fit into linesize $Length!"
-		    }
-		}
-	    }
-
-	    for {set i 0; set w3 ""} {$i < $iMax} {incr i} {
-		set syl [lindex $w2 $i]
-		if {($pos+[string length " $w3$syl-"]) > $Length} {break}
-		append w3 $syl
-	    }
-	    for {set w4 ""} {$i < $iMax} {incr i} {
-		set syl [lindex $w2 $i]
-		append w4 $syl
-	    }
-
-	    if {[string length $w3] && [string length $w4]} {
-		# hyphenation was successfull: redefine
-		# list of words w => {"$w3-" "$w4"}
-
-		set x [lreplace $words $cnt $cnt "$w4"]
-		set words [linsert $x $cnt "$w3-"]
-		set w [lindex $words $cnt]
-		set wLen [string length $w]
-		incr numWords
-	    }
-	}
-
-	# the word $w doesn't fit into the present line
-	# case #2: we try to cut the word into pieces
-
-	if {$StrictLength && ([string length $w] > $Length)} {
-	    # cut word into two pieces
-	    set w2 $w
-
-	    set over [expr {$pos+2+$wLen-$Length}]
-	    set w3   [string range $w2 0 $Length]
-	    set w4   [string range $w2 [expr {$Length+1}] end]
-
-	    set x [lreplace $words $cnt $cnt $w4]
-	    set words [linsert $x $cnt $w3 ]
-	    set w [lindex $words $cnt]
-	    set wLen [string length $w]
-	    incr numWords
-	}
-
-	# continuing with the normal procedure
-
-	if {($pos+$wLen < $Length)} {
-	    # append word to current line
-
-	    if {$pos} {append line " "; incr pos}
-	    append line $w
-	    incr pos $wLen
-	} else {
-	    # line full => write buffer and  begin a new line
-
-	    if {[string length $text]} {append text "\n"}
-	    append text [Justification $line [incr numline]]
-	    set line $w
-	    set pos $wLen
-	}
-    }
-
-    # write buffer and return!
-
-    if {[string length $text]} {append text "\n"}
-    append text [Justification $line end]
-    return $text
-}
-
-# ::textutil::adjust::Justification
-#
-# justify a given line
-#
-# Parameters:
-#      line    text for justification
-#      index   index for line in text
-#
-# Returns:
-#      the justified line
-#
-# Remarks:
-#      Only lines with size not exceeding the max. linesize provided
-#      for text formatting are justified!!!
-
-proc ::textutil::adjust::Justification { line index } {
-    variable Justify
-    variable Length
-    variable FullLine
-
-    set len [string length $line];               # length of current line
-
-    if { $Length <= $len } then {
-	# the length of current line ($len) is equal as or greater than
-	# the value provided for text formatting ($Length) => to avoid
-	# inifinite loops we leave $line unchanged and return!
-
-	return $line
-    }
-
-    # Special case:
-    # for the last line, and if the justification is set to 'plain'
-    # the real justification is 'left' if the length of the line
-    # is less than 90% (rounded) of the max length allowed. This is
-    # to avoid expansion of this line when it is too small: without
-    # it, the added spaces will 'unbeautify' the result.
-    #
-
-    set justify $Justify
-    if { ( "$index" == "end" ) && \
-	    ( "$Justify" == "plain" ) && \
-	    ( $len < round($Length * 0.90) ) } then {
-	set justify left
-    }
-
-    # For a left justification, nothing to do, but to
-    # add some spaces at the end of the line if requested
-
-    if { "$justify" == "left" } then {
-	set jus ""
-	if { $FullLine } then {
-	    set jus [strRepeat " " [ expr { $Length - $len } ]]
-	}
-	return "${line}${jus}"
-    }
-
-    # For a right justification, just add enough spaces
-    # at the beginning of the line
-
-    if { "$justify" == "right" } then {
-	set jus [strRepeat " " [ expr { $Length - $len } ]]
-	return "${jus}${line}"
-    }
-
-    # For a center justification, add half of the needed spaces
-    # at the beginning of the line, and the rest at the end
-    # only if needed.
-
-    if { "$justify" == "center" } then {
-	set mr [ expr { ( $Length - $len ) / 2 } ]
-	set ml [ expr { $Length - $len - $mr } ]
-	set jusl [strRepeat " " $ml]
-	set jusr [strRepeat " " $mr]
-	if { $FullLine } then {
-	    return "${jusl}${line}${jusr}"
-	} else {
-	    return "${jusl}${line}"
-	}
-    }
-
-    # For a plain justification, it's a little bit complex:
-    #
-    # if some spaces are missing, then
-    #
-    # 1) sort the list of words in the current line by decreasing size
-    # 2) foreach word, add one space before it, except if it's the
-    #    first word, until enough spaces are added
-    # 3) rebuild the line
-
-    if { "$justify" == "plain" } then {
-	set miss [ expr { $Length - [ string length $line ] } ]
-
-	# Bugfix tcllib-bugs-860753 (jhv)
-
-	set words [split $line]
-	set numWords [llength $words]
-
-	if {$numWords < 2} {
-	    # current line consists of less than two words - we can't
-	    # insert blanks to achieve a plain justification => leave
-	    # $line unchanged and return!
-
-	    return $line
-	}
-
-	for {set i 0; set totalLen 0} {$i < $numWords} {incr i} {
-	    set w($i) [lindex $words $i]
-	    if {$i > 0} {set w($i) " $w($i)"}
-	    set wLen($i) [string length $w($i)]
-	    set totalLen [expr {$totalLen+$wLen($i)}]
-	}
-
-	set miss [expr {$Length - $totalLen}]
-
-	# len walks through all lengths of words of the line under
-	# consideration
-
-	for {set len 1} {$miss > 0} {incr len} {
-	    for {set i 1} {($i < $numWords) && ($miss > 0)} {incr i} {
-		if {$wLen($i) == $len} {
-		    set w($i) " $w($i)"
-		    incr wLen($i)
-		    incr miss -1
-		}
-	    }
-	}
-
-	set line ""
-	for {set i 0} {$i < $numWords} {incr i} {
-	    set line "$line$w($i)"
-	}
-
-	# End of bugfix
-
-	return "${line}"
-    }
-
-    error "Illegal justification key \"$justify\""
-}
-
-proc ::textutil::adjust::SortList { list dir index } {
-
-    if { [ catch { lsort -integer -$dir -index $index $list } sl ] != 0 } then {
-        error "$sl"
-    }
-
-    return $sl
-}
-
-# Hyphenation utilities based on Knuth's algorithm
-#
-# Copyright (C) 2001-2003 by Dr.Johannes-Heinrich Vogeler (jhv)
-# These procedures may be used as part of the tcllib
-
-# textutil::adjust::Hyphenation
-#
-#      Hyphenate a string using Knuth's algorithm
-#
-# Parameters:
-#      str     string to be hyphenated
-#
-# Returns:
-#      the hyphenated string
-
-proc ::textutil::adjust::Hyphenation { str } {
-
-    # if there are manual set hyphenation marks e.g. "Recht\-schrei\-bung"
-    # use these for hyphenation and return
-
-    if {[regexp {[^\\-]*[\\-][.]*} $str]} {
-	regsub -all {(\\)(-)} $str {-} tmp
-	return [split $tmp -]
-    }
-
-    # Don't hyphenate very short words! Minimum length for hyphenation
-    # is set to 3 characters!
-
-    if { [string length $str] < 4 } then { return $str }
-
-    # otherwise follow Knuth's algorithm
-
-    variable HyphPatterns;                       # hyphenation patterns (TeX)
-
-    set w ".[string tolower $str].";             # transform to lower case
-    set wLen [string length $w];                 # and add delimiters
-
-    # Initialize hyphenation weights
-
-    set s {}
-    for {set i 0} {$i < $wLen} {incr i} {
-	lappend s 0
-    }
-
-    for {set i 0} {$i < $wLen} {incr i} {
-	set kmax [expr {$wLen-$i}]
-	for {set k 1} {$k < $kmax} {incr k} {
-	    set sw [string range $w $i [expr {$i+$k}]]
-	    if {[info exists HyphPatterns($sw)]} {
-		set hw $HyphPatterns($sw)
-		set hwLen [string length $hw]
-		for {set l1 0; set l2 0} {$l1 < $hwLen} {incr l1} {
-		    set c [string index $hw $l1]
-		    if {[string is digit $c]} {
-			set sPos [expr {$i+$l2}]
-			if {$c > [lindex $s $sPos]} {
-			    set s [lreplace $s $sPos $sPos $c]
-			}
-		    } else {
-			incr l2
-		    }
-		}
-	    }
-	}
-    }
-
-    # Replace all even hyphenation weigths by zero
-
-    for {set i 0} {$i < [llength $s]} {incr i} {
-	set c [lindex $s $i]
-	if {!($c%2)} { set s [lreplace $s $i $i 0] }
-    }
-
-    # Don't start with a hyphen! Take also care of words enclosed in quotes
-    # or that someone has forgotten to put a blank between a punctuation
-    # character and the following word etc.
-
-    for {set i 1} {$i < ($wLen-1)} {incr i} {
-	set c [string range $w $i end]
-	if {[regexp {^[:alpha:][.]*} $c]} {
-	    for {set k 1} {$k < ($i+1)} {incr k} {
-		set s [lreplace $s $k $k 0]
-	    }
-	    break
-	}
-    }
-
-    # Don't separate the last character of a word with a hyphen
-
-    set max [expr {[llength $s]-2}]
-    if {$max} {set s [lreplace $s $max end 0]}
-
-    # return the syllabels of the hyphenated word as a list!
-
-    set ret ""
-    set w ".$str."
-    for {set i 1} {$i < ($wLen-1)} {incr i} {
-	if {[lindex $s $i]} { append ret - }
-	append ret [string index $w $i]
-    }
-    return [split $ret -]
-}
-
-# textutil::adjust::listPredefined
-#
-#      Return the names of the hyphenation files coming with the package.
-#
-# Parameters:
-#      None.
-#
-# Result:
-#       List of filenames (without directory)
-
-proc ::textutil::adjust::listPredefined {} {
-    variable here
-    return [glob -type f -directory $here -tails *.tex]
-}
-
-# textutil::adjust::getPredefined
-#
-#      Retrieve the full path for a predefined hyphenation file
-#       coming with the package.
-#
-# Parameters:
-#      name     Name of the predefined file.
-#
-# Results:
-#       Full path to the file, or an error if it doesn't
-#       exist or is matching the pattern *.tex.
-
-proc ::textutil::adjust::getPredefined {name} {
-    variable here
-
-    if {![string match *.tex $name]} {
-        return -code error \
-                "Illegal hyphenation file \"$name\""
-    }
-    set path [file join $here $name]
-    if {![file exists $path]} {
-        return -code error \
-                "Unknown hyphenation file \"$path\""
-    }
-    return $path
-}
-
-# textutil::adjust::readPatterns
-#
-#      Read hyphenation patterns from a file and store them in an array
-#
-# Parameters:
-#      filNam  name of the file containing the patterns
-
-proc ::textutil::adjust::readPatterns { filNam } {
-
-    variable HyphPatterns;                       # hyphenation patterns (TeX)
-
-    # HyphPatterns(_LOADED_) is used as flag for having loaded
-    # hyphenation patterns from the respective file (TeX format)
-
-    if {[info exists HyphPatterns(_LOADED_)]} {
-	unset HyphPatterns(_LOADED_)
-    }
-
-    # the array xlat provides translation from TeX encoded characters
-    # to those of the ISO-8859-1 character set
-
-    set xlat(\"s) \337;  # 223 := sharp s    "
-    set xlat(\`a) \340;  # 224 := a, grave
-    set xlat(\'a) \341;  # 225 := a, acute
-    set xlat(\^a) \342;  # 226 := a, circumflex
-    set xlat(\"a) \344;  # 228 := a, diaeresis "
-    set xlat(\`e) \350;  # 232 := e, grave
-    set xlat(\'e) \351;  # 233 := e, acute
-    set xlat(\^e) \352;  # 234 := e, circumflex
-    set xlat(\`i) \354;  # 236 := i, grave
-    set xlat(\'i) \355;  # 237 := i, acute
-    set xlat(\^i) \356;  # 238 := i, circumflex
-    set xlat(\~n) \361;  # 241 := n, tilde
-    set xlat(\`o) \362;  # 242 := o, grave
-    set xlat(\'o) \363;  # 243 := o, acute
-    set xlat(\^o) \364;  # 244 := o, circumflex
-    set xlat(\"o) \366;  # 246 := o, diaeresis "
-    set xlat(\`u) \371;  # 249 := u, grave
-    set xlat(\'u) \372;  # 250 := u, acute
-    set xlat(\^u) \373;  # 251 := u, circumflex
-    set xlat(\"u) \374;  # 252 := u, diaeresis "
-
-    set fd [open $filNam RDONLY]
-    set status 0
-
-    while {[gets $fd line] >= 0} {
-
-	switch -exact $status {
-	    PATTERNS {
-		if {[regexp {^\}[.]*} $line]} {
-		    # End of patterns encountered: set status
-		    # and ignore that line
-		    set status 0
-		    continue
-		} else {
-		    # This seems to be pattern definition line; to process it
-		    # we have first to do some editing
-		    #
-		    # 1) eat comments in a pattern definition line
-		    # 2) eat braces and coded linefeeds
-
-		    set z [string first "%" $line]
-		    if {$z > 0} { set line [string range $line 0 [expr {$z-1}]] }
-
-		    regsub -all {(\\n|\{|\})} $line {} tmp
-		    set line $tmp
-
-		    # Now $line should consist only of hyphenation patterns
-		    # separated by white space
-
-		    # Translate TeX encoded characters to ISO-8859-1 characters
-		    # using the array xlat defined above
-
-		    foreach x [array names xlat] {
-			regsub -all {$x} $line $xlat($x) tmp
-			set line $tmp
-		    }
-
-		    # split the line and create a lookup array for
-		    # the repective hyphenation patterns
-
-		    foreach item [split $line] {
-			if {[string length $item]} {
-			    if {![string match {\\} $item]} {
-				# create index for hyphenation patterns
-
-				set var $item
-				regsub -all {[0-9]} $var {} idx
-				# store hyphenation patterns as elements of an array
-
-				set HyphPatterns($idx) $item
-			    }
-			}
-		    }
-		}
-	    }
-	    EXCEPTIONS {
-		if {[regexp {^\}[.]*} $line]} {
-		    # End of patterns encountered: set status
-		    # and ignore that line
-		    set status 0
-		    continue
-		} else {
-		    # to be done in the future
-		}
-	    }
-	    default {
-		if {[regexp {^\\endinput[.]*} $line]} {
-		    # end of data encountered, stop processing and
-		    # ignore all the following text ..
-		    break
-		} elseif {[regexp {^\\patterns[.]*} $line]} {
-		    # begin of patterns encountered: set status
-		    # and ignore that line
-		    set status PATTERNS
-		    continue
-		} elseif {[regexp {^\\hyphenation[.]*} $line]} {
-		    # some particular cases to be treated separately
-		    set status EXCEPTIONS
-		    continue
-		} else {
-		    set status 0
-		}
-	    }
-	}
-    }
-
-    close $fd
-    set HyphPatterns(_LOADED_) 1
-
-    return
-}
-
-#######################################################
-
-# @c The specified <a text>block is indented
-# @c by <a prefix>ing each line. The first
-# @c <a hang> lines ares skipped.
-#
-# @a text:   The paragraph to indent.
-# @a prefix: The string to use as prefix for each line
-# @a prefix: of <a text> with.
-# @a skip:   The number of lines at the beginning to leave untouched.
-#
-# @r Basically <a text>, but indented a certain amount.
-#
-# @i indent
-# @n This procedure is not checked by the testsuite.
-
-proc ::textutil::adjust::indent {text prefix {skip 0}} {
-    set text [string trimright $text]
-
-    set res [list]
-    foreach line [split $text \n] {
-	if {[string compare "" [string trim $line]] == 0} {
-	    lappend res {}
-	} else {
-	    set line [string trimright $line]
-	    if {$skip <= 0} {
-		lappend res $prefix$line
-	    } else {
-		lappend res $line
-	    }
-	}
-	if {$skip > 0} {incr skip -1}
-    }
-    return [join $res \n]
-}
-
-# Undent the block of text: Compute LCP (restricted to whitespace!)
-# and remove that from each line. Note that this preverses the
-# shaping of the paragraph (i.e. hanging indent are _not_ flattened)
-# We ignore empty lines !!
-
-proc ::textutil::adjust::undent {text} {
-
-    if {$text == {}} {return {}}
-
-    set lines [split $text \n]
-    set ne [list]
-    foreach l $lines {
-	if {[string length [string trim $l]] == 0} continue
-	lappend ne $l
-    }
-    set lcp [::textutil::string::longestCommonPrefixList $ne]
-
-    if {[string length $lcp] == 0} {return $text}
-
-    regexp {^([         ]*)} $lcp -> lcp
-
-    if {[string length $lcp] == 0} {return $text}
-
-    set len [string length $lcp]
-
-    set res [list]
-    foreach l $lines {
-	if {[string length [string trim $l]] == 0} {
-	    lappend res {}
-	} else {
-	    lappend res [string range $l $len end]
-	}
-    }
-    return [join $res \n]
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::adjust {
-    variable here [file dirname [info script]]
-
-    variable Justify      left
-    variable Length       72
-    variable FullLine     0
-    variable StrictLength 0
-    variable Hyphenate    0
-    variable HyphPatterns
-
-    namespace export adjust indent undent
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::adjust 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/dehypht.tex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/dehypht.tex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,902 +1,0 @@
-% This is `dehypht.tex' as of 03 March 1999.
-%
-% Copyright (C) 1988,1991 Rechenzentrum der Ruhr-Universitaet Bochum
-%               [german hyphen patterns]
-% Copyright (C) 1993,1994,1999 Bernd Raichle/DANTE e.V.
-%               [macros, adaption for TeX 2]
-%
-% -----------------------------------------------------------------
-% IMPORTANT NOTICE:
-%
-% This program can be redistributed and/or modified under the terms
-% of the LaTeX Project Public License Distributed from CTAN
-% archives in directory macros/latex/base/lppl.txt; either
-% version 1 of the License, or any later version.
-% -----------------------------------------------------------------
-%
-%
-% This file contains german hyphen patterns following traditional
-% hyphenation rules and includes umlauts and sharp s, but without
-% `c-k' and triple consonants.  It is based on hyphen patterns
-% containing 5719 german hyphen patterns with umlauts in the
-% recommended version of September 27, 1990.
-%
-% For use with TeX generated by
-%
-%          Norbert Schwarz
-%          Rechenzentrum Ruhr-Universitaet Bochum
-%          Universitaetsstrasse 150
-%          D-44721 Bochum, FRG
-%
-%
-% Adaption of these patterns for TeX, Version 2.x and 3.x and
-% all fonts in T1/`Cork'/EC/DC and/or OT1/CM encoding by
-%
-%          Bernd Raichle
-%          Stettener Str. 73
-%          D-73732 Esslingen, FRG
-%   Email: raichle@Informatik.Uni-Stuttgart.DE
-%
-%
-% Error reports in case of UNCHANGED versions to
-%
-%          DANTE e.V., Koordinator `german.sty'
-%          Postfach 10 18 40
-%          D-69008 Heidelberg, FRG
-%   Email: german@Dante.DE
-%
-% or one of the addresses given above.
-%
-%
-% Changes:
-%  1990-09-27 First version of `ghyphen3.tex' (Norbert Schwarz)
-%  1991-02-13 PC umlauts changed to ^^xx  (Norbert Schwarz)
-%  1993-08-27 Umlauts/\ss changed to "a/\3 macros, added macro
-%             definitions and additional logic to select correct
-%             patterns/encoding  (Bernd Raichle)
-%  1994-02-13 Release of `ghyph31.tex' V3.1a (Bernd Raichle)
-%  1999-03-03 Renamed file to `dehypht.tex' according to the
-%             naming scheme using the ISO country code `de', the
-%             common part `hyph' for all hyphenation patterns files,
-%             and the additional postfix `t' for traditional,
-%             removed wrong catcode change of ^^e (the comment
-%             character %) and ^^f (the character &),
-%             do _not_ change \catcode, \lccode, \uccode to avoid
-%             problems with other hyphenation pattern files,
-%             changed code to distinguish TeX 2.x/3.x,
-%             changed license conditions to LPPL (Bernd Raichle)
-%
-%
-% For more information see the additional documentation
-% at the end of this file.
-%
-% -----------------------------------------------------------------
-%
-\message{German Traditional Hyphenation Patterns %
-         `dehypht' Version 3.2a <1999/03/03>}
-\message{(Formerly known under the name `ghyph31' and `ghyphen'.)}
-%
-%
-% Next we define some commands which are used inside the patterns.
-% To keep them local, we enclose the rest of the file in a group
-% (The \patterns command globally changes the hyphenation trie!).
-%
-\begingroup
-%
-%
-% Make sure that doublequote is not active:
-\catcode`\"=12
-%
-%
-% Because ^^e4 is used in the following macros which is read by
-% TeX 2.x as ^^e or %, the comment character of TeX, some trick
-% has to be found to avoid this problem.  The same is true for the
-% character ^^f or & in the TeX 2.x code.
-% Therefore in the code the exclamationmark ! is used instead of
-% the circumflex ^ and its \catcode is set appropriately
-% (normally \catcode`\!=12, in the code \catcode`\!=7).
-%
-% The following \catcode, \lccode assignments and macro definitions
-% are defined in such a way that the following \pattern{...} list
-% can be used for both, TeX 2.x and TeX 3.x.
-%
-% We first change the \lccode of ^^Y to make sure that we can
-% include this character in the hyphenation patterns.
-%
-\catcode`\^^Y=11 \lccode`\^^Y=`\^^Y
-%
-% Then we have to define some macros depending on the TeX version.
-% Therefore we have to distinguish TeX version 2.x and 3.x:
-%
-\ifnum`\@=`\^^40 % true => TeX 3.x
-  %
-  % For TeX 3:
-  % ----------
-  %
-  % Assign appropriate \catcode and \lccode values for all
-  % accented characters used in the patterns (\uccode changes are
-  % not used within \patterns{...} and thus not necessary):
-  %
-  \catcode"E4=11 \catcode"C4=11 % \"a \"A
-  \catcode"F6=11 \catcode"D6=11 % \"o \"O
-  \catcode"FC=11 \catcode"DC=11 % \"u \"U
-  \catcode"FF=11 \catcode"DF=11 % \ss  SS
-  %
-  \lccode"C4="E4 \uccode"C4="C4  \lccode"E4="E4 \uccode"E4="C4
-  \lccode"D6="F6 \uccode"D6="D6  \lccode"F6="F6 \uccode"F6="D6
-  \lccode"DC="FC \uccode"DC="DC  \lccode"FC="FC \uccode"FC="DC
-  \lccode"DF="FF \uccode"DF="DF  \lccode"FF="FF \uccode"FF="DF
-  %
-  % In the following definitions we use ??xy instead of ^^xy
-  % to avoid errors when reading the following macro definitions
-  % with TeX 2.x (remember ^^e(4) is the comment character):
-  %
-  \catcode`\?=7
-  %
-  % Define the accent macro " in such a way that it
-  % expands to single letters in font encoding T1.
-  \catcode`\"=13
-  \def"#1{\ifx#1a??e4\else \ifx#1o??f6\else \ifx#1u??fc\else
-      \errmessage{Hyphenation pattern file corrupted!}%
-    \fi\fi\fi}
-  %
-  %   - patterns with umlauts are ok
-  \def\n#1{#1}
-  %
-  % For \ss which exists in T1 _and_ OT1 encoded fonts but with
-  % different glyph codes, duplicated patterns for both encodings
-  % are included.  Thus you can use these hyphenation patterns for
-  % T1 and OT1 encoded fonts:
-  %   - define \3 to be code `\^^ff (\ss in font encoding T1)
-  %   - define \9 to be code `\^^Y  (\ss in font encoding OT1)
-  \def\3{??ff}
-  \def\9{??Y}
-  %   - duplicated patterns to support font encoding OT1 are ok
-  \def\c#1{#1}
-  %   >>>>>>  UNCOMMENT the next line, if you do not want
-  %   >>>>>>  to use fonts in font encoding OT1
-  %\def\c#1{}
-  %
-  \catcode`\?=12
-  %
-\else
-  %
-  % For TeX 2:
-  % ----------
-  %
-  % Define the accent macro " to throw an error message.
-  \catcode`\"=13
-  \def"#1{\errmessage{Hyphenation pattern file corrupted!}}
-  %
-  %   - ignore all patterns with umlauts
-  \def\n#1{}
-  %
-  % With TeX 2 fonts in encoding T1 can be used, but all glyphs
-  % in positions > 127 can not be used in hyphenation patterns.
-  % Thus only patterns with glyphs in OT1 positions are included:
-  %   - define \3 to be code ^^Y (\ss in CM font encoding)
-  %   - define \9 to throw an error message
-  \def\3{^^Y}
-  \def\9{\errmessage{Hyphenation pattern file corrupted!}}
-  %   - ignore all duplicated patterns with \ss in T1 encoding
-  \def\c#1{}
-  %
-\fi
-%
-%
-\patterns{%
-.aa6l .ab3a4s .ab3ei .abi2 .ab3it .ab1l .ab1r .ab3u .ad3o4r .alti6
-.ana3c .an5alg .an1e .ang8s .an1s .ap1p .ar6sc .ar6ta .ar6tei .as2z
-.au2f1 .au2s3 .be5erb .be3na .ber6t5r .bie6r5 .bim6s5t .brot3 .bru6s
-.ch6 .che6f5 .da8c .da2r .dar5in .dar5u .den6ka .de5r6en .des6pe
-.de8spo .de3sz .dia3s4 .dien4 .dy2s1 .ehren5 .eine6 .ei6n5eh .ei8nen
-.ein5sa .en6der .en6d5r .en3k4 .en8ta8 .en8tei .en4t3r .epo1 .er6ban
-.er6b5ei .er6bla .er6d5um .er3ei .er5er .er3in .er3o4b .erwi5s .es1p
-.es8t .ex1a2 .ex3em .fal6sc .fe6st5a .flu4g3 .furch8 .ga6ner .ge3n4a
-\n{.ge5r"o} .ges6 .halb5 .halbe6 .hal6br .haup4 .hau4t .heima6 .he4r3e
-.her6za .he5x .hin3 .hir8sc .ho4c .hu3sa .hy5o .ibe5 .ima6ge .in1
-.ini6 .is5chi .jagd5 .kal6k5o .ka6ph .ki4e .kop6f3 .kraf6 \n{.k"u5ra}
-.lab6br .liie6 .lo6s5k \n{.l"o4s3t} .ma5d .mi2t1 .no6th .no6top
-.obe8ri .ob1l .obs2 .ob6st5e .or3c .ort6s5e .ost3a .oste8r .pe4re
-.pe3ts .ph6 .po8str .rau4m3 .re5an .ro8q .ru5the \n{.r"u5be}
-\n{.r"u8stet} .sch8 .se6e .se5n6h .se5ra .si2e .spi6ke .st4 .sy2n
-.tages5 .tan6kl .ta8th .te6e .te8str .to6der .to8nin .to6we .um1
-.umpf4 .un1 .une6 .unge5n .ur1c .ur5en .ve6rin .vora8 .wah6l5 .we8ges
-.wo6r .wor3a .wun4s .zi4e .zuch8 \n{."ande8re} \n{."och8} aa1c aa2gr
-aal5e aa6r5a a5arti aa2s1t aat2s 6aba ab3art 1abdr 6abel aben6dr
-ab5erk ab5err ab5esse 1abf 1abg \n{1abh"a} ab1ir 1abko a1bl ab1la
-5ablag a6bla\3 \c{a6bla\9} ab4ler ab1lu \n{a8bl"a} \n{5a6bl"o} abma5c
-1abn ab1ra ab1re 5a6brec ab1ro ab1s ab8sk abs2z 3abtei ab1ur 1abw
-5abze 5abzu \n{ab1"an} \n{ab"au8} a4ce.  a5chal ach5art ach5au a1che
-a8chent ach6er.  a6ch5erf a1chi ach1l ach3m ach5n a1cho ach3re a1chu
-ach1w a1chy \n{ach5"af} ack1o acks6t ack5sta a1d 8ad.  a6d5ac ad3ant
-ad8ar 5addi a8dein ade5o8 adi5en 1adj 1adle ad1op a2dre 3adres adt1
-1adv \n{a6d"a} a1e2d ae1r a1er.  1aero 8afa a3fal af1an a5far a5fat
-af1au a6fentl a2f1ex af1fr af5rau af1re 1afri af6tent af6tra aft5re
-a6f5um \n{8af"a} ag5abe 5a4gent ag8er ages5e 1aggr ag5las ag1lo a1gn
-ag2ne 1agog a6g5und a1ha a1he ah5ein a4h3erh a1hi ahl1a ah1le ah4m3ar
-ahn1a a5ho ahra6 ahr5ab ah1re ah8rei ahren8s ahre4s3 ahr8ti ah1ru a1hu
-\n{ah8"o} ai3d2s ai1e aif6 a3inse ai4re.  a5isch.  ais8e a3ismu ais6n
-aiso6 a1j 1akad a4kade a1ke a1ki 1akko 5akro1 a5lal al5ans 3al8arm
-al8beb al8berw alb5la 3album al1c a1le a6l5e6be a4l3ein a8lel a8lerb
-a8lerh a6lert 5a6l5eth 1algi al4gli al3int al4lab al8lan al4l3ar
-alle3g a1lo a4l5ob al6schm al4the altist5 al4t3re 8a1lu alu5i a6lur
-alu3ta \n{a1l"a} a6mate 8ame.  5a6meise am6m5ei am6mum am2n ampf3a
-am6schw am2ta a1mu \n{a1m"a} a3nac a1nad anadi5e an3ako an3alp 3analy
-an3ame an3ara a1nas an5asti a1nat anat5s an8dent ande4s3 an1ec an5eis
-an1e2k 4aner.  a6n5erd a8nerf a6n5erke 1anfa 5anfert \n{1anf"a} 3angab
-5angebo an3gli ang6lis an2gn 3angri ang5t6 \n{5anh"a} ani5g ani4ka
-an5i8on an1kl an6kno an4kro 1anl anma5c anmar4 3annah anne4s3 a1no
-5a6n1o2d 5a6n3oma 5a6nord 1anr an1sa 5anschl an4soz an1st 5anstal
-an1s2z 5antenn an1th \n{5anw"a} a5ny an4z3ed 5anzeig 5anzieh 3anzug
-\n{an1"a} \n{5an"as} \n{a1n"o} \n{an"o8d} a1os a1pa 3apfel a2ph1t
-\n{aph5"a6} a1pi 8apl apo1c apo1s a6poste a6poth 1appa ap1pr a1pr
-\n{a5p"a} \n{a3p"u} a1ra a4r3af ar3all 3arbei 2arbt ar1c 2a1re ar3ein
-ar2gl 2a1ri ari5es ar8kers ar6les ar4nan ar5o6ch ar1o2d a1rol ar3ony
-a8ror a3ros ar5ox ar6schl 8artei ar6t5ri a1ru a1ry 1arzt arz1w
-\n{ar8z"a} \n{ar"a8m} \n{ar"o6} \n{ar5"om} \n{ar1"u2} a1sa a6schec
-asch5l asch3m a6schn a3s4hi as1pa asp5l a8steb as5tev 1asth a6stoc
-a1str ast3re 8a1ta ata5c ata3la a6tapf ata5pl a1te a6teli aten5a
-ate5ran 6atf 6atg a1th at3hal 1athl 2a1ti 5atlant 3atlas 8atmus 6atn
-a1to a6t5ops ato6ra a6t5ort.  4a1tr a6t5ru at2t1h \n{at5t6h"a} 6a1tu
-atz1w \n{a1t"a} \n{a1t"u} au1a au6bre auch3a au1e aue4l 5aufent
-\n{3auff"u} 3aufga 1aufn auf1t 3auftr 1aufw 3auge.  au4kle aule8s 6aum
-au8mar aum5p 1ausb 3ausd 1ausf 1ausg au8sin 3auss au4sta 1ausw 1ausz
-aut5eng au1th 1auto au\3e8 \c{au\9e8} a1v ave5r6a aver6i a1w a6wes a1x
-a2xia a6xio a1ya a1z azi5er.  8a\3 \c{8a\9} 1ba 8ba8del ba1la ba1na
-ban6k5r ba5ot bardi6n ba1ro basten6 bau3sp 2b1b bb6le b2bli 2b1c 2b1d
-1be be1a be8at.  be1ch 8becht 8becke.  be5el be1en bee8rei be5eta bef2
-8beff be1g2 \n{beh"o8} bei1s 6b5eisen bei3tr b8el bel8o belu3t be3nac
-bend6o be6ners be6nerw be4nor ben4se6 bens5el \n{be1n"a} \n{be1n"u}
-be1o2 b8er.  be1ra be8rac ber8gab.  ber1r \n{be1r"u} bes8c bes5erh
-bes2p be5tha bet5sc be1un be1ur 8bex be6zwec 2b1f8 bfe6st5e 2b1g2
-bga2s5 bge1 2b1h bhole6 1bi bi1bl b6ie bi1el bi1la \n{bil"a5} bi1na
-bi4nok bi5str bi6stu bi5tr bit4t5r b1j 2b1k2 \n{bk"u6} bl8 b6la.
-6b1lad 6blag 8blam 1blat b8latt 3blau.  b6lav 3ble.  b1leb b1led
-8b1leg 8b1leh 8bleid 8bleih 6b3lein blei3s ble4m3o 4blich b4lind
-8bling b2lio 5blit b4litz b1loh 8b1los 1blu 5blum 2blun blut3a blut5sc
-\n{3bl"a} \n{bl"as5c} \n{5bl"o} \n{3bl"u} \n{bl"u8sc} 2b1m 2b1n 1bo
-bo1ch bo5d6s boe5 8boff 8bonk bo1ra b1ort 2b1p2 b1q 1br brail6 brast8
-bre4a b5red 8bref 8b5riem b6riga bro1s b1rup b2ruz \n{8br"oh}
-\n{br"os5c} 8bs b1sa b8sang b2s1ar b1sc bs3erl bs3erz b8sof b1s2p
-bst1h b3stru \n{b5st"a} b6sun 2b1t b2t1h 1bu bu1ie bul6k b8ure bu6sin
-6b1v 2b1w 1by1 by6te.  8b1z bzi1s \n{1b"a} \n{b5"a6s5} \n{1b"u}
-\n{b6"u5bere} \n{b"uge6} \n{b"ugel5e} \n{b"ur6sc} 1ca cag6 ca5la ca6re
-ca5y c1c 1ce celi4c celich5 ce1ro c8h 2ch.  1chae ch1ah ch3akt cha6mer
-8chanz 5chara 3chari 5chato 6chb 1chef 6chei ch3eil ch3eis 6cherkl
-6chf 4chh 5chiad 5chias 6chins 8chj chl6 5chlor 6ch2m 2chn6 ch8nie
-5cho.  8chob choi8d 6chp ch3ren ch6res \n{ch3r"u} 2chs 2cht cht5ha
-cht3hi 5chthon ch6tin 6chuh chu4la 6ch3unt chut6t 8chw 1ci ci5tr c2k
-2ck.  ck1ei 4ckh ck3l ck3n ck5o8f ck1r 2cks ck5stra ck6s5u c2l 1c8o
-con6ne 8corb cos6t c3q 1c6r 8c1t 1cu 1cy \n{5c"a1} \n{c"o5} 1da.
-8daas 2dabg 8dabr 6dabt 6dabw 1dac da2gr 6d5alk 8d5amt dan6ce.
-dani5er dan8ker 2danl danla6 6dans 8danzi 6danzu d1ap da2r1a8 2d1arb
-d3arc dar6men 4d3art 8darz 1dat 8datm 2d1auf 2d1aus 2d1b 2d1c 2d1d
-d5de d3d2h \n{dd"amme8} 1de 2deal de5an de3cha de1e defe6 6deff 2d1ehr
-5d4eic de5isc de8lar del6s5e del6spr de4mag de8mun de8nep dene6r
-8denge.  8dengen de5o6d 2deol de5ram 8derdb der5ein de1ro der1r d8ers
-der5um de4s3am de4s3an de4sau de6sil de4sin de8sor de4spr de2su 8deul
-de5us.  2d1f df2l 2d1g 2d1h 1di dia5c di5ara dice5 di3chr di5ena di1gn
-di1la dil8s di1na 8dind 6dinf 4d3inh 2d1ins di5o6d di3p4t di8sen dis1p
-di5s8per di6s5to dis5tra di8tan di8tin d1j 6dje 2dju 2d1k 2d1l 2d1m
-2d1n6 dni6 dnje6 1do 6d5obe do6berf 6d5ony do3ran 6dord 2d1org dor4t3h
-do6ste 6doth dott8e 2d1p d5q dr4 1drah 8drak d5rand 6dre.  4drech
-d6reck 4d3reg 8d3reic d5reife 8drem 8d1ren 2drer 8dres.  6d5rh 1dria
-d1ric 8drind droi6 dro5x 1dru 8drut \n{dr"os5c} \n{1dr"u} \n{dr"u5b}
-\n{dr"u8sc} 2ds d1sa d6san dsat6 d1sc 5d6scha.  5dschik dse8e d8serg
-8dsl d1sp d4spak ds2po \n{d8sp"a} d1st \n{d1s"u} 2dt d1ta d1te d1ti
-d1to dt1s6 d1tu \n{d5t"a} 1du du5als du1b6 du1e duf4t3r 4d3uh du5ie
-8duml 8dumw 2d1und du8ni 6d5unt dur2c durch3 6durl 6dursa 8durt du1s
-du8schr 2d1v 2d1w dwa8l 2d1z \n{1d"a} \n{6d"ah} \n{8d"and} \n{d"a6r}
-\n{d"o8bl} \n{d5"ol} \n{d"or6fl} \n{d"o8sc} \n{d5"o4st} \n{d"os3te}
-\n{1d"u} ea4ben e1ac e1ah e1akt e1al.  e5alf e1alg e5a8lin e1alk e1all
-e5alp e1alt e5alw e1am e1and ea6nim e1ar.  e5arf e1ark e5arm e3art
-e5at.  e6ate e6a5t6l e8ats e5att e6au.  e1aus e1b e6b5am ebens5e
-eb4lie eb4ser eb4s3in e1che e8cherz e1chi ech3m 8ech3n ech1r ech8send
-ech4su e1chu eck5an e5cl e1d ee5a ee3e ee5g e1ei ee5isc eei4s3t
-ee6lend e1ell \n{ee5l"o} e1erd ee3r4e ee8reng eere6s5 \n{ee5r"a}
-ee6tat e1ex e1f e6fau e8fe8b 3effek ef3rom ege6ra eglo6si 1egy e1ha
-e6h5ach eh5ans e6hap eh5auf e1he e1hi ehl3a eh1le ehl5ein eh1mu ehn5ec
-e1ho ehr1a eh1re ehre6n eh1ri eh1ru ehr5um e1hu eh1w e1hy \n{e1h"a}
-\n{e1h"o} \n{e3h"ut} ei1a eia6s ei6bar eich3a eich5r ei4dar ei6d5ei
-ei8derf ei3d4sc ei1e 8eifen 3eifri 1eign eil1d ei6mab ei8mag ein1a4
-ei8nat ei8nerh ei8ness ei6nete ein1g e8ini ein1k ei6n5od ei8nok ei4nor
-\n{e3ins"a} ei1o e1irr ei5ru ei8sab ei5schn ei6s5ent ei8sol ei4t3al
-eit3ar eit1h ei6thi ei8tho eit8samt ei6t5um e1j 1ekd e1ke e1ki e1k2l
-e1kn ekni4 e1la e2l1al 6elan e6lanf e8lanl e6l5ans el3arb el3arm
-e6l3art 5e6lasti e6lauge elbst5a e1le 6elef ele6h e6l5ehe e8leif
-e6l5einh 1elek e8lel 3eleme e6lemen e6lente el5epi e4l3err e6l5ersc
-elf2l elg2 e6l5ins ell8er 4e1lo e4l3ofe el8soh el8tent 5eltern e1lu
-elut2 \n{e1l"a} \n{e1l"u} em8dei em8meis 4emo emo5s 1emp1f 1empt 1emto
-e1mu emurk4 emurks5 \n{e1m"a} en5a6ben en5achs en5ack e1nad en5af
-en5all en3alt en1am en3an.  en3ant en3anz en1a6p en1ar en1a6s 6e1nat
-en3auf en3aus en2ce enda6l end5erf end5erg en8dess 4ene.  en5eck
-e8neff e6n5ehr e6n5eim en3eis 6enem.  6enen e4nent 4ener.  e8nerd
-e6n3erf e4nerg 5energi e6n5erla en5ers e6nerst en5erw 6enes e6n5ess
-e2nex en3glo 2eni enni6s5 ennos4 enns8 e1no e6nober eno8f en5opf
-e4n3ord en8sers ens8kl en1sp ens6por en5t6ag enta5go en8terbu en6tid
-3entla ent5ric 5entwic 5entwu 1entz enu5i e3ny en8zan \n{en1"of}
-\n{e1n"os} \n{e1n"ug} eo1c e5o6fe e5okk e1on.  e3onf e5onk e5onl e5onr
-e5opf e5ops e5or.  e1ord e1org eo5r6h eo1t e1pa e8pee e6p5e6g ep5ent
-e1p2f e1pi 5epid e6pidem e1pl 5epos e6pos.  ep4p3a e1pr \n{e1p"a} e1q
-e1ra.  er5aal 8eraba e5rabel er5a6ben e5rabi er3abs er3ach era5e
-era5k6l er3all er3amt e3rand e3rane er3ans e5ranz.  e1rap er3arc
-e3rari er3a6si e1rat erat3s er3auf e3raum 3erbse er1c e1re 4e5re.
-er3eck er5egg er5e2h 2erei e3rei.  e8reine er5einr 6eren.  e4r3enm
-4erer.  e6r5erm er5ero er5erst e4r3erz er3ess \n{5erf"ul} er8gan.
-5ergebn er2g5h \n{5erg"anz} \n{5erh"ohu} 2e1ri eri5ak e6r5iat e4r3ind
-e6r5i6n5i6 er5ins e6r5int er5itio er1kl \n{3erkl"a} \n{5erl"os.}
-ermen6s er6nab 3ernst 6e1ro.  e1rod er1o2f e1rog 6e3roi ero8ide e3rol
-e1rom e1ron e3rop8 e2r1or e1ros e1rot er5ox ersch4 5erstat er6t5ein
-er2t1h er5t6her 2e1ru eruf4s3 e4r3uhr er3ums e5rus 5erwerb e1ry er5zwa
-er3zwu \n{er"a8m} \n{er5"as} \n{er"o8} \n{e3r"os.} \n{e6r1"u2b} e1sa
-esa8b e8sap e6s5a6v e1sc esch4l ese1a es5ebe eserve5 e8sh es5ill
-es3int es4kop e2sl eso8b e1sp espei6s5 es2po es2pu 5essenz e6stabs
-e6staf e6st5ak est3ar e8stob e1str est5res es3ur e2sz \n{e1s"u} e1ta
-et8ag etari5e eta8ta e1te eten6te et5hal e5thel e1ti 1etn e1to e1tr
-et3rec e8tscha et8se et6tei et2th et2t1r e1tu etu1s et8zent et8zw
-\n{e1t"a} \n{e1t"o} \n{e1t"u} eu1a2 eu1e eue8rei eu5fe euin5 euk2
-e1um.  eu6nio e5unter eu1o6 eu5p 3europ eu1sp eu5str eu8zo e1v eval6s
-eve5r6en ever4i e1w e2wig ex1or 1exp 1extr ey3er.  e1z \n{e1"a2}
-\n{e5"o8} \n{e1"u} e8\3es \c{e8\9es} fa6ch5i fade8 fa6del fa5el.
-fal6lo falt8e fa1na fan4gr 6fanl 6fap far6ba far4bl far6r5a 2f1art
-fa1sc fau8str fa3y 2f1b2 6f1c 2f1d 1fe 2f1eck fe6dr feh6lei f6eim
-8feins f5eis fel5en 8feltern 8femp fe5rant 4ferd.  ferri8 fe8stof
-fe6str fe6stum fe8tag fet6ta fex1 2ff f1fa f6f5arm f5fe ffe5in ffe6la
-ffe8ler ff1f f1fla ff3lei ff4lie ff8sa ff6s5ta 2f1g2 fgewen6 4f1h 1fi
-fid4 fi3ds fieb4 fi1la fi8lei fil4m5a f8in.  fi1na 8finf fi8scho fi6u
-6f1j 2f1k2 f8lanz fl8e 4f3lein 8flib 4fling f2lix 6f3lon 5flop 1flor
-\n{5f8l"ac} \n{3fl"ot} 2f1m 2f1n 1fo foh1 f2on fo6na 2f1op fo5ra
-for8mei for8str for8th for6t5r fo5ru 6f5otte 2f1p8 f1q fr6 f5ram
-1f8ran f8ra\3 \c{f8ra\9} f8re.  frei1 5frei.  f3reic f3rest f1rib
-8f1ric 6frig 1fris fro8na \n{fr"as5t} 2fs f1sc f2s1er f5str
-\n{fs3t"at} 2ft f1tak f1te ft5e6h ftere6 ft1h f1ti f5to f1tr ft5rad
-ft1sc ft2so f1tu ftwi3d4 ft1z 1fu 6f5ums 6funf fun4ka fu8\3end
-\c{fu8\9end} 6f1v 2f1w 2f1z \n{1f"a} \n{f"a1c} \n{8f"arm} \n{6f"aug}
-\n{f"a8\3} \n{\c{f"a8\9}} \n{f"ode3} \n{8f"of} \n{3f"or} \n{1f"u}
-\n{f"un4f3u} 1ga ga6bl 6gabw 8gabz g3a4der ga8ho ga5isc 4gak ga1la
-6g5amt ga1na gan5erb gan6g5a ga5nj 6ganl 8gansc 6garb 2g1arc 2g1arm
-ga5ro 6g3arti ga8sa ga8sc ga6stre 2g1atm 6g5auf gau5fr g5aus 2g1b g5c
-6gd g1da 1ge ge1a2 ge6an ge8at.  ge1e2 ge6es gef2 8geff ge1g2l ge1im
-4g3eise geist5r gel8bra gelt8s \n{ge5l"o} ge8nin gen3k 6g5entf
-\n{ge3n"a} ge1or ge1ra ge6rab ger8au \n{8gerh"o} ger8ins ge1ro 6g5erz.
-\n{ge1r"a} \n{ge1r"u} ge1s ges2p ge5unt 4g3ex3 2g1f8 2g1g g1ha 6g1hei
-5ghel.  g5henn 6g1hi g1ho 1ghr \n{g1h"o} 1gi gi5la gi8me.  gi1na
-4g3ins gi3str g1j 2g1k 8gl.  1glad g5lag glan4z3 1glas 6glass 5glaub
-g3lauf 1gle.  g5leb 3gleic g3lein 5gleis 1glem 2gler 8g3leu gli8a
-g2lie 3glied 1g2lik 1g2lim g6lio 1gloa 5glom 1glon 1glop g1los g4loss
-g5luf 1g2ly \n{1gl"u} 2g1m gn8 6gn.  1gna 8gnach 2gnah g1nas g8neu
-g2nie g3nis 1gno 8gnot 1go goe1 8gof 2gog 5gogr 6g5oh goni5e 6gonist
-go1ra 8gord 2g1p2 g1q 1gr4 g5rahm gra8m gra4s3t 6g1rec gre6ge 4g3reic
-g5reit 8grenn gri4e g5riem 5grif 2grig g5ring 6groh 2grot gro6\3
-\c{gro6\9} 4grut 2gs gs1ab g5sah gs1ak gs1an gs8and gs1ar gs1au g1sc
-gs1ef g5seil gs5ein g2s1er gs1in g2s1o gso2r gs1pr g2s1u 2g1t g3te
-g2t1h 1gu gu5as gu2e 2gue.  6gued 4g3uh 8gums 6g5unt gu1s gut3h gu2tu
-4g1v 2g1w gy1n g1z \n{1g"a} \n{8g"a8m} \n{6g"arm} \n{1g"o} \n{1g"u}
-\n{6g"ub} 1haa hab8r ha8del hade4n 8hae ha5el.  haf6tr 2hal.  ha1la
-hal4b5a 6hale 8han.  ha1na han6dr han6ge.  2hani h5anth 6hanz 6harb
-h3arbe h3arme ha5ro ha2t1h h1atm hau6san ha8\3 \c{ha8\9} h1b2 h1c h1d
-he2bl he3cho h3echt he5d6s 5heft h5e6he.  hei8ds h1eif 2hein he3ism
-he5ist.  heit8s3 hek6ta hel8lau 8helt he6mer 1hemm 6h1emp hen5end
-hen5klo hen6tri he2nu 8heo he8q her3ab he5rak her3an 4herap her3au
-h3erbi he1ro he8ro8b he4r3um her6z5er he4spe he1st heta6 het5am he5th
-heu3sc he1xa hey5e h1f2 h1g hgol8 h1h h1iat hie6r5i hi5kt hil1a2
-hil4fr hi5nak hin4ta hi2nu hi5ob hirn5e hir6ner hi1sp hi1th hi5tr
-5hitz h1j h6jo h1k2 hlabb4 hla4ga hla6gr h5lai hl8am h1las h1la\3
-\c{h1la\9} hl1c h1led h3lein h5ler.  h2lif h2lim h8linf hl5int h2lip
-h2lit h4lor h3lose \n{h1l"as} hme5e h2nee h2nei hn3eig h2nel hne8n
-hne4p3f hn8erz h6netz h2nip h2nit h1nol hn5sp h2nuc h2nud h2nul hoch1
-1hoh hoh8lei 2hoi ho4l3ar 1holz h2on ho1ra 6horg 5horn.  ho3sl hos1p
-ho4spi h1p hpi6 h1q 6hr h1rai h8rank h5raum hr1c hrcre8 h1red h3reg
-h8rei.  h4r3erb h8rert hrg2 h1ric hr5ins h2rom hr6t5erl hr2t1h hr6t5ra
-hr8tri h6rum hr1z hs3ach h6s5amt h1sc h6s5ec h6s5erl hs8erle h4sob
-h1sp h8spa\3 \c{h8spa\9} h8spel hs6po h4spun h1str h4s3tum hs3und
-\n{h1s"u} h5ta.  h5tab ht3ac ht1ak ht3ang h5tanz ht1ar ht1at h5taub
-h1te h2t1ec ht3eff ht3ehe h4t3eif h8teim h4t3ein ht3eis h6temp h8tentf
-hte8ren \n{h6terf"u} h8tergr h4t3erh h6t5ersc h8terst h8tese h8tess
-h2t1eu h4t3ex ht1he ht5hu h1ti ht5rak hts3ah ht1sc ht6sex ht8sk ht8so
-h1tu htz8 \n{h5t"um} hub5l hu6b5r huh1l h5uhr.  huld5a6 hu8lent
-\n{hu8l"a} h5up.  h1v h5weib h3weis h1z \n{h"a8kl} \n{h"al8s}
-\n{h"ama8tu8} \n{h"a8sche.} \n{h"at1s} \n{h"au4s3c} \n{2h"o.}
-\n{2h"oe} \n{8h"oi} \n{h"o6s} \n{h"os5c} \n{h"uhne6} \n{h"ul4s3t}
-\n{h"utte8re} i5adn i1af i5ak.  i1al.  i1al1a i1alb i1ald i5alei i1alf
-i1alg i3alh i1alk i1all i1alp i1alr i1als i1alt i1alv i5alw i3alz
-i1an.  ia5na i3and ian8e ia8ne8b i1ang i3ank i5ann i1ant i1anz i6apo
-i1ar.  ia6rab i5arr i1as.  i1asm i1ass i5ast.  i1at.  i5ats i1au i5azz
-i6b5eig i6b5eis ib2le i4blis i6brig i6b5unt \n{i6b"ub} i1che ich5ei
-i6cherb i1chi ich5ins ich1l ich3m ich1n i1cho icht5an icht3r i1chu
-ich1w ick6s5te ic5l i1d id3arm 3ideal ide8na 3ideol \n{ide5r"o} i6diot
-id5rec id1t ie1a ie6b5ar iebe4s3 ie2bl ieb1r ie8bra ie4bre \n{ie8b"a}
-ie2dr ie1e8 ie6f5ad ief5f ie2f1l ie4fro ief1t i1ei ie4l3ec ie8lei
-ie4lek i3ell i1en.  i1end ien6e i3enf i5enn ien6ne.  i1enp i1enr
-i5ensa ien8stal i5env i1enz ie5o ier3a4b ie4rap i2ere ie4rec ie6r5ein
-ie6r5eis ier8er i3ern.  ie8rum ie8rund ie6s5che ie6tau ie8tert ie5the
-ie6t5ri i1ett ie5un iex5 2if i1fa if5ang i6fau if1fr if5lac i5f6lie
-i1fre ift5a if6t5r ig3art 2ige i8gess ig5he i5gla ig2ni i5go ig3rot
-ig3s2p i1ha i8ham i8hans i1he i1hi ih1n ih1r i1hu i8hum ih1w 8i1i ii2s
-ii2t i1j i1k i6kak i8kerz i6kes ik4ler i6k5unt 2il i5lac i1lag il3ans
-i5las i1lau il6auf i1le ile8h i8lel il2fl il3ipp il6l5enn i1lo ilt8e
-i1lu \n{i1l"a} i8mart imb2 i8mele i8mid imme6l5a i1mu \n{i1m"a}
-\n{i5m"o} ina5he i1nat in1au inau8s 8ind.  in4d3an 5index ind2r 3indus
-i5nec i2n1ei i8nerw 3infek 1info 5ingeni ing5s6o 5inhab ini5er.  5inj
-\n{in8k"at} in8nan i1no inoi8d in3o4ku in5sau in1sp 5inspe 5instit
-5instru ins4ze 5intere 5interv in3the in5t2r i5ny \n{in"a2} \n{i1n"ar}
-\n{in1"as} \n{in"o8} \n{in5"od} \n{i1n"os} 2io io1a8 io1c iode4 io2di
-ioi8 i1ol.  i1om.  i1on.  i5onb ion2s1 i1ont i5ops i5o8pt i1or.
-i3oral io3rat i5orc i1os.  i1ot.  i1o8x 2ip i1pa i1pi i1p2l i1pr i1q
-i1ra ir6bl i1re i1ri ir8me8d ir2m1o2 ir8nak i1ro ir5rho ir6schl
-ir6sch5r i5rus i5ry \n{i5r"a} i1sa i8samt i6sar i2s1au i8scheh i8schei
-isch5m isch3r \n{isch"a8} is8ele ise3ra i4s3erh is3err isi6de i8sind
-is4kop ison5e is6por i8s5tum i5sty \n{i5s"o} i1ta it5ab.  i2t1a2m
-i8tax i1te i8tersc i1thi i1tho i5thr \n{it8h"a} i1ti i8ti8d iti6kl
-itmen4 i1to i8tof it3ran it3rau i1tri itri5o it1sc it2se it5spa it8tru
-i1tu it6z5erg it6z1w \n{i1t"a} \n{it"a6r5e} \n{it"at2} \n{it"ats5}
-\n{i1t"u} i1u iu6r 2i1v i6vad iva8tin i8vei i6v5ene i8verh i2vob i8vur
-i1w iwi2 i5xa i1xe i1z ize8n i8zir i6z5w \n{i"a8m} \n{i1"a6r}
-\n{i5"at.} \n{i5"av} \n{i1"o8} \n{i"u8} i6\35ers \c{i6\95ers} ja5la
-je2t3r 6jm 5jo jo5as jo1ra jou6l ju5cha jugen4 jugend5 jung5s6 ju1s
-\n{3j"a} 1ka 8kachs 8kakz ka1la kal5d kam5t ka1na 2kanl 8kapf ka6pl
-ka5r6a 6k3arbe ka1ro kar6p5f 4k3arti 8karz \n{ka1r"a} kasi5e ka6teb
-kat8ta kauf6s kau3t2 2k1b 2k1c 4k1d kehr6s kehrs5a 8keic 2k1eig 6k5ein
-6k5eis ke6lar ke8leis ke8lo 8kemp k5ente.  k3entf 8k5ents 6kentz ke1ra
-k5erlau 2k1f8 2k1g 2k1h ki5fl 8kik king6s5 6kinh ki5os ki5sp ki5th
-\n{8ki8"o} 2k1k2 kl8 1kla 8klac k5lager kle4br k3leib 3kleid kle5isc
-4k3leit k3lek 6k5ler.  5klet 2klic 8klig k2lim k2lin 5klip 5klop k3lor
-\n{1kl"a} 2k1m kmani5e kn8 6kner k2ni \n{kn"a8} 1k2o ko1a2 ko6de.
-ko1i koi8t ko6min ko1op ko1or ko6pht ko3ra kor6d5er ko5ru ko5t6sc k3ou
-3kow 6k5ox 2k1p2 k1q 1kr8 4k3rad 2k1rec 4k3reic kre5ie 2krib 6krig
-2krip 6kroba 2ks k1sa k6sab ksal8s k8samt k6san k1sc k2s1ex k5spat
-k5spe k8spil ks6por k1spr kst8 k2s1uf 2k1t kta8l kt5a6re k8tein kte8re
-k2t1h k8tinf kt3rec kt1s 1ku ku1ch kuck8 k3uhr ku5ie kum2s1 kunfts5
-kun2s kunst3 ku8rau ku4ro kurz1 ku1st 4kusti ku1ta ku8\3 \c{ku8\9}
-6k1v 2k1w ky5n 2k1z \n{1k"a} \n{k"a4m} \n{4k3"ami} \n{k"ase5} \n{1k"o}
-\n{k"o1c} \n{k"o1s} \n{1k"u} \n{k"u1c} \n{k"ur6sc} \n{k"u1s} 1la.
-8labf 8labh lab2r 2l1abs lach3r la8dr 5ladu 8ladv 6laff laf5t la2gn
-5laken 8lamb la6mer 5lampe.  2l1amt la1na 1land lan4d3a lan4d3r lan4gr
-8lanme 6lann 8lanw \n{6lan"a} 8lappa lap8pl lap6pr l8ar.  la5ra lar4af
-la8rag la8ran la6r5a6s l3arbe la8rei 6larm.  la8sa la1sc la8sta lat8i
-6l5atm 4lauss 4lauto 1law 2lb l8bab l8bauf l8bede l4b3ins l5blo
-lbst5an lbst3e 8lc l1che l8chert l1chi lch3m l5cho lch5w 6ld l4d3ei
-ld1re \n{l6d"ub} le2bl le8bre lecht6s5 led2r 6leff le4gas 1lehr lei6br
-le8inf 8leinn 5leistu 4lektr le6l5ers lemo2 8lemp l8en.  8lends
-6lendun le8nend len8erw 6l5ents 4l3entw 4lentz 8lenzy 8leoz 6lepi
-le6pip 8lepo 1ler l6er.  8lerbs 6l5erde le8reis le8rend le4r3er 4l3erg
-l8ergr 6lerkl 6l5erzie \n{8ler"o} 8lesel lesi5e le3sko le3tha let1s
-5leuc 4leuro leu4s3t le5xe 6lexp l1f 2l1g lgend8 l8gh lglie3 lglied6
-6l1h 1li li1ar li1as 2lick li8dr li1en lien6n li8ers li8ert 2lie\3
-\c{2lie\9} 3lig li8ga8b li1g6n li1l8a 8limb li1na 4l3indu lings5
-4l3inh 6linj link4s3 4linkt 2lint 8linv lion5s6t 4lipp 5lipt 4lisam
-livi5e 6l1j 6l1k l8keim l8kj lk2l lko8f lkor8 lk2sa lk2se 6ll l1la
-ll3a4be l8labt ll8anl ll1b ll1c ll1d6 l1le l4l3eim l6l5eise ller3a
-l4leti l5lip l1lo ll3ort ll5ov ll6spr llte8 l1lu ll3urg \n{l1l"a}
-\n{l5l"u} \n{l6l"ub} 2l1m l6m5o6d 6ln l1na l1no 8lobl lo6br 3loch.
-l5o4fen 5loge.  5lohn 4l3ohr 1lok l2on 4l3o4per lo1ra 2l1ord 6lorg
-4lort lo1ru 1los.  lo8sei 3losig lo6ve lowi5 6l1p lp2f l8pho l8pn
-lp4s3te l2pt l1q 8l1r 2ls l1sa l6sarm l1sc l8sec l6s5erg l4s3ers l8sh
-l5s6la l1sp ls4por ls2pu l1str l8suni \n{l1s"u} 2l1t lt5amp l4t3ein
-l5ten l6t5eng l6t5erp l4t3hei lt3her l2t1ho l6t5i6b lti1l \n{l8tr"o}
-lt1sc lt6ser lt4s3o lt5ums lu8br lu2dr lu1en8 8lu8fe luft3a luf8tr
-lu6g5r 2luh l1uhr lu5it 5luk 2l1umf 2l1umw 1lun 6l5u6nio 4l3unte lu5ol
-4lurg 6lurs l3urt lu4sto lu3str lu6st5re lu8su lu6tal lu6t5e6g lu8terg
-lu3the lu6t5or lu2t1r lu6\35 \c{lu6\95} l1v lve5r6u 2l1w 1ly lya6
-6lymp ly1no l8zess l8zo8f l3zwei lz5wu \n{3l"and} \n{l"a5on}
-\n{l"a6sc} \n{l"at1s} \n{5l"auf} \n{2l"aug} \n{l"au6s5c} \n{l"a5v}
-\n{l1"ol} \n{1l"os} \n{l"o1\36t} \n{\c{l"o1\96t}} \n{6l1"ube} 1ma
-8mabg ma5chan mad2 ma5el 4magg mag8n ma1la ma8lau mal5d 8malde mali5e
-malu8 ma8lut 2m1amp 3man mand2 man3ds 8mangr mani5o 8m5anst 6mappa
-4m3arbe mar8kr ma1r4o mar8schm 3mas ma1sc \n{ma1t"o} 4m5auf ma5yo 2m1b
-mb6r 2m1c 2m1d \n{md6s"a} 1me me1ch me5isc 5meld mel8sa 8memp me5nal
-men4dr men8schl men8schw 8mentsp me1ra mer4gl me1ro 3mes me6s5ei me1th
-me8\3 \c{me8\9} 2m1f6 2m1g 2m1h 1mi mi1a mi6ale mi1la 2m1imm mi1na
-\n{mi5n"u} mi4s3an mit1h mi5t6ra 3mitt mitta8 mi6\35 \c{mi6\95} 6mj
-2m1k8 2m1l 2m1m m6mad m6m5ak m8menth m8mentw mme6ra m2mn mm5sp mm5ums
-mmut5s \n{m8m"an} m1n8 m5ni 1mo mo5ar mo4dr 8mof mo8gal mo4kla mol5d
-m2on mon8do mo4n3od mont8a 6m5ony mopa6 mo1ra mor8d5a mo1sc mo1sp 5mot
-moy5 2mp m1pa mpfa6 mpf3l mphe6 m1pi mpin6 m1pl mp2li m2plu mpo8ste
-m1pr \n{mpr"a5} mp8th mput6 mpu5ts \n{m1p"o} 8m1q 2m1r 2ms ms5au m1sc
-msch4l ms6po m3spri m1str 2m1t mt1ar m8tein m2t1h mt6se \n{mt8s"a}
-mu5e 6m5uh mumi1 1mun mun6dr muse5e mu1ta 2m1v mvol2 mvoll3 2m1w 1my
-2m1z \n{m"a6kl} \n{1m"an} \n{m"a1s} \n{m"a5tr} \n{m"au4s3c} \n{3m"a\3}
-\n{\c{3m"a\9}} \n{m"ob2} \n{6m"ol} \n{1m"u} \n{5m"un} \n{3m"ut} 1na.
-n5ab.  8nabn n1abs n1abz \n{na6b"a} na2c nach3e 3nacht 1nae na5el
-n1afr 1nag 1n2ah na8ha na8ho 1nai 6nair na4kol n1akt nal1a 8naly 1nama
-na4mer na1mn n1amp 8n1amt 5nanc nan6ce n1and n6and.  2n1ang 1nani
-1nann n1ans 8nanw 5napf.  1n2ar.  na2ra 2n1arc n8ard 1nari n8ark
-6n1arm 5n6ars 2n1art n8arv 6natm nat6s5e 1naue 4nauf n3aug 5naui n5auk
-na5um 6nausb 6nauto 1nav 2nax 3naz 1na\3 \c{1na\9} n1b2 nbau5s n1c
-nche5e nch5m 2n1d nda8d n2d1ak nd5ans n2d1ei nde8lac ndel6sa n8derhi
-nde4se nde8stal n2dj ndnis5 n6d5or6t nd3rec nd3rot nd8samt nd6sau
-ndt1h n8dumd 1ne ne5as ne2bl 6n5ebn 2nec 5neei ne5en ne1g4l 2negy
-4n1ein 8neis 4n3e4lem 8nemb 2n1emp nen1a 6n5energ nen3k 8nentb
-4n3en3th 8nentl 8n5entn 8n5ents ne1ra ne5r8al ne8ras 8nerbi 6n5erde.
-nere5i6d nerfor6 \n{6n5erh"o} \n{8nerl"o} 2n1err n8ers.  6n5ertra
-2n1erz nesi3e net1h neu4ra neu5sc 8neu\3 \c{8neu\9} n1f nf5f nf2l
-nflei8 nf5lin nft8st n8g5ac ng5d ng8en nge8ram ngg2 ng1h n6glic ng3rip
-ng8ru ng2se4 ng2si n2g1um n1gy \n{n8g"al} n1h nhe6r5e 1ni ni1bl
-\n{ni5ch"a} ni8dee n6ie ni1en nie6s5te niet5h ni8etn 4n3i6gel n6ik
-ni1la 2n1imp ni5na 2n1ind 8ninf 6n5inh ni8nit 6n5inn 2n1ins 4n1int
-n6is ni3str ni1th ni1tr n1j n6ji n8kad nk5ans n1ke n8kerla n1ki nk5inh
-\n{n5kl"o} n1k2n n8k5not nk3rot \n{n8kr"u} nk5spo nk6t5r n8kuh
-\n{n6k"ub} n5l6 nli4mi n1m nmen4s n1na n8nerg nni5o n1no nn4t3ak nnt1h
-nnu1e n1ny \n{n1n"a} \n{n1n"o} \n{n1n"u} no5a no4b3la 4n3obs 2nobt
-noche8 no6die no4dis no8ia no5isc 6n5o6leu no4mal noni6er 2n1onk n1ony
-4n3o4per 6nopf 6nopti no3ra no4ram nor6da 4n1org 2n1ort n6os no1st
-8nost.  no8tan no8ter noty6pe 6n5ox n1p2 n1q n1r \n{nr"os3} 6ns n1sac
-ns3ang n1sc n8self n8s5erf n8serg n6serk ns5erw n8sint n1s2pe n1spr
-n6s5tat.  n5s6te.  n6stob n1str n1ta n4t3a4go nt5anh nt3ark nt3art
-n1te nt3eis nte5n6ar nte8nei nter3a nte6rei nt1ha nt6har n3ther nt5hie
-n3thus n1ti nti1c n8tinh nti1t ntlo6b ntmen8 n1to nt3o4ti n1tr ntra5f
-ntra5ut nt8rea nt3rec nt8rep n4t3rin nt8rop n4t3rot \n{n4tr"u} nt1s
-nts6an nt2sk n1tu nt1z \n{n1t"a} \n{n1t"o} \n{n8t"ol} \n{n1t"u} 1nu
-nu1a nu5el nu5en 4n1uhr nu5ie 8numl 6n5ums 6n5umw 2n1und 6nuni 6n5unr
-2n1unt 2nup 2nu6r n5uri nu3skr nu5ta n1v 8n1w 1nys n1za n6zab n2z1ar
-n6zaus nzi4ga n8zof n6z5unt n1zw n6zwir \n{1n"ac} \n{5n"ae} \n{5n"ai}
-\n{n8"al} \n{n"a6m} \n{n"a6re} \n{n5"arz} \n{5n"aus} \n{n1"ol}
-\n{1n"ot} \n{n5"oz} \n{5n"u.} \n{6n1"u2b} \n{5n"u\3} \n{\c{5n"u\9}}
-o5ab.  oa2l o8ala o1a2m o1an ob1ac obe4ra o6berh 5o4bers o4beru
-obe6ser 1obj o1bl o2bli ob5sk 3obst.  ob8sta obst5re ob5sz o1che
-oche8b o8chec o3chi och1l och3m ocho8f o3chro och3to o3chu och1w o1d
-o2d1ag od2dr ode5i ode6n5e od1tr o5e6b o5e6der.  oe8du o1ef o1e2l
-o1e2p o1er.  o5e8x o1fa of8fan 1offi of8fin of6f5la o5fla o1fr 8o1g
-og2n o1ha o1he o6h5eis o1hi ohl1a oh1le oh4l3er 5ohm.  oh2ni o1ho
-oh1re oh1ru o1hu oh1w o1hy \n{o1h"a} o5ia o1id.  o8idi oi8dr o5ids
-o5isch.  oiset6 o1ism o3ist.  o5i6tu o1j o1k ok2l ok3lau \n{o8kl"a}
-1okta o1la old5am old5r o1le ole5in ole1r ole3u ol6gl ol2kl olk4s1
-ol8lak ol8lauf.  ol6lel ol8less o1lo ol1s ol6sk o1lu oly1e2 5olym
-o2mab om6an o8mau ombe4 o8merz om5sp o1mu o8munt \n{o1m"a} \n{o1m"o}
-o1na ona8m on1ax on8ent o6n5erb 8oni oni5er.  on1k on6n5a6b o1no ono1c
-o4nokt 1ons onts8 \n{o1n"a} oo8f 1oog oo2pe oo2sa o1pa 3o4pera o3pfli
-opf3lo opf3r o1pi o1pl o2pli o5p6n op8pa op6pl o1pr o3p4ter 1opti
-\n{o1p"a} \n{o5p"o} o1q o1ra.  o3rad o8radd 1oram o6rang o5ras o8rauf
-or5cha or4d3a4m or8dei or8deu 1ordn or4dos o1re o5re.  ore2h o8r5ein
-ore5isc or6enn or8fla or8fli 1orga 5orgel.  or2gl o1ri 5o6rient or8nan
-\n{or8n"a} o1ro or1r2h or6t5an or8tau or8tere o1rus o1ry \n{o1r"a}
-\n{or1"u2} o1sa osa3i 6ose o8serk o1sk o6ske o6ski os2kl os2ko os2kr
-osni5e o2s1o2d o3s4per o4stam o6stau o3stra ost3re osu6 o6s5ur o5s6ze
-o1ta ot3auf o6taus o1te o6terw o1th othe5u o2th1r o1ti o1to oto1a
-ot1re o1tri o1tro ot1sc o3tsu ot6t5erg ot2t3h ot2t5r \n{ot8t"o} o1tu
-ou3e ouf1 ou5f6l o5u6gr ou5ie ou6rar ou1t6a o1v o1wa o1we o6wer.  o1wi
-owid6 o1wo o5wu o1xe oy5al.  oy1e oy1i o5yo o1z oza2r 1o2zea ozo3is
-\n{o"o8} o\35elt \c{o\95elt} o\31t \c{o\91t} 3paa pa6ce 5pad pag2 1pak
-pa1la pa8na8t pani5el pa4nor pan1s2 1pap pap8s pa8rei par8kr paro8n
-par5o6ti part8e 5partei 3partn pas6sep pa4tha 1pau 6paug pau3sc p1b
-8p5c 4p1d 1pe 4peic pe5isc 2pek pen3k pen8to8 p8er pe1ra pere6 per5ea
-per5eb pe4rem 2perr per8ran 3pers 4persi \n{pe3r"u} pe4sta pet2s
-p2f1ec p4fei pf1f pf2l 5pflanz pf8leg pf3lei 2pft pf3ta p1g 1ph 2ph.
-2p1haf 6phb 8phd 6p5heit ph5eme 6phg phi6e 8phk 6phn p5holl pht2
-ph3tha 4ph3the phu6 6phz pi1en pi5err pi1la pi1na 5pinse pioni8e 1pis
-pi1s2k pi1th p1k pl8 5pla p2lau 4plei p3lein 2pler 6p5les 2plig p6lik
-6p5ling p2liz plo8min 6p1m p1n 1p2o 8poh 5pol po8lan poly1 po3ny po1ra
-2porn por4t3h \n{po5r"o} 5poti p1pa p6p5ei ppe6la pp5f p2p1h p1pi pp1l
-ppp6 pp5ren pp1s \n{p5p"o} pr6 3preis 1pres 2p3rig 5prinz 1prob 1prod
-5prog pro8pt pro6t5a prote5i 8pro\3 \c{8pro\9} \n{pr"a3l} \n{1pr"as}
-\n{pr"ate4} \n{1pr"uf} p5schl 2pst 1p2sy p1t p8to8d pt1s 5p6ty 1pu
-pu1b2 2puc pu2dr puf8fr 6p5uh pun8s pu8rei pu5s6h pu1ta p1v p3w 5py
-py5l p1z \n{p"a6der} \n{p5"a6m} \n{p"a8nu} \n{8p"ar} \n{p"at5h}
-\n{p"at1s} qu6 1qui 8rabk ra6bla 3rable ra2br r1abt 6rabz ra4dan ra2dr
-5rafal ra4f3er ra5gla ra2g3n 6raha ral5am 5rald 4ralg ra8lins 2rall
-ral5t 8ramei r3anal r6and ran8der ran4dr 8ranf 6ranga 5rangi ran8gli
-r3angr rans5pa 8ranw r8anz.  ra5or 6rapf ra5pl rap6s5er 2r1arb 1rarh
-r1arm ra5ro 2r1art 6r1arz ra8tei ra6t5he 6ratl ra4t3ro r5atta raue4n
-6raus.  r5austa rau8tel raut5s ray1 r1b rb5lass r6bler rb4lie rbon6n
-r8brecht \n{rb6s5t"a} r8ces r1che rch1l rch3m rch3re rch3tr rch1w 8rd
-r1da r8dachs r8dap rda5ro rde5ins rdio5 r8dir rd3ost r1dr r8drau 1re.
-re1ak 3reakt re3als re6am.  re1as 4reben re6bl rech5a r8edi re3er
-8reff 3refl 2reh 5reha r4ei.  reich6s5 8reier 6reign re5imp 4r3eina
-6r3einb 6reing 6r5einn 6reinr 4r3eins r3eint reli3e 8r5elt 6rempf
-2remt ren5a6b ren8gl r3enni 1reno 5rente 4r3enth 8rentl 4r3entw 8rentz
-ren4zw re1on requi5 1rer rer4bl 6rerbs 4r3erd \n{8rerh"o} 8rerkl
-4r3erla \n{8rerl"o} 4r3erns \n{6r5ern"a} rer5o 6r5erreg r5ertr r5erwec
-\n{r5er"o} re2sa re8schm 2ress re5u8ni 6rewo 2r1ex r1f r8ferd rf4lie
-8r1g r8gah rge4bl rge5na rgest4 rg6ne r2gni2 r8gob r4g3ret rg8sel r1h8
-r2hy 5rhyt ri1ar ri5cha rid2g r2ie rieg4s5 ri8ei ri1el ri6ele ri1en
-ri3er.  ri5ers.  ri6fan ri8fer ri8fr 1r2ig ri8kn ri5la \n{rim"a8}
-ri1na r8inde rin4ga rin6gr 1rinn 6rinner rino1 r8insp 4rinst
-\n{ri1n"a} ri5o6ch ri1o2d ri3o6st 2r1ir r2is ri3sko ri8spr \n{ri8st"u}
-ri5sv r2it 6r5i6tal ri5tr ri6ve.  8r1j 6rk r1ke rkehrs5 r1ki r3klin
-r1k2n rk3str rk4t3an rk6to r6kuh \n{rk"a4s3t} r1l r5li rline5a 6r1m
-r6manl rma4p r4m3aph r8minf r8mob rm5sa 2rn r1na rna8be r5ne rn2ei
-r6neif r6nex r6nh rn1k r1no r6n5oc rn1sp \n{r1n"a} \n{r1n"u} ro6bern
-6robs ro1ch 3rock.  ro5de ro1e 4rofe ro8hert 1rohr ro5id ro1in ro5isc
-6rolym r2on 6roog ro6phan r3ort ro1s2p ro5s6w ro4tau ro1tr ro6ts 5rout
-r1p rpe8re rp2f r2ps r2pt r1q 2rr r1ra r1re rrer6 rr6hos \n{r5rh"o}
-r1ri r1ro rro8f rr8or rror5a r1ru r3ry \n{r1r"a} \n{r1r"o} \n{r1r"u}
-2r1s r6sab r4sanf rse6e rse5na r2sh r6ska r6ski rs2kl r8sko r2sl rs2p
-r6stauf r8sterw r8stran rswi3d4 r2sz 2r1t rt3art r8taut r5tei rt5eige
-r8tepe r4t3erh r8terla r4t3hei r5t6hu r4t3int rt5reif rt1sc rt6ser
-rt6s5o rt6s5u rt5und r8turt rube6 ru1en 1r4uf ruf4st ru1ie 2r1umg
-2r1uml 2rums run8der run4d5r 6rundz 6runf 8runs 2r1unt 2r1ur r6us
-ru6sta ru3str ru6tr 1ruts r1v rven1 rvi2c r1w r1x r1za rz5ac r6z5al
-r8z1ar r8zerd r6z5erf rz8erh rz4t3h r8zum \n{r"a4ste} \n{r"au8sc}
-\n{r1"of} \n{5r"ohr} \n{r"o5le} \n{3r"oll} \n{5r"omis} \n{r1"or}
-\n{r"o2sc} \n{3r"ump} 1sa.  1saa s3a4ben sa2bl 2s1abs 6s1abt 6sabw
-3sack.  6s3a4der 1saf sa1fa 4s1aff sa5fr 1sag 1sai sa1i2k1 4s1akt 1sal
-sa1la 4s3alpi 6salter salz3a 1sam s5anb san2c 1sand s5angeh 6sanl
-2s1ans 6s3antr 8s1anw s1ap s6aph 8sapo sap5p6 s8ar.  2s1arb 3sarg
-s1arm sa5ro 2s1art 6s1arz 1sas 1sat sat8a 2s1atl sa8tom 3s8aue s5auff
-sau5i s6aur 2s1aus 5s6ause 2s1b2 2sca s4ce 8sch.  3scha.  5schade
-3schaf 3schal sch5ame 8schanc 8schb 1sche 6schef 8schex 2schf 2schg
-2schh 1schi 2schk 5schlag 5schlu \n{6schm"a\3} \n{\c{6schm"a\9}}
-6schna\3 \c{6schna\9} 1scho 6schord 6schp 3schri 8schric 8schrig
-8schrou 6schs 2scht sch3ta sch3tr 1schu 8schunt 6schv 2schz \n{5sch"o}
-\n{5sch"u} 2sco scre6 6scu 2s1d 1se se5an se1ap se6ben se5ec see5i6g
-se3erl 8seff se6han se8hi \n{se8h"o} 6s5eid.  2s1eig s8eil 5sein.
-sei5n6e 6s5einh 3s8eit 3sel.  se4lar selb4 6s3e4lem se8lerl 2s1emp
-sen3ac se5nec 6s5ents 4sentz s8er.  se8reim ser5inn \n{8serm"a}
-8s5erzi \n{6ser"of} se1um 8sexa 6sexp 2s1f2 sfal8ler 2s3g2 sge5b2 s1h
-s8hew 5s6hip 5s4hop 1si 2siat si1b sicht6s 6s5i6dee siege6s5 si1en
-si5err si1f2 si1g2n si6g5r si8kau sik1i si4kin si2kl \n{si8k"u} si1la
-sil6br si1na 2s1inf sin5gh 2s1inh sinne6s5 2s1ins si5ru si5str 4s1j
-s1k2 6sk.  2skau skel6c skelch5 s6kele 1s2ki.  3s4kin.  s6kiz s8kj
-6skn 2skow 3skrib 3skrip 2sku \n{8sk"u} s1l s8lal slei3t s4low 2s1m
-s1n 6sna 6snot 1so so1ch 2s1odo so4dor 6s5o4fen solo3 s2on so5of 4sope
-so1ra 2s1ord 4sorga sou5c so3un 4s3ox sp2 8spaa 5spal 1span 2spap
-s2pec s4peis 1spek s6perg 4spers s6pes 2s1pf 8sphi \n{1s2ph"a} 1spi
-spi4e 6s5pig 6spinse 2spis 2spla 2spol 5s6pom 6s5pos 6spoti 1spra
-3s8prec 6spreis 5spring 6sprob 1spru s2pul 1s2pur 6spy \n{5sp"an}
-\n{1sp"u} s1q 2s1r 2s1s2 sse8nu ssini6s ssoi6r 2st.  1sta 4stafe 2stag
-sta3la 6stale 4stalg 8stalk 8stamt 6st5anf 4stans 6stanw 6starb sta4te
-6staus 2stb 6stc 6std 1ste 4steil 3s2tel st3elb 8stemb 6steppi 8stese
-8stesse 6stf 2stg 2sth st1ha st3hei s8t1hi st1ho st5hu 1sti sti4el
-4stigm sti3na 6stind 4stinf sti8r 2stk 2stl 2stm 1sto 6stoll.  4st3ope
-6stopf.  6stord 6stp 5stra.  4strai 3s4tral 6s5traum 3stra\3
-\c{3stra\9} 3strec 6s3tref 8streib 5streif 6streno 6stres 6strev
-5s6tria 6strig 5strik 8strisi 3s4troa s8troma st5rose 4struf 3strum
-\n{6str"ag} 2st1s6 2stt 1stu stu5a 4stuc 2stue 8stun.  2stv 2stw s2tyl
-6stz \n{1st"a} \n{8st"ag} \n{1st"o} \n{1st"u} \n{8st"uch} \n{4st"ur.}
-1su su2b1 3suc su1e su2fe su8mar 6sumfa 8sumk 2s1unt sup1p2 6s5u6ran
-6surte 2s1v 2s1w 1sy 8syl.  sy5la syn1 sy2na syne4 s1z s4zend 5s6zene.
-8szu \n{1s"a} \n{6s5"and} \n{6s"augi} \n{6s"au\3} \n{\c{6s"au\9}}
-\n{5s"om} \n{2s1"u2b} \n{1s"uc} \n{s"u8di} \n{1s"un} \n{5s"u\3}
-\n{\c{5s"u\9}} taats3 4tab.  taba6k ta8ban tab2l ta6bre 4tabs t3absc
-8tabz 6t3acht ta6der 6tadr tad6s tad2t 1tafe4 1tag ta6ga6 ta8gei
-tage4s tag6s5t tah8 tahl3 tai6ne.  ta5ir.  tak8ta tal3au 1tale ta8leng
-tal5ert 6t5a6mer 6tamp tampe6 2t1amt tan5d6a tan8dr tands5a tani5e
-6tanl 2tanr t3ans 8t5antr tanu6 t5anw 8tanwa tan8zw ta8rau 6tarbe
-1tari 2tark 2t1arm ta1ro 2tart t3arti 6tarz ta1sc ta6sien ta8stem
-ta8sto t5aufb 4taufn 8taus.  5tause 8tausf 6tausg t5ausl 2t1b2 2t1c
-t6chu 2t1d te2am tea4s te8ben 5techn 4teff te4g3re te6hau 2tehe te4hel
-2t1ehr te5id.  teig5l 6teign tei8gr 1teil 4teinh t5einhe 4teis t5eisen
-8teiw te8lam te4lar 4telek 8telem te6man te6n5ag ten8erw ten5k tens4p
-ten8tro 4t3entw 8tentz te6pli 5teppi ter5a6b te3ral ter5au 8terbar
-t5erbe.  6terben 8terbs 4t3erbt t5erde.  ter5ebe ter5ein te8rers terf4
-\n{8terh"o} \n{6terkl"a} ter8nor ter6re.  t8erscha t5e6sel te8stau
-t3euro te1xa tex3e 8texp tex6ta 2t1f2 2t1g2 2th.  th6a 5tha.  2thaa
-6t1hab 6t5haf t5hah 8thak 3thal.  6thals 6t3hand 2t1hau 1the.  3t4hea
-t1heb t5heil t3heit t3helf 1theo 5therap 5therf 6t5herz 1thes 1thet
-5thi.  2t1hil t3him 8thir 3this t5hj 2th1l 2th1m th1n t5hob t5hof
-4tholz 6thopti 1thr6 4ths t1hum 1thy \n{4t1h"a} \n{2t1h"o} \n{t1h"u}
-ti1a2m ti1b tie6fer ti1en ti8gerz tig3l ti8kin ti5lat 1tilg t1ind
-tin4k3l ti3spa ti5str 5tite ti5tr ti8vel ti8vr 2t1j 2t1k2 2t1l tl8a
-2t1m8 2t1n 3tobe 8tobj to3cha 5tocht 8tock tode4 to8del to8du to1e
-6t5o6fen to1in toi6r 5toll.  to8mene t2ons 2t1ony to4per 5topf.  6topt
-to1ra to1s to6ska tos2l 2toti to1tr t8ou 2t1p2 6t1q tr6 tra5cha
-tra8far traf5t 1trag tra6gl tra6gr t3rahm 1trai t6rans tra3sc tra6st
-3traue t4re.  2trec t3rech t8reck 6t1red t8ree 4t1reg 3treib 4treif
-8t3reis 8trepo tre6t5r t3rev 4t3rez 1trib t6rick tri6er 2trig t8rink
-tri6o5d trizi5 tro1a 3troc trocke6 troi8d tro8man.  tro3ny 5tropf
-6t5rosa t5ro\3 \c{t5ro\9} 5trub 5trup trut5 \n{1tr"ag} \n{6t1r"oh}
-\n{5tr"ub} \n{tr"u3bu} \n{t1r"uc} \n{t1r"us} 2ts ts1ab t1sac tsa8d
-ts1ak t6s5alt ts1an ts1ar ts3auf t3schr \n{t5sch"a} tse6e tsee5i
-tsein6s ts3ent ts1er t8serf t4serk t8sh 5t6sik t4s3int ts5ort.
-t5s6por t6sprei t1st t6s5tanz ts1th t6stit t4s3tor 1t2sua t2s1uf
-t8sum.  t2s1u8n t2s1ur 2t1t tt5eif tte6sa tt1ha tt8ret tt1sc tt8ser
-tt5s6z 1tuc tuch5a 1tu1e 6tuh t5uhr tu1i tu6it 1tumh 6t5umr 1tums
-8tumt 6tund 6tunf 2t1unt tu5ra tu6rau tu6re.  tu4r3er 2t1v 2t1w 1ty1
-ty6a ty8la 8tym 6ty6o 2tz tz5al tz1an tz1ar t8zec tzeh6 tzehn5 t6z5ei.
-t6zor t4z3um \n{t6z"au} \n{5t"ag} \n{6t"ah} \n{t5"alt} \n{t8"an}
-\n{t"are8} \n{8t"a8st} \n{6t"au\3} \n{\c{6t"au\9}} \n{t5"offen}
-\n{8t"o8k} \n{1t"on} \n{4t"ub} \n{t6"u5ber.} \n{5t"uch} \n{1t"ur.}
-u3al.  u5alb u5alf u3alh u5alk u3alp u3an.  ua5na u3and u5ans u5ar.
-ua6th u1au ua1y u2bab ubi5er.  u6b5rit ubs2k \n{u5b"o} \n{u8b"ub} 2uc
-u1che u6ch5ec u1chi uch1l uch3m uch5n uch1r uch5to ucht5re u1chu uch1w
-uck1a uck5in u1d ud4a u1ei u6ela uene8 u6ep u1er uer1a ue8rerl uer5o
-u8esc u2est u8ev u1fa u2f1ei u4f3ent u8ferh uf1fr uf1l uf1ra uf1re
-\n{uf1r"a} \n{uf1r"u} uf1s2p uf1st uft1s u8gabt u8gad u6gap ugeb8 u8gn
-ugo3s4 u1ha u1he u1hi uh1le u1ho uh1re u1hu uh1w \n{u1h"a} \n{u1h"o}
-6ui ui5en u1ig u3ins uin8tes u5isch.  u1j 6uk u1ke u1ki u1kl u8klu
-u1k6n u5ky u1la uld8se u1le ul8lac ul6lau ul6le6l ul6lo ulni8 u1lo
-ulo6i ult6a ult8e u1lu ul2vr \n{u1l"a} \n{u1l"o} 3umfan 5umlau umo8f
-um8pho u1mu umu8s \n{u5m"o} u1n1a un2al un6at unau2 6und.  5undein
-un4d3um 3undzw \n{und"u8} \n{un8d"ub} une2b un1ec une2h un3eis 3unfal
-\n{1unf"a} 5ungea \n{3ungl"u} ung2s1 \n{un8g"a} 1u2nif un4it un8kro
-unk5s u1no unpa2 uns2p unvol4 unvoll5 u5os.  u1pa u1pi u1p2l u1pr
-up4s3t up2t1a u1q u1ra ur5abs ura8d ur5ah u6rak ur3alt u6rana u6r5ans
-u8rap ur5a6ri u8ratt u1re ur3eig ur8gri u1ri ur5ins 3urlau urmen6
-ur8nan u1ro 3ursac ur8sau ur8sei ur4sk 3urtei u1ru uru5i6 uru6r u1ry
-ur2za \n{ur6z"a} \n{ur5"a6m} \n{u5r"o} \n{u1r"u} \n{ur"uck3} u1sa
-usa4gi u2s1ar u2s1au u8schec usch5wi u2s1ei use8kel u8sl u4st3a4b
-us3tau u3s4ter u2s1uf u8surn ut1ac u1tal uta8m u1tan ut1ar u1tas ut1au
-u1te u8teic u4tent u8terf u6terin u4t3hei ut5ho ut1hu u1ti utine5
-uti6q u1to uto5c u1tr ut1sa ut1s6p ut6stro u1tu utz5w u1u u1v uve5n
-\n{uve3r4"a} u1w u1xe u5ya uy5e6 u1yi u2z1eh u8zerh \n{u5"o} u\3e6n
-\c{u\9e6n} u\3en5e \c{u\9en5e} 8vanb 6vang 6varb var8d va6t5a va8tei
-va2t1r 2v1b 6v5c 6vd 1ve 6ve5g6 ver1 ver5b verb8l ve2re2 verg8 ve2ru8
-ve1s ve2s3p ve3xe 2v1f 2v1g 6v5h vi6el vie6w5 vi1g4 vi8leh vil6le.
-8vint vi1ru vi1tr 2v1k 2v1l 2v1m 4v5n 8vo8f voi6le vol8lend vol8li
-v2or1 vo2re vo8rin vo2ro 2v1p 8vra v6re 2v1s 2v1t 2v1v 4v3w 2v1z
-waffe8 wa6g5n 1wah wah8n wa5la wal8din wal6ta wan4dr 5ware wa8ru
-war4za 1was w5c w1d 5wech we6fl 1weg we8geng weg5h weg3l we2g1r
-weh6r5er 5weise weit3r wel2t welt3r we6rat 8werc 5werdu wer4fl 5werk.
-wer4ka wer8ku wer4ta wer8term we2sp we8stend we6steu we8str
-\n{we8st"o} wet8ta wich6s5t 1wid wi2dr wiede4 wieder5 wik6 wim6ma
-win4d3r 5wirt wisch5l 1wj 6wk 2w1l 8w1n wo1c woche6 wol6f wor6t5r 6ws2
-w1sk 6w5t 5wunde.  wun6gr wu1sc wu2t1 6w5w wy5a \n{w"arme5} \n{w"a1sc}
-1xag x1ak x3a4men 8xamt x1an 8x1b x1c 1xe.  x3e4g 1xen xe1ro x1erz
-1xes 8xf x1g 8x1h 1xi 8xid xi8so 4xiste x1k 6x1l x1m 8xn 1xo 8x5o6d
-8x3p2 x1r x1s6 8x1t x6tak x8terf x2t1h 1xu xu1e x5ul 6x3w x1z 5ya.
-y5an.  y5ank y1b y1c y6cha y4chia y1d yen6n y5ern y1g y5h y5in y1j
-y1k2 y1lak yl1al yla8m y5lax y1le y1lo y5lu y8mn ym1p2 y3mu y1na yno2d
-yn1t y1on.  y1o4p y5ou ypo1 y1pr y8ps y1r yri3e yr1r2 y1s ys5iat ys8ty
-y1t y3w y1z \n{y"a8m} z5a6b zab5l 8za6d 1zah za5is 4z3ak 6z1am 5zange.
-8zanl 2z1ara 6z5as z5auf 3zaun 2z1b 6z1c 6z1d 1ze ze4dik 4z3eff 8zein
-zei4ta zei8ters ze6la ze8lec zel8th 4zemp 6z5engel zen8zin \n{8zerg"a}
-zer8i ze1ro zers8 zerta8 zer8tab zer8tag 8zerz ze8ste zeu6gr 2z1ex
-2z1f8 z1g 4z1h 1zi zi1en zi5es.  4z3imp zi1na 6z5inf 6z5inni zin6s5er
-8zinsuf zist5r zi5th zi1tr 6z1j 2z1k 2z1l 2z1m 6z1n 1zo zo6gl 4z3oh
-zo1on zor6na8 4z1p z5q 6z1r 2z1s8 2z1t z4t3end z4t3hei z8thi 1zu zu3al
-zu1b4 zu1f2 6z5uhr zun2a 8zunem zunf8 8zungl zu1o zup8fi zu1s8 zu1z
-2z1v zw8 z1wal 5zweck zwei3s z1wel z1wer z6werg 8z5wes 1zwi zwi1s
-6z1wo 1zy 2z1z zz8a zzi1s \n{1z"a} \n{1z"o} \n{6z"ol.} \n{z"o1le}
-\n{1z"u} \n{2z1"u2b} \n{"a1a6} \n{"ab1l} \n{"a1che} \n{"a3chi}
-\n{"ach8sc} \n{"ach8sp} \n{"a5chu} \n{"ack5a} \n{"ad1a} \n{"ad5era}
-\n{"a6d5ia} \n{"a1e} \n{"a5fa} \n{"af1l} \n{"aft6s} \n{"ag1h}
-\n{"ag3le} \n{"a6g5nan} \n{"ag5str} \n{"a1he} \n{"a1hi} \n{"ah1le}
-\n{"ah5ne} \n{1"ahnl} \n{"ah1re} \n{"ah5ri} \n{"ah1ru} \n{"a1hu}
-\n{"ah1w} \n{6"ai} \n{"a1isc} \n{"a6ische} \n{"a5ism} \n{"a5j}
-\n{"a1k} \n{"al1c} \n{"a1le} \n{"a8lei} \n{"al6schl} \n{"ami1e}
-\n{"am8n} \n{"am8s} \n{"a5na} \n{5"anderu} \n{"ane5i8} \n{"ang3l}
-\n{"ank5l} \n{"a1no} \n{"an6s5c} \n{"a1pa} \n{"ap6s5c} \n{3"aq}
-\n{"ar1c} \n{"a1re} \n{"are8m} \n{5"argern} \n{"ar6gl} \n{"a1ri}
-\n{3"armel} \n{"a1ro} \n{"art6s5} \n{"a1ru} \n{3"arztl} \n{"a5r"o}
-\n{"a6s5chen} \n{"asen8s} \n{"as1th} \n{"ata8b} \n{"a1te} \n{"ateri4}
-\n{"ater5it} \n{"a6thy} \n{"a1ti} \n{3"atk} \n{"a1to} \n{"at8schl}
-\n{"ats1p} \n{"a5tu} \n{"aub1l} \n{"au1e} \n{1"aug} \n{"au8ga}
-\n{"au5i} \n{"a1um.} \n{"a1us.} \n{1"au\3} \n{\c{1"au\9}} \n{"a1z}
-\n{"o1b} \n{"o1che} \n{"o5chi} \n{"och8stei} \n{"och8str} \n{"ocht6}
-\n{5"o6dem} \n{5"offn} \n{"o1he} \n{"oh1l8} \n{"oh1re} \n{"o1hu}
-\n{"o1is} \n{"o1ke} \n{1"o2ko} \n{1"ol.} \n{"ol6k5l} \n{"ol8pl}
-\n{"o1mu} \n{"o5na} \n{"onig6s3} \n{"o1no} \n{"o5o6t} \n{"opf3l}
-\n{"op6s5c} \n{"o1re} \n{"or8gli} \n{"o1ri} \n{"or8tr} \n{"o1ru}
-\n{5"osterr} \n{"o1te} \n{"o5th} \n{"o1ti} \n{"o1tu} \n{"o1v} \n{"o1w}
-\n{"owe8} \n{"o2z} \n{"ub6e2} \n{3"u4ber1} \n{"ub1l} \n{"ub1r}
-\n{5"u2bu} \n{"u1che} \n{"u1chi} \n{"u8ch3l} \n{"uch6s5c} \n{"u8ck}
-\n{"uck1a} \n{"uck5ers} \n{"ud1a2} \n{"u6deu} \n{"udi8t} \n{"u2d1o4}
-\n{"ud5s6} \n{"uge4l5a} \n{"ug1l} \n{"uh5a} \n{"u1he} \n{"u8heh}
-\n{"u6h5erk} \n{"uh1le} \n{"uh1re} \n{"uh1ru} \n{"u1hu} \n{"uh1w}
-\n{"u3k} \n{"u1le} \n{"ul4l5a} \n{"ul8lo} \n{"ul4ps} \n{"ul6s5c}
-\n{"u1lu} \n{"un8da} \n{"un8fei} \n{"unk5l} \n{"un8za} \n{"un6zw}
-\n{"u5pi} \n{"u1re} \n{"u8rei} \n{"ur8fl} \n{"ur8fr} \n{"ur8geng}
-\n{"u1ri} \n{"u1ro} \n{"ur8sta} \n{"ur8ster} \n{"u1ru} \n{"use8n}
-\n{"u8sta} \n{"u8stes} \n{"u6s5tete} \n{"u3ta} \n{"u1te} \n{"u1ti}
-\n{"ut8tr} \n{"u1tu} \n{"ut8zei} \n{"u1v} \31a8 \c{\91a8} 5\3a.
-\c{5\9a.} \38as \c{\98as} \31b8 \c{\91b8} \31c \c{\91c} \31d \c{\91d}
-1\3e \c{1\9e} \35ec \c{\95ec} 8\3e8g \c{8\9e8g} 8\3e8h \c{8\9e8h}
-2\31ei \c{2\91ei} 8\3em \c{8\9em} \31f8 \c{\91f8} \31g \c{\91g} \31h
-\c{\91h} 1\3i \c{1\9i} \31k \c{\91k} \31l \c{\91l} \31m \c{\91m}
-\3mana8 \c{\9mana8} \31n \c{\91n} \31o \c{\91o} \31p8 \c{\91p8} \35q
-\c{\95q} \31r \c{\91r} \31s2 \c{\91s2} \3st8 \c{\9st8} \31ta \c{\91ta}
-\31te \c{\91te} \3t3hei \c{\9t3hei} \31ti \c{\91ti} \35to \c{\95to}
-\31tr \c{\91tr} 1\3u8 \c{1\9u8} 6\35um \c{6\95um} \31v \c{\91v} \31w
-\c{\91w} \31z \c{\91z}
-}%
-\endgroup
-\relax\endinput
-%
-% -----------------------------------------------------------------
-%
-% =============== Additional Documentation ===============
-%
-%
-% Older Versions of German Hyphenation Patterns:
-% ----------------------------------------------
-%
-% All older versions of `ghyphen.tex' distributed as
-%
-%       ghyphen.tex/germhyph.tex   as of 1986/11/01
-%       ghyphen.min/ghyphen.max    as of 1988/10/10
-%       ghyphen3.tex               as of 1990/09/27 & 1991/02/13
-%       ghyph31.tex                as of 1994/02/13
-%
-% are out of date and it is recommended to replace them
-% with the new version `dehypht.tex' as of 1999/03/03.
-%
-% If you are using `ghyphen.min' (a minor version of `ghyphen')
-% because of limited trie memory space, try this version and if
-% the space is exceeded get a newer TeX implementation with
-% larger or configurable trie memory sizes.
-%
-%
-%
-% Trie Memory Requirements/Space for Hyphenation Patterns:
-% --------------------------------------------------------
-%
-% To load this set of german hyphenation patterns the parameters
-% of TeX has to have at least these values:
-%
-% TeX 3.x:
-%    IniTeX:    trie_size >= 9733    trie_op_size >= 207
-%    VirTeX:    trie_size >= 8375    trie_op_size >= 207
-%
-% TeX 2.x:
-%    IniTeX:    trie_size >= 8675    trie_op_size >= 198
-%    VirTeX:    trie_size >= 7560    trie_op_size >= 198
-%
-% If you want to load more than one set of hyphenation patterns
-% (in TeX 3.x), the parameters have to be set to a value larger
-% than or equal to the sum of all required values for each set.
-%
-%
-% Setting Trie Memory Parameters:
-% -------------------------------
-%
-% Some implementations allow the user to change the default value
-% of a set of the internal TeX parameters including the trie memory
-% size parameter specifying the used memory for the hyphenation
-% patterns.
-% 
-% Web2c 7.x (Source), teTeX 0.9 (Unix, Amiga), fpTeX (Win32)
-% and newer:
-%   The used memory size of the true is usually set high enough.
-%   If needed set the size of the trie using the keyword `trie_size'
-%   in the configuration file `texmf/web2c/texmf.cnf'.  For details
-%   see the included documentation.
-%
-% emTeX (OS/2, MS-DOS, Windows 3.x/9x/NT):
-%   You can set the used memory size of the trie using the
-%   `-mt<number>' option on the command line or in the
-%   TEXOPTIONS environment variable.
-%
-% PasTeX (Amiga):
-%   The values for the parameters can be set using the keywords
-%   `triesize', `itriesize' and `trieopsize' in the configuration
-%   file.
-%
-% others (binaries only):
-%   See the documentation of the implementation if it is possible
-%   and how to change these values without recompilation.
-%
-% others (with sources)
-%   If the trie memory is too small, you have to recompile TeX
-%   using larger values for `trie_size' and `trie_op_size'.
-%   Modify the change file `tex.ch' and recompile TeX.
-%   For details see the documentation included in the sources.
-%
-%
-%
-% Necessary Settings in TeX macro files:
-% --------------------------------------
-%
-% \lefthyphenmin, \righthyphenmin:
-%   You can set both parameters to 2.
-%
-% \lccode <char>:
-%   To get correct hyphenation points within words containing
-%   umlauts or \ss, it's necessary to assign values > 0 to the
-%   appropriate \lccode <char> positions.
-%
-% These changes are _not_ done when reading this file and have to
-% be included in the language switching mechanism as is done in,
-% for example, `german.sty' (\lccode change for ^^Y = \ss in OT1,
-% \left-/\righthyphenmin settings).
-%
-%
-%% \CharacterTable
-%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%%   Digits        \0\1\2\3\4\5\6\7\8\9
-%%   Exclamation   \!     Double quote  \"     Hash (number) \#
-%%   Dollar        \$     Percent       \%     Ampersand     \&
-%%   Acute accent  \'     Left paren    \(     Right paren   \)
-%%   Asterisk      \*     Plus          \+     Comma         \,
-%%   Minus         \-     Point         \.     Solidus       \/
-%%   Colon         \:     Semicolon     \;     Less than     \<
-%%   Equals        \=     Greater than  \>     Question mark \?
-%%   Commercial at \@     Left bracket  \[     Backslash     \\
-%%   Right bracket \]     Circumflex    \^     Underscore    \_
-%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
-%%   Right brace   \}     Tilde         \~}
-%%
-\endinput
-%% 
-%% End of file `dehypht.tex'.
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/eshyph_vo.tex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/eshyph_vo.tex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1104 +1,0 @@
-.\'a2
-.\'aa2
-.\'ae2
-.\'ai2
-.\'ao2
-.\'au2
-.\'e2
-.\'ea2
-.\'ee2
-.\'ei2
-.\'eo2
-.\'eu2
-.\'i2
-.\'ia2
-.\'ie2
-.\'ii2
-.\'io2
-.\'iu2
-.\'o2
-.\'oa2
-.\'oe2
-.\'oi2
-.\'oo2
-.\'ou2
-.\'u2
-.\'ua2
-.\'ue2
-.\'ui2
-.\'uo2
-.\'uu2
-.a2
-.a\'a2
-.a\'e2
-.a\'i2
-.a\'o2
-.a\'u2
-.aa2
-.ae2
-.ai2
-.ao2
-.au2
-.e2
-.e\'a2
-.e\'e2
-.e\'i2
-.e\'o2
-.e\'u2
-.ea2
-.ee2
-.ei2
-.eo2
-.eu2
-.i2
-.i\'a2
-.i\'e2
-.i\'i2
-.i\'o2
-.i\'u2
-.ia2
-.ie2
-.ii2
-.io2
-.iu2
-.o2
-.o\'a2
-.o\'e2
-.o\'i2
-.o\'o2
-.o\'u2
-.oa2
-.oe2
-.oi2
-.oo2
-.ou2
-.u2
-.u\'a2
-.u\'e2
-.u\'i2
-.u\'o2
-.u\'u2
-.ua2
-.ue2
-.ui2
-.uo2
-.uu2
-2\'a.
-2\'aa.
-2\'ae.
-2\'ai.
-2\'ao.
-2\'au.
-2\'e.
-2\'ea.
-2\'ee.
-2\'ei.
-2\'eo.
-2\'eu.
-2\'i.
-2\'ia.
-2\'ie.
-2\'ii.
-2\'io.
-2\'iu.
-2\'o.
-2\'oa.
-2\'oe.
-2\'oi.
-2\'oo.
-2\'ou.
-2\'u.
-2\'ua.
-2\'ue.
-2\'ui.
-2\'uo.
-2\'uu.
-2\~n1\~n
-2\~n1b
-2\~n1c
-2\~n1d
-2\~n1f
-2\~n1g
-2\~n1h
-2\~n1j
-2\~n1k
-2\~n1m
-2\~n1n
-2\~n1p
-2\~n1q
-2\~n1s
-2\~n1t
-2\~n1v
-2\~n1w
-2\~n1x
-2\~n1y
-2\~n1z
-2a.
-2a\'a.
-2a\'e.
-2a\'i.
-2a\'o.
-2a\'u.
-2aa.
-2ae.
-2ai.
-2ao.
-2au.
-2b1\~n
-2b1b
-2b1c
-2b1d
-2b1f
-2b1g
-2b1h
-2b1j
-2b1k
-2b1m
-2b1n
-2b1p
-2b1q
-2b1s
-2b1t
-2b1v
-2b1w
-2b1x
-2b1y
-2b1z
-2c1\~n
-2c1b
-2c1c
-2c1d
-2c1f
-2c1g
-2c1j
-2c1k
-2c1m
-2c1n
-2c1p
-2c1q
-2c1s
-2c1t
-2c1v
-2c1w
-2c1x
-2c1y
-2c1z
-2d1\~n
-2d1b
-2d1c
-2d1d
-2d1f
-2d1g
-2d1h
-2d1j
-2d1k
-2d1m
-2d1n
-2d1p
-2d1q
-2d1s
-2d1t
-2d1v
-2d1w
-2d1x
-2d1y
-2d1z
-2e.
-2e\'a.
-2e\'e.
-2e\'i.
-2e\'o.
-2e\'u.
-2ea.
-2ee.
-2ei.
-2eo.
-2eu.
-2f1\~n
-2f1b
-2f1c
-2f1d
-2f1f
-2f1g
-2f1h
-2f1j
-2f1k
-2f1m
-2f1n
-2f1p
-2f1q
-2f1s
-2f1t
-2f1v
-2f1w
-2f1x
-2f1y
-2f1z
-2g1\~n
-2g1b
-2g1c
-2g1d
-2g1f
-2g1g
-2g1h
-2g1j
-2g1k
-2g1m
-2g1n
-2g1p
-2g1q
-2g1s
-2g1t
-2g1v
-2g1w
-2g1x
-2g1y
-2g1z
-2h1\~n
-2h1b
-2h1c
-2h1d
-2h1f
-2h1g
-2h1h
-2h1j
-2h1k
-2h1m
-2h1n
-2h1p
-2h1q
-2h1s
-2h1t
-2h1v
-2h1w
-2h1x
-2h1y
-2h1z
-2i.
-2i\'a.
-2i\'e.
-2i\'i.
-2i\'o.
-2i\'u.
-2ia.
-2ie.
-2ii.
-2io.
-2iu.
-2j1\~n
-2j1b
-2j1c
-2j1d
-2j1f
-2j1g
-2j1h
-2j1j
-2j1k
-2j1m
-2j1n
-2j1p
-2j1q
-2j1s
-2j1t
-2j1v
-2j1w
-2j1x
-2j1y
-2j1z
-2k1\~n
-2k1b
-2k1c
-2k1d
-2k1f
-2k1g
-2k1h
-2k1j
-2k1k
-2k1m
-2k1n
-2k1p
-2k1q
-2k1s
-2k1t
-2k1v
-2k1w
-2k1x
-2k1y
-2k1z
-2l1\~n
-2l1b
-2l1c
-2l1d
-2l1f
-2l1g
-2l1h
-2l1j
-2l1k
-2l1m
-2l1n
-2l1p
-2l1q
-2l1s
-2l1t
-2l1v
-2l1w
-2l1x
-2l1y
-2l1z
-2m1\~n
-2m1b
-2m1c
-2m1d
-2m1f
-2m1g
-2m1h
-2m1j
-2m1k
-2m1l
-2m1m
-2m1n
-2m1p
-2m1q
-2m1r
-2m1s
-2m1t
-2m1v
-2m1w
-2m1x
-2m1y
-2m1z
-2n1\~n
-2n1b
-2n1c
-2n1d
-2n1f
-2n1g
-2n1h
-2n1j
-2n1k
-2n1l
-2n1m
-2n1n
-2n1p
-2n1q
-2n1r
-2n1s
-2n1t
-2n1v
-2n1w
-2n1x
-2n1y
-2n1z
-2o.
-2o\'a.
-2o\'e.
-2o\'i.
-2o\'o.
-2o\'u.
-2oa.
-2oe.
-2oi.
-2oo.
-2ou.
-2p1\~n
-2p1b
-2p1c
-2p1d
-2p1f
-2p1g
-2p1h
-2p1j
-2p1k
-2p1m
-2p1n
-2p1p
-2p1q
-2p1s
-2p1t
-2p1v
-2p1w
-2p1x
-2p1y
-2p1z
-2q1\~n
-2q1b
-2q1c
-2q1d
-2q1f
-2q1g
-2q1h
-2q1j
-2q1k
-2q1m
-2q1n
-2q1p
-2q1q
-2q1s
-2q1t
-2q1v
-2q1w
-2q1x
-2q1y
-2q1z
-2r1\~n
-2r1b
-2r1c
-2r1d
-2r1f
-2r1g
-2r1h
-2r1j
-2r1k
-2r1m
-2r1n
-2r1p
-2r1q
-2r1s
-2r1t
-2r1v
-2r1w
-2r1x
-2r1y
-2r1z
-2s1\~n
-2s1b
-2s1c
-2s1d
-2s1f
-2s1g
-2s1h
-2s1j
-2s1k
-2s1m
-2s1n
-2s1p
-2s1q
-2s1s
-2s1t
-2s1v
-2s1w
-2s1x
-2s1y
-2s1z
-2t1\~n
-2t1b
-2t1c
-2t1d
-2t1f
-2t1g
-2t1h
-2t1j
-2t1k
-2t1m
-2t1n
-2t1p
-2t1q
-2t1s
-2t1t
-2t1v
-2t1w
-2t1x
-2t1y
-2t1z
-2u.
-2u\'a.
-2u\'e.
-2u\'i.
-2u\'o.
-2u\'u.
-2ua.
-2ue.
-2ui.
-2uo.
-2uu.
-2v1\~n
-2v1b
-2v1c
-2v1d
-2v1f
-2v1g
-2v1h
-2v1j
-2v1k
-2v1m
-2v1n
-2v1p
-2v1q
-2v1s
-2v1t
-2v1v
-2v1w
-2v1x
-2v1y
-2v1z
-2w1\~n
-2w1b
-2w1c
-2w1d
-2w1f
-2w1g
-2w1h
-2w1j
-2w1k
-2w1m
-2w1n
-2w1p
-2w1q
-2w1s
-2w1t
-2w1v
-2w1w
-2w1x
-2w1y
-2w1z
-2x1\~n
-2x1b
-2x1c
-2x1d
-2x1f
-2x1g
-2x1h
-2x1j
-2x1k
-2x1m
-2x1n
-2x1p
-2x1q
-2x1s
-2x1t
-2x1v
-2x1w
-2x1x
-2x1y
-2x1z
-2y1\~n
-2y1b
-2y1c
-2y1d
-2y1f
-2y1g
-2y1h
-2y1j
-2y1k
-2y1m
-2y1n
-2y1p
-2y1q
-2y1s
-2y1t
-2y1v
-2y1w
-2y1x
-2y1y
-2y1z
-2z1\~n
-2z1b
-2z1c
-2z1d
-2z1f
-2z1g
-2z1h
-2z1j
-2z1k
-2z1m
-2z1n
-2z1p
-2z1q
-2z1s
-2z1t
-2z1v
-2z1w
-2z1x
-2z1y
-2z1z
-\'a1\'i
-\'a1\'u
-\'a1\~n
-\'a1a
-\'a1b
-\'a1c
-\'a1d
-\'a1e
-\'a1f
-\'a1g
-\'a1h
-\'a1j
-\'a1k
-\'a1l
-\'a1m
-\'a1n
-\'a1o
-\'a1p
-\'a1q
-\'a1r
-\'a1s
-\'a1t
-\'a1v
-\'a1w
-\'a1x
-\'a1y
-\'a1z
-\'a2\~n.
-\'a2b.
-\'a2c.
-\'a2d.
-\'a2f.
-\'a2g.
-\'a2h.
-\'a2j.
-\'a2k.
-\'a2l.
-\'a2m.
-\'a2n.
-\'a2p.
-\'a2q.
-\'a2r.
-\'a2s.
-\'a2t.
-\'a2v.
-\'a2w.
-\'a2x.
-\'a2y.
-\'a2z.
-\'e1\'i
-\'e1\'u
-\'e1\~n
-\'e1a
-\'e1b
-\'e1c
-\'e1d
-\'e1e
-\'e1f
-\'e1g
-\'e1h
-\'e1j
-\'e1k
-\'e1l
-\'e1m
-\'e1n
-\'e1o
-\'e1p
-\'e1q
-\'e1r
-\'e1s
-\'e1t
-\'e1v
-\'e1w
-\'e1x
-\'e1y
-\'e1z
-\'e2\~n.
-\'e2b.
-\'e2c.
-\'e2d.
-\'e2f.
-\'e2g.
-\'e2h.
-\'e2j.
-\'e2k.
-\'e2l.
-\'e2m.
-\'e2n.
-\'e2p.
-\'e2q.
-\'e2r.
-\'e2s.
-\'e2t.
-\'e2v.
-\'e2w.
-\'e2x.
-\'e2y.
-\'e2z.
-\'i1\'a
-\'i1\'e
-\'i1\'o
-\'i1\~n
-\'i1a
-\'i1b
-\'i1c
-\'i1d
-\'i1e
-\'i1f
-\'i1g
-\'i1h
-\'i1j
-\'i1k
-\'i1l
-\'i1m
-\'i1n
-\'i1o
-\'i1p
-\'i1q
-\'i1r
-\'i1s
-\'i1t
-\'i1v
-\'i1w
-\'i1x
-\'i1y
-\'i1z
-\'i2\~n.
-\'i2b.
-\'i2c.
-\'i2d.
-\'i2f.
-\'i2g.
-\'i2h.
-\'i2j.
-\'i2k.
-\'i2l.
-\'i2m.
-\'i2n.
-\'i2p.
-\'i2q.
-\'i2r.
-\'i2s.
-\'i2t.
-\'i2v.
-\'i2w.
-\'i2x.
-\'i2y.
-\'i2z.
-\'o1\'i
-\'o1\'u
-\'o1\~n
-\'o1a
-\'o1b
-\'o1c
-\'o1d
-\'o1e
-\'o1f
-\'o1g
-\'o1h
-\'o1j
-\'o1k
-\'o1l
-\'o1m
-\'o1n
-\'o1o
-\'o1p
-\'o1q
-\'o1r
-\'o1s
-\'o1t
-\'o1v
-\'o1w
-\'o1x
-\'o1y
-\'o1z
-\'o2\~n.
-\'o2b.
-\'o2c.
-\'o2d.
-\'o2f.
-\'o2g.
-\'o2h.
-\'o2j.
-\'o2k.
-\'o2l.
-\'o2m.
-\'o2n.
-\'o2p.
-\'o2q.
-\'o2r.
-\'o2s.
-\'o2t.
-\'o2v.
-\'o2w.
-\'o2x.
-\'o2y.
-\'o2z.
-\'u1\'a
-\'u1\'e
-\'u1\'o
-\'u1\~n
-\'u1a
-\'u1b
-\'u1c
-\'u1d
-\'u1e
-\'u1f
-\'u1g
-\'u1h
-\'u1j
-\'u1k
-\'u1l
-\'u1m
-\'u1n
-\'u1o
-\'u1p
-\'u1q
-\'u1r
-\'u1s
-\'u1t
-\'u1v
-\'u1w
-\'u1x
-\'u1y
-\'u1z
-\'u2\~n.
-\'u2b.
-\'u2c.
-\'u2d.
-\'u2f.
-\'u2g.
-\'u2h.
-\'u2j.
-\'u2k.
-\'u2l.
-\'u2m.
-\'u2n.
-\'u2p.
-\'u2q.
-\'u2r.
-\'u2s.
-\'u2t.
-\'u2v.
-\'u2w.
-\'u2x.
-\'u2y.
-\'u2z.
-a1\'a
-a1\'e
-a1\'i
-a1\'o
-a1\'u
-a1\~n
-a1a
-a1b
-a1c
-a1d
-a1e
-a1f
-a1g
-a1h
-a1j
-a1k
-a1l
-a1m
-a1n
-a1o
-a1p
-a1q
-a1r
-a1s
-a1t
-a1v
-a1w
-a1x
-a1y
-a1z
-a2\~n.
-a2b.
-a2c.
-a2d.
-a2f.
-a2g.
-a2h.
-a2j.
-a2k.
-a2l.
-a2m.
-a2n.
-a2p.
-a2q.
-a2r.
-a2s.
-a2t.
-a2v.
-a2w.
-a2x.
-a2y.
-a2z.
-e1\'a
-e1\'e
-e1\'i
-e1\'o
-e1\'u
-e1\~n
-e1a
-e1b
-e1c
-e1d
-e1e
-e1f
-e1g
-e1h
-e1j
-e1k
-e1l
-e1m
-e1n
-e1o
-e1p
-e1q
-e1r
-e1s
-e1t
-e1v
-e1w
-e1x
-e1y
-e1z
-e2\~n.
-e2b.
-e2c.
-e2d.
-e2f.
-e2g.
-e2h.
-e2j.
-e2k.
-e2l.
-e2m.
-e2n.
-e2p.
-e2q.
-e2r.
-e2s.
-e2t.
-e2v.
-e2w.
-e2x.
-e2y.
-e2z.
-i1\~n
-i1b
-i1c
-i1d
-i1f
-i1g
-i1h
-i1j
-i1k
-i1l
-i1m
-i1n
-i1p
-i1q
-i1r
-i1s
-i1t
-i1v
-i1w
-i1x
-i1y
-i1z
-i2\~n.
-i2b.
-i2c.
-i2d.
-i2f.
-i2g.
-i2h.
-i2j.
-i2k.
-i2l.
-i2m.
-i2n.
-i2p.
-i2q.
-i2r.
-i2s.
-i2t.
-i2v.
-i2w.
-i2x.
-i2y.
-i2z.
-o1\'a
-o1\'e
-o1\'i
-o1\'o
-o1\'u
-o1\~n
-o1a
-o1b
-o1c
-o1d
-o1e
-o1f
-o1g
-o1h
-o1j
-o1k
-o1l
-o1m
-o1n
-o1o
-o1p
-o1q
-o1r
-o1s
-o1t
-o1v
-o1w
-o1x
-o1y
-o1z
-o2\~n.
-o2b.
-o2c.
-o2d.
-o2f.
-o2g.
-o2h.
-o2j.
-o2k.
-o2l.
-o2m.
-o2n.
-o2p.
-o2q.
-o2r.
-o2s.
-o2t.
-o2v.
-o2w.
-o2x.
-o2y.
-o2z.
-u1\~n
-u1b
-u1c
-u1d
-u1f
-u1g
-u1h
-u1j
-u1k
-u1l
-u1m
-u1n
-u1p
-u1q
-u1r
-u1s
-u1t
-u1v
-u1w
-u1x
-u1y
-u1z
-u2\~n.
-u2b.
-u2c.
-u2d.
-u2f.
-u2g.
-u2h.
-u2j.
-u2k.
-u2l.
-u2m.
-u2n.
-u2p.
-u2q.
-u2r.
-u2s.
-u2t.
-u2v.
-u2w.
-u2x.
-u2y.
-u2z.
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/expander.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/expander.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1122 +1,0 @@
-#---------------------------------------------------------------------
-# TITLE:
-#	expander.tcl
-#
-# AUTHOR:
-#	Will Duquette
-#
-# DESCRIPTION:
-#
-# An expander is an object that takes as input text with embedded
-# Tcl code and returns text with the embedded code expanded.  The
-# text can be provided all at once or incrementally.
-#
-# See  expander.[e]html for usage info.
-# Also expander.n
-#
-# LICENSE:
-#       Copyright (C) 2001 by William H. Duquette.  See expander_license.txt,
-#       distributed with this file, for license information.
-#
-# CHANGE LOG:
-#
-#       10/31/01: V0.9 code is complete.
-#       11/23/01: Added "evalcmd"; V1.0 code is complete.
-
-# Provide the package.
-
-# Create the package's namespace.
-
-namespace eval ::textutil {
-    namespace eval expander {
-	# All indices are prefixed by "$exp-".
-	#
-	# lb		    The left bracket sequence
-	# rb		    The right bracket sequence
-	# errmode	    How to handle macro errors: 
-	#		    nothing, macro, error, fail.
-        # evalcmd           The evaluation command.
-	# textcmd           The plain text processing command.
-	# level		    The context level
-	# output-$level     The accumulated text at this context level.
-	# name-$level       The tag name of this context level
-	# data-$level-$var  A variable of this context level     
-	
-	variable Info
-    
-	# In methods, the current object:
-	variable This ""
-	
-	# Export public commands
-	namespace export expander
-    }
-
-    #namespace import expander::*
-    namespace export expander
-
-    proc expander {name} {uplevel ::textutil::expander::expander [list $name]}
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	expander name
-#
-# INPUTS:
-#	name		A proc name for the new object.  If not
-#                       fully-qualified, it is assumed to be relative
-#                       to the caller's namespace.
-#
-# RETURNS:
-#	nothing
-#
-# DESCRIPTION:
-#	Creates a new expander object.
-
-proc ::textutil::expander::expander {name} {
-    variable Info
-
-    # FIRST, qualify the name.
-    if {![string match "::*" $name]} {
-        # Get caller's namespace; append :: if not global namespace.
-        set ns [uplevel 1 namespace current]
-        if {"::" != $ns} {
-            append ns "::"
-        }
-        
-        set name "$ns$name"
-    }
-
-    # NEXT, Check the name
-    if {"" != [info command $name]} {
-        return -code error "command name \"$name\" already exists"
-    }
-
-    # NEXT, Create the object.
-    proc $name {method args} [format {
-        if {[catch {::textutil::expander::Methods %s $method $args} result]} {
-            return -code error $result
-        } else {
-            return $result
-        }
-    } $name]
-
-    # NEXT, Initialize the object
-    Op_reset $name
-    
-    return $name
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Methods name method argList
-#
-# INPUTS:
-#	name		The object's fully qualified procedure name.
-#			This argument is provided by the object command
-#			itself.
-#	method		The method to call.
-#	argList		Arguments for the specific method.
-#
-# RETURNS:
-#	Depends on the method
-#
-# DESCRIPTION:
-#	Handles all method dispatch for a expander object.
-#       The expander's object command merely passes its arguments to
-#	this function, which dispatches the arguments to the
-#	appropriate method procedure.  If the method raises an error,
-#	the method procedure's name in the error message is replaced
-#	by the object and method names.
-
-proc ::textutil::expander::Methods {name method argList} {
-    variable Info
-    variable This
-
-    switch -exact -- $method {
-        expand -
-        lb -
-        rb -
-        setbrackets -
-        errmode -
-        evalcmd -
-	textcmd -
-        cpush -
-	ctopandclear -
-        cis -
-        cname -
-        cset -
-        cget -
-        cvar -
-        cpop -
-        cappend -
-	where -
-        reset {
-            # FIRST, execute the method, first setting This to the object
-            # name; then, after the method has been called, restore the
-            # old object name.
-            set oldThis $This
-            set This $name
-
-            set retval [catch "Op_$method $name $argList" result]
-
-            set This $oldThis
-
-            # NEXT, handle the result based on the retval.
-            if {$retval} {
-                regsub -- "Op_$method" $result "$name $method" result
-                return -code error $result
-            } else {
-                return $result
-            }
-        }
-        default {
-            return -code error "\"$name $method\" is not defined"
-        }
-    }
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Get key
-#
-# INPUTS:
-#	key		A key into the Info array, excluding the
-#	                object name.  E.g., "lb"
-#
-# RETURNS:
-#	The value from the array
-#
-# DESCRIPTION:
-#	Gets the value of an entry from Info for This.
-
-proc ::textutil::expander::Get {key} {
-    variable Info
-    variable This
-
-    return $Info($This-$key)
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Set key value
-#
-# INPUTS:
-#	key		A key into the Info array, excluding the
-#	                object name.  E.g., "lb"
-#
-#	value		A Tcl value
-#
-# RETURNS:
-#	The value
-#
-# DESCRIPTION:
-#	Sets the value of an entry in Info for This.
-
-proc ::textutil::expander::Set {key value} {
-    variable Info
-    variable This
-
-    return [set Info($This-$key) $value]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Var key
-#
-# INPUTS:
-#	key		A key into the Info array, excluding the
-#	                object name.  E.g., "lb"
-#
-# RETURNS:
-#	The full variable name, suitable for setting or lappending
-
-proc ::textutil::expander::Var {key} {
-    variable Info
-    variable This
-
-    return ::textutil::expander::Info($This-$key)
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Contains list value
-#
-# INPUTS:
-#       list		any list
-#	value		any value
-#
-# RETURNS:
-#	TRUE if the list contains the value, and false otherwise.
-
-proc ::textutil::expander::Contains {list value} {
-    if {[lsearch -exact $list $value] == -1} {
-        return 0
-    } else {
-        return 1
-    }
-}
-
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_lb ?newbracket?
-#
-# INPUTS:
-#	newbracket		If given, the new bracket token.
-#
-# RETURNS:
-#	The current left bracket
-#
-# DESCRIPTION:
-#	Returns the current left bracket token.
-
-proc ::textutil::expander::Op_lb {name {newbracket ""}} {
-    if {[string length $newbracket] != 0} {
-        Set lb $newbracket
-    }
-    return [Get lb]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_rb ?newbracket?
-#
-# INPUTS:
-#	newbracket		If given, the new bracket token.
-#
-# RETURNS:
-#	The current left bracket
-#
-# DESCRIPTION:
-#	Returns the current left bracket token.
-
-proc ::textutil::expander::Op_rb {name {newbracket ""}} {
-    if {[string length $newbracket] != 0} {
-        Set rb $newbracket
-    }
-    return [Get rb]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_setbrackets lbrack rbrack
-#
-# INPUTS:
-#	lbrack		The new left bracket
-#	rbrack		The new right bracket
-#
-# RETURNS:
-#	nothing
-#
-# DESCRIPTION:
-#	Sets the brackets as a pair.
-
-proc ::textutil::expander::Op_setbrackets {name lbrack rbrack} {
-    Set lb $lbrack
-    Set rb $rbrack
-    return
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_errmode ?newErrmode?
-#
-# INPUTS:
-#	newErrmode		If given, the new error mode.
-#
-# RETURNS:
-#	The current error mode
-#
-# DESCRIPTION:
-#	Returns the current error mode.
-
-proc ::textutil::expander::Op_errmode {name {newErrmode ""}} {
-    if {[string length $newErrmode] != 0} {
-        if {![Contains "macro nothing error fail" $newErrmode]} {
-            error "$name errmode: Invalid error mode: $newErrmode"
-        }
-
-        Set errmode $newErrmode
-    }
-    return [Get errmode]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_evalcmd ?newEvalCmd?
-#
-# INPUTS:
-#	newEvalCmd		If given, the new eval command.
-#
-# RETURNS:
-#	The current eval command
-#
-# DESCRIPTION:
-#	Returns the current eval command.  This is the command used to
-#	evaluate macros; it defaults to "uplevel #0".
-
-proc ::textutil::expander::Op_evalcmd {name {newEvalCmd ""}} {
-    if {[string length $newEvalCmd] != 0} {
-        Set evalcmd $newEvalCmd
-    }
-    return [Get evalcmd]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_textcmd ?newTextCmd?
-#
-# INPUTS:
-#	newTextCmd		If given, the new text command.
-#
-# RETURNS:
-#	The current text command
-#
-# DESCRIPTION:
-#	Returns the current text command.  This is the command used to
-#	process plain text. It defaults to {}, meaning identity.
-
-proc ::textutil::expander::Op_textcmd {name args} {
-    switch -exact [llength $args] {
-	0 {}
-	1 {Set textcmd [lindex $args 0]}
-	default {
-	    return -code error "wrong#args for textcmd: name ?newTextcmd?"
-	}
-    }
-    return [Get textcmd]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_reset
-#
-# INPUTS:
-#	none
-#
-# RETURNS:
-#	nothing
-#
-# DESCRIPTION:
-#	Resets all object values, as though it were brand new.
-
-proc ::textutil::expander::Op_reset {name} {
-    variable Info 
-
-    if {[info exists Info($name-lb)]} {
-        foreach elt [array names Info "$name-*"] {
-            unset Info($elt)
-        }
-    }
-
-    set Info($name-lb) "\["
-    set Info($name-rb) "\]"
-    set Info($name-errmode) "fail"
-    set Info($name-evalcmd) "uplevel #0"
-    set Info($name-textcmd) ""
-    set Info($name-level) 0
-    set Info($name-output-0) ""
-    set Info($name-name-0) ":0"
-
-    return
-}
-
-#-------------------------------------------------------------------------
-# Context: Every expansion takes place in its own context; however, 
-# a macro can push a new context, causing the text it returns and all
-# subsequent text to be saved separately.  Later, a matching macro can
-# pop the context, acquiring all text saved since the first command,
-# and use that in its own output.
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cpush cname
-#
-# INPUTS:
-#	cname		The context name
-#
-# RETURNS:
-#	nothing
-#
-# DESCRIPTION:
-#       Pushes an empty macro context onto the stack.  All expanded text
-#       will be added to this context until it is popped.
-
-proc ::textutil::expander::Op_cpush {name cname} {
-    # FRINK: nocheck
-    incr [Var level]
-    # FRINK: nocheck
-    set [Var output-[Get level]] {}
-    # FRINK: nocheck
-    set [Var name-[Get level]] $cname
-
-    # The first level is init'd elsewhere (Op_expand)
-    if {[set [Var level]] < 2} return
-
-    # Initialize the location information, inherit from the outer
-    # context.
-
-    LocInit $cname
-    catch {LocSet $cname [LocGet $name]}
-    return    
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cis cname
-#
-# INPUTS:
-#	cname		A context name
-#
-# RETURNS:
-#	true or false
-#
-# DESCRIPTION:
-#       Returns true if the current context has the specified name, and
-#	false otherwise.
-
-proc ::textutil::expander::Op_cis {name cname} {
-    return [expr {[string compare $cname [Op_cname $name]] == 0}]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cname
-#
-# INPUTS:
-#	none
-#
-# RETURNS:
-#	The context name
-#
-# DESCRIPTION:
-#       Returns the name of the current context.
-
-proc ::textutil::expander::Op_cname {name} {
-    return [Get name-[Get level]]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cset varname value
-#
-# INPUTS:
-#	varname		The name of a context variable
-#	value		The new value for the context variable
-#
-# RETURNS:
-#	The value
-#
-# DESCRIPTION:
-#       Sets a variable in the current context.
-
-proc ::textutil::expander::Op_cset {name varname value} {
-    Set data-[Get level]-$varname $value
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cget varname
-#
-# INPUTS:
-#	varname		The name of a context variable
-#
-# RETURNS:
-#	The value
-#
-# DESCRIPTION:
-#       Returns the value of a context variable.  It's an error if
-#	the variable doesn't exist.
-
-proc ::textutil::expander::Op_cget {name varname} {
-    if {![info exists [Var data-[Get level]-$varname]]} {
-        error "$name cget: $varname doesn't exist in this context ([Get level])"
-    }
-    return [Get data-[Get level]-$varname]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cvar varname
-#
-# INPUTS:
-#	varname		The name of a context variable
-#
-# RETURNS:
-#	The index to the variable
-#
-# DESCRIPTION:
-#       Returns the index to a context variable, for use with set, 
-#	lappend, etc.
-
-proc ::textutil::expander::Op_cvar {name varname} {
-    if {![info exists [Var data-[Get level]-$varname]]} {
-        error "$name cvar: $varname doesn't exist in this context"
-    }
-
-    return [Var data-[Get level]-$varname]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cpop cname
-#
-# INPUTS:
-#	cname		The expected context name.
-#
-# RETURNS:
-#	The accumulated output in this context
-#
-# DESCRIPTION:
-#       Returns the accumulated output for the current context, first
-#	popping the context from the stack.  The expected context name
-#	must match the real name, or an error occurs.
-
-proc ::textutil::expander::Op_cpop {name cname} {
-    variable Info
-
-    if {[Get level] == 0} {
-        error "$name cpop underflow on '$cname'"
-    }
-
-    if {[string compare [Op_cname $name] $cname] != 0} {
-        error "$name cpop context mismatch: expected [Op_cname $name], got $cname"
-    }
-
-    set result [Get output-[Get level]]
-    # FRINK: nocheck
-    set [Var output-[Get level]] ""
-    # FRINK: nocheck
-    set [Var name-[Get level]] ""
-
-    foreach elt [array names "Info data-[Get level]-*"] {
-        unset Info($elt)
-    }
-
-    # FRINK: nocheck
-    incr [Var level] -1
-    return $result
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_ctopandclear
-#
-# INPUTS:
-#	None.
-#
-# RETURNS:
-#	The accumulated output in the topmost context, clears the context,
-#	but does not pop it.
-#
-# DESCRIPTION:
-#       Returns the accumulated output for the current context, first
-#	popping the context from the stack.  The expected context name
-#	must match the real name, or an error occurs.
-
-proc ::textutil::expander::Op_ctopandclear {name} {
-    variable Info
-
-    if {[Get level] == 0} {
-        error "$name cpop underflow on '[Op_cname $name]'"
-    }
-
-    set result [Get output-[Get level]]
-    Set output-[Get level] ""
-    return $result
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_cappend text
-#
-# INPUTS:
-#	text		Text to add to the output
-#
-# RETURNS:
-#	The accumulated output
-#
-# DESCRIPTION:
-#       Appends the text to the accumulated output in the current context.
-
-proc ::textutil::expander::Op_cappend {name text} {
-    # FRINK: nocheck
-    append [Var output-[Get level]] $text
-}
-
-#-------------------------------------------------------------------------
-# Macro-expansion:  The following code is the heart of the module.
-# Given a text string, and the current variable settings, this code
-# returns an expanded string, with all macros replaced.
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_expand inputString ?brackets?
-#
-# INPUTS:
-#	inputString		The text to expand.
-#	brackets		A list of two bracket tokens.
-#
-# RETURNS:
-#	The expanded text.
-#
-# DESCRIPTION:
-#	Finds all embedded macros in the input string, and expands them.
-#	If ?brackets? is given, it must be list of length 2, containing
-#	replacement left and right macro brackets; otherwise the default
-#	brackets are used.
-
-proc ::textutil::expander::Op_expand {name inputString {brackets ""}} {
-    # FIRST, push a new context onto the stack, and save the current
-    # brackets.
-
-    Op_cpush $name expand
-    Op_cset $name lb [Get lb]
-    Op_cset $name rb [Get rb]
-
-    # Keep position information in context variables as well.
-    # Line we are in, counting from 1; column we are at,
-    # counting from 0, and index of character we are at,
-    # counting from 0. Tabs counts as '1' when computing
-    # the column.
-
-    LocInit $name
-
-    # SF Tcllib Bug #530056.
-    set start_level [Get level] ; # remember this for check at end
-
-    # NEXT, use the user's brackets, if given.
-    if {[llength $brackets] == 2} {
-        Set lb [lindex $brackets 0]
-        Set rb [lindex $brackets 1]
-    }
-
-    # NEXT, loop over the string, finding and expanding macros.
-    while {[string length $inputString] > 0} {
-        set plainText [ExtractToToken inputString [Get lb] exclude]
-
-        # FIRST, If there was plain text, append it to the output, and 
-        # continue.
-        if {$plainText != ""} {
-	    set input $plainText
-	    set tc [Get textcmd]
-	    if {[string length $tc] > 0} {
-		lappend tc $plainText
-
-		if {![catch "[Get evalcmd] [list $tc]" result]} {
-		    set plainText $result
-		} else {
-		    HandleError $name {plain text} $tc $result
-		}
-	    }
-            Op_cappend $name $plainText
-	    LocUpdate  $name $input
-
-            if {[string length $inputString] == 0} {
-                break
-            }
-        }
-
-        # NEXT, A macro is the next thing; process it.
-        if {[catch {GetMacro inputString} macro]} {
-	    # SF tcllib bug 781973 ... Do not throw a regular
-	    # error. Use HandleError to give the user control of the
-	    # situation, via the defined error mode. The continue
-	    # intercepts if the user allows the expansion to run on,
-	    # yet we must not try to run the non-existing macro.
-
-	    HandleError $name {reading macro} $inputString $macro
-	    continue
-        }
-
-        # Expand the macro, and output the result, or
-        # handle an error.
-        if {![catch "[Get evalcmd] [list $macro]" result]} {
-            Op_cappend $name $result 
-
-	    # We have to advance the location by the length of the
-	    # macro, plus the two brackets. They were stripped by
-	    # GetMacro, so we have to add them here again to make
-	    # computation correct.
-
-	    LocUpdate $name [Get lb]${macro}[Get rb]
-            continue
-        } 
-
-	HandleError $name macro $macro $result
-    }
-
-    # SF Tcllib Bug #530056.
-    if {[Get level] > $start_level} {
-	# The user macros pushed additional contexts, but forgot to
-	# pop them all. The main work here is to place all the still
-	# open contexts into the error message, and to produce
-	# syntactically correct english.
-
-	set c [list]
-	set n [expr {[Get level] - $start_level}]
-	if {$n == 1} {
-	    set ctx  context
-	    set verb was
-	} else {
-	    set ctx  contexts
-	    set verb were
-	}
-	for {incr n -1} {$n >= 0} {incr n -1} {
-	    lappend c [Get name-[expr {[Get level]-$n}]]
-	}
-	return -code error \
-		"The following $ctx pushed by the macros $verb not popped: [join $c ,]."
-    } elseif {[Get level] < $start_level} {
-	set n [expr {$start_level - [Get level]}]
-	if {$n == 1} {
-	    set ctx  context
-	} else {
-	    set ctx  contexts
-	}
-	return -code error \
-		"The macros popped $n more $ctx than they had pushed."
-    }
-
-    Op_lb $name [Op_cget $name lb]
-    Op_rb $name [Op_cget $name rb]
-
-    return [Op_cpop $name expand]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	Op_where
-#
-# INPUTS:
-#	None.
-#
-# RETURNS:
-#	The current location in the input.
-#
-# DESCRIPTION:
-#	Retrieves the current location the expander
-#	is at during processing.
-
-proc ::textutil::expander::Op_where {name} {
-    return [LocGet $name]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION
-#	HandleError name title command errmsg
-#
-# INPUTS:
-#	name		The name of the expander object in question.
-#	title		A title text
-#	command		The command which caused the error.
-#	errmsg		The error message to report
-#
-# RETURNS:
-#	Nothing
-#
-# DESCRIPTIONS
-#	Is executed when an error in a macro or the plain text handler
-#	occurs. Generates an error message according to the current
-#	error mode.
-
-proc ::textutil::expander::HandleError {name title command errmsg} {
-    switch [Get errmode] {
-	nothing { }
-	macro {
-	    # The location is irrelevant here.
-	    Op_cappend $name "[Get lb]$command[Get rb]" 
-	}
-	error {
-	    foreach {ch line col} [LocGet $name] break
-	    set display [DisplayOf $command]
-
-	    Op_cappend $name "\n=================================\n"
-	    Op_cappend $name "*** Error in $title at line $line, column $col:\n"
-	    Op_cappend $name "*** [Get lb]$display[Get rb]\n--> $errmsg\n"
-	    Op_cappend $name "=================================\n"
-	}
-	fail   { 
-	    foreach {ch line col} [LocGet $name] break
-	    set display [DisplayOf $command]
-
-	    return -code error "Error in $title at line $line,\
-		    column $col:\n[Get lb]$display[Get rb]\n-->\
-		    $errmsg"
-	}
-	default {
-	    return -code error "Unknown error mode: [Get errmode]"
-	}
-    }
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	ExtractToToken string token mode
-#
-# INPUTS:
-#	string		The text to process.
-#	token		The token to look for
-#	mode		include or exclude
-#
-# RETURNS:
-#	The extracted text
-#
-# DESCRIPTION:
-# 	Extract text from a string, up to or including a particular
-# 	token.  Remove the extracted text from the string.
-# 	mode determines whether the found token is removed;
-# 	it should be "include" or "exclude".  The string is
-# 	modified in place, and the extracted text is returned.
-
-proc ::textutil::expander::ExtractToToken {string token mode} {
-    upvar $string theString
-
-    # First, determine the offset
-    switch $mode {
-        include { set offset [expr {[string length $token] - 1}] }
-        exclude { set offset -1 }
-        default { error "::expander::ExtractToToken: unknown mode $mode" }
-    }
-
-    # Next, find the first occurrence of the token.
-    set tokenPos [string first $token $theString]
-
-    # Next, return the entire string if it wasn't found, or just
-    # the part upto or including the character.
-    if {$tokenPos == -1} {
-        set theText $theString
-        set theString ""
-    } else {
-        set newEnd    [expr {$tokenPos + $offset}]
-        set newBegin  [expr {$newEnd + 1}]
-        set theText   [string range $theString 0 $newEnd]
-        set theString [string range $theString $newBegin end]
-    }
-
-    return $theText
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	GetMacro string
-#
-# INPUTS:
-#	string		The text to process.
-#
-# RETURNS:
-#	The macro, stripped of its brackets.
-#
-# DESCRIPTION:
-
-proc ::textutil::expander::GetMacro {string} {
-    upvar $string theString
-
-    # FIRST, it's an error if the string doesn't begin with a
-    # bracket.
-    if {[string first [Get lb] $theString] != 0} {
-        error "::expander::GetMacro: assertion failure, next text isn't a command! '$theString'"
-    }
-
-    # NEXT, extract a full macro
-    set macro [ExtractToToken theString [Get lb] include]
-    while {[string length $theString] > 0} {
-        append macro [ExtractToToken theString [Get rb] include]
-
-        # Verify that the command really ends with the [rb] characters,
-        # whatever they are.  If not, break because of unexpected
-        # end of file.
-        if {![IsBracketed $macro]} {
-            break;
-        }
-
-        set strippedMacro [StripBrackets $macro]
-
-        if {[info complete "puts \[$strippedMacro\]"]} {
-            return $strippedMacro
-        }
-    }
-
-    if {[string length $macro] > 40} {
-        set macro "[string range $macro 0 39]...\n"
-    }
-    error "Unexpected EOF in macro:\n$macro"
-}
-
-# Strip left and right bracket tokens from the ends of a macro,
-# provided that it's properly bracketed.
-proc ::textutil::expander::StripBrackets {macro} {
-    set llen [string length [Get lb]]
-    set rlen [string length [Get rb]]
-    set tlen [string length $macro]
-
-    return [string range $macro $llen [expr {$tlen - $rlen - 1}]]
-}
-
-# Return 1 if the macro is properly bracketed, and 0 otherwise.
-proc ::textutil::expander::IsBracketed {macro} {
-    set llen [string length [Get lb]]
-    set rlen [string length [Get rb]]
-    set tlen [string length $macro]
-
-    set leftEnd  [string range $macro 0       [expr {$llen - 1}]]
-    set rightEnd [string range $macro [expr {$tlen - $rlen}] end]
-
-    if {$leftEnd != [Get lb]} {
-        return 0
-    } elseif {$rightEnd != [Get rb]} {
-        return 0
-    } else {
-        return 1
-    }
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	LocInit name
-#
-# INPUTS:
-#	name		The expander object to use.
-#
-# RETURNS:
-#	No result.
-#
-# DESCRIPTION:
-#	A convenience wrapper around LocSet. Initializes the location
-#	to the start of the input (char 0, line 1, column 0).
-
-proc ::textutil::expander::LocInit {name} {
-    LocSet $name {0 1 0}
-    return
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	LocSet name loc
-#
-# INPUTS:
-#	name		The expander object to use.
-#	loc		Location, list containing character position,
-#			line number and column, in this order.
-#
-# RETURNS:
-#	No result.
-#
-# DESCRIPTION:
-#	Sets the current location in the expander to 'loc'.
-
-proc ::textutil::expander::LocSet {name loc} {
-    foreach {ch line col} $loc break
-    Op_cset  $name char $ch
-    Op_cset  $name line $line
-    Op_cset  $name col  $col
-    return
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	LocGet name
-#
-# INPUTS:
-#	name		The expander object to use.
-#
-# RETURNS:
-#	A list containing the current character position, line number
-#	and column, in this order.
-#
-# DESCRIPTION:
-#	Returns the current location as stored in the expander.
-
-proc ::textutil::expander::LocGet {name} {
-    list [Op_cget $name char] [Op_cget $name line] [Op_cget $name col]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	LocUpdate name text
-#
-# INPUTS:
-#	name		The expander object to use.
-#	text		The text to process.
-#
-# RETURNS:
-#	No result.
-#
-# DESCRIPTION:
-#	Takes the current location as stored in the expander, computes
-#	a new location based on the string (its length and contents
-#	(number of lines)), and makes that new location the current
-#	location.
-
-proc ::textutil::expander::LocUpdate {name text} {
-    foreach {ch line col} [LocGet $name] break
-    set numchars [string length $text]
-    #8.4+ set numlines [regexp -all "\n" $text]
-    set numlines [expr {[llength [split $text \n]]-1}]
-
-    incr ch   $numchars
-    incr line $numlines
-    if {$numlines} {
-	set col [expr {$numchars - [string last \n $text] - 1}]
-    } else {
-	incr col $numchars
-    }
-
-    LocSet $name [list $ch $line $col]
-    return
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	LocRange name text
-#
-# INPUTS:
-#	name		The expander object to use.
-#	text		The text to process.
-#
-# RETURNS:
-#	A text range description, compatible with the 'location' data
-#	used in the tcl debugger/checker.
-#
-# DESCRIPTION:
-#	Takes the current location as stored in the expander object
-#	and the length of the text to generate a character range.
-
-proc ::textutil::expander::LocRange {name text} {
-    # Note that the structure is compatible with
-    # the ranges uses by tcl debugger and checker.
-    # {line {charpos length}}
-
-    foreach {ch line col} [LocGet $name] break
-    return [list $line [list $ch [string length $text]]]
-}
-
-#---------------------------------------------------------------------
-# FUNCTION:
-# 	DisplayOf text
-#
-# INPUTS:
-#	text		The text to process.
-#
-# RETURNS:
-#	The text, cut down to at most 30 bytes.
-#
-# DESCRIPTION:
-#	Cuts the incoming text down to contain no more than 30
-#	characters of the input. Adds an ellipsis (...) if characters
-#	were actually removed from the input.
-
-proc ::textutil::expander::DisplayOf {text} {
-    set ellip ""
-    while {[string bytelength $text] > 30} {
-	set ellip ...
-	set text [string range $text 0 end-1]
-    }
-    set display $text$ellip
-}
-
-#---------------------------------------------------------------------
-# Provide the package only if the code above was read and executed
-# without error.
-
-package provide textutil::expander 1.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/ithyph.tex
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/ithyph.tex	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,223 +1,0 @@
-
-%%%%%%%%%%%%%%%%%%%% file ithyph.tex
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%  file ithyph.tex  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Prepared by Claudio Beccari   e-mail  beccari@polito.it
-%
-%                                       Dipartimento di Elettronica
-%                                       Politecnico di Torino
-%                                       Corso Duca degli Abruzzi, 24
-%                                       10129 TORINO
-%
-% Copyright  1998, 2001 Claudio Beccari
-%
-% This program can be redistributed and/or modified under the terms
-% of the LaTeX Project Public License Distributed from CTAN
-% archives in directory macros/latex/base/lppl.txt; either
-% version 1 of the License, or any later version.
-%
-% \versionnumber{4.8d}   \versiondate{2001/11/21}
-%
-% These hyphenation patterns for the Italian language are supposed to comply
-% with the Reccomendation UNI 6461 on hyphenation issued by the Italian
-% Standards Institution (Ente Nazionale di Unificazione UNI).  No guarantee
-% or declaration of fitness to any particular purpose is given and any
-% liability is disclaimed.
-%
-% See comments and loading instructions at the end of the file after the
-% \endinput line
-%
-{\lccode`\'=`\'      % Apostrophe has its own lccode so that it is treated
-                     % as a letter
-                     %>> 1998/04/14 inserted grouping
-                     %
-%\lccode23=23        % Compound word mark is a letter in encoding T1
-%\def\W{^^W}         % ^^W =\char23 = \char"17 =\char'27
-%
-\patterns{
-.a3p2n               % After the Garzanti dictionary: a-pnea, a-pnoi-co,...
-.anti1  .anti3m2n
-.bio1
-.ca4p3s
-.circu2m1
-.di2s3cine
-%.e2x
-.fran2k3
-.free3
-.narco1
-.opto1
-.orto3p2
-.para1
-.poli3p2
-.pre1
-.p2s
-%.ri1a2   .ri1e2    .re1i2  .ri1o2  .ri1u2
-.sha2re3
-.tran2s3c .tran2s3d .tran2s3f .tran2s3l .tran2s3n .tran2s3p .tran2s3r .tran2s3t
-.su2b3lu   .su2b3r
-.wa2g3n
-.wel2t1
-a1ia a1ie  a1io  a1iu a1uo a1ya 2at.
-e1iu e2w
-o1ia o1ie  o1io  o1iu
-%u1u
-%
-%1\W0a2 1\W0e2 1\W0i2 1\W0o2 1\W0u2
-'2
-1b   2bb   2bc   2bd  2bf  2bm  2bn  2bp  2bs  2bt  2bv
-     b2l   b2r   2b.  2b'. 2b''
-1c   2cb   2cc   2cd  2cf  2ck  2cm  2cn  2cq  2cs  2ct  2cz
-     2chh  c2h   2chb ch2r 2chn c2l  c2r  2c.  2c'. 2c'' .c2
-1d   2db   2dd   2dg  2dl  2dm  2dn  2dp  d2r  2ds  2dt  2dv  2dw
-     2d.   2d'.  2d'' .d2
-1f   2fb   2fg   2ff  2fn  f2l  f2r  2fs  2ft  2f.  2f'. 2f''
-1g   2gb   2gd   2gf  2gg  g2h  g2l  2gm  g2n  2gp  g2r  2gs  2gt
-     2gv   2gw   2gz  2gh2t     2g.  2g'. 2g''
-1h   2hb   2hd   2hh  hi3p2n    h2l  2hm  2hn  2hr  2hv  2h.  2h'.  2h''
-1j   2j.   2j'.  2j''
-1k   2kg   2kf   k2h  2kk  k2l  2km  k2r  2ks  2kt  2k.  2k'. 2k''
-1l   2lb   2lc   2ld  2l3f2     2lg  l2h  2lk  2ll  2lm  2ln  2lp
-     2lq   2lr   2ls  2lt  2lv  2lw  2lz  2l.  2l'. 2l''
-1m   2mb   2mc   2mf  2ml  2mm  2mn  2mp  2mq  2mr  2ms  2mt  2mv  2mw
-     2m.   2m'.  2m''
-1n   2nb   2nc   2nd  2nf  2ng  2nk  2nl  2nm  2nn  2np  2nq  2nr
-     2ns   2nt   2nv  2nz  n2g3n     2nheit.   2n.  2n'  2n''
-1p   2pd   p2h   p2l  2pn  3p2ne 2pp p2r  2ps  3p2sic 2pt  2pz  2p.  2p'. 2p''
-1q   2qq   2q.   2q'. 2q''
-1r   2rb   2rc   2rd  2rf  r2h  2rg  2rk  2rl  2rm  2rn  2rp
-     2rq   2rr   2rs  2rt  rt2s3 2rv 2rx  2rw  2rz  2r.  2r'. 2r''
-1s2  2shm  2s3s  s4s3m 2s3p2n   2stb 2stc 2std 2stf 2stg 2stm 2stn
-     2stp  2sts  2stt 2stv 2sz  4s.  4s'. 4s''
-1t   2tb   2tc   2td  2tf  2tg  t2h  t2l  2tm  2tn  2tp  t2r  2ts
-     3t2sch      2tt  2tv  2tw  t2z  2tzk 2tzs 2t.  2t'. 2t''
-1v   2vc   v2l   v2r  2vv  2v.  2v'. 2v''
-1w   w2h   wa2r  2w1y 2w.  2w'. 2w''
-1x   2xt   2xw   2x.   2x'. 2x''
-y1ou y1i
-1z   2zb   2zd   2zl  2zn  2zp  2zt  2zs  2zv  2zz  2z.  2z'. 2z''  .z2
-}}                          % Pattern end
-
-\endinput
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Information %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-                           LOADING THESE PATTERNS
-
-These patterns, as well  as  those  for  any  other  language, do not become
-effective until they are loaded in a special form into a format  file;  this
-task  is  performed  by  the  TeX  initializer;  any  TeX system has its own
-initializer with its special way  of  being activated.  Before loading these
-patterns, then, it is necessary to read very carefully the instructions that
-come with your TeX system.
-
-Here I describe how to load the  patterns with the freeware TeX system named
-MiKTeX version 2.x for Windows 9x, NT, 2000,  XP;  with  minor  changes  the
-whole  procedure  is applicable with other TeX systems, but the details must
-be deduced from your TeX system documentation at the section/chapter "How to
-build or to rebuild a format file".
-
-With MikTeX:
-
-a) copy this file and replace  the existing file ithyph.tex in the directory
-   \texmf\tex\generic\hyphen if the existing one has an older  version  date
-   and number.
-b) select Start|Programs|MiKTeX|MiKTeX options.
-c) in  the  Language tab add a check mark to the line concerning the Italian
-   language.
-d) in the Geneal tab click "Update format files".
-e) That's all!  
-
-For the activation of these  patterns  with the specific Italian typesetting
-features, use the babel package as this:
-
-\documentclass{article} % Or whatever other class
-\usepackage[italian]{babel}
-...
-\begin{document}
-...
-\end{document}
-
-
-                           ON ITALIAN HYPHENATION
-
-I have been working on patterns for the Italian language since 1987; in 1992
-I published
-
-C. Beccari, "Computer aided hyphenation for Italian and Modern
-      Latin", TUG vol. 13, n. 1, pp. 23-33 (1992)
-
-which contained a set of patterns that allowed hyphenation for both  Italian
-and  Latin;  a  slightly  modified  version of the patterns published in the
-above paper is contained in LAHYPH.TEX available on the CTAN archives.
-
-From  the  above  patterns  I  extracted  the  minimum  set  necessary   for
-hyphenating  Italian  that  was made available on the CTAN archives with the
-name ITHYPH.tex the version number  3.5  on  the  16th of August 1994.  
-
-The  original  pattern  set  required  37  ops;  being interested in a local
-version of TeX/LaTeX  capable  of  dealing  with  half  a dozen languages, I
-wanted to reduce memory occupation and therefore the number of ops.
-
-Th new version (4.0 released  in  1996)  of  ITHYPH.TEX is much simpler than
-version 3.5 and requires just 29 ops while  it  retains  all  the  power  of
-version  3.5;  it  contains  many  more new patterns that allow to hyphenate
-unusual words that generally have  a  root borrowed from a foreign language.
-Updated versions 4.x contain minor  additions  and  the  number  of  ops  is
-increased to 30 (version 4.7 of 1998/06/01).
-
-This new pattern set has been tested  with the same set of difficult Italian
-words that was used to test version 3.5 and it yields the  same  results  (a
-part  a  minor  change  that was deliberately introduced so as to reduce the
-typographical hyphenation  with  hyathi,  since  hyphenated  hyathi  are not
-appreciated by Italian readers).   A  new  enlarged  word  set  for  testing
-purposes  gets correct hyphen points that were missed or wrongly placed with
-version 3.5, although no error had  been reported, because such words are of
-very specialized nature and are seldom used.
-
-As the previous version, this new set  of  patterns  does  not  contain  any
-accented  character  so  that  the hyphenation algorithm behaves properly in
-both cases, that is with cm  and  with dc/ec fonts.  With LaTeXe terminology
-the difference is between OT1 and T1 encodings;  with  the  former  encoding
-fonts  do  not  contain  accented characters, while with the latter accented
-characters are present and sequences  such  as  \`a map directly to slot "E0
-that contains "agrave".
-
-Of course if you use dc/ec fonts (or any other real or virtual font with  T1
-encoding)  you get the full power of the hyphenation algorithm, while if you
-use cm fonts (or any other real or virtual font with OT1 encoding) you  miss
-some  possible  break  points;  this  is  not a big inconvenience in Italian
-because:
-
-1) The Regulation UNI 6015 on  accents  specifies  that  compulsory  accents
-   appear  only  on the ending vowel of oxitone words; this means that it is
-   almost indifferent to have or  to  miss  the dc/ec fonts because the only
-   difference consists in how TeX evaluates the end of the word; in practice
-   if you have these special facilities you get "qua-li-t\`a", while if  you
-   miss them, you get "qua-lit\`a" (assuming that \righthyphenmin > 1).
-
-2)  Optional  accents are so rare in Italian, that if you absolutely want to
-   use  them  in  those  rare  instances,  and  you  miss  the  T1  encoding
-   facilities, you should also provide  explicit discretionary hyphens as in
-   "s\'e\-gui\-to".
-
-There is no explicit  hyphenation  exception  list  because  these  patterns
-proved  to  hyphenate correctly a very large set of words suitably chosen in
-order to test them in the most heavy circumstances; these patterns were used
-in the preparation of a number of books and no errors were discovered.
-
-Nevertheless if you frequently use  technical terms that you want hyphenated
-differently  from  what  is  normally  done  (for  example  if  you   prefer
-etymological  hyphenation  of  prefixed  and/or  suffixed  words) you should
-insert a specific hyphenation  list  in  the  preamble of your document, for
-example:
-
-\hyphenation{su-per-in-dut-to-re su-per-in-dut-to-ri}
-
-Should you find any word that gets hyphenated in a wrong way, please, AFTER
-CHECKING ON A RELIABLE MODERN DICTIONARY, report to the author, preferably
-by e-mail.
-
-
-                       Happy multilingual typesetting !
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # FRINK: nocheck
-    return
-}
-package ifneeded textutil           0.7.1 [list source [file join $dir textutil.tcl]]
-package ifneeded textutil::adjust   0.7 [list source [file join $dir adjust.tcl]]
-package ifneeded textutil::split    0.7 [list source [file join $dir split.tcl]]
-package ifneeded textutil::trim     0.7 [list source [file join $dir trim.tcl]]
-package ifneeded textutil::tabify   0.7 [list source [file join $dir tabify.tcl]]
-package ifneeded textutil::repeat   0.7 [list source [file join $dir repeat.tcl]]
-package ifneeded textutil::string   0.7 [list source [file join $dir string.tcl]]
-package ifneeded textutil::expander 1.3.1 [list source [file join $dir expander.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/repeat.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/repeat.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,91 +1,0 @@
-# repeat.tcl --
-#
-#	Emulation of string repeat for older
-#	revisions of Tcl.
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: repeat.tcl,v 1.1 2006/04/21 04:42:28 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-
-namespace eval ::textutil::repeat {}
-
-# ### ### ### ######### ######### #########
-
-namespace eval ::textutil::repeat {
-    variable HaveBuiltin [expr {![catch {string repeat a 1}]}]
-}
-
-if {0} {
-    # Problems with the deactivated code:
-    # - Linear in 'num'.
-    # - Tests for 'string repeat' in every call!
-    #   (Ok, just the variable, still a test every call)
-    # - Fails for 'num == 0' because of undefined 'str'.
-
-    proc textutil::repeat::StrRepeat { char num } {
-	variable HaveBuiltin
-	if { $HaveBuiltin == 0 } then {
-	    for { set i 0 } { $i < $num } { incr i } {
-		append str $char
-	    }
-	} else {
-	    set str [ string repeat $char $num ]
-	}
-	return $str
-    }
-}
-
-if {$::textutil::repeat::HaveBuiltin} {
-    proc ::textutil::repeat::strRepeat {char num} {
-	return [string repeat $char $num]
-    }
-
-    proc ::textutil::repeat::blank {n} {
-	return [string repeat " " $n]
-    }
-} else {
-    proc ::textutil::repeat::strRepeat {char num} {
-	if {$num <= 0} {
-	    # No replication required
-	    return ""
-	} elseif {$num == 1} {
-	    # Quick exit for recursion
-	    return $char
-	} elseif {$num == 2} {
-	    # Another quick exit for recursion
-	    return $char$char
-	} elseif {0 == ($num % 2)} {
-	    # Halving the problem results in O (log n) complexity.
-	    set result [strRepeat $char [expr {$num / 2}]]
-	    return "$result$result"
-	} else {
-	    # Uneven length, reduce problem by one
-	    return "$char[strRepeat $char [incr num -1]]"
-	}
-    }
-
-    proc ::textutil::repeat::blank {n} {
-	return [strRepeat " " $n]
-    }
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::repeat {
-    namespace export strRepeat blank
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::repeat 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/split.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/split.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,167 +1,0 @@
-# split.tcl --
-#
-#	Various ways of splitting a string.
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2000      by Eric Melski <ericm@ajubasolutions.com>
-# Copyright (c) 2001      by Reinhard Max <max@suse.de>
-# Copyright (c) 2003      by Pat Thoyts <patthoyts@users.sourceforge.net>
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: split.tcl,v 1.7 2006/04/21 04:42:28 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-
-namespace eval ::textutil::split {}
-
-########################################################################
-# This one was written by Bob Techentin (RWT in Tcl'ers Wiki):
-# http://www.techentin.net
-# mailto:techentin.robert@mayo.edu
-#
-# Later, he send me an email stated that I can use it anywhere, because
-# no copyright was added, so the code is defacto in the public domain.
-#
-# You can found it in the Tcl'ers Wiki here:
-# http://mini.net/cgi-bin/wikit/460.html
-#
-# Bob wrote:
-# If you need to split string into list using some more complicated rule
-# than builtin split command allows, use following function. It mimics
-# Perl split operator which allows regexp as element separator, but,
-# like builtin split, it expects string to split as first arg and regexp
-# as second (optional) By default, it splits by any amount of whitespace. 
-# Note that if you add parenthesis into regexp, parenthesed part of separator
-# would be added into list as additional element. Just like in Perl. -- cary 
-#
-# Speed improvement by Reinhard Max:
-# Instead of repeatedly copying around the not yet matched part of the
-# string, I use [regexp]'s -start option to restrict the match to that
-# part. This reduces the complexity from something like O(n^1.5) to
-# O(n). My test case for that was:
-# 
-# foreach i {1 10 100 1000 10000} {
-#     set s [string repeat x $i]
-#     puts [time {splitx $s .}]
-# }
-#
-
-if {[package vsatisfies [package provide Tcl] 8.3]} {
-
-    proc ::textutil::split::splitx {str {regexp {[\t \r\n]+}}} {
-        # Bugfix 476988
-        if {[string length $str] == 0} {
-            return {}
-        }
-        if {[string length $regexp] == 0} {
-            return [::split $str ""]
-        }
-        set list  {}
-        set start 0
-        while {[regexp -start $start -indices -- $regexp $str match submatch]} {
-            foreach {subStart subEnd} $submatch break
-            foreach {matchStart matchEnd} $match break
-            incr matchStart -1
-            incr matchEnd
-            lappend list [string range $str $start $matchStart]
-            if {$subStart >= $start} {
-                lappend list [string range $str $subStart $subEnd]
-            }
-            set start $matchEnd
-        }
-        lappend list [string range $str $start end]
-        return $list
-    }
-
-} else {    
-    # For tcl <= 8.2 we do not have regexp -start...
-    proc ::textutil::split::splitx [list str [list regexp "\[\t \r\n\]+"]] {
-
-        if {[string length $str] == 0} {
-            return {}
-        }
-        if {[string length $regexp] == 0} {
-            return [::split $str {}]
-        }
-
-        set list  {}
-        while {[regexp -indices -- $regexp $str match submatch]} {
-            lappend list [string range $str 0 [expr {[lindex $match 0] -1}]]
-            if {[lindex $submatch 0] >= 0} {
-                lappend list [string range $str [lindex $submatch 0] \
-                                  [lindex $submatch 1]]
-            }
-            set str [string range $str [expr {[lindex $match 1]+1}] end]
-        }
-        lappend list $str
-        return $list
-    }
-    
-}
-
-#
-# splitn --
-#
-# splitn splits the string $str into chunks of length $len.  These
-# chunks are returned as a list.
-#
-# If $str really contains a ByteArray object (as retrieved from binary
-# encoded channels) splitn must honor this by splitting the string
-# into chunks of $len bytes.
-#
-# It is an error to call splitn with a nonpositive $len.
-#
-# If splitn is called with an empty string, it returns the empty list.
-#
-# If the length of $str is not an entire multiple of the chunk length,
-# the last chunk in the generated list will be shorter than $len.
-#
-# The implementation presented here was given by Bryan Oakley, as
-# part of a ``contest'' I staged on c.l.t in July 2004.  I selected
-# this version, as it does not rely on runtime generated code, is
-# very fast for chunk size one, not too bad in all the other cases,
-# and uses [split] or [string range] which have been around for quite
-# some time.
-#
-# -- Robert Suetterlin (robert@mpe.mpg.de)
-#
-proc ::textutil::split::splitn {str {len 1}} {
-
-    if {$len <= 0} {
-        return -code error "len must be > 0"
-    }
-
-    if {$len == 1} {
-        return [split $str {}]
-    }
-
-    set result [list]
-    set max [string length $str]
-    set i 0
-    set j [expr {$len -1}]
-    while {$i < $max} {
-        lappend result [string range $str $i $j]
-        incr i $len
-        incr j $len
-    }
-
-    return $result
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::split {
-    namespace export splitx splitn
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::split 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/string.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/string.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,135 +1,0 @@
-# string.tcl --
-#
-#	Utilities for manipulating strings, words, single lines,
-#	paragraphs, ...
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2000      by Eric Melski <ericm@ajubasolutions.com>
-# Copyright (c) 2002      by Joe English <jenglish@users.sourceforge.net>
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: string.tcl,v 1.1 2006/04/21 04:42:28 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-
-namespace eval ::textutil::string {}
-
-# ### ### ### ######### ######### #########
-## API implementation
-
-# @c Removes the last character from the given <a string>.
-#
-# @a string: The string to manipulate.
-#
-# @r The <a string> without its last character.
-#
-# @i chopping
-
-proc ::textutil::string::chop {string} {
-    return [string range $string 0 [expr {[string length $string]-2}]]
-}
-
-# @c Removes the first character from the given <a string>.
-# @c Convenience procedure.
-#
-# @a string: string to manipulate.
-#
-# @r The <a string> without its first character.
-#
-# @i tail
-
-proc ::textutil::string::tail {string} {
-    return [string range $string 1 end]
-}
-
-# @c Capitalizes first character of the given <a string>.
-# @c Complementary procedure to <p ::textutil::uncap>.
-#
-# @a string: string to manipulate.
-#
-# @r The <a string> with its first character capitalized.
-#
-# @i capitalize
-
-proc ::textutil::string::cap {string} {
-    return [string toupper [string index $string 0]][string range $string 1 end]
-}
-
-# @c unCapitalizes first character of the given <a string>.
-# @c Complementary procedure to <p ::textutil::cap>.
-#
-# @a string: string to manipulate.
-#
-# @r The <a string> with its first character uncapitalized.
-#
-# @i uncapitalize
-
-proc ::textutil::string::uncap {string} {
-    return [string tolower [string index $string 0]][string range $string 1 end]
-}
-
-# Compute the longest string which is common to all strings given to
-# the command, and at the beginning of said strings, i.e. a prefix. If
-# only one argument is specified it is treated as a list of the
-# strings to look at. If more than one argument is specified these
-# arguments are the strings to be looked at. If only one string is
-# given, in either form, the string is returned, as it is its own
-# longest common prefix.
-
-proc ::textutil::string::longestCommonPrefix {args} {
-    return [longestCommonPrefixList $args]
-}
-
-proc ::textutil::string::longestCommonPrefixList {list} {
-    if {[llength $list] == 0} {
-	return ""
-    } elseif {[llength $list] == 1} {
-	return [lindex $list 0]
-    }
-
-    set list [lsort  $list]
-    set min  [lindex $list 0]
-    set max  [lindex $list end]
-
-    # Min and max are the two strings which are most different. If
-    # they have a common prefix, it will also be the common prefix for
-    # all of them.
-
-    # Fast bailouts for common cases.
-
-    set n [string length $min]
-    if {$n == 0}                         {return ""}
-    if {0 == [string compare $min $max]} {return $min}
-
-    set prefix ""
-    for {set i 0} {$i < $n} {incr i} {
-	if {0 == [string compare [set x [string range $min 0 $i]] [string range $max 0 $i]]} {
-	    set prefix $x
-	    continue
-	}
-	break
-    }
-    return $prefix
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::string {
-    # Export the imported commands
-
-    namespace export chop tail cap uncap
-    namespace export longestCommonPrefix
-    namespace export longestCommonPrefixList
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::string 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/tabify.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/tabify.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,289 +1,0 @@
-#
-# As the author of the procs 'tabify2' and 'untabify2' I suggest that the
-# comments explaining their behaviour be kept in this file.
-# 1) Beginners in any programming language (I am new to Tcl so I know what I
-#    am talking about) can profit enormously from studying 'correct' code.
-#    Of course comments will help a lot in this regard.
-# 2) Many problems newbies face can be solved by directing them towards
-#    available libraries - after all, libraries have been written to solve
-#    recurring problems. Then they can just use them, or have a closer look
-#    to see and to discover how things are done the 'Tcl way'.
-# 3) And if ever a proc from a library should be less than perfect, having
-#    comments explaining the behaviour of the code will surely help.
-#
-# This said, I will welcome any error reports or suggestions for improvements
-# (especially on the 'doing things the Tcl way' aspect).
-#
-# Use of these sources is licensed under the same conditions as is Tcl.
-#
-# June 2001, Helmut Giese (hgiese@ratiosoft.com)
-#
-# ----------------------------------------------------------------------------
-#
-# The original procs 'tabify' and 'untabify' each work with complete blocks
-# of $num spaces ('num' holding the tab size). While this is certainly useful
-# in some circumstances, it does not reflect the way an editor works:
-# 	Counting columns from 1, assuming a tab size of 8 and entering '12345'
-#   followed by a tab, you expect to advance to column 9. Your editor might
-#   put a tab into the file or 3 spaces, depending on its configuration.
-#	Now, on 'tabifying' you will expect to see those 3 spaces converted to a
-#	tab (and on the other hand expect the tab *at this position* to be
-#	converted to 3 spaces).
-#
-#	This behaviour is mimicked by the new procs 'tabify2' and 'untabify2'.
-#   Both have one feature in common: They accept multi-line strings (a whole
-#   file if you want to) but in order to make life simpler for the programmer,
-#   they split the incoming string into individual lines and hand each line to
-#   a proc that does the real work.
-#
-#   One design decision worth mentioning here:
-#      A single space is never converted to a tab even if its position would
-#      allow to do so.
-#   Single spaces occur very often, say in arithmetic expressions like
-#   [expr (($a + $b) * $c) < $d]. If we didn't follow the above rule we might
-#   need to replace one or more of them to tabs. However if the tab size gets
-#   changed, this expression would be formatted quite differently - which is
-#   probably not a good idea.
-#
-#   'untabifying' on the other hand might need to replace a tab with a single
-#   space: If the current position requires it, what else to do?
-#   As a consequence those two procs are unsymmetric in this aspect, but I
-#   couldn't think of a better solution. Could you?
-#
-# ----------------------------------------------------------------------------
-#
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-package require textutil::repeat
-
-namespace eval ::textutil::tabify {}
-
-# ### ### ### ######### ######### #########
-## API implementation
-
-namespace eval ::textutil::tabify {
-    namespace import -force ::textutil::repeat::strRepeat
-}
-
-proc ::textutil::tabify::tabify { string { num 8 } } {
-    return [string map [list [MakeTabStr $num] \t] $string]
-}
-
-proc ::textutil::tabify::untabify { string { num 8 } } {
-    return [string map [list \t [MakeTabStr $num]] $string]
-}
-
-proc ::textutil::tabify::MakeTabStr { num } {
-    variable TabStr
-    variable TabLen
-
-    if { $TabLen != $num } then {
-	set TabLen $num
-	set TabStr [strRepeat " " $num]
-    }
-
-    return $TabStr
-}
-
-# ----------------------------------------------------------------------------
-#
-# tabifyLine: Works on a single line of text, replacing 'spaces at correct
-# 		positions' with tabs. $num is the requested tab size.
-#		Returns the (possibly modified) line.
-#
-# 'spaces at correct positions': Only spaces which 'fill the space' between
-# an arbitrary position and the next tab stop can be replaced. 
-# Example: With tab size 8, spaces at positions 11 - 13 will *not* be replaced,
-#          because an expansion of a tab at position 11 will jump up to 16.
-# See also the comment at the beginning of this file why single spaces are
-# *never* replaced by a tab.
-#
-# The proc works backwards, from the end of the string up to the beginning:
-#	- Set the position to start the search from ('lastPos') to 'end'.
-#	- Find the last occurrence of ' ' in 'line' with respect to 'lastPos'
-#         ('currPos' below). This is a candidate for replacement.
-#       - Find to 'currPos' the following tab stop using the expression
-#           set nextTab [expr ($currPos + $num) - ($currPos % $num)]
-#         and get the previous tab stop as well (this will be the starting 
-#         point for the next iteration).
-#	- The ' ' at 'currPos' is only a candidate for replacement if
-#	  1) it is just one position before a tab stop *and*
-#	  2) there is at least one space at its left (see comment above on not
-#	     touching an isolated space).
-#	  Continue, if any of these conditions is not met.
-#	- Determine where to put the tab (that is: how many spaces to replace?)
-#	  by stepping up to the beginning until
-#		-- you hit a non-space or
-#		-- you are at the previous tab position
-#	- Do the replacement and continue.
-#
-# This algorithm only works, if $line does not contain tabs. Otherwise our 
-# interpretation of any position beyond the tab will be wrong. (Imagine you 
-# find a ' ' at position 4 in $line. If you got 3 leading tabs, your *real*
-# position might be 25 (tab size of 8). Since in real life some strings might 
-# already contain tabs, we test for it (and eventually call untabifyLine).
-#
-
-proc ::textutil::tabify::tabifyLine { line num } {
-    if { [string first \t $line] != -1 } { 		
-	# assure array 'Spaces' is set up 'comme il faut'
-	checkArr $num
-	# remove existing tabs
-	set line [untabifyLine $line $num]
-    }
-
-    set lastPos end
-
-    while { $lastPos > 0 } {
-	set currPos [string last " " $line $lastPos]
-	if { $currPos == -1 } {
-	    # no more spaces
-	    break;
-	}
-
-	set nextTab [expr {($currPos + $num) - ($currPos % $num)}]
-	set prevTab [expr {$nextTab - $num}]
-
-	# prepare for next round: continue at 'previous tab stop - 1'
-	set lastPos [expr {$prevTab - 1}]
-
-	if { ($currPos + 1) != $nextTab } {
-	    continue			;# crit. (1)
-	}
-
-	if { [string index $line [expr {$currPos - 1}]] != " " } {
-	    continue			;# crit. (2)
-	}
-
-	# now step backwards while there are spaces
-	for {set pos [expr {$currPos - 2}]} {$pos >= $prevTab} {incr pos -1} {
-	    if { [string index $line $pos] != " " } {
-		break;
-	    }
-	}
-
-	# ... and replace them
-	set line [string replace $line [expr {$pos + 1}] $currPos \t]
-    }
-    return $line
-}
-
-#
-# Helper proc for 'untabifyLine': Checks if all needed elements of array
-# 'Spaces' exist and creates the missing ones if needed.
-#
-
-proc ::textutil::tabify::checkArr { num } {
-    variable TabLen2
-    variable Spaces
-
-    if { $num > $TabLen2 } {
-	for { set i [expr {$TabLen2 + 1}] } { $i <= $num } { incr i } {
-	    set Spaces($i) [strRepeat " " $i]
-	}
-	set TabLen2 $num
-    }
-}
-
-
-# untabifyLine: Works on a single line of text, replacing tabs with enough
-#		spaces to get to the next tab position.
-#		Returns the (possibly modified) line.
-#
-# The procedure is straight forward:
-#	- Find the next tab.
-#	- Calculate the next tab position following it.
-#	- Delete the tab and insert as many spaces as needed to get there.
-#
-
-proc ::textutil::tabify::untabifyLine { line num } {
-    variable Spaces
-
-    set currPos 0
-    while { 1 } {
-	set currPos [string first \t $line $currPos]
-	if { $currPos == -1 } {
-	    # no more tabs
-	    break
-	}
-
-	# how far is the next tab position ?
-	set dist [expr {$num - ($currPos % $num)}]
-	# replace '\t' at $currPos with $dist spaces
-	set line [string replace $line $currPos $currPos $Spaces($dist)]
-
-	# set up for next round (not absolutely necessary but maybe a trifle
-	# more efficient)
-	incr currPos $dist
-    }
-    return $line
-}
-
-# tabify2: Replace all 'appropriate' spaces as discussed above with tabs.
-#	'string' might hold any number of lines, 'num' is the requested tab size.
-#	Returns (possibly modified) 'string'.
-#
-proc ::textutil::tabify::tabify2 { string { num 8 } } {
-
-    # split string into individual lines
-    set inLst [split $string \n]
-
-    # now work on each line
-    set outLst [list]
-    foreach line $inLst {
-	lappend outLst [tabifyLine $line $num]
-    }
-
-    # return all as one string
-    return [join $outLst \n]
-}
-
-
-# untabify2: Replace all tabs with the appropriate number of spaces.
-#	'string' might hold any number of lines, 'num' is the requested tab size.
-#	Returns (possibly modified) 'string'.
-#
-proc ::textutil::tabify::untabify2 { string { num 8 } } {
-
-    # assure array 'Spaces' is set up 'comme il faut'
-    checkArr $num
-
-    set inLst [split $string \n]
-
-    set outLst [list]
-    foreach line $inLst {
-	lappend outLst [untabifyLine $line $num]
-    }
-
-    return [join $outLst \n]
-}
-
-
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::tabify {
-    variable TabLen  8
-    variable TabStr  [strRepeat " " $TabLen]
-
-    namespace export tabify untabify tabify2 untabify2
-    
-    # The proc 'untabify2' uses the following variables for efficiency.
-    # Since a tab can be replaced by one up to 'tab size' spaces, it is handy
-    # to have the appropriate 'space strings' available. This is the use of
-    # the array 'Spaces', where 'Spaces(n)' contains just 'n' spaces.
-    # The variable 'TabLen2' remembers the biggest tab size used.
-
-    variable  TabLen2 0
-    variable  Spaces
-    array set Spaces {0 ""}
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::tabify 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/textutil.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/textutil.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,79 +1,0 @@
-# textutil.tcl --
-#
-#	Utilities for manipulating strings, words, single lines,
-#	paragraphs, ...
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2000      by Eric Melski <ericm@ajubasolutions.com>
-# Copyright (c) 2002      by Joe English <jenglish@users.sourceforge.net>
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: textutil.tcl,v 1.17 2006/09/21 06:46:24 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-
-namespace eval ::textutil {}
-
-# ### ### ### ######### ######### #########
-## API implementation
-## All through sub-packages imported here.
-
-package require textutil::string
-package require textutil::repeat
-package require textutil::adjust
-package require textutil::split
-package require textutil::tabify
-package require textutil::trim
-
-namespace eval ::textutil {
-    # Import the miscellaneous string command for public export
-
-    namespace import -force string::chop string::tail
-    namespace import -force string::cap string::uncap
-    namespace import -force string::longestCommonPrefix
-    namespace import -force string::longestCommonPrefixList
-
-    # Import the repeat commands for public export
-
-    namespace import -force repeat::strRepeat repeat::blank
-
-    # Import the adjust commands for public export
-
-    namespace import -force adjust::adjust adjust::indent adjust::undent
-
-    # Import the split commands for public export
-
-    namespace import -force split::splitx split::splitn
-
-    # Import the trim commands for public export
-
-    namespace import -force trim::trim trim::trimleft trim::trimright
-    namespace import -force trim::trimPrefix trim::trimEmptyHeading
-
-    # Import the tabify commands for public export
-
-    namespace import -force tabify::tabify tabify::untabify
-    namespace import -force tabify::tabify2 tabify::untabify2
-
-    # Re-export all the imported commands
-
-    namespace export chop tail cap uncap
-    namespace export longestCommonPrefix longestCommonPrefixList
-    namespace export strRepeat blank
-    namespace export adjust indent undent
-    namespace export splitx splitn
-    namespace export trim trimleft trimright trimPrefix trimEmptyHeading
-    namespace export tabify untabify tabify2 untabify2
-}
-
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil 0.7.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/textutil/trim.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/textutil/trim.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,112 +1,0 @@
-# trim.tcl --
-#
-#	Various ways of trimming a string.
-#
-# Copyright (c) 2000      by Ajuba Solutions.
-# Copyright (c) 2000      by Eric Melski <ericm@ajubasolutions.com>
-# Copyright (c) 2001-2006 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: trim.tcl,v 1.5 2006/04/21 04:42:28 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.2
-
-namespace eval ::textutil::trim {}
-
-# ### ### ### ######### ######### #########
-## API implementation
-
-proc ::textutil::trim::trimleft {text {trim "[ \t]+"}} {
-    regsub -line -all -- [MakeStr $trim left] $text {} text
-    return $text
-}
-
-proc ::textutil::trim::trimright {text {trim "[ \t]+"}} {
-    regsub -line -all -- [MakeStr $trim right] $text {} text
-    return $text
-}
-
-proc ::textutil::trim::trim {text {trim "[ \t]+"}} {
-    regsub -line -all -- [MakeStr $trim left]  $text {} text
-    regsub -line -all -- [MakeStr $trim right] $text {} text
-    return $text
-}
-
-
-
-# @c Strips <a prefix> from <a text>, if found at its start.
-#
-# @a text: The string to check for <a prefix>.
-# @a prefix: The string to remove from <a text>.
-#
-# @r The <a text>, but without <a prefix>.
-#
-# @i remove, prefix
-
-proc ::textutil::trim::trimPrefix {text prefix} {
-    if {[string first $prefix $text] == 0} {
-	return [string range $text [string length $prefix] end]
-    } else {
-	return $text
-    }
-}
-
-
-# @c Removes the Heading Empty Lines of <a text>.
-#
-# @a text: The text block to manipulate.
-#
-# @r The <a text>, but without heading empty lines.
-#
-# @i remove, empty lines
-
-proc ::textutil::trim::trimEmptyHeading {text} {
-    regsub -- "^(\[ \t\]*\n)*" $text {} text
-    return $text
-}
-
-# ### ### ### ######### ######### #########
-## Helper commands. Internal
-
-proc ::textutil::trim::MakeStr { string pos }  {
-    variable StrU
-    variable StrR
-    variable StrL
-
-    if { "$string" != "$StrU" } {
-        set StrU $string
-        set StrR "(${StrU})\$"
-        set StrL "^(${StrU})"
-    }
-    if { "$pos" == "left" } {
-        return $StrL
-    }
-    if { "$pos" == "right" } {
-        return $StrR
-    }
-
-    return -code error "Panic, illegal position key \"$pos\""
-}
-
-# ### ### ### ######### ######### #########
-## Data structures
-
-namespace eval ::textutil::trim {	    
-    variable StrU "\[ \t\]+"
-    variable StrR "(${StrU})\$"
-    variable StrL "^(${StrU})"
-
-    namespace export \
-	    trim trimright trimleft \
-	    trimPrefix trimEmptyHeading
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide textutil::trim 0.7
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,9 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded tie                1.1   [list source [file join $dir tie.tcl]]
-package ifneeded tie::std::file     1.0.2 [list source [file join $dir tie_file.tcl]]
-package ifneeded tie::std::growfile 1.0   [list source [file join $dir tie_growfile.tcl]]
-package ifneeded tie::std::log      1.0   [list source [file join $dir tie_log.tcl]]
-package ifneeded tie::std::array    1.0   [list source [file join $dir tie_array.tcl]]
-package ifneeded tie::std::rarray   1.0   [list source [file join $dir tie_rarray.tcl]]
-package ifneeded tie::std::dsource  1.0   [list source [file join $dir tie_dsource.tcl]]
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,511 +1,0 @@
-# tie.tcl --
-#
-#	Tie arrays to persistence engines.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie.tcl,v 1.7 2006/09/19 23:36:18 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require cmdline
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-# ### ### ### ######### ######### #########
-## Public API
-
-namespace eval ::tie {}
-
-proc ::tie::tie {avar args} {
-    # Syntax : avar ?-open? ?-save? ?-merge? dstype dsargs...?
-
-    variable registry
-
-    upvar 1 $avar thearray
-
-    if {![array exists thearray]} {
-	return -code error "can't tie to \"$avar\": no such array variable"
-    }
-
-    # Create shortcuts for the options, and initialize them.
-    foreach k {open save merge} {upvar 0 opts($k) $k}
-    set open  0
-    set save  0
-    set merge 0
-
-    # Option processing ...
-
-    array set opts [GetOptions args]
-
-    # Basic validation ...
-
-    if {$open && $save} {
-	return -code error "-open and -save exclude each other"
-    } elseif {!$open && !$save} {
-	set open 1
-    }
-
-    if {![llength $args]} {
-	return -code error "dstype and type arguments missing"
-    }
-    set type [lindex $args 0]
-    set args [lrange $args 1 end]
-
-    # Create DS object from type (DS class) and args.
-    if {[::info exists registry($type)]} {
-	set type $registry($type)
-    }
-    set dso [eval [concat $type %AUTO% $args]]
-
-    Connect thearray $open $merge $dso
-    return [NewToken thearray $dso]
-}
-
-proc ::tie::untie {avar args} {
-    # Syntax : arrayvarname ?token?
-
-    variable mgr
-    variable tie
-
-    upvar 1 $avar thearray
-
-    switch -exact -- [llength $args] {
-	0 {
-	    # Remove all ties for the variable. Do nothing if there
-	    # are no ties in place.
-
-	    set mid [TraceManager thearray]
-	    if {$mid eq ""} return
-	}
-	1 {
-	    # Remove a specific tie.
-
-	    set tid [lindex $args 0]
-	    if {![::info exists tie($tid)]} {
-		return -code error "Unknown tie \"$tid\""
-	    }
-
-	    foreach {mid dso} $tie($tid) break
-	    set midvar [TraceManager thearray]
-
-	    if {$mid ne $midvar} {
-		return -code error "Tie \"$tid\" not associated with variable \"$avar\""
-	    }
-
-	    set pos       [lsearch -exact $mgr($mid) $tid]
-	    set mgr($mid) [lreplace $mgr($mid) $pos $pos]
-
-	    unset tie($tid)
-	    $dso destroy
-
-	    # Leave the manager in place if there still ties
-	    # associated with the variable.
-	    if {[llength $mgr($mid)]} return
-	}
-	default {
-	    return -code error "wrong#args: array ?token?"	    
-	}
-    }
-
-    # Delegate full removal to common code.
-    Untie $mid thearray
-    return
-}
-
-proc ::tie::info {cmd args} {
-    variable mgr
-    if {$cmd eq "ties"} {
-	if {[llength $args] != 1} {
-	    return -code error "wrong#args: should be \"tie::info ties avar\""
-	}
-	upvar 1 [lindex $args 0] thearray
-	set mid [TraceManager thearray]
-	if {$mid eq ""} {return {}}
-
-	return $mgr($mid)
-    } elseif {$cmd eq "types"} {
-	if {[llength $args] != 0} {
-	    return -code error "wrong#args: should be \"tie::info types\""
-	}
-	variable registry
-	return [array get registry]
-    } elseif {$cmd eq "type"} {
-	if {[llength $args] != 1} {
-	    return -code error "wrong#args: should be \"tie::info type dstype\""
-	}
-	variable registry
-	set type [lindex $args 0]
-	if {![::info exists registry($type)]} {
-	    return -code error "Unknown type \"$type\""
-	}
-	return $registry($type)
-    } else {
-	return -code error "Unknown command \"$cmd\", should be ties, type, or types"
-    }
-}
-
-proc ::tie::register {dsclasscmd _as_ dstype} {
-    variable registry
-    if {$_as_ ne "as"} {
-	return -code error "wrong#args: should be \"tie::register command 'as' type\""
-    }
-
-    # Resolve a chain of type definitions right now.
-    while {[::info exists registry($dsclasscmd)]} {
-	set dsclasscmd $registry($dsclasscmd)
-    }
-
-    set registry($dstype) $dsclasscmd
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Internal : Framework state
-
-namespace eval ::tie {
-    # Registry of short names and their associated class commands
-
-    variable  registry
-    array set registry {}
-
-    # Management databases for the ties.
-    #
-    #    mgr   : mgr id  -> list (tie id)
-    #    tie   : tie id  -> (mgr id, dso cmd)
-    #
-    #    array  ==> mgr -1---n-> tie
-    #                ^           |
-    #                +-1-------n-+
-    #
-    #    lock  : mgr id x key -> 1/exists 0/!exists
-
-    # Database of managers for arrays.
-    # Also counter for the generation of mgr ids.
-
-    variable mgrcount 0
-    variable mgr ; array set mgr {}
-
-
-    # Database of ties (and their tokens).
-    # Also counter for the generation of tie ids.
-
-    variable  tiecount 0
-    variable  tie ; array set tie {}
-
-    # Database of locked arrays, keys, and data sources.
-
-    variable  lock ; array set lock {}
-
-    # Key	| Meaning
-    # ---	+ -------
-    # $mid,$idx	| Propagation for index $idx is in progress.
-}
-
-# ### ### ### ######### ######### #########
-## Internal : Option processor
-
-proc ::tie::GetOptions {arglistVar} {
-    upvar 1 $arglistVar argv
-
-    set opts [lrange [::cmdline::GetOptionDefaults {
-	{open        {}}
-	{save        {}}
-	{merge       {}}
-    } result] 2 end] ;# Remove ? and help.
-
-    set argc [llength $argv]
-    while {[set err [::cmdline::getopt argv $opts opt arg]]} {
-	if {$err < 0} {
-	    set olist ""
-	    foreach o [lsort $opts] {
-		if {[string match *.arg $o]} {
-		    set o [string range $o 0 end-4]
-		}
-		lappend olist -$o
-	    }
-	    return -code error "bad option \"$opt\",\
-		    should be one of\
-		    [linsert [join $olist ", "] end-1 or]"
-	}
-	set result($opt) $arg
-    }
-    return [array get result]
-}
-
-# ### ### ### ######### ######### #########
-## Internal : Token generator
-
-proc ::tie::NewToken {avar dso} {
-    variable tiecount
-    variable tie
-    variable mgr
-
-    upvar 1 $avar thearray
-
-    set     mid         [NewTraceManager thearray]
-    set     tid         tie[incr tiecount]
-    set     tie($tid)   [list $mid $dso]
-    lappend mgr($mid)   $tid
-    return $tid
-}
-
-# ### ### ### ######### ######### #########
-## Internal : Trace Management
-
-proc ::tie::TraceManager {avar} {
-    upvar 1 $avar thearray
-
-    set traces [trace info variable thearray]
-
-    foreach t $traces {
-	foreach {op cmd} $t break
-	if {
-	    ([llength $cmd] == 2) &&
-	    ([lindex $cmd 0] eq "::tie::Trace")
-	} {
-	    # Our internal manager id is the first argument of the
-	    # trace command we attached to the array.
-	    return [lindex $cmd 1]
-	}
-    }
-    # No framework trace was found, there is no manager.
-    return {}
-}
-
-proc ::tie::NewTraceManager {avar} {
-    variable mgrcount
-    variable mgr
-
-    upvar 1 $avar thearray
-
-    set mid [TraceManager thearray]
-    if {$mid ne ""} {return $mid}
-
-    # No manager was found, we have to create a new one for the
-    # variable.
-
-    set mid [incr mgrcount]
-    set mgr($mid) [list]
-
-    trace add variable thearray \
-	    {write unset} \
-	    [list ::tie::Trace $mid]
-
-    return $mid
-}
-
-proc ::tie::Trace {mid avar idx op} {
-    #puts "[pid] Trace $mid $avar ($idx) $op"
-
-    variable mgr
-    variable tie
-    variable lock
-
-    upvar $avar thearray
-
-    if {($op eq "unset") && ($idx eq "")} {
-	# The variable as a whole is unset. This
-	# destroys all the ties placed on it.
-	# Note: The traces are already gone!
-
-	Untie $mid thearray
-	return
-    }
-
-    if {[::info exists lock($mid,$idx)]} {
-	#puts "%% locked $mid,$idx"
-	return
-    }
-    set lock($mid,$idx) .
-    #puts "%% lock $mid,$idx"
-
-    if {$op eq "unset"} {
-	foreach tid $mgr($mid) {
-	    set dso [lindex $tie($tid) 1]
-	    $dso unsetv $idx
-	}
-    } elseif {$op eq "write"} {
-	set value $thearray($idx)
-	foreach tid $mgr($mid) {
-	    set dso [lindex $tie($tid) 1]
-	    $dso setv $idx $value
-	}
-    } else {
-	#puts "%% unlock/1 $mid,$idx"
-	unset -nocomplain lock($mid,$idx)
-	return -code error "Bad trace call, unexpected operation \"$op\""
-    }
-
-    #puts "%% unlock/2 $mid,$idx"
-    unset -nocomplain lock($mid,$idx)
-    return
-}
-
-proc ::tie::Connect {avar open merge dso} {
-    upvar 1 $avar thearray
-
-    # Doing this as first operation is a convenient check that the ds
-    # object command exists.
-    set dsdata [$dso get]
- 
-    if {$open} {
-	# Open DS and load data from it.
-
-	# Save current contents of array, for restoration in case of
-	# trouble.
-	set save [array get thearray]
-
-	if {$merge} {
-	    # merge -> Remember the existing keys, so that we
-	    # save their contents after loading the DS as well.
-	    set wback [array names thearray]
-	} else {
-	    # not merge -> Replace existing content.
-	    array unset thearray *
-	}
-
-	if {[set code [catch {
-	    array set thearray $dsdata
-	    # ! Propagation through other ties.
-	} msg]]} {
-	    # Errors found. Reset bogus contents, then reinsert the
-	    # saved information to restore the previous state.
-	    array unset thearray *
-	    array set thearray $save
-
-	    return -code $code \
-		    -errorcode $::errorCode \
-		    -errorinfo $::errorInfo $msg
-	}
-
-	if {$merge} {
-	    # Now save everything we had before the tie was added into
-	    # the DS. This may save data which came from the DS.
-	    foreach idx $wback {
-		$dso setv $idx $thearray($idx)
-	    }
-	}
-    } else {
-	# Save array data to DS.
-
-	# Save current contents of DS, for restoration in case of
-	# trouble.
-	# set save $dsdata
-
-	set source [array get thearray]
-
-	if {$merge} {
-	    # merge -> Remember the existing keys, so that we
-	    # read their contents after saving the array as well.
-	    set rback [$dso names]
-	} else {
-	    # not merge -> Replace existing content.
-	    $dso unset
-	}
-
-	if {[set code [catch {
-	    $dso set $source
-	} msg]]} {
-	    $dso unset
-	    $dso set $dsdata
-
-	    return -code $code \
-		    -errorcode $::errorCode \
-		    -errorinfo $::errorInfo $msg
-	}
-
-	if {$merge} {
-	    # Now read everything we had before the tie was added from
-	    # the DS. This may read data which came from the array.
-	    foreach idx $rback {
-		set thearray($idx) [$dso getv $idx]
-		# ! Propagation through other ties.
-	    }
-	}
-    }
-    return
-}
-
-proc ::tie::Untie {mid avar} {
-    variable mgr
-    variable tie
-    variable lock
-
-    upvar 1 $avar thearray
-
-    trace remove variable thearray \
-	    {write unset} \
-	    [list ::tie::Trace $mid]
-
-    foreach tid $mgr($mid) {
-	foreach {mid dso} $tie($tid) break
-	# ASSERT: mid == mid
-
-	unset tie($tid)
-	$dso destroy
-    }
-
-    unset mgr($mid)
-    array unset lock ${mid},*
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Test helper, peek into internals
-## Returns a serialized representation.
-
-proc ::tie::Peek {} {
-    variable mgr
-    variable tie
-
-    variable mgrcount
-    variable tiecount
-
-    list \
-	    $mgrcount $tiecount \
-	    mgr [Dictsort [array get mgr]] \
-	    tie [Dictsort [array get tie]]
-}
-
-proc ::tie::Reset {} {
-    variable mgrcount 0
-    variable tiecount 0
-    return
-}
-
-proc ::tie::Dictsort {dict} {
-    array set a $dict
-    set out [list]
-    foreach key [lsort [array names a]] {
-	lappend out $key $a($key)
-    }
-    return $out
-}
-
-# ### ### ### ######### ######### #########
-## Standard DS classes
-# @mdgen NODEP: tie::std::log
-# @mdgen NODEP: tie::std::dsource
-# @mdgen NODEP: tie::std::array
-# @mdgen NODEP: tie::std::rarray
-# @mdgen NODEP: tie::std::file
-# @mdgen NODEP: tie::std::growfile
-
-::tie::register {package require tie::std::log      ; ::tie::std::log}      as log
-::tie::register {package require tie::std::dsource  ; ::tie::std::dsource}  as dsource
-::tie::register {package require tie::std::array    ; ::tie::std::array}    as array
-::tie::register {package require tie::std::rarray   ; ::tie::std::rarray}   as remotearray
-::tie::register {package require tie::std::file     ; ::tie::std::file}     as file
-::tie::register {package require tie::std::growfile ; ::tie::std::growfile} as growfile
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-package provide tie 1.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_array.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_array.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,124 +1,0 @@
-# tie_array.tcl --
-#
-#	Data source: Tcl array.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_array.tcl,v 1.3 2005/09/28 04:51:24 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::tie::std::array {
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-    pragma -simpledispatch yes
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {rvar} {
-	# Bring reference to the array into the object scope,
-	# i.e. namespace of the object. This will fail for proc local
-	# variables. This latter is enforced by the core, to prevent
-	# the existence of dangling references to the variable when
-	# the procedure goes away.
-
-	# upvar 3, because we have to skip 3 snit internal levels to
-	# access the callers level.
-
-	if {[catch {
-	    upvar 3 $rvar ${selfns}::thesource
-	}]} {
-	    return -code error "Illegal use of proc local array variable \"$rvar\""
-	}
-
-	# Now bring the variable into method scope as well, to check
-	# for its existence.
-
-	variable ${selfns}::thesource
-
-	if {![array exists thesource]} {
-	    return -code error "Undefined source array variable \"$rvar\""
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    method get {} {
-	variable ${selfns}::thesource
-	return [array get thesource]
-    }
-
-    method set {dict} {
-	variable ${selfns}::thesource
-	return [array set thesource $dict]
-    }
-
-    method unset {{pattern *}} {
-	variable ${selfns}::thesource
-	array unset thesource $pattern
-	return
-    }
-
-    method names {} {
-	variable ${selfns}::thesource
-	return [array names thesource]
-    }
-
-    method size {} {
-	variable ${selfns}::thesource
-	return [array size thesource]
-    }
-
-    method getv {index} {
-	variable ${selfns}::thesource
-	return $thesource($index)
-    }
-
-    method setv {index value} {
-	variable ${selfns}::thesource
-	set thesource($index) $value
-	return
-    }
-
-    method unsetv {index} {
-	variable ${selfns}::thesource
-	unset thesource($index)
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal : Instance data
-
-    ## During construction the source array variable is imported into
-    ## the namespace of the object, for direct access through a
-    ## constant name. This also allows a direct reference without
-    ## having to deal with changing stack scopes. This is possible if
-    ## and only if the imported array is a namespaced variable. Proc
-    ## local variables cannot be imported into a namespace in this
-    ## manner. Trying to do so results in an error.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::array as array
-package provide   tie::std::array 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_dsource.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_dsource.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,54 +1,0 @@
-# tie_dsource.tcl --
-#
-#	Data source: Data source object. I.e. here we implement a proxy.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_dsource.tcl,v 1.3 2005/09/28 04:51:24 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::tie::std::dsource {
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {args} {
-	set delegate $args
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    delegate method * to delegate
-
-    # ### ### ### ######### ######### #########
-    ## Internal : Instance data
-
-    variable delegate ; # The object to delegate to.
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::dsource as dsource
-package provide   tie::std::dsource 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_file.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_file.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,268 +1,0 @@
-# tie_file.tcl --
-#
-#	Data source: Files.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_file.tcl,v 1.8 2006/09/19 23:36:18 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::tie::std::file {
-    # ### ### ### ######### ######### #########
-    ## Notes
-
-    ## This data source maintains an internal cache for higher
-    ## efficiency, i.e. to avoid having to go out to the slow file.
-
-    ## This cache is handled as follows
-    ##
-    ## - All write operations invalidate the cache and write directly
-    ##   to the file.
-    ##
-    ## - All read operations load from the file if the cache is
-    ##   invalid, and from the cache otherwise
-
-    ## This scheme works well in the following situations:
-
-    ## (a) The data source is created, and then only read from.
-    ## (b) The data source is created, and then only written to.
-    ## (c) The data source is created, read once, and then only
-    ##     written to.
-
-    ## This scheme works badly if the data source is opened and then
-    ## randomly read from and written to. The cache is useless, as it
-    ## is continuously invalidated and reloaded.
-
-    ## This no problem from this developers POV of view however.
-    ## Consider the context. If you have this situation just tie the
-    ## DS to an array A after creation. The tie framework operates on
-    ## the DS in mode (c) and A becomes an explicit cache for the DS
-    ## which is not invalidated by writing to it. IOW this covers
-    ## exactly the situation the DS by itself is not working well for.
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-    pragma -simpledispatch yes
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {thepath} {
-	# Locate and open the journal file.
-
-	set path [::file normalize $thepath]
-	if {[::file exists $path]} {
-	    set chan [open $path {RDWR EXCL APPEND}]
-	} else {
-	    set chan [open $path {RDWR EXCL CREAT APPEND}]
-	}
-	fconfigure $chan -buffering none -encoding utf-8
-	return
-    }
-
-    destructor {
-	# Release the channel to the journal file, should it be open.
-	if {$chan ne ""} {close $chan}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    method get {} {
-	if {![::file size $path]} {return {}}
-	$self LoadJournal
-	return [array get cache]
-    }
-
-    method set {dict} {
-	puts $chan [list array set $dict]
-	$self Invalidate
-	return
-    }
-
-    method unset {{pattern *}} {
-	puts $chan [list array unset $pattern]
-	$self Invalidate
-	return
-    }
-
-    method names {} {
-	if {![::file size $path]} {return {}}
-	$self LoadJournal
-	return [array names cache]
-    }
-
-    method size {} {
-	if {![::file size $path]} {return 0}
-	$self LoadJournal
-	return [array size cache]
-    }
-
-    method getv {index} {
-	if {![::file size $path]} {
-	    return -code error "can't read \"$index\": no such variable"
-	}
-	$self LoadJournal
-	return $cache($index)
-    }
-
-    method setv {index value} {
-	puts $chan [list set $index $value]
-	$self Invalidate
-	return
-    }
-
-    method unsetv {index} {
-	puts $chan [list unset $index]
-	$self Invalidate
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal : Instance data
-
-    variable chan {} ; # Channel to write the journal.
-    variable path {} ; # Path to journal file.
-
-    # Journal loading, and cache.
-
-    variable count 0         ; # #Operations in the journal.
-    variable cvalid 0        ; # Validity of the cache.
-    variable cache -array {} ; # Cache for journal
-
-    # Management of the cache: See notes at beginning.
-
-    # ### ### ### ######### ######### #########
-    ## Internal: Loading from the journal.
-
-    method LoadJournal {} {
-	if {$cvalid} return
-	$self Replay
-	$self Compact
-	return
-    }
-
-    method Replay {} {
-	# Use a safe interp for the evaluation of the journal file.
-	# (Empty safe for the hidden commands and the aliases we insert).
-
-	# Called for !cvalid, implies cache does not exist
-
-	set ip [interp create -safe]
-	foreach c [$ip eval {info commands}] {
-	    if {$c eq "rename"} continue
-	    $ip eval [list rename $c {}]
-	}
-	$ip eval {rename rename {}}
-
-	interp alias $ip set   {} $self Set
-	interp alias $ip unset {} $self Unset
-	interp alias $ip array {} $self Array
-
-	array set cache {}
-	set       count 0
-
-	$ip invokehidden -global source $path
-	interp delete $ip
-
-	set cvalid 1
-	return
-    }
-
-    method Compact {} {
-	# Compact the journal
-
-	#puts @@/2*$count/3*[array size temp]/=/[expr {2*$count >= 3*[array size temp]}]
-
-	# ASSERT cvalid
-
-	# do not compact <=>
-	# 2*ops < 3*size <=>
-	# ops < 3/2*size <=>
-	# ops < 1.5*size
-
-	if {(2*$count) < (3*[array size cache])} return
-
-	::file delete -force ${path}.new
-	set new [open ${path}.new {RDWR EXCL CREAT APPEND}]
-	fconfigure $new -buffering none -encoding utf-8
-
-	# Compress current contents into a single multi-key load operation.
-	puts $new [list array set [array get cache]]
-
-	if {$::tcl_platform(platform) eq "windows"} {
-	    # For windows the open channels prevent us from
-	    # overwriting the old file. We have to leave
-	    # attackers a (small) window of opportunity for
-	    # replacing the file with something they own :(
-	    close $chan
-	    close $new
-	    ::file rename -force ${path}.new $path
-	    set chan [open ${path} {RDWR EXCL APPEND}]
-	    fconfigure $chan -buffering none -encoding utf-8
-	} else {
-	    # Copy compacted journal over the existing one.
-	    ::file rename -force ${path}.new $path
-	    close $chan
-	    set    chan $new
-	}
-	return
-    }
-
-    method Set {index value} {
-	set cache($index) $value
-	incr count
-	return
-    }
-
-    method Unset {index} {
-	unset cache($index)
-	incr count
-	return
-    }
-
-    method Array {cmd detail} {
-	# syntax : set   dict
-	# ...... : unset pattern
-
-	if {$cmd eq "set"} {
-	    array set cache $detail
-	} elseif {$cmd eq "unset"} {
-	    array unset cache $detail
-	} else {
-	    return -code error "Illegal command \"$cmd\""
-	}
-	incr count
-	return
-    }
-
-    method Invalidate {} {
-	if {!$cvalid} return
-	set cvalid 0
-	unset cache
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::file as file
-package provide   tie::std::file 1.0.2
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_growfile.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_growfile.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,147 +1,0 @@
-# tie_growfile.tcl --
-#
-#	Data source: Files.
-#
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_growfile.tcl,v 1.1 2006/03/08 04:55:58 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::tie::std::growfile {
-    # ### ### ### ######### ######### #########
-    ## Notes
-
-    ## This data source is geared towards the storage of arrays which
-    ## will never shrink over time. Data is always appended to the
-    ## files associated with this driver. Nothing is ever
-    ## removed. Compaction does not happen either, so modification of
-    ## array entries will keep the old information around in the history.
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-    pragma -simpledispatch yes
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {thepath} {
-	# Locate and open the journal file.
-
-	set path [file normalize $thepath]
-	if {[file exists $path]} {
-	    set chan [open $path {RDWR EXCL APPEND}]
-	} else {
-	    set chan [open $path {RDWR EXCL CREAT APPEND}]
-	}
-	fconfigure $chan -buffering none -encoding utf-8
-	return
-    }
-
-    destructor {
-	# Release the channel to the journal file, should it be open.
-	if {$chan ne ""} {close $chan}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    method get {} {
-	if {![file size $path]} {return {}}
-	$self LoadJournal
-	return [array get cache]
-    }
-
-    method names {} {
-	if {![file size $path]} {return {}}
-	$self LoadJournal
-	return [array names cache]
-    }
-
-    method size {} {
-	if {![file size $path]} {return 0}
-	$self LoadJournal
-	return [array size cache]
-    }
-
-    method getv {index} {
-	if {![file size $path]} {
-	    return -code error "can't read \"$index\": no such variable"
-	}
-	$self LoadJournal
-	return $cache($index)
-    }
-
-    method set {dict} {
-	puts  -nonewline $chan $dict
-	puts  -nonewline $chan { }
-	flush            $chan
-	return
-    }
-
-    method setv {index value} {
-	puts  -nonewline $chan [list $index $value]
-	puts  -nonewline $chan { }
-	flush            $chan
-	return
-    }
-
-    method unset {{pattern *}} {
-	return -code error \
-		"Deletion of entries is not allowed by this data source"
-    }
-
-    method unsetv {index} {
-	return -code error \
-		"Deletion of entries is not allowed by this data source"
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal : Instance data
-
-    variable chan {} ; # Channel to write the journal.
-    variable path {} ; # Path to journal file.
-
-    # Journal loading, and cache.
-
-    variable count 0         ; # #Operations in the journal.
-    variable cvalid 0        ; # Validity of the cache.
-    variable cache -array {} ; # Cache for journal
-
-    # Management of the cache: See notes at beginning.
-
-    # ### ### ### ######### ######### #########
-    ## Internal: Loading from the journal.
-
-    method LoadJournal {} {
-	if {$cvalid} return
-	set cvalid 1
-
-	set in [open $path r]
-	array set cache [read $in]
-	close $in
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::growfile as growfile
-package provide   tie::std::growfile 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_log.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_log.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,95 +1,0 @@
-# tie_log.tcl --
-#
-#	Data source: /dev/null. Just log changes.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_log.tcl,v 1.3 2005/09/28 04:51:24 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require log
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-package require snit
-snit::type ::tie::std::log {
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-    pragma -simpledispatch yes
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {} {
-	::log::log debug "$self construction"
-	return
-    }
-
-    destructor {
-	::log::log debug "$self destruction"
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    method get {} {
-	::log::log debug "$self get (nothing)"
-	return {}
-    }
-
-    method set {dict} {
-	::log::log debug "$self set [list $dict]"
-	return
-    }
-
-    method unset {{pattern *}} {
-	::log::log debug "$self unset $pattern"
-	return
-    }
-
-    method names {} {
-	::log::log debug "$self names (nothing)"
-	return {}
-    }
-
-    method size {} {
-	::log::log debug "$self size (0)"
-	return 0
-    }
-
-    method getv {index} {
-	::log::log debug "$self get ($index)"
-	return {}
-    }
-
-    method setv {index value} {
-	::log::log debug "$self set ($index) = \[$value\]"
-	return
-    }
-
-    method unsetv {index} {
-	::log::log debug "$self unset ($index)"
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::log as log
-package provide   tie::std::log 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_rarray.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tie/tie_rarray.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,118 +1,0 @@
-# tie_rarray.tcl --
-#
-#	Data source: Remote Tcl array.
-#
-# Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tie_rarray.tcl,v 1.3 2005/09/28 04:51:24 andreas_kupries Exp $
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require snit
-package require tie
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::tie::std::rarray {
-
-    # ### ### ### ######### ######### #########
-    ## Specials
-
-    pragma -hastypemethods no
-    pragma -hasinfo        no
-    pragma -simpledispatch yes
-
-    # ### ### ### ######### ######### #########
-    ## API : Construction & Destruction
-
-    constructor {rvar cmdpfx id} {
-	set remotevar $rvar
-	set cmd       $cmdpfx
-	set rid       $id
-
-	if {![$self Call array exists $rvar]} {
-	    return -code error "Undefined source array variable \"$rvar\""
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API : Data source methods
-
-    method get {} {
-	return [$self Call array get $remotevar]
-    }
-
-    method set {dict} {
-	$self Call array set $remotevar $dict
-	return
-    }
-
-    method unset {{pattern *}} {
-	$self Call array unset $remotevar $pattern
-	return
-    }
-
-    method names {} {
-	return [$self Call array names $remotevar]
-    }
-
-    method size {} {
-	return [$self Call array size $remotevar]
-    }
-
-    method getv {index} {
-	return [$self Call set ${remotevar}($index)]
-    }
-
-    method setv {index value} {
-	$self Call set ${remotevar}($index) $value
-	return
-    }
-
-    method unsetv {index} {
-	$self Call unset -nocomplain ${remotevar}($index)
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal : Instance data
-
-    variable remotevar {} ; # Name of rmeote array
-    variable cmd       {} ; # Send command prefix
-    variable rid       {} ; # Id of entity hosting the array.
-
-    # ### ### ### ######### ######### #########
-    ## Internal: Calling to the remote entity.
-
-    ## All calls are synchronous. Asynchronous operations would
-    ## created problems with circular ties. Because the operation may
-    ## came back so much later that the origin is already in a
-    ## completely new state. This is avoied in synchronous mode as the
-    ## origin waits for the change to be acknowledged, and the
-    ## operation came back in this time. The change made by it is no
-    ## problem. The trace is still running, thus any write does _not_
-    ## re-invoke our trace. The only possible problem is an unset for
-    ## an element already gone. This was solved by using -nocomplain
-    ## when propagating this type of change.
-
-    method Call {args} {
-	set     c $cmd
-	lappend c $rid
-	foreach a $args {lappend c $a}
-	return [uplevel #0 $c]
-    }
-
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready to go
-
-::tie::register ::tie::std::rarray as remotearray
-package provide   tie::std::rarray 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tiff/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tiff/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,2 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded tiff 0.1 [list source [file join $dir tiff.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/tiff/tiff.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/tiff/tiff.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,786 +1,0 @@
-# tiff.tcl --
-#
-#       Querying and modifying TIFF image files.
-#
-# Copyright (c) 2004    Aaron Faupell <afaupell@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# 
-# RCS: @(#) $Id: tiff.tcl,v 1.3 2006/07/20 07:09:58 afaupell Exp $
-
-package provide tiff 0.1
-
-namespace eval ::tiff {}
-
-proc ::tiff::openTIFF {file {mode r}} {
-    variable byteOrder
-    set fh [open $file $mode]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    binary scan [read $fh 2] H4 byteOrder
-    if {$byteOrder == "4949"} {
-        set byteOrder little
-    } elseif {$byteOrder == "4d4d"} {
-        set byteOrder big
-    } else {
-        close $fh
-        return -code error "not a tiff file"
-    }
-    _scan $byteOrder [read $fh 6] si version offset
-    if {$version != "42"} {
-        close $fh
-        return -code error "not a tiff file"
-    }
-    seek $fh $offset start
-    return $fh
-}
-
-proc ::tiff::isTIFF {file} {
-    set is [catch {openTIFF $file} fh]
-    catch {close $fh}
-    return [expr {!$is}]
-}
-
-proc ::tiff::byteOrder {file} {
-    global $byteOrder
-    set fh [openTIFF $file]
-    close $fh
-    return $byteOrder
-}
-
-proc ::tiff::nametotag {names} {
-    variable tiff_sgat
-    set out {}
-    foreach x $names {
-        set y [lindex $x 0]
-        if {[info exists tiff_sgat($y)]} {
-            set y $tiff_sgat($y)
-        } elseif {![string match {[0-9a-f][0-9a-f][0-9a-f][0-9a-f]} $x]} {
-            error "unknown tag $y"
-        }
-        lappend out [lreplace $x 0 0 $y]
-    }
-    return $out
-}
-
-proc ::tiff::tagtoname {tags} {
-    variable tiff_tags
-    set out {}
-    foreach x $tags {
-        set y [lindex $x 0]
-        if {[info exists tiff_tags($y)]} { set y $tiff_tags($y) }
-        lappend out [lreplace $x 0 0 $y]
-    }
-    return $out
-}
-
-proc ::tiff::numImages {file} {
-    variable byteOrder
-    set fh [openTIFF $file]
-    set images [llength [_ifds $fh]]
-    close $fh
-    return $images
-}
-
-proc ::tiff::dimensions {file {image 0}} {
-    return [getEntry $file {0100 0101} $image]
-}
-
-proc ::tiff::imageInfo {file {image 0}} {
-    return [getEntry $file {ImageWidth ImageLength BitsPerSample Compression \
-          PhotometricInterpretation ImageDescription Orientation XResolution \
-          YResolution ResolutionUnit DateTime Artist HostComputer} $image]
-}
-
-proc ::tiff::entries {file {image 0}} {
-    variable byteOrder
-    set fh [openTIFF $file]
-    set ret {}
-    if {[set ifd [lindex [_ifds $fh] $image]] != ""} {
-        seek $fh $ifd
-        foreach e [tagtoname [_entries $fh]] {
-            lappend ret [lindex $e 0]
-        }
-    }
-    close $fh
-    return $ret
-}
-
-proc ::tiff::getEntry {file entry {image 0}} {
-    variable byteOrder
-    set fh [openTIFF $file]
-    set ret {}
-    if {[set ifd [lindex [_ifds $fh] $image]] != ""} {
-        seek $fh $ifd 
-        set ent [_entries $fh]
-        foreach e $entry {
-            if {[set x [lsearch -inline $ent "[nametotag $e] *"]] != ""} {
-                seek $fh [lindex $x 1]
-                lappend ret $e [lindex [_getEntry $fh] 1]
-            } else {
-                lappend ret $e {}
-            }
-        }
-    }
-    close $fh
-    return $ret
-}
-
-proc ::tiff::addEntry {file entry {image 0}} {
-    variable byteOrder
-    set fh [openTIFF $file]
-    set new [_new $file.tmp $byteOrder]
-    set ifds [_ifds $fh]
-    for {set i 0} {$i < [llength $ifds]} {incr i} {
-        seek $fh [lindex $ifds $i]
-        _readifd $fh ifd
-        if {$i == $image || $image == "all"} {
-            foreach e [nametotag $entry] {
-                set ifd($tag) [eval _unformat $byteOrder $e]
-            }
-        }
-        _copyData $fh $new ifd
-    }
-    close $fh
-    close $new
-    file rename -force $file.tmp $file
-}
-
-proc ::tiff::deleteEntry {file entry {image 0}} {
-    variable byteOrder
-    set fh [openTIFF $file]
-    set new [_new $file.tmp $byteOrder]
-    set ifds [_ifds $fh]
-    for {set i 0} {$i < [llength $ifds]} {incr i} {
-        seek $fh [lindex $ifds $i]
-        _readifd $fh ifd
-        if {$i == $image || $image == "all"} {
-            foreach e [nametotag $entry] { unset -nocomplain ifd($e) }
-        }
-        _copyData $fh $new ifd
-    }
-    close $fh
-    close $new
-    file rename -force $file.tmp $file
-}
-
-proc ::tiff::writeImage {image file {entry {}}} {
-    variable byteOrder
-    set byteOrder big
-    set fh [_new $file $byteOrder]
-    set w [$image cget -width]
-    set h [$image cget -height]
-    set ifd(0100) [_unformat $byteOrder 0100 4 $w]      ;# width
-    set ifd(0101) [_unformat $byteOrder 0101 4 $h]      ;# height
-    set ifd(0102) [_unformat $byteOrder 0102 3 {8 8 8}] ;# color depth
-    set ifd(0103) [_unformat $byteOrder 0103 3 1]       ;# compression = none
-    set ifd(0106) [_unformat $byteOrder 0106 3 2]       ;# photometric interpretation = rgb
-    set ifd(0115) [_unformat $byteOrder 0115 3 3]       ;# 3 samples per pixel r, g, and b
-    set ifd(011c) [_unformat $byteOrder 011c 3 1]       ;# planar configuration = rgb
-    foreach {tag format value} $entry {
-        set ifd($tag) [_unformat $byteOrder $tag $format $value]
-    }
-
-    set rowsPerStrip 2
-    while {$w * 3 * $rowsPerStrip < 8000} { incr rowsPerStrip }
-    incr rowsPerStrip -1
-    set strips [expr {int(ceil($h / double($rowsPerStrip)))}]
-    set stripSize [expr {$w * $rowsPerStrip * 3}]
-    set lastStripSize [expr {3 * $w * ($h - (($strips - 1) * $rowsPerStrip))}]
-    
-    for {set i $strips} {$i > 1} {incr i -1} { lappend sizes $stripSize }
-    lappend sizes $lastStripSize
-    
-    set ifd(0116) [_unformat $byteOrder 0116 4 $rowsPerStrip]
-    set ifd(0111) [_unformat $byteOrder 0111 4 $sizes]
-    # dummy data, to get ifd size, real value inserted later
-    set ifd(0117) [_unformat $byteOrder 0117 4 $sizes]
-    
-    # add 8 bytes for file header
-    set start [expr {[_ifdsize ifd] + 8}]
-    for {set i $strips} {$i > 0} {incr i -1} {
-        lappend offsets $start
-        incr start $stripSize
-    }
-    set ifd(0111) [_unformat $byteOrder 0111 4 $offsets]
-    
-    _writeifd $fh ifd
-
-    for {set y 0} {$y < $h} {incr y} {
-        for {set x 0} {$x < $w} {incr x} {
-            foreach {r g b} [$image get $x $y] {
-                puts -nonewline $fh [_unscan $byteOrder ccc [expr {$r & 0xFF}] [expr {$g & 0xFF}] [expr {$b & 0xFF}]]
-            }
-        }
-    }
-    
-    close $fh
-}
-
-proc ::tiff::getImage {file {image 0}} {
-    array set tags [getEntry $file {0100 0101 0102 0103 0106 011c 0115 0111 0117 0140} $image]
-    if {$tags(0102) == "8 8 8" && $tags(0103) == 1 && $tags(0106) == 2 && $tags(0115) == 3 && $tags(011c) == 1} {
-        set w $tags(0100)
-        set h $tags(0101)
-        set i [image create photo -height $h -width $w]
-        set fh [open $file]
-        fconfigure $fh -translation binary -encoding binary -eofchar {}
-
-        set y 0
-        set x 0
-        set row {}
-        set block {}
-        foreach offset $tags(0111) len $tags(0117) {
-            seek $fh $offset start
-            binary scan [read $fh $len] c* buf
-            foreach {r g b} $buf {
-                lappend row [format "#%02X%02X%02X" [expr {$r & 0xFF}] [expr {$g & 0xFF}] [expr {$b & 0xFF}]]
-                incr x
-                if {$x == $w} { lappend block $row; set row {}; set x 0 }
-            }
-            $i put $block -to 0 $y
-            incr y [llength $block]
-            set block {}
-        }
-        close $fh
-    } elseif {$tags(0102) == 8 && $tags(0103) == 1 && $tags(0106) == 3 && $tags(0115) == 1 && $tags(011c) == 1} {
-        set w $tags(0100)
-        set h $tags(0101)
-        set i [image create photo -height $h -width $w]
-        set fh [open $file]
-        fconfigure $fh -translation binary -encoding binary -eofchar {}
-
-        set map {}
-        set third [expr {[llength $tags(0140)] / 3}]
-        set rs [lrange $tags(0140) 0 [expr {$third - 1}]]
-        set gs [lrange $tags(0140) $third [expr {($third * 2) - 1}]]
-        set bs [lrange $tags(0140) [expr {$third * 2}] end]
-        foreach r $rs g $gs b $bs {
-            set r [expr {int($r / 256) & 0xFF}]
-            set g [expr {int($g / 256) & 0xFF}]
-            set b [expr {int($b / 256) & 0xFF}]
-            lappend map [format "#%02X%02X%02X" $r $g $b]
-        }
-        
-        set y 0
-        set x 0
-        set row {}
-        set block {}
-        
-        foreach offset $tags(0111) len $tags(0117) {
-            seek $fh $offset start
-            binary scan [read $fh $len] c* buf
-            foreach index $buf {
-                lappend row [lindex $map [expr {$index & 0xFF}]]
-                incr x
-                if {$x == $w} { lappend block $row; set row {}; set x 0 }
-            }
-            $i put $block -to 0 $y
-            incr y [llength $block]
-            set block {}
-        }
-        close $fh
-    } else {
-        error "I cant read that image format"
-    }
-    return $i
-}
-
-proc ::tiff::_copyData {fh new var} {
-    variable byteOrder
-    upvar $var ifd
-
-    set fix {}
-    #       strips, free bytes, tiles,   and their sizes     
-    foreach f_off {0111 0120 0143} f_len {0117 0121 0144} {
-        if {![info exists ifd($f_len)] || ![info exists ifd($f_off)]} { continue }
-        set n 0
-        # put everything into a list
-        foreach x [_value $ifd($f_len)] y [_value $ifd($f_off)] {
-            lappend fix [list $n $f_len $x $f_off $y]
-            incr n
-        }
-    }
-    set offset [expr {[tell $new] + [_ifdsize ifd]}]
-    set new_fix {}
-    # sort the list by offset
-    foreach x [lsort -integer -index 4 $fix] {
-        lappend new_fix [lreplace $x 4 4 $offset]
-        incr offset [lindex $x 2]
-    }
-    foreach x [lsort -integer -index 0 $new_fix] {
-        lappend blah([lindex $x 3]) [lindex $x 4]
-    }
-    foreach x [array names blah] {
-        _scan $byteOrder [lindex $ifd($x) 0] x2s format
-        set ifd($x) [_unformat $byteOrder $x $format $blah($x)]
-    }
-    if {[info exists ifd(8769)]} {
-        seek $fh [_value $ifd(8769)]
-        _readifd $fh exif
-        _scan $byteOrder [lindex $ifd($x) 0] x2s format
-        set ifd(8769) [_unformat $byteOrder 8769 $format $offset]
-    }
-    _writeifd $new ifd
-        
-    foreach x $fix {
-        seek $fh [lindex $x 4] start
-        fcopy $fh $new -size [lindex $x 2]
-    }
-    if {[info exists ifd(8769)]} {
-        _writeifd $new exif
-    }
-}
-
-# returns a list of offsets of all the IFDs
-proc ::tiff::_ifds {fh} {
-    variable byteOrder
-
-    # number of entries in this ifd
-    _scan $byteOrder [read $fh 2] s num
-    # subract 2 to account for reading the number
-    set ret [list [expr {[tell $fh] - 2}]]
-    # skip the entries, 12 bytes each
-    seek $fh [expr {$num * 12}] current
-    # 4 byte offset to next ifd after entries
-    _scan $byteOrder [read $fh 4] i next
-
-    while {$next > 0} {
-        seek $fh $next start
-        _scan $byteOrder [read $fh 2] s num
-        lappend ret [expr {[tell $fh] - 2}]
-        seek $fh [expr {$num * 12}] current
-        _scan $byteOrder [read $fh 4] i next
-    }
-    return $ret
-}
-
-# takes fh at start of IFD and returns entries, offset, and size
-proc ::tiff::_entries {fh} {
-    variable byteOrder
-    variable formats
-    set ret {}
-    _scan $byteOrder [read $fh 2] s num
-    for {} {$num > 0} {incr num -1} {
-        set offset [tell $fh]
-        binary scan [read $fh 2] H2H2 t1 t2
-        _scan $byteOrder [read $fh 6] si format components
-        seek $fh 4 current
-        if {$byteOrder == "big"} {
-            set tag $t1$t2
-        } else {
-            set tag $t2$t1
-        }
-        #puts "$tag $format $components"
-        set size [expr {$formats($format) * $components}]
-        lappend ret [list $tag $offset $size]
-    }
-    return $ret
-}
-
-# takes fh at start of dir entry and returns tag and value(s)
-proc ::tiff::_getEntry {fh} {
-    variable byteOrder
-    variable formats
-    binary scan [read $fh 2] H2H2 t1 t2
-    _scan $byteOrder [read $fh 6] si format components
-    if {$byteOrder == "big"} {
-        set tag $t1$t2
-    } else {
-        set tag $t2$t1
-    }
-    set value [read $fh 4]
-    set size [expr {$formats($format) * $components}]
-    #puts "entry $tag $format $components $size"
-    # if the data is over 4 bytes, its stored later in the file
-    if {$size > 4} {
-        set pos [tell $fh]
-        _scan $byteOrder $value i value
-        seek $fh $value start
-        set value [read $fh $size]
-        seek $fh $pos start
-    }
-    return [list $tag [_format $byteOrder $value $format $components]]
-}
-
-proc ::tiff::_value {data} {
-    variable byteOrder
-    _scan $byteOrder [lindex $data 0] x2si format components
-    return [_format $byteOrder [lindex $data 1] $format $components]
-}
-
-proc ::tiff::_new {file byteOrder} {
-    set fh [open $file w]
-    fconfigure $fh -encoding binary -translation binary -eofchar {}
-    if {$byteOrder == "big"} {
-        puts -nonewline $fh [binary format H4 4d4d]
-    } else {
-        puts -nonewline $fh [binary format H4 4949]
-    }
-    puts -nonewline $fh [_unscan $byteOrder si 42 8]
-    return $fh
-}
-
-proc ::tiff::_readifd {fh var} {
-    variable byteOrder
-    variable formats
-    upvar $var ifd
-    array set ifd {}
-    _scan $byteOrder [read $fh 2] s num
-    for {} {$num > 0} {incr num -1} {
-        set one [read $fh 8]
-        binary scan $one H2H2 t1 t2
-        _scan $byteOrder $one x2si format components
-        if {$byteOrder == "big"} {
-            set tag $t1$t2
-        } else {
-            set tag $t2$t1
-        }
-        set ifd($tag) [list $one]
-        set value [read $fh 4]
-        set size [expr {$formats($format) * $components}]
-        if {$size > 4} {
-            set pos [tell $fh]
-            _scan $byteOrder $value i value
-            seek $fh $value start
-            lappend ifd($tag) [read $fh $size]
-            seek $fh $pos start
-        } else {
-            lappend ifd($tag) $value
-        }
-    }
-}
-
-proc ::tiff::_writeifd {new var} {
-    variable byteOrder
-    upvar $var ifd
-    set num [llength [array names ifd]]
-    puts -nonewline $new [_unscan $byteOrder s $num]
-    set dataOffset [expr {[tell $new] + ($num * 12) + 4}]
-    set data {}
-    foreach tag [lsort [array names ifd]] {
-        set entry $ifd($tag)
-        puts -nonewline $new [lindex $entry 0]
-        if {[string length [lindex $entry 1]] > 4} {
-            puts -nonewline $new [_unscan $byteOrder i $dataOffset]
-            append data [lindex $entry 1]
-            incr dataOffset [string length [lindex $entry 1]]
-        } else {
-            puts -nonewline $new [lindex $entry 1]
-        }
-    }
-    set next [tell $new]
-    puts -nonewline $new [binary format i 0]
-    puts -nonewline $new $data
-    return $next
-}
-
-proc ::tiff::_ifdsize {var} {
-    upvar $var ifd
-    # 2 bytes for number of entries and 4 bytes for pointer to next ifd
-    set size 6
-    foreach x [array names ifd] {
-        incr size 12
-        # include data that doesnt fit in entry
-        if {[string length [lindex $ifd($x) 1]] > 4} {
-            incr size [string length [lindex $ifd($x) 1]]
-        }
-    }
-    return $size
-}
-
-proc ::tiff::debug {file} {
-    variable byteOrder
-    variable tiff_tags
-    set fh [openTIFF $file]
-    set n 0
-    foreach ifd [_ifds $fh] {
-        seek $fh $ifd start
-        set entries [_entries $fh]
-        puts "IFD $n ([llength $entries] entries)"
-        foreach ent $entries {
-            if {[info exists tiff_tags([lindex $ent 0])]} {
-                puts -nonewline "  $tiff_tags([lindex $ent 0])"
-            } else {
-                puts -nonewline "  [lindex $ent 0]"
-            }
-            if {[lindex $ent 2] < 200} {
-                seek $fh [lindex $ent 1] start
-                puts ": [lindex [_getEntry $fh] 1]"
-            } else {
-                puts " offset [lindex $ent 1] size [lindex $ent 2] bytes"
-            }
-            if {[lindex $ent 0] == "8769"} {
-                seek $fh [lindex $ent 1] start
-                seek $fh [lindex [_getEntry $fh] 1]
-                foreach x [_entries $fh] {
-                    seek $fh [lindex $x 1]
-                    puts "    [_getEntry $fh]"
-                }
-            }
-        }
-        incr n
-    }
-}
-
-array set ::tiff::tiff_tags {
-    00fe NewSubfileType
-    00ff SubfileType 
-    0100 ImageWidth 
-    0101 ImageLength
-    0102 BitsPerSample 
-    0103 Compression
-    0106 PhotometricInterpretation
-    0107 Threshholding 
-    0108 CellWidth  
-    0109 CellLength 
-    010a FillOrder
-    010e ImageDescription
-    010f Make
-    0110 Model
-    0111 StripOffsets
-    0112 Orientation   
-    0115 SamplesPerPixel
-    0116 RowsPerStrip
-    0117 StripByteCounts
-    0118 MinSampleValue
-    0119 MaxSampleValue
-    011a XResolution 
-    011b YResolution
-    011c PlanarConfiguration
-    0120 FreeOffsets
-    0121 FreeByteCounts
-    0122 GrayResponseUnit
-    0123 GrayResponseCurve
-    0128 ResolutionUnit
-    0131 Software
-    0132 DateTime
-    013b Artist
-    013c HostComputer
-    0140 ColorMap
-    0152 ExtraSamples
-    8298 Copyright
-
-    010d DocumentName 
-    011d PageName   
-    011e XPosition  
-    011f YPosition   
-    0124 T4Options
-    0125 T6Options
-    0129 PageNumber
-    012d TransferFunction
-    013d Predictor
-    013e WhitePoint
-    013f PrimaryChromaticities
-    0141 HalftoneHints
-    0142 TileWidth   
-    0143 TileLength  
-    0144 TileOffsets
-    0145 TileByteCounts  
-    0146 BadFaxLines
-    0147 CleanFaxData
-    0148 ConsecutiveBadFaxLines
-    014a SubIFDs
-    014c InkSet
-    014d InkNames
-    014e NumberOfInks
-    0150 DotRange
-    0151 TargetPrinter
-    0153 SampleFormat
-    0154 SMinSampleValue
-    0155 SMaxSampleValue
-    0156 TransferRange
-    0157 ClipPath
-    0158 XClipPathUnits
-    0159 YClipPathUnits
-    015a Indexed
-    015b JPEGTables
-    015f OPIProxy
-    0190 GlobalParametersIFD
-    0191 ProfileType
-    0192 FaxProfile
-    0193 CodingMethods
-    0194 VersionYear
-    0195 ModeNumber
-    01b1 Decode
-    01b2 DefaultImageColor
-    0200 JPEGProc
-    0201 JPEGInterchangeFormat
-    0202 JPEGInterchangeFormatLength
-    0203 JPEGRestartInterval
-    0205 JPEGLosslessPredictors
-    0206 JPEGPointTransforms
-    0207 JPEGQTables
-    0208 JPEGDCTables
-    0209 JPEGACTables
-    0211 YCbCrCoefficients
-    0212 YCbCrSubSampling
-    0213 YCbCrPositioning
-    0214 ReferenceBlackWhite
-    022f StripRowCounts
-    02bc XMP
-    800d ImageID
-    87ac ImageLayer
-
-    8649 Photoshop
-    8769 ExifIFD
-    8773 ICCProfile
-}
-
-if {![info exists ::tiff::tiff_sgat]} {
-    foreach {x y} [array get ::tiff::tiff_tags] {
-        set ::tiff::tiff_sgat($y) $x
-    }
-}
-
-array set ::tiff::data_types {
-    1 BYTE
-    2 ASCII
-    3 SHORT
-    4 LONG
-    5 RATIONAL
-    6 SBYTE
-    7 UNDEFINED
-    8 SSHORT
-    9 SLONG
-    10 SRATIONAL
-    11 FLOAT
-    12 DOUBLE
-    BYTE 1
-    ASCII 2
-    SHORT 3
-    LONG 4
-    RATIONAL 5
-    SBYTE 6 
-    UNDEFINED 7
-    SSHORT 8
-    SLONG 9
-    SRATIONAL 10
-    FLOAT 11
-    DOUBLE 12
-}
-
-# for mapping the format types to byte lengths
-array set ::tiff::formats [list 1 1 2 1 3 2 4 4 5 8 6 1 7 1 8 2 9 4 10 8 11 4 12 8]
-
-proc ::tiff::_seek {chan offset {origin start}} {
-    if {$origin == "start"} {
-        variable start
-        seek $chan [expr {$offset + $start}] start
-    } else {
-        seek $chan $offset $origin
-    }
-}
-
-# [binary scan], in the byte order indicated by $e
-proc ::tiff::_scan {e v f args} {
-     foreach x $args { upvar 1 $x $x }
-     if {$e == "big"} {
-          eval [list binary scan $v [string map {b B h H s S i I} $f]] $args
-     } else {
-         eval [list binary scan $v $f] $args
-     }
-}
-
-# [binary format], in the byte order indicated by $e
-proc ::tiff::_unscan {e f args} {
-     if {$e == "big"} {
-         return [eval [list binary format [string map {b B h H s S i I} $f]] $args]
-     } else {
-         return [eval [list binary format $f] $args]
-     }
-}
-
-# formats values, the numbers correspond to data types
-# values may be either byte order, as indicated by $end
-# see the tiff spec for more info
-proc ::tiff::_format {end value type num} {
-    if {$num > 1 && $type != 2 && $type != 7} {
-        variable formats
-        set r {}
-        for {set i 0} {$i < $num} {incr i} {
-            set len $formats($type)
-            lappend r [_format $end [string range $value [expr {$len * $i}] [expr {($len * $i) + $len - 1}]] $type 1]
-        }
-        #return [join $r ,]
-        return $r
-    }
-    switch -exact -- $type {
-        1 { _scan $end $value c value }
-        2 { set value [string trimright $value \x00] }
-        3 {
-            _scan $end $value s value
-            set value [format %u $value]
-        }
-        4 {
-            _scan $end $value i value
-            set value [format %u $value]
-        }
-        5 {
-            _scan $end $value ii n d
-            set n [format %u $n]
-            set d [format %u $d]
-            if {$d == 0} {set d 1}
-            #set value [string trimright [string trimright [format %5.4f [expr {double($n) / $d}]] 0] .]
-            set value [string trimright [string trimright [expr {double($n) / $d}] 0] .]
-            #set value "$n/$d"
-        }
-        6 { _scan $end $value c value }
-        8 { _scan $end $value s value }
-        9 { _scan $end $value i value }
-        10 {
-            _scan $end $value ii n d
-            if {$d == 0} {set d 1}
-            #set value [string trimright [string trimright [format %5.4f [expr {double($n) / $d}]] 0] .]
-            set value [string trimright [string trimright [expr {double($n) / $d}] 0] .]
-            #set value "$n/$d"
-        }
-        11 { _scan $end $value i value }
-        12 { _scan $end $value w value }
-    }
-    return $value
-}
-
-proc ::tiff::_unformat {end tag type value} {
-    set packed_val {}
-    set count [llength $value]
-    if {$type == 2 || $type == 7} { set value [list $value] }
-    foreach val $value {
-        switch -exact -- $type {
-            1 { set val [_unscan $end c $val] }
-            2 {
-                append val \x00
-                set count [string length $val]
-            }
-            3 { set val [_unscan $end s $val] }
-            4 { set val [_unscan $end i $val] }
-            5 {
-                set val [split $val /]
-                set val [_unscan $end i [lindex $val 0]][_unscan $end i [lindex $val 1]]
-            }
-            6 { set val [_unscan $end c $val] }
-            7 { set count [string length $val }
-            8 { set val [_unscan $end s $val] }
-            9 { set val [_unscan $end i $val] }
-            10 {
-                set val [split $val /]
-                set val [_unscan $end i [lindex $val 0]][_unscan $end i [lindex $val 1]]
-            }
-            11 { set val [_unscan $end $value i value] }
-            12 { set val [_unscan $end $value w value] }
-            default { error "unknown data type $type" }
-        }
-        append packed_val $val
-    }
-    if {$tag != ""} {
-        if {$end == "big"} {
-            set tag [binary format H2H2 [string range $tag 0 1] [string range $tag 2 3]]
-        } else {
-            set tag [binary format H2H2 [string range $tag 2 3] [string range $tag 0 1]]
-        }
-    }
-    if {[string length $packed_val] < 4} { set packed_val [binary format a4 $packed_val] }
-    return [list $tag[_unscan $end si $type $count] $packed_val]
-}
-        
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/connect.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/connect.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,103 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-
-# Class for handling of active/passive connectivity.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::connect {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    option -host localhost
-    option -port 0
-    option -mode active
-
-    option -translation {}
-    option -encoding    {}
-    option -eofchar     {}
-
-    method connect {command} {}
-
-    # active:
-    # - connect to host/port
-    #
-    # passive:
-    # - listen on port for connection
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    method connect {command} {
-	if {$options(-mode) eq "active"} {
-
-	    set sock [socket $options(-host) $options(-port)]
-	    $self Setup $sock
-
-	    lappend command $self $sock
-	    uplevel \#0 $command
-	    return
-	} else {
-	    set server [socket -server [mymethod Start $command] \
-			    $options(-port)]
-
-	    return [lindex [fconfigure $server -sockname] 2]
-	}
-	return
-    }
-
-    method Start {command sock peerhost peerport} {
-	close $server
-	$self Setup $sock
-
-	lappend command $self $sock
-	uplevel \#0 $command
-	return
-    }
-
-    method Setup {sock} {
-	foreach o {-translation -encoding -eofchar} {
-	    if {$options($o) eq ""} continue
-	    fconfigure $sock $o $options($o)
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands.
-
-    onconfigure -mode {newvalue} {
-	upvar 0 options(-mode) value
-	if {$value eq $newvalue} return
-	switch -exact -- $newvalue {
-	    passive - active {
-		set value $newvalue
-	    }
-	    default {
-		return -code error "Bad value \"$newvalue\", expected active, or passive"
-	    }
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable server {}
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::connect 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/copyops.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/copyops.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,354 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-# Basic byte transfer facilities. Essentially fcopy with a different
-# API, hopefully better (progress and completion are separate). Also
-# equivalent facilities to transfer an explicitly given string instead
-# of reading the data to be transfered from a channel.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-
-namespace eval ::transfer::copy {
-    namespace export do chan string options
-    namespace export doChan doString
-}
-
-# ### ### ### ######### ######### #########
-## API commands
-
-proc ::transfer::copy::do {type in out args} {
-    switch -exact -- $type {
-	chan - string {}
-	default {
-	    return -code error \
-		    "Unknown type \"$type\",\
-		    expected chan, or string"
-	}
-    }
-
-    options $out $args settings
-
-    switch -exact -- $type {
-	chan   {doChan   $in $out settings}
-	string {doString $in $out settings}
-    }
-    return
-}
-
-proc ::transfer::copy::chan {in out args} {
-    # Options: -size n
-    #          -blocksize n
-    #          -progress cmd, (cmd n)       - feedback
-    #          -command cmd,  (cmd n ?err?) - completion
-
-    options     $out $args settings
-    doChan  $in $out       settings
-    return
-}
-
-proc ::transfer::copy::string {string out args} {
-    # Options: -size n
-    #          -blocksize n
-    #          -progress cmd, (cmd n)       - feedback
-    #          -command cmd,  (cmd n ?err?) - completion
-
-    options          $out $args settings
-    doString $string $out       settings
-    return
-}
-
-proc ::transfer::copy::options {chan alist optv {defaults {}}} {
-    upvar 1 $optv settings
-
-    # Prepare defaults, hardwired, output channel, and caller
-
-    array set settings {
-	-size     -1
-	-progress {}
-	-command  {}
-    }
-
-    array set settings [CGet $chan]
-    array set settings $defaults
-
-    # Process the options
-
-    set capture 0
-    foreach o $alist {
-	# Store argument to previous option
-	if {$capture} {
-	    set settings($key) $o
-	    set capture 0
-	    continue
-	}
-	# Dispatch & process the option
-	switch -exact -- $o {
-	    -blocksize -
-	    -command -
-	    -encoding -
-	    -eofchar -
-	    -progress -
-	    -size -
-	    -translation {
-		set key $o
-		set capture 1
-	    }
-	    default {
-		return -code error \
-			"Unknown option \"$o\",\
-			expected one of -size,\
-			-blocksize, -progress,\
-			or -command"
-	    }
-	}
-    }
-    if {$capture} {
-	return -code error \
-		"wrong\#args, option \"$o\" \
-		is without argument"
-    }
-
-    if {![llength $settings(-command)]} {
-	return -code error \
-		"Completion callback is missing"
-    }
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Implementation. Transfer from a channel.
-
-proc ::transfer::copy::doChan {in out ov} {
-    upvar 1 $ov settings
-
-    upvar 0 settings(-size)    size
-    upvar 0 settings(-command) command
-
-    if {$size == 0} {
-	# Nothing to transfer. Is that an error, or mildy ok ?
-	# For now: Ok.
-
-	Run command 0
-	return
-    }
-
-    set state [CGet $out]
-    Configure $out [array get settings]
-    upvar 0 settings(-progress) progress
-
-    if {$size > 0} {
-	fcopy $in $out -size $size -command \
-		[list \
-		::transfer::copy::HandlerChan \
-		$size $progress $command \
-		$in $out $state]
-    } else {
-	fcopy $in $out -command [list \
-		::transfer::copy::HandlerChan \
-		$size $progress $command \
-		$in $out $state]
-	return
-    }
-}
-
-proc ::transfer::copy::HandlerChan {
-    size progress command
-    in out state
-    transfered args
-} {
-    # Progress
-    if {[llength $progress]} {
-	Run progress $transfered
-    }
-
-    # Error signaled ?
-    if {[llength $args]} {
-	# Restore channel state and then propagate the problem
-	# forward.
-	Configure $out $state
-	Run command $transfered [lindex $args 0]
-	return
-    }
-
-    # How much transfered, have we transfered everything ?
-
-    if {($size >= 0) && ($size <= $transfered)} {
-	# Everything has been transfered, trigger completion
-	# callback. The caller has to close the output channel!
-
-	Configure $out $state
-	Run command $transfered
-	return
-    }
-
-    if {[eof $in]} {
-	# Input has closed, action depends on the specified size. -1
-	# signals transfer to eof, so we are now done. Otherwise we
-	# have transfered less than we wanted, and that is an error.
-
-	Configure $out $state
-	if {$size < 0} {
-	    Run command $transfered
-	} else {
-	    Run command $transfered \
-		    "Transfer aborted, not\
-		    enough input"
-	}
-	return
-    }
-
-    # Wait for more callbacks.
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Implementation. Transfer from a string.
-
-proc ::transfer::copy::doString {str out ov} {
-    upvar 1 $ov settings
-
-    upvar 0 settings(-size)    size
-    upvar 0 settings(-command) command
-
-    if {$size == 0} {
-	# Nothing to transfer. Is that an error, or mildy ok ?
-	# For now: Ok
-
-	Run command 0
-	return
-    }
-
-    set length [::string length $str]
-    if {$size > 0} {
-	if {$length < $size} {
-	    Run command 0 \
-		    "Transfer impossible,\
-		    not enough data for size"]
-	    return
-	}
-	set last $size
-    } else {
-	# size < 0 (Note size == 0 already captured)
-	set last $length
-	set size $last
-    }
-
-    # We transfer the string in chunks of -blocksize. We cannot use
-    # fcopy for this, so do our own event processing.
-
-    set state [CGet $out]
-    Configure $out [array get settings]
-
-    upvar 0 settings(-blocksize) blocksize
-    upvar 0 settings(-progress)  progress
-
-    fileevent $out writable [list \
-	    ::transfer::copy::HandlerString \
-	    $size 0 $last \
-	    $blocksize 0 [expr {$blocksize - 1}] \
-	    $progress $command \
-	    $str $out $state]
-    return
-}
-
-proc ::transfer::copy::HandlerString {
-    pending transfered last
-    block from to
-    progress command
-    str out state
-} {
-    # pending + transfered = last. from/to is chunk to transfer.
-
-    if {$to > $last} {
-	set  to         end
-	incr transfered $pending
-	set  pending    0
-    }
-
-    set code [catch {
-	puts -nonewline $out \
-		[::string range $str $from $to]
-    } res]
-    if {$code} {
-	Configure $out $state
-	fileevent $out writable {}
-	Run command $transfered $res
-	return
-    }
-
-    if {[llength $progress]} {
-	Run progress $transfered
-    }
-
-    if {$pending == 0} {
-	# Done
-	Configure $out $state
-	fileevent $out writable {}
-	Run command $transfered
-    }
-
-    # Prepare for next chunk
-
-    incr transfered $block
-    incr pending   -$block
-    incr from       $block
-    incr to         $block
-
-    fileevent $out writable [list \
-		  ::transfer::copy::HandlerString \
-		  $pending $transfered $last \
-		  $block $from $to \
-		  $progress $command \
-		  $str $out $state]
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Implementation. Support commands.
-
-proc ::transfer::copy::Run {cmdv args} {
-    upvar 1 $cmdv c
-    set command $c
-    foreach a $args {lappend command $a}
-    return [uplevel #0 $command]
-
-    # 8.5: {*}$c {*}$args
-}
-
-proc ::transfer::copy::CGet {chan} {
-    array set settings {}
-
-    foreach o {
-	-buffersize -encoding -translation -eofchar -blocking
-    } {
-	set settings($o) [fconfigure $chan $o]
-    }
-
-    set   settings(-blocksize) $settings(-buffersize)
-    unset settings(-buffersize)
-    return [array get settings]
-}
-
-proc ::transfer::copy::Configure {chan settings} {
-    array set tmp $settings
-
-    set   tmp(-buffersize) $tmp(-blocksize)
-    unset tmp(-blocksize)
-    unset -nocomplain tmp(-progress)
-    unset -nocomplain tmp(-command)
-    unset -nocomplain tmp(-size)
-
-    foreach o [array names tmp] {
-	fconfigure $chan $o $tmp($o)
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::copy 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/ddest.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/ddest.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,165 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-
-# Class for the handling of stream destinations.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::data::destination {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    #                       Destination is ...
-    option -channel  {} ; # an open & writable channel.
-    option -file     {} ; # a writable file.
-    option -variable {} ; # the named variable.
-
-    method put   {chunk} {}
-    method done  {}      {}
-    method valid {mv}    {}
-
-    method receive {sock done} {}
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    method put {chunk} {
-	if {$xtype eq "file"} {
-	    set value [open $value w]
-	    set xtype  channel
-	    set close 1
-	}
-
-	switch -exact -- $xtype {
-	    variable {
-		upvar \#0 $value var
-		append var $chunk
-	    }
-	    channel {
-		puts -nonewline $value $chunk
-	    }
-	}
-	return
-    }
-
-    method done {} {
-	switch -exact -- $xtype {
-	    file - variable {}
-	    channel {
-		if {$close} {close $value}
-	    }
-	}
-    }
-
-    method valid {mv} {
-	upvar 1 $mv message
-	switch -exact -- $xtype {
-	    undefined {
-		set message "Data destination is undefined"
-		return 0
-	    }
-	    default {}
-	}
-	return 1
-    }
-
-    method receive {sock done} {
-	set ntransfered 0
-	set old [fconfigure $sock -blocking]
-	fconfigure $sock -blocking 0
-	fileevent $sock readable \
-		[mymethod Read $sock $old $done]
-	return
-    }
-
-    method Read {sock oldblock done} {
-	set chunk [read $sock]
-	if {[set l [string length $chunk]]} {
-	    $self put $chunk
-	    incr ntransfered $l
-	}
-	if {[eof $sock]} {
-	    $self done
-	    fileevent  $sock readable {}
-	    fconfigure $sock -blocking $oldblock
-
-	    lappend done $ntransfered
-	    uplevel #0 $done
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands.
-
-    onconfigure -variable {newvalue} {
-	set etype variable
-	set xtype string
-
-	if {![uplevel \#0 {info exists $newvalue}]} {
-	    return -code error "Bad variable \"$newvalue\", does not exist"
-	}
-
-	set value $newvalue
-	return
-    }
-
-    onconfigure -channel {newvalue} {
-	if {![llength [file channels $newvalue]]} {
-	    return -code error "Bad channel handle \"$newvalue\", does not exist"
-	}
-	set etype channel
-	set xtype channel
-	set value $newvalue
-	return
-    }
-
-    onconfigure -file {newvalue} {
-	if {![file exists $newvalue]} {
-	    set d [file dirname $newvalue]
-	    if {![file writable $d]} {
-		return -code error "File \"$newvalue\" not creatable"
-	    }
-	    if {![file isdirectory $d]} {
-		return -code error "File \"$newvalue\" not creatable"
-	    }
-	} else {
-	    if {![file writable $newvalue]} {
-		return -code error "File \"$newvalue\" not writable"
-	    }
-	    if {![file isfile $newvalue]} {
-		return -code error "File \"$newvalue\" not a file"
-	    }
-	}
-	set etype channel
-	set xtype file
-	set value $newvalue
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable etype  undefined
-    variable xtype  undefined
-    variable value
-    variable close 0
-
-    variable ntransfered
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::data::destination 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/dsource.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/dsource.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,181 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-
-# Class for the handling of stream sources.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require transfer::copy ; # Data transmission core
-package require snit
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::data::source {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    #                       Source is ...
-    option -string   {} ; # a string.
-    option -channel  {} ; # an open & readable channel.
-    option -file     {} ; # a file.
-    option -variable {} ; # a string held by the named variable.
-
-    option -size -1     ; # number of characters to transfer.
-
-    method type  {} {}
-    method data  {} {}
-    method size  {} {}
-    method valid {mv} {}
-
-    method transmit {sock blocksize done} {}
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    method type {} {
-	return $xtype
-    }
-
-    method data {} {
-	switch -exact -- $etype {
-	    undefined {
-		return -code error "Data source is undefined"
-	    }
-	    string - chan {
-		return $value
-	    }
-	    variable {
-		upvar \#0 $value thevalue
-		return $thevalue
-	    }
-	    file {
-		return [open $value r]
-	    }
-	}
-    }
-
-    method size {} {
-	if {$options(-size) < 0} {
-	    switch -exact -- $etype {
-		undefined {
-		    return -code error "Data source is undefined"
-		}
-		string {
-		    return [string length $value]
-		}
-		variable {
-		    upvar \#0 $value thevalue
-		    return [string length $thevalue]
-		}
-		chan - file {
-		    # Nothing, -1 passes through
-		    # We do not use [file size] for a file, as a
-		    # user-specified encoding may distort the
-		    # counting.
-		}
-	    }
-	}
-
-	return $options(-size)
-    }
-
-    method valid {mv} {
-	upvar 1 $mv message
-
-	switch -exact -- $etype {
-	    undefined {
-		set message "Data source is undefined"
-		return 0
-	    }
-	    string - variable {
-		if {[$self size] > [string length [$self data]]} {
-		    set message "Not enough data to transmit"
-		    return 0
-		}
-	    }
-	    chan {
-		# Additional check of option ?
-	    }
-	    file {
-		# Additional check of option ?
-	    }
-	}
-	return 1
-    }
-
-    method transmit {sock blocksize done} {
-	::transfer::copy::do \
-	    [$self type] [$self data] $sock \
-	    -size      [$self size] \
-	    -blocksize $blocksize \
-	    -command   $done
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands.
-
-    onconfigure -string {newvalue} {
-	set etype string
-	set xtype string
-	set value $newvalue
-	return
-    }
-
-    onconfigure -variable {newvalue} {
-	set etype variable
-	set xtype string
-
-	if {![uplevel \#0 {info exists $newvalue}]} {
-	    return -code error "Bad variable \"$newvalue\", does not exist"
-	}
-
-	set value $newvalue
-	return
-    }
-
-    onconfigure -channel {newvalue} {
-	if {![llength [file channels $newvalue]]} {
-	    return -code error "Bad channel handle \"$newvalue\", does not exist"
-	}
-	set etype chan
-	set xtype chan
-	set value $newvalue
-	return
-    }
-
-    onconfigure -file {newvalue} {
-	if {![file exists $newvalue]} {
-	    return -code error "File \"$newvalue\" does not exist"
-	}
-	if {![file readable $newvalue]} {
-	    return -code error "File \"$newvalue\" not readable"
-	}
-	if {![file isfile $newvalue]} {
-	    return -code error "File \"$newvalue\" not a file"
-	}
-	set etype file
-	set xtype chan
-	set value $newvalue
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable etype undefined
-    variable xtype undefined
-    variable value
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::data::source 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,8 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} return
-package ifneeded transfer::copy              0.1 [list source [file join $dir copyops.tcl]]
-package ifneeded transfer::copy::queue       0.1 [list source [file join $dir tqueue.tcl]]
-package ifneeded transfer::data::source      0.1 [list source [file join $dir dsource.tcl]]
-package ifneeded transfer::data::destination 0.1 [list source [file join $dir ddest.tcl]]
-package ifneeded transfer::connect           0.1 [list source [file join $dir connect.tcl]]
-package ifneeded transfer::transmitter       0.1 [list source [file join $dir transmitter.tcl]]
-package ifneeded transfer::receiver          0.1 [list source [file join $dir receiver.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/receiver.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/receiver.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,126 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-# Transfer class. Reception of data.
-##
-# Utilizes data destination and connect components to handle the
-# general/common parts.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-package require transfer::data::destination ; # Data destination
-package require transfer::connect           ; # Connection startup
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::receiver {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    ## Data destination sub component
-
-    delegate option -channel  to dest
-    delegate option -file     to dest
-    delegate option -variable to dest
-
-    ## Connection management sub component
-
-    delegate option -host        to conn
-    delegate option -port        to conn
-    delegate option -mode        to conn
-    delegate option -translation to conn
-    delegate option -encoding    to conn
-    delegate option -eofchar     to conn
-
-    ## Receiver configuration, and API
-
-    option -command {}
-
-    constructor {args} {}
-
-    method start {} {}
-    method busy  {} {}
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    constructor {args} {
-	set dest [::transfer::data::destination ${selfns}::dest]
-	set conn [::transfer::connect           ${selfns}::conn]
-	set busy 0
-
-	$self configurelist $args
-	return
-    }
-
-    method start {} {
-	if {$busy} {
-	    return -code error "Object is busy"
-	}
-
-	if {![$dest valid msg]} {
-	    return -code error $msg
-	}
-
-	if {$options(-command) eq ""} {
-	    return -code error "Completion callback is missing"
-	}
-
-	set busy 1
-	return [$conn connect [mymethod Begin]]
-    }
-
-    method busy {} {
-	return $busy
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands.
-
-    method Begin {__ sock} {
-	# __ == conn
-	$dest receive $sock \
-		[mymethod Done $sock]
-	return
-    }
-
-    method Done {sock args} {
-	# args is either (n),
-	#             or (n errormessage)
-
-	set busy 0
-	close $sock
-	$self Complete $args
-	return
-    }
-
-    method Complete {alist} {
-	set     cmd $options(-command)
-	lappend cmd $self
-	foreach a $alist {lappend cmd $a}
-
-	uplevel #0 $cmd
-	return
-
-	# 8.5: {*}$options(-command) {*}$alist
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable dest
-    variable conn
-    variable busy
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::receiver 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/tqueue.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/tqueue.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,223 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-# Transfer class built on top of the basic facilities. Accepts many
-# transfer requests, any time, and executes them serially. Each
-# request has its own progress and completion commands.
-#
-# Note: The output channel used is part of the queue, and not
-#       contained in the transfer requests themselves. Otherwise
-#       we would not need a queue and serialized execution.
-#
-# Instances also have a general callback to report the instance status
-# (#pending transfer requests, busy).
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require transfer::copy ; # Basic transfer facilities
-package require struct::queue  ; # Request queue
-package require snit           ; # OO system
-package require Tcl 8.4
-
-namespace eval ::transfer::copy::queue {
-    namespace import ::transfer::copy::options
-    namespace import ::transfer::copy::doChan
-    namespace import ::transfer::copy::doString
-}
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::copy::queue {
-    # ### ### ### ######### ######### #########
-    ## API
-
-    option -on-status-change {}
-
-    constructor {thechan args} {}
-    method put     {request} {}
-    method busy    {} {}
-    method pending {} {}
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    constructor {thechan args} {
-	if {![llength [file channels $chan]]} {
-	    return -code error "Channel \"$chan\" does not exist"
-	}
-
-	set chan  $thechan
-	set queue [struct::queue ${selfns}::queue]
-	set busy  0
-
-	$self configurelist $args
-	return
-    }
-
-    destructor {
-	if {$queue eq ""} return
-	$queue destroy
-	return
-    }
-
-    method put {request} {
-	# Request syntax: type dataref ?options?
-	# Accepted options are those of 'transfer::transmit::copy',
-	# etc.
-
-	# We parse out the completion callback so that we can use it
-	# directly. This also checks the request for basic validity.
-
-	if {[llength $request] < 2} {
-	    return -code error "Bad request: Not enough elements"
-	}
-
-	set type [lindex $request 0]
-	switch -exact -- $type {
-	    chan - string {}
-	    default {
-		return -code error "Bad request: Unknown type \"$type\", expected chan, or string"
-	    }
-	}
-
-	set options [lrange $request 2 end]
-	if {[catch {
-	    options $chan $options opts
-	} res]} {
-	    return -code error "Bad request: $res"
-	}
-
-	set ref [lindex $request 1]
-
-	# We store the fully parsed request. Later
-	# we call lower-level copy functionality
-	# which avoids a reparsing.
-
-	$queue put [list $type $ref [array get opts]]
-
-	# Start the engine executing transfers in the background, if
-	# it is not already running.
-
-	if {!$busy} {
-	    after 0 [mymethod Transfer]
-	}
-
-	$self ReportStatus
-	return
-    }
-
-    method busy {} {
-	return $busy
-    }
-
-    method pending {} {
-	return [$queue size]
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands
-
-    method Transfer {} {
-	# Get the next pending request. It is already fully-parsed.
-
-	foreach {type ref o} [$queue get] break
-	array set opts $o
-
-	# Save the actual completion callback and redirect the
-	# completion of the copy operation to ourselves for proper
-	# management.
-
-	set opts(-command) [mymethod \
-		Done $opts(-command)]
-
-	# Start the transfer. We catch this as it can fail immediately
-	# (example: string-type copy and not enough data). We go
-	# through 'Done' for the reporting of such errors to avoid
-	# forgetting all the other management stuff (like the engine
-	# forced to stop).
-
-	set busy 1
-	$self ReportStatus
-
-	switch -exact -- $type {
-	    chan {
-		set code [catch {
-		    doChan $ref $chan opts
-		} res]
-	    }
-	    string {
-		set code [catch {
-		    doString $ref $chan opts
-		} res]
-	    }
-	}
-
-	if {$code} {
-	    $self Done $command 0 $res
-	}
-
-	return
-    }
-
-    method Done {command args} {
-	# args is either (n)
-	#             or (n errormessage)
-
-	# A transfer ending in an error causes the instance to stop
-	# processing requests. I.e. all requests waiting after the
-	# failed one are not executed anymore.
-
-	if {[llength $args] == 2} {
-	    set busy 0
-	    $self ReportStatus
-	    $self Notify $command $args
-	    return
-	}
-
-	# Depending on the status of the queue of pending requests we
-	# either trigger the start of the next transfer, or stop the
-	# engine. The completion of the current transfer however is
-	# unconditionally reported through its completion callback.
-
-	if {[$queue size]} {
-	    after 0 [mymethod Transfer]
-	} else {
-	    set busy 0
-	    $self ReportStatus
-	}
-
-	$self Notify $command $args
-	return
-    }
-
-    method ReportStatus {} {
-	if {![llength $options(-on-status-change)]} return
-	uplevel #0 [linsert $options(-on-status-change) end $self [$queue size] $busy]
-	return
-    }
-
-    method Notify {cmd alist} {
-	foreach a $args {lappend cmd $a}
-	uplevel #0 $cmd
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-    ## - Channel the transfered data is written to
-    ## - Queue of pending requests.
-
-    variable chan  {}
-    variable queue {}
-    variable busy  0
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::copy::queue 0.1
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/transfer/transmitter.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/transfer/transmitter.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,130 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-##
-# Transfer class. Sending of data.
-##
-# Utilizes data source and connect components to handle the
-# general/common parts.
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require snit
-package require transfer::data::source ; # Data source
-package require transfer::connect      ; # Connection startup
-
-# ### ### ### ######### ######### #########
-## Implementation
-
-snit::type ::transfer::transmitter {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    ## Data source sub component
-
-    delegate option -string   to source
-    delegate option -channel  to source
-    delegate option -file     to source
-    delegate option -variable to source
-    delegate option -size     to source
-
-    ## Connection management sub component
-
-    delegate option -host        to conn
-    delegate option -port        to conn
-    delegate option -mode        to conn
-    delegate option -translation to conn
-    delegate option -encoding    to conn
-    delegate option -eofchar     to conn
-
-    ## Transmitter configuration, and API
-
-    option -command   {}
-    option -blocksize 1024
-
-    constructor {args} {}
-
-    method start {} {}
-    method busy  {} {}
-
-    # ### ### ### ######### ######### #########
-    ## Implementation
-
-    constructor {args} {
-	set source [::transfer::data::source ${selfns}::source]
-	set conn   [::transfer::connect      ${selfns}::conn]
-	set busy   0
-
-	$self configurelist $args
-	return
-    }
-
-    method start {} {
-	if {$busy} {
-	    return -code error "Object is busy"
-	}
-
-	if {![$source valid msg]} {
-	    return -code error $msg
-	}
-
-	if {$options(-command) eq ""} {
-	    return -code error "Completion callback is missing"
-	}
-
-	set busy 1
-	return [$conn connect [mymethod Begin]]
-    }
-
-    method busy {} {
-	return $busy
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Internal helper commands.
-
-    method Begin {__ sock} {
-	# __ <=> conn
-	$source transmit $sock \
-		$options(-blocksize) \
-		[mymethod Done $sock]
-	return
-    }
-
-    method Done {sock args} {
-	# args is either (n),
-	#             or (n errormessage)
-
-	set busy 0
-	close $sock
-	$self Complete $args
-	return
-    }
-
-    method Complete {alist} {
-	set     cmd $options(-command)
-	lappend cmd $self
-	foreach a $alist {lappend cmd $a}
-
-	uplevel #0 $cmd
-	return
-
-	# 8.5: {*}$options(-command) {*}$alist
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Data structures
-
-    variable source
-    variable conn
-    variable busy
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide transfer::transmitter 0.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/treeql/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/treeql/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {
-    # PRAGMA: returnok
-    return
-}
-package ifneeded treeql 1.3.1 [list source [file join $dir treeql.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,24 +1,0 @@
-# treeql.tcl
-# A generic tree query language in snit
-#
-# Copyright 2004 Colin McCormack.
-# You are permitted to use this code under the same license as tcl.
-#
-# 20040930 Colin McCormack - initial release to tcllib
-#
-# RCS: @(#) $Id: treeql.tcl,v 1.10 2006/09/19 23:36:18 andreas_kupries Exp $
-
-package require Tcl 8.4
-
-# Select the implementation based on the version of the Tcl core
-# executing this code. For 8.5 we are using features like
-# word-expansion to simplify the various evaluations.
-
-set dir [file dirname [info script]]
-if {[package vsatisfies [package provide Tcl] 8.5]} {
-    source [file join $dir treeql85.tcl]
-} else {
-    source [file join $dir treeql84.tcl]
-}
-
-package provide treeql 1.3.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql84.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql84.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,734 +1,0 @@
-# treeql.tcl
-# A generic tree query language in snit
-#
-# Copyright 2004 Colin McCormack.
-# You are permitted to use this code under the same license as tcl.
-#
-# 20040930 Colin McCormack - initial release to tcllib
-#
-# RCS: @(#) $Id: treeql84.tcl,v 1.10 2007/06/23 03:39:34 andreas_kupries Exp $
-
-package require Tcl 8.4
-package require snit
-package require struct::list
-package require struct::set
-
-snit::type ::treeql {
-    variable nodes	;# set of all nodes
-    variable tree	;# tree over which nodes are defined
-    variable query	;# full query - ie: 'parent' of this treeql object
-
-    # low level accessor to tree
-    method treeObj {} {
-	return $tree
-    }
-
-    # apply the [$tree cmd {*}$args] form to each node
-    # returns the list of results of application
-    method apply {cmd args} {
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		eval [list $tree] $cmd [list $node] $args
-	    } application]} {
-		upvar ::errorInfo eo
-		puts stderr "apply: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Apply: $tree $cmd $node $args -> $application"
-		foreach a $application {lappend result $a}
-	    }
-	}
-
-	return $result
-    }
-
-    # filter nodes by [$tree cmd {*}$args]
-    # returns the list of results of application when application is non nil
-    method filter {cmd args} {
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		eval [list $tree] $cmd [list $node] $args
-	    } application]} {
-		upvar ::errorInfo eo
-		puts stderr "filter: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Filter: $tree $cmd $node $args -> $application"
-		if {$application != {}} {
-		    lappend result $application
-		}
-	    }
-	}
-	return $result
-    }
-
-    # filter nodes by the predicate [$tree cmd {*}$args]
-    # returns the list of results of application when application is true
-    method bool {cmd args} {
-
-	#puts stderr "Bool: $tree $cmd - $args"
-	#set result [::struct::list filter $nodes [list $tree $cmd {*}$args]]
-	#puts stderr "Bool: $tree $cmd - $nodes - $args -> $result"
-	#return $result
-
-	# replaced by tcllib's list filter
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		eval [list $tree] $cmd [list $node] $args
-	    } application]} {
-		upvar ::errorInfo eo
-		puts stderr "filter: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "bool: $tree $cmd $node $args -> $application - [$tree dump $node]"
-		if {$application} {
-		    lappend result $node
-		}
-	    }
-	}
-
-	return $result
-    }
-
-    # applyself - map cmd on $self to each node, discarding null results
-    method applyself {cmd args} {
-
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		eval [list $query] $cmd [list $node] $args
-	    } application]} {
-		upvar ::errorInfo eo
-		puts stderr "applyself: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		if {[llength $application]} {
-		    foreach a $application {lappend result $a}
-		}
-	    }
-	}
-
-	return $result
-    }
-
-    # mapself - map cmd on $self to each node
-    method mapself {cmd args} {
-
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		eval [list $query] $cmd [list $node] $args
-	    } application]} {
-		upvar ::errorInfo eo
-		puts stderr "mapself: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Mapself: $query $cmd $node $args -> $application"
-		lappend result $application
-	    }
-	}
-
-	return $result
-    }
-
-    # shim to perform operation $op on attribute $attr of $node
-    method do_attr {node op attr} {
-	set attrv [$tree get $node $attr]
-	#puts stderr "$self do_attr node:'$node' op:'$op' attr:'$attr' attrv:'$attrv'"
-	return [eval [linsert $op end $attrv]]
-    }
-
-    # filter nodes by predicate [string $op] over attribute $attr
-    method stringP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [linsert $op 0 string] $attr]
-	foreach result $map node $nodes {
-	    #puts stderr "$self stringP $op $attr -> $result - $node"
-	    if {$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by negated predicate [string $op] over attribute $attr
-    method stringNP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [linsert $op 0 string] $attr]
-	foreach result $map node $nodes {
-	    if {!$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by predicate [expr {*}$op] over attribute $attr
-    method exprP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [linsert $op 0 expr] $attr]
-	foreach result $map node $nodes {
-	    if {$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by predicate ![expr {*}$op] over attribute $attr
-    method exprNP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [linsert $op 0 expr] $attr]
-	foreach result $map node $nodes {
-	    if {!$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # shim to return string values of attributes matching $pattern of a given $node
-    method do_get {node pattern} {
-	set result {}
-	foreach key [$tree keys $node $pattern] {
-	    set result [concat $result [$tree get $node $key]]
-	}
-	return $result
-    }
-
-    # Returns list of attribute values of attributes matching $pattern -
-    method get {pattern} {
-	set nodes [$self mapself do_get $pattern]
-	return {}	;# terminate query
-    }
-
-    # Returns list of attribute values of the current node, in an unspecified order.
-    method attlist {} {
-	$self get *
-	return {}	;# terminate query
-    }
-
-    # Returns list of lists of attributes of each node
-    method attrs {glob} {
-	set nodes [$self apply keys $glob]
-	return {}	;# terminate query
-    }
-
-    # shim to find node ancestors by repetitive [parent]
-    # as tcllib tree lacks this
-    method do_ancestors {node} {
-	set ancestors {}
-	set rootname [$tree rootname]
-	while {$node ne $rootname} {
-	    lappend ancestors $node
-	    set node [$tree parent $node]
-	}
-	lappend ancestors $rootname
-	return $ancestors
-    }
-
-    # path from node to root
-    method ancestors {args} {
-	set nodes [$self applyself do_ancestors]
-	return $args
-   }
-
-    # shim to find $node rootpath by repetitive [parent]
-    # as tcllib tree lacks this
-    method do_rootpath {node} {
-	set ancestors {}
-	set rootname [$tree rootname]
-	while {$node ne $rootname} {
-	    lappend ancestors $node
-	    set node [$tree parent $node]
-	}
-	lappend ancestors $rootname
-	return [::struct::list reverse $ancestors]
-    }
-
-    # path from root to node
-    method rootpath {args} {
-	set nodes [$self applyself do_rootpath]
-	return $args
-    }
-
-    # node parent
-    method parent {args} {
-	set nodes [$self apply parent]
-	return $args
-    }
-
-    # node children
-    method children {args} {
-	set nodes [$self apply children]
-	return $args
-    }
-
-    # previous sibling
-    method left {args} {
-	set nodes [$self apply previous]
-	return $args
-    }
-
-    # next sibling
-    method right {args} {
-	set nodes [$self apply next]
-	return $args
-    }
-
-    # shim to find left siblings of node, in order of occurrence
-    method do_previous* {node} {
-	if {$node == [$tree rootname]} {
-	    set children $node
-	} else {
-	    set children [$tree children [$tree parent $node]]
-	}
-	set index [expr {[lsearch $children $node] - 1}]
-	return [lrange $children 0 $index]
-    }
-
-    # previous siblings in reverse order
-    method prev {args} {
-	set nodes [::struct::list reverse [$self applyself do_previous*]]
-	return $args
-    }
-
-    # previous siblings in tree order
-    method esib {args} {
-	set nodes [$self applyself do_previous*]
-	return $args
-    }
-
-    # shim to find next siblings in tree order
-    method do_next* {node} {
-	if {$node == [$tree rootname]} {
-	    set children $node
-	} else {
-	    set children [$tree children [$tree parent $node]]
-	}
-	set index [expr {[lsearch $children $node] + 1}]
-	return [lrange $children $index end]
-    }
-
-    # next siblings in tree order
-    method next {args} {
-	set nodes [$self applyself do_next*]
-	return $args
-    }
-
-    # generates the tree root
-    method root {args} {
-	set nodes [$tree rootname]
-	return $args
-    }
-
-    # shim to calculate descendants
-    method do_subtree {node} {
-	set nodeset $node
-	set children [$tree children $node]
-	foreach child $children {
-	    foreach d [$self do_subtree $child] {lappend nodeset $d}
-	}
-	#puts stderr "do_subtree $node -> $nodeset"
-	return $nodeset
-    }
-
-    # generates proper-descendants of nodes
-    method descendants {args} {
-	set desc {}
-	set nodeset {}
-	foreach node $nodes {
-	    foreach d [lrange [$self do_subtree $node] 1 end] {lappend nodeset $d}
-	}
-	set nodes $nodeset
-	return $args
-    }
-
-    # generates all subtrees rooted at node
-    method subtree {args} {
-	set nodeset {}
-	foreach node $nodes {
-	    foreach d [$self do_subtree $node] {lappend nodeset $d}
-	}
-	set nodes $nodeset
-	return $args
-    }
-
-    # generates all nodes in the tree
-    method tree {args} {
-	set nodes [$self do_subtree [$tree rootname]]
-	return $args
-    }
-
-    # generates all subtrees rooted at node
-    #method descendants {args} {
-    #	set nodes [$tree apply descendants]
-    #	return $args
-    #}
-
-    # flattened next subtrees
-    method forward {args} {
-	set nodes [$self applyself do_next*]	;# next siblings
-	$self descendants	;# their proper descendants
-	return $args
-    }
-
-    # synonym for [forward]
-    method later {args} {
-	$self forward
-	return $args
-    }
-
-    # flattened previous subtrees in tree order
-    method earlier {args} {
-	set nodes [$self applyself do_previous*]	;# all earlier siblings
-	$self descendants	;# their proper descendants
-	return $args
-    }
-
-    # flattened previous subtrees in reverse tree order
-    # FIXME - this isn't going to return things in the correct order
-    method backward {args} {
-	set nodes [$self applyself do_previous*]	;# all earlier siblings
-	$self subtree	;# their subtrees
-	set nodes [::struct::list reverse $nodes]	;# reverse order
-	return $args
-    }
-
-    # Returns the node type of nodes
-    method nodetype {} {
-	set nodes [$self apply get @type]
-	return {}	;# terminate query
-    }
-
-    # Reduce to nodes of @type $t
-    method oftype {t args} {
-	return [eval [linsert $args 0 $self stringP [list equal -nocase $t] @type]]
-    }
-
-    # Reduce to nodes not of @type $t
-    method nottype {t args} {
-	return [eval [linsert $args 0 $self stringNP [list equal -nocase $t] @type]]
-    }
-
-    # Reduce to nodes whose @type is one of $attrs
-    # @type values are assumed to be simple strings
-    method oftypes {attrs args} {
-	set n {}
-	foreach result [$self mapself do_attr list @type] node $nodes {
-	    if {[lsearch $attrs $result] > -1} {
-		#puts stderr "$self oftypes '$attrs' -> $result - $node"
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # Reduce to nodes with attribute $attr (can be a glob)
-    method hasatt {attr args} {
-	set nodes [$self bool keyexists $attr]
-	return $args
-    }
-
-    # Returns values of attribute attname
-    method attval {attname} {
-	$self hasatt $attname	;# only nodes with attribute
-	set nodes [$self apply get $attname]	;# get the attribute nodes
-	return {}	;# terminate query
-    }
-
-    # Reduce to nodes with attribute $attr of $value
-    method withatt {attr value args} {
-	$self hasatt $attr	;# only nodes with attribute
-	return [eval [linsert $args 0 $self stringP [list equal -nocase $value] $attr]]
-    }
-
-    # Reduce to nodes with attribute $attr of $value
-    method withatt! {attr val args} {
-	return [eval [linsert $args 0 $self stringP [list equal $val] $attr]]
-    }
-
-    # Reduce to nodes with attribute $attr value one of $vals
-    method attof {attr vals args} {
-
-	set result {}
-	foreach node $nodes {
-	    set x [string tolower [[$self treeObj] get $node $attr]]
-	    if {[lsearch $vals $x] != -1} {
-		lappend result $node
-	    }
-	}
-
-	set nodes $result
-	return $args
-    }
-
-    # Reduce to nodes whose attribute $attr string matches $match
-    method attmatch {attr match args} {
-	$self stringP [linsert $match 0 match] $attr
-	return $args
-    }
-
-    # Side Effect: set attribute $attr to $val
-    method set {attr val args} {
-	$self apply set $attr $val
-	return $args
-    }
-
-    # Side Effect: unset attribute $attr
-    method unset {attr args} {
-	$self apply unset $attr
-	return $args
-    }
-
-    # apply string operation $op to attribute $attr on each node
-    method string {op attr} {
-	set nodes [$self mapself do_attr [linsert $op 0 string] $attr]
-	return {}	;# terminate query
-    }
-
-    # remove duplicate nodes, preserving order
-    method unique {args} {
-	set all {}
-	array set keys {}
-	foreach node $nodes {
-	    if {![info exists keys($node)]} {
-		set keys($node) 1
-		lappend all $node
-	    }
-	}
-	set nodes $all
-	return $args
-    }
-
-    # construct the set of nodes present in both $nodes and node set $and
-    method and {and args} {
-	set nodes [::struct::set intersect $and $nodes]
-	return $args
-    }
-
-    # return result of new query $query, preserving current node set
-    method subquery {args} {
-	set org $nodes	;# save current node set
-	set new [uplevel 1 [linsert $args 0 $query query]]
-	set nodes $org	;# restore old node set
-
-	return $new
-    }
-
-    # perform a subquery and and in the result
-    method andq {q args} {
-	$self and [uplevel 1 [linsert $q 0 $self subquery]]
-	return $args
-    }
-
-    # construct the set of nodes present in $nodes or node set $or
-    method or {or args} {
-	set nodes [::struct::set union $nodes $or]
-	$self unique
-	return $args
-    }
-
-    # perform a subquery and or in the result
-    method orq {q args} {
-	$self or [uplevel 1 [linsert $q 0 $self subquery]]
-	return $args
-    }
-
-    # construct the set of nodes present in $nodes but not node set $not
-    method not {not args} {
-	set nodes [::struct::set difference $nodes $not]
-	return $args
-    }
-
-    # perform a subquery and return the set of nodes not in the result
-    method notq {q args} {
-	$self not [uplevel 1 [linsert $q 0 $self subquery]]
-	return $args
-    }
-
-    # select the first of the nodes
-    method select {args} {
-	set nodes [lindex $nodes 0]
-	return $args
-    }
-
-    # perform a subquery then replace the nodeset
-    method transform {q var body args} {
-	upvar 1 $var iter
-	set new {}
-	foreach n [uplevel 1 [linsert $q 0 $self subquery]] {
-	    set iter $n
-	    switch -exact -- [catch {uplevel 1 $body} result] {
-		0 {
-		    # ok
-		    lappend new $result
-		}
-		1 {
-		    # pass errors up
-		    return -code error $result
-		}
-		2 {
-		    # return
-		    set nodes $result
-		    return
-		}
-		3 {
-		    # break
-		    break
-		}
-		4 {
-		    # continue
-		    continue
-		}
-	    }
-	}
-
-	set nodes $new
-
-	return $args
-    }
-
-    # replace the nodeset
-    method map {var body args} {
-	upvar 1 $var iter
-	set new {}
-	foreach n $nodes {
-	    set iter $n
-	    switch -exact -- [catch {uplevel 1 $body} result] {
-		0 {
-		    # ok
-		    lappend new $result
-		}
-		1 {
-		    # pass errors up
-		    return -code error $result
-		}
-		2 {
-		    # return
-		    set nodes $result
-		    return
-		}
-		3 {
-		    # break
-		    break
-		}
-		4 {
-		    # continue
-		    continue
-		}
-	    }
-	}
-
-	set nodes $new
-
-	return $args
-    }
-
-    # perform a subquery $query then map $body over results
-    method foreach {q var body args} {
-	upvar 1 $var iter
-	foreach n [uplevel 1 [linsert $q 0 $self subquery]] {
-	    set iter $n
-	    uplevel 1 $body
-	}
-	return $args
-    }
-
-    # perform a query, then evaluate $body
-    method with {q body args} {
-	# save current node set, implied reset
-	set org $nodes; set nodes {}
-
-	uplevel 1 [linsert $q 0 $self query]
-	set result [uplevel 1 $body]
-
-	# restore old node set
-	set new $nodes; set nodes $org
-
-	return $args
-    }
-
-    # map $body over $nodes
-    method over {var body args} {
-	upvar 1 $var iter
-	set result {}
-	foreach n $nodes {
-	    set iter $n
-	    uplevel 1 $body
-	}
-	return $args
-    }
-
-    # perform the query
-    method query {args} {
-	# iterate over the args, treating each as a method invocation
-	while {$args != {}} {
-	    #puts stderr "query $self $args"
-	    set args [uplevel 1 [linsert $args 0 $query]]
-	    #puts stderr "-> $nodes"
-	}
-
-	return $nodes
-    }
-
-    # append the literal $val to node set
-    method quote {val args} {
-	lappend nodes $val
-	return $args
-    }
-
-    # replace the node set with the literal
-    method replace {val args} {
-	set nodes $val
-	return $args
-    }
-
-    # set nodeset to empty
-    method reset {args} {
-	set nodes {}
-	return $args
-    }
-
-    # delete all nodes in node set
-    method delete {args} {
-
-	foreach node $nodes {
-	    $tree cut $node
-	}
-
-	set nodes {}
-	return $args
-    }
-
-    # return the node set
-    method result {} {
-	return $nodes
-    }
-
-    constructor {args} {
-	set query [from args -query ""]
-	if {$query == ""} {
-	    set query $self
-	}
-
-	set nodes [from args -nodes {}]
-
-	set tree [from args -tree ""]
-
-	uplevel 1 [linsert $args 0 $self query]
-    }
-
-    # Return result, and destroy this query
-    # useful in constructing a sub-query
-    method discard {args} {
-	return [K [$self result] [$self destroy]]
-    }
-
-    proc K {x y} {
-	set x
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql85.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/treeql/treeql85.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,737 +1,0 @@
-# treeql.tcl
-# A generic tree query language in snit
-#
-# Copyright 2004 Colin McCormack.
-# You are permitted to use this code under the same license as tcl.
-#
-# 20040930 Colin McCormack - initial release to tcllib
-#
-# RCS: @(#) $Id: treeql85.tcl,v 1.2 2007/05/01 17:00:25 andreas_kupries Exp $
-
-package require Tcl 8.5
-package require snit
-package require struct::list
-package require struct::set
-
-snit::type ::treeql {
-    variable nodes	;# set of all nodes
-    variable tree	;# tree over which nodes are defined
-    variable query	;# full query - ie: 'parent' of this treeql object
-
-    # low level accessor to tree
-    method treeObj {} {
-	return $tree
-    }
-
-    # apply the [$tree cmd {*}$args] form to each node
-    # returns the list of results of application
-    method apply {cmd args} {
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		$tree {*}$cmd $node {*}$args
-	    } application eo]} {
-		puts stderr "apply ERROR: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Apply: $tree $cmd $node $args -> $application"
-		lappend result {*}$application
-	    }
-	}
-
-	return $result
-    }
-
-    # filter nodes by [$tree cmd {*}$args]
-    # returns the list of results of application when application is non nil
-    method filter {cmd args} {
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		$tree {*}$cmd $node {*}$args
-	    } application eo]} {
-		puts stderr "filter ERROR: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Filter: $tree $cmd $node $args -> $application"
-		if {$application != {}} {
-		    lappend result $application
-		}
-	    }
-	}
-	return $result
-    }
-
-    # filter nodes by the predicate [$tree cmd {*}$args]
-    # returns the list of results of application when application is true
-    method bool {cmd args} {
-
-	#puts stderr "Bool: $tree $cmd - $args"
-	#set result [::struct::list filter $nodes [list $tree $cmd {*}$args]]
-	#puts stderr "Bool: $tree $cmd - $nodes - $args -> $result"
-	#return $result
-
-	# replaced by tcllib's list filter
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		$tree {*}$cmd $node {*}$args
-	    } application eo]} {
-		puts stderr "bool ERROR: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Bool: $tree $cmd $node $args -> $application - [$tree dump $node]"
-		if {$application} {
-		    lappend result $node
-		}
-	    }
-	}
-
-	return $result
-    }
-
-    # applyself - map cmd on $self to each node, discarding null results
-    method applyself {cmd args} {
-
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		$query {*}$cmd $node {*}$args
-	    } application eo]} {
-		puts stderr "applyself ERROR: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		if {[llength $application]} {
-		    lappend result {*}$application
-		}
-	    }
-	}
-
-	return $result
-    }
-
-    # mapself - map cmd on $self to each node
-    method mapself {cmd args} {
-
-	set result {}
-	foreach node $nodes {
-	    if {[catch {
-		$query {*}$cmd $node {*}$args
-	    } application eo]} {
-		puts stderr "mapself ERROR: $tree $cmd $node $args -> $application - $eo"
-	    } else {
-		#puts stderr "Mapself: $query $cmd $node $args -> $application"
-		lappend result $application
-	    }
-	}
-
-	return $result
-    }
-
-    # shim to perform operation $op on attribute $attr of $node
-    method do_attr {node op attr} {
-	set attrv [$tree get $node $attr]
-	#puts stderr "$self do_attr node:'$node' op:'$op' attr:'$attr' attrv:'$attrv'"
-	return [{*}$op $attrv]
-    }
-
-    # filter nodes by predicate [string $op] over attribute $attr
-    method stringP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [list string {*}$op] $attr]
-	foreach result $map node $nodes {
-	    #puts stderr "$self stringP $op $attr -> $result - $node"
-	    if {$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by negated predicate [string $op] over attribute $attr
-    method stringNP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [list string {*}$op] $attr]
-	foreach result $map node $nodes {
-	    if {!$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by predicate [expr {*}$op] over attribute $attr
-    method exprP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [list expr {*}$op] $attr]
-	foreach result $map node $nodes {
-	    if {$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # filter nodes by predicate ![expr {*}$op] over attribute $attr
-    method exprNP {op attr args} {
-	set n {}
-	set map [$self mapself do_attr [list expr {*}$op] $attr]
-	foreach result $map node $nodes {
-	    if {!$result} {
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # shim to return string values of attributes matching $pattern of a given $node
-    method do_get {node pattern} {
-	set result {}
-	foreach key [$tree keys $node $pattern] {
-	    set result [concat $result [$tree get $node $key]]
-	}
-	return $result
-    }
-
-    # Returns list of attribute values of attributes matching $pattern -
-    method get {pattern} {
-	set nodes [$self mapself do_get $pattern]
-	return {}	;# terminate query
-    }
-
-    # Returns list of attribute values of the current node, in an unspecified order.
-    method attlist {} {
-	$self get *
-	return {}	;# terminate query
-    }
-
-    # Returns list of lists of attributes of each node
-    method attrs {glob} {
-	set nodes [$self apply keys $glob]
-	return {}	;# terminate query
-    }
-
-    # shim to find node ancestors by repetitive [parent]
-    # as tcllib tree lacks this
-    method do_ancestors {node} {
-	set ancestors {}
-	set rootname [$tree rootname]
-	while {$node ne $rootname} {
-	    lappend ancestors $node
-	    set node [$tree parent $node]
-	}
-	lappend ancestors $rootname
-	return $ancestors
-    }
-
-    # path from node to root
-    method ancestors {args} {
-	set nodes [$self applyself do_ancestors]
-	return $args
-   }
-
-    # shim to find $node rootpath by repetitive [parent]
-    # as tcllib tree lacks this
-    method do_rootpath {node} {
-	set ancestors {}
-	set rootname [$tree rootname]
-	while {$node ne $rootname} {
-	    lappend ancestors $node
-	    set node [$tree parent $node]
-	}
-	lappend ancestors $rootname
-	return [::struct::list reverse $ancestors]
-    }
-
-    # path from root to node
-    method rootpath {args} {
-	set nodes [$self applyself do_rootpath]
-	return $args
-    }
-
-    # node parent
-    method parent {args} {
-	set nodes [$self apply parent]
-	return $args
-    }
-
-    # node children
-    method children {args} {
-	set nodes [$self apply children]
-	return $args
-    }
-
-    # previous sibling
-    method left {args} {
-	set nodes [$self apply previous]
-	return $args
-    }
-
-    # next sibling
-    method right {args} {
-	set nodes [$self apply next]
-	return $args
-    }
-
-    # shim to find left siblings of node, in order of occurrence
-    method do_previous* {node} {
-	if {$node == [$tree rootname]} {
-	    set children $node
-	} else {
-	    set children [$tree children [$tree parent $node]]
-	}
-	set index [expr {[lsearch $children $node] - 1}]
-	return [lrange $children 0 $index]
-    }
-
-    # previous siblings in reverse order
-    method prev {args} {
-	set nodes [::struct::list reverse [$self applyself do_previous*]]
-	return $args
-    }
-
-    # previous siblings in tree order
-    method esib {args} {
-	set nodes [$self applyself do_previous*]
-	return $args
-    }
-
-    # shim to find next siblings in tree order
-    method do_next* {node} {
-	if {$node == [$tree rootname]} {
-	    set children $node
-	} else {
-	    set children [$tree children [$tree parent $node]]
-	}
-	set index [expr {[lsearch $children $node] + 1}]
-	return [lrange $children $index end]
-    }
-
-    # next siblings in tree order
-    method next {args} {
-	set nodes [$self applyself do_next*]
-	return $args
-    }
-
-    # generates the tree root
-    method root {args} {
-	set nodes [$tree rootname]
-	return $args
-    }
-
-    # shim to calculate descendants
-    method do_subtree {node} {
-	set nodeset $node
-	set children [$tree children $node]
-	foreach child $children {
-	    set descendants [$self do_subtree $child]
-	    lappend nodeset {*}$descendants
-	}
-	#puts stderr "do_subtree $node -> $nodeset"
-	return $nodeset
-    }
-
-    # generates proper-descendants of nodes
-    method descendants {args} {
-	set desc {}
-	set nodeset {}
-	foreach node $nodes {
-	    set subtree [$self do_subtree $node]
-	    set descendants [lrange $subtree 1 end]
-	    lappend nodeset {*}$descendants
-	}
-	set nodes $nodeset
-	return $args
-    }
-
-    # generates all subtrees rooted at node
-    method subtree {args} {
-	set nodeset {}
-	foreach node $nodes {
-	    set descendants [$self do_subtree $node]
-	    lappend nodeset {*}$descendants
-	}
-	set nodes $nodeset
-	return $args
-    }
-
-    # generates all nodes in the tree
-    method tree {args} {
-	set nodes [$self do_subtree [$tree rootname]]
-	return $args
-    }
-
-    # generates all subtrees rooted at node
-    #method descendants {args} {
-    #	set nodes [$tree apply descendants]
-    #	return $args
-    #}
-
-    # flattened next subtrees
-    method forward {args} {
-	set nodes [$self applyself do_next*]	;# next siblings
-	$self descendants	;# their proper descendants
-	return $args
-    }
-
-    # synonym for [forward]
-    method later {args} {
-	$self forward
-	return $args
-    }
-
-    # flattened previous subtrees in tree order
-    method earlier {args} {
-	set nodes [$self applyself do_previous*]	;# all earlier siblings
-	$self descendants	;# their proper descendants
-	return $args
-    }
-
-    # flattened previous subtrees in reverse tree order
-    # FIXME - this isn't going to return things in the correct order
-    method backward {args} {
-	set nodes [$self applyself do_previous*]	;# all earlier siblings
-	$self subtree	;# their subtrees
-	set nodes [::struct::list reverse $nodes]	;# reverse order
-	return $args
-    }
-
-    # Returns the node type of nodes
-    method nodetype {} {
-	set nodes [$self apply get @type]
-	return {}	;# terminate query
-    }
-
-    # Reduce to nodes of @type $t
-    method oftype {t args} {
-	return [$self stringP [list equal -nocase $t] @type {*}$args]
-    }
-
-    # Reduce to nodes not of @type $t
-    method nottype {t args} {
-	return [$self stringNP [list equal -nocase $t] @type {*}$args]
-    }
-
-    # Reduce to nodes whose @type is one of $attrs
-    # @type values are assumed to be simple strings
-    method oftypes {attrs args} {
-	set n {}
-	foreach result [$self mapself do_attr list @type] node $nodes {
-	    if {[lsearch $attrs $result] > -1} {
-		#puts stderr "$self oftypes '$attrs' -> $result - $node"
-		lappend n $node
-	    }
-	}
-	set nodes $n
-	return $args
-    }
-
-    # Reduce to nodes with attribute $attr (can be a glob)
-    method hasatt {attr args} {
-	set nodes [$self bool keyexists $attr]
-	return $args
-    }
-
-    # Returns values of attribute attname
-    method attval {attname} {
-	$self hasatt $attname	;# only nodes with attribute
-	set nodes [$self apply get $attname]	;# get the attribute nodes
-	return {}	;# terminate query
-    }
-
-    # Reduce to nodes with attribute $attr of $value
-    method withatt {attr value args} {
-	$self hasatt $attr	;# only nodes with attribute
-	return [$self stringP [list equal -nocase $value] $attr {*}$args]
-    }
-
-    # Reduce to nodes with attribute $attr of $value
-    method withatt! {attr val args} {
-	return [$self stringP [list equal $val] $attr {*}$args]
-    }
-
-    # Reduce to nodes with attribute $attr value one of $vals
-    method attof {attr vals args} {
-
-	set result {}
-	foreach node $nodes {
-	    set x [string tolower [[$self treeObj] get $node $attr]]
-	    if {[lsearch $vals $x] != -1} {
-		lappend result $node
-	    }
-	}
-
-	set nodes $result
-	return $args
-    }
-
-    # Reduce to nodes whose attribute $attr string matches $match
-    method attmatch {attr match args} {
-	$self stringP [list match {*}$match] $attr
-	return $args
-    }
-
-    # Side Effect: set attribute $attr to $val
-    method set {attr val args} {
-	$self apply set $attr $val
-	return $args
-    }
-
-    # Side Effect: unset attribute $attr
-    method unset {attr args} {
-	$self apply unset $attr
-	return $args
-    }
-
-    # apply string operation $op to attribute $attr on each node
-    method string {op attr} {
-	set nodes [$self mapself do_attr [list string {*}$op] $attr]
-	return {}	;# terminate query
-    }
-
-    # remove duplicate nodes, preserving order
-    method unique {args} {
-	set all {}
-	array set keys {}
-	foreach node $nodes {
-	    if {![info exists keys($node)]} {
-		set keys($node) 1
-		lappend all $node
-	    }
-	}
-	set nodes $all
-	return $args
-    }
-
-    # construct the set of nodes present in both $nodes and node set $and
-    method and {and args} {
-	set nodes [::struct::set intersect $and $nodes]
-	return $args
-    }
-
-    # return result of new query $query, preserving current node set
-    method subquery {args} {
-	set org $nodes	;# save current node set
-	set new [uplevel 1 [list $query query {*}$args]]
-	set nodes $org	;# restore old node set
-
-	return $new
-    }
-
-    # perform a subquery and and in the result
-    method andq {q args} {
-	$self and [uplevel 1 [list $self subquery {*}$q]]
-	return $args
-    }
-
-    # construct the set of nodes present in $nodes or node set $or
-    method or {or args} {
-	set nodes [::struct::set union $nodes $or]
-	$self unique
-	return $args
-    }
-
-    # perform a subquery and or in the result
-    method orq {q args} {
-	$self or [uplevel 1 [list $self subquery {*}$q]]
-	return $args
-    }
-
-    # construct the set of nodes present in $nodes but not node set $not
-    method not {not args} {
-	set nodes [::struct::set difference $nodes $not]
-	return $args
-    }
-
-    # perform a subquery and return the set of nodes not in the result
-    method notq {q args} {
-	$self not [uplevel 1 [list $self subquery {*}$q]]
-	return $args
-    }
-
-    # select the first of the nodes
-    method select {args} {
-	set nodes [lindex $nodes 0]
-	return $args
-    }
-
-    # perform a subquery then replace the nodeset
-    method transform {q var body args} {
-	upvar 1 $var iter
-	set new {}
-	foreach n [uplevel 1 [list $self subquery {*}$q]] {
-	    set iter $n
-	    switch -exact -- [catch {
-		uplevel 1 $body
-	    } result eo] {
-		0 {
-		    # ok
-		    lappend new $result
-		}
-		1 {
-		    # pass errors up
-		    return -code error $result
-		}
-		2 {
-		    # return
-		    set nodes $result
-		    return
-		}
-		3 {
-		    # break
-		    break
-		}
-		4 {
-		    # continue
-		    continue
-		}
-	    }
-	}
-
-	set nodes $new
-
-	return $args
-    }
-
-    # replace the nodeset
-    method map {var body args} {
-	upvar 1 $var iter
-	set new {}
-	foreach n $nodes {
-	    set iter $n
-	    switch -exact -- [catch {
-		uplevel 1 $body
-	    } result eo] {
-		0 {
-		    # ok
-		    lappend new $result
-		}
-		1 {
-		    # pass errors up
-		    return -code error $result
-		}
-		2 {
-		    # return
-		    set nodes $result
-		    return
-		}
-		3 {
-		    # break
-		    break
-		}
-		4 {
-		    # continue
-		    continue
-		}
-	    }
-	}
-
-	set nodes $new
-
-	return $args
-    }
-
-    # perform a subquery $query then map $body over results
-    method foreach {q var body args} {
-	upvar 1 $var iter
-	foreach n [uplevel 1 [list $self subquery {*}$q]] {
-	    set iter $n
-	    uplevel 1 $body
-	}
-	return $args
-    }
-
-    # perform a query, then evaluate $body
-    method with {q body args} {
-	# save current node set, implied reset
-	set org $nodes; set nodes {}
-
-	uplevel 1 [list $self query {*}$q]
-	set result [uplevel 1 $body]
-
-	# restore old node set
-	set new $nodes; set nodes $org
-
-	return $args
-    }
-
-    # map $body over $nodes
-    method over {var body args} {
-	upvar 1 $var iter
-	set result {}
-	foreach n $nodes {
-	    set iter $n
-	    uplevel 1 $body
-	}
-	return $args
-    }
-
-    # perform the query
-    method query {args} {
-	# iterate over the args, treating each as a method invocation
-	while {$args != {}} {
-	    #puts stderr "query $self $args"
-	    set args [uplevel 1 [list $query {*}$args]]
-	    #puts stderr "-> $nodes"
-	}
-
-	return $nodes
-    }
-
-    # append the literal $val to node set
-    method quote {val args} {
-	lappend nodes $val
-	return $args
-    }
-
-    # replace the node set with the literal
-    method replace {val args} {
-	set nodes $val
-	return $args
-    }
-
-    # set nodeset to empty
-    method reset {args} {
-	set nodes {}
-	return $args
-    }
-
-    # delete all nodes in node set
-    method delete {args} {
-
-	foreach node $nodes {
-	    $tree cut $node
-	}
-
-	set nodes {}
-	return $args
-    }
-
-    # return the node set
-    method result {} {
-	return $nodes
-    }
-
-    constructor {args} {
-	set query [from args -query ""]
-	if {$query == ""} {
-	    set query $self
-	}
-
-	set nodes [from args -nodes {}]
-
-	set tree [from args -tree ""]
-
-	uplevel 1 [list $self query {*}$args]
-    }
-
-    # Return result, and destroy this query
-    # useful in constructing a sub-query
-    method discard {args} {
-	return [K [$self result] [$self destroy]]
-    }
-
-    proc K {x y} {
-	set x
-    }
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uev/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uev/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded uevent 0.1.2 [list source [file join $dir uevent.tcl]]
-
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uev/uevent.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uev/uevent.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,135 +1,0 @@
-# -*- tcl -*-
-# ### ### ### ######### ######### #########
-## UEvent - User Event Service - Tcl-level general Event Handling
-
-# ### ### ### ######### ######### #########
-## Requirements
-
-package require Tcl 8.4
-package require logger
-
-namespace eval ::uevent {}
-
-# ### ### ### ######### ######### #########
-## API: bind, unbind, generate
-
-proc ::uevent::bind {tag event command} {
-    # Register command (prefix!) as observer for events on the tag.
-    # Command will take 3 arguments: tag, event, and dictionary of
-    # detail information. Result is token by which the observer can
-    # be removed.
-
-    variable db
-    variable tk
-    variable ex
-    variable tcounter
-
-    log::debug [list bind: $tag $event -> $command]
-
-    set tec [list $tag $event $command]
-
-    # Same combination as before, same token
-    if {[info exists ex($tec)]} {
-	log::debug [list known! $ex($tec)]
-	return $ex($tec)
-    }
-
-    # New token, and enter everything ...
-
-    set te [list $tag $event]
-    set t uev[incr tcounter]
-
-    set     tk($t) $tec
-    set     ex($tec) $t
-    lappend db($te)  $t
-
-    log::debug [list new! $t]
-    return $t
-}
-
-proc ::uevent::unbind {token} {
-    # Removes the event binding represented by the token.
-
-    variable db
-    variable tk
-    variable ex
-
-    log::debug [list unbind: $token]
-
-    if {![info exists tk($token)]} return
-
-    set tec $tk($token)
-    set te [lrange $tex 0 1]
-
-    log::debug [linsert [linsert $tec 0 =] end-1 ->]
-
-    unset ex($tec)
-    unset tk($token)
-
-    set pos [lsearch -exact $db($te) $token]
-    if {$pos < 0} return
-
-    if {[llength $db($te)] == 1} {
-	# Last observer for this tag,event combination is gone.
-	log::debug [linsert $te 0 last!]
-	unset db($te)
-    } else {
-	# Shrink list of observers
-	log::debug [linsert [linsert $te 0 shrink!] end @ $pos]
-	set db($te) [lreplace $db($te) $pos $pos]
-    }
-    return
-}
-
-proc ::uevent::generate {tag event {details {}}} {
-    # Generates the event on the tag, with detail information (a
-    # dictionary). This notifies all registered observers.  The
-    # notifications are put into the Tcl event queue via 'after 0'
-    # events, decoupling them in time from them issueing code.
-
-    variable db
-    variable tk
-
-    log::debug [list generate: $tag $event $details]
-
-    set key [list $tag $event]
-    if {![info exists db($key)]} return
-
-    foreach t $db($key) {
-	set cmd [lindex $tk($t) 2]
-	log::debug [list trigger! $t = $cmd]
-	after 0 [linsert $cmd end $tag $event $details]
-    }
-
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Initialization - Tracing, System state
-
-logger::initNamespace ::uevent
-namespace eval        ::uevent {
-
-    # Information needed:
-    # (1) Per <tag,event> the commands bound to it.
-    # (2) Per <tag,event,command> a token representing it.
-    # (3) For all <tag,event,command> a quick way to check their existence
-
-    # (Ad 1) db : array (list (tag, event) -> list (token))
-    # (Ad 2) tk : array (token -> list (tag, event, command))
-    # (Ad 3) ex : array (list (tag, event, command) -> token)
-
-    variable db ; array set db {}
-    variable tk ; array set tk {}
-    variable ex ; array set ex {}
-
-    variable tcounter 0
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide uevent 0.1.2
-
-##
-# ### ### ### ######### ######### #########
Index: tolsh/tolsh.vfs/lib/tcllib1.10/units/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/units/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,4 +1,0 @@
-# Tcl package index file, version 1.1
-
-if {![package vsatisfies [package provide Tcl] 8.1]} {return}
-package ifneeded units 2.1 [list source [file join $dir units.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/units/units.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/units/units.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,690 +1,0 @@
-#----------------------------------------------*-TCL-*------------
-#
-#  units.tcl
-#
-#  The units package provides a conversion facility from a variety of
-#  scientific and engineering shorthand notations into floating point
-#  numbers.
-#
-#  Robert W. Techentin
-#  November 1, 2000
-#  Copyright (C) Mayo Foundation.  All Rights Reserved.
-#
-#-----------------------------------------------------------------
-package provide units 2.1
-
-package require Tcl 8.1
-
-namespace eval ::units {
-
-    namespace export new
-    namespace export convert
-    namespace export reduce
-
-    variable UnitTable
-    variable PrefixTable
-}
-
-
-#-----------------------------------------------------------------
-#
-# ::units::new --
-#
-#  Add a new unit to the units table.  The new unit is defined
-#  in terms of its baseUnits.  If baseUnits is "-primitive",
-#  then it is assumed to be some magical new kind of quantity.
-#  Otherwise, it must reduce to units already defined.
-#
-#-----------------------------------------------------------------
-proc ::units::new { args } {
-
-    variable UnitTable
-    variable UnitList
-
-    #  Check number of arguments
-    switch [llength $args] {
-	2 {
-	    set name [lindex $args 0]
-	    set baseUnits [lindex $args 1]
-	}
-	default {
-	    #  issue same error as C extension
-	    error "Wrong # args. units::new name baseUnits "
-	}
-    }
-
-    # check for duplicates
-    if { [info exists UnitTable($name)] } {
-	error "unit '$name' is already defined"
-    }
-
-    # check for valid characters
-    if { [regexp {[^a-zA-Z]} $name] } {
-	error "non-alphabetic characters in unit name '$name'"
-    }
-
-    # Compute reduced units
-    if { [catch {::units::reduce $baseUnits} reducedUnits] } {
-	error "'$baseUnits' cannot be reduced to primitive units"
-    }
-
-    # add the unit, but don't return a value
-    set UnitTable($name) $reducedUnits
-    lappend UnitList $name $reducedUnits
-    return
-}
-
-#-----------------------------------------------------------------
-#
-# ::units::convert --
-#
-#  Convert a value to the target units.
-#
-#  If units are specified for the value, then they must
-#  be compatible with the target units.  (i.e., you can 
-#  convert "newtons" to "kg-m/s^2", but not to "sieverts".
-#
-# Arguments:
-#  value  A value can be a floating point number, either with or
-#         without units.  
-#  targetUnits  A units string which  may also include a scale factor.  
-#
-# Results:
-#  The return value is a scaled floating point number.
-#
-#-----------------------------------------------------------------
-
-proc ::units::convert { args } {
-
-    #  Check number of arguments
-    switch [llength $args] {
-	2 {
-	    set value [lindex $args 0]
-	    # make sure it isn't octal (bug 758702)
-	    set value [string trimleft $value "0"]
-	    set targetUnits [lindex $args 1]
-	}
-	default {
-	    #  issue same error as C extension
-	    error "Wrong # args. units::convert value targetUnits "
-	}
-    }
-
-    #  Reduce each of value and target
-    #  to primitive units
-    set reducedValue [::units::reduce $value]
-    set reducedTarget [::units::reduce $targetUnits]
-
-    #  If the value has units, it must be compatible with
-    #  the target.  (If it is unitless, then compatibility
-    #  is not required.)
-    if { [llength $reducedValue] > 1} {
-	if {[lrange $reducedValue 1 end]!=[lrange $reducedTarget 1 end]} {
-	    error "'$value' and '$targetUnits' have incompatible units"
-	}
-    }
-
-    #  Compute and return scaled value
-    expr {[lindex $reducedValue 0] / [lindex $reducedTarget 0]}
-}
-
-
-#-----------------------------------------------------------------
-#
-# ::units::reduce --
-#
-#  Reduce a string of numbers, prefixes, units, exponents into a
-#  single multiplicitive factor and sorted list of primitive units.
-#  For example, the unit string for "newton", which is "m-kg/s^2"
-#  would reduce to the list {1000.0 gram meter / second second}
-#
-#  Unit String Syntax
-#
-#  This procedure defines a valid unit string that may
-#  be reduced to primitive units, so it is reasonable to
-#  document valid unit string syntax here.
-#
-#  A unit string consists of an optional scale factor followed
-#  by zero or more subunit strings.  The scale factor must be
-#  a valid floating point number.  
-#
-#  Subunits are separated by unit separator characters, which are 
-#  " ", "-", "*", and "/".  It is not necessary to separate
-#  the leading scale factor from the rest of the subunits.
-#
-#  The forward slash seperator "/" indicates that following
-#  subunits are in the denominator.  There can be at most
-#  one "/" separator.
-#
-#  Subunits can be floating point scale factors, but they
-#  must be surrounded by valid separators.
-#
-#  Subunits can be valid units or abbreviations from the
-#  UnitsTable.  They may include a prefix from the PrefixTable.
-#  They may include a plural suffix "s" or "es".  They may
-#  also include a power string "^", followed by an integer,
-#  after the unit name (or plural suffix, if there is one.)
-#
-#  Examples of valid unit strings:  "meter", "/s", "kg-m/s^2",
-#  "30second" "30 second", "30 seconds" "200*meter/20.5*second"
-#
-# Arguments:
-#  unitString  string of units characters
-#
-# Results:
-#  The return value is a list, the first element of which 
-#  is the multiplicitive factor, and the remaining elements are
-#  sorted reduced primitive units, possibly including the "/"
-#  operator, which separates the numerator from the denominator.
-#-----------------------------------------------------------------
-#
-
-proc ::units::reduce { args } {
-
-    #  Check number of arguments
-    switch [llength $args] {
-	1 {
-	    set unitString [lindex $args 0]
-	}
-	default {
-	    #  issue same error as C extension
-	    error "Wrong # args. units::reduce unitString "
-	}
-    }
-
-    # check for primitive unit - may already be reduced
-    #  This gets excercised by new units
-    if { "$unitString" == "-primitive" } {
-	return $unitString
-    }
-
-    # trim leading and trailing white space
-    set unitString [string trim $unitString]
-
-    # Check cache of unitStrings
-   if { [info exists ::units::cache($unitString)] } {
-	return $::units::cache($unitString)
-    }
-
-    # Verify syntax of unit string
-    #  It may contain, at most, one "/"
-    if { [regexp {/.*/} $unitString] } {
-	error "invalid unit string '$unitString':  only one '/' allowed"
-    }
-    #  It may contain only letters, digits, the powerstring ("^"),
-    #  decimal points, and separators 
-    if { [regexp {[^a-zA-Z0-9. \t*^/+-]} $unitString] } {
-	error "invalid characters in unit string '$unitString'"
-    }
-
-    #  Check for leading scale factor
-    #  If the leading characters are in floating point
-    #  format, then extract and save them (including any
-    #  minus signs) before handling subunit separators.
-    #  This is based on a regexp from Roland B. Roberts which
-    #  allows leading +/-, digits, decimals, and exponents.
-    regexp {(^[-+]?(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:[eE][-+]?[0-9]+)?)?(.*)} \
-	    $unitString matchvar scaleFactor subunits
-    #  Ensure that scale factor is a nice floating point number
-    if { "$scaleFactor" == "" } {
-	set scaleFactor 1.0
-    } else {
-	set scaleFactor [expr {double($scaleFactor)}]
-    }
-
-    #  replace all separators with spaces.
-    regsub -all {[\t\-\*]} $subunits " " subunits
-    #  add spaces around "/" character.
-    regsub {/} $subunits " / " subunits
-
-    #  The unitString is now essentially a well structured list
-    #  of subunits, which may be processed as a list, and it
-    #  may be necessary to process it recursively, without
-    #  performing the string syntax checks again.  But check
-    #  for errors.
-    if { [catch {ReduceList $scaleFactor $subunits} result] } {
-	error "$result in '$unitString'"
-    }
-
-    #  Store the reduced unit in a cache, so future lookups
-    #  are much quicker.
-    set ::units::cache($unitString) $result
-}
-
-
-#-----------------------------------------------------------------
-#
-# ::units::ReduceList --
-#
-#  Reduce a list of subunits to primitive units and a single
-#  scale factor.
-#
-# Arguments:
-#  factor      A scale factor, which is multiplied and divided
-#              by subunit prefix values and constants.
-#  unitString  A unit string which is syntactically correct
-#              and includes only space separators.  This
-#              string can be treated as a Tcl list.
-#
-# Results:
-#  A valid unit string list, consisting of a single floating
-#  point factor, followed by sorted primitive units.  If the 
-#  forward slash separator "/" is included, then each of the
-#  numerator and denominator is sorted, and common units have
-#  been cancelled.
-#
-#-----------------------------------------------------------------
-#
-proc ::units::ReduceList { factor unitString } {
-
-    variable UnitList
-    variable UnitTable
-    variable PrefixTable
-
-    # process each subunit in turn, starting in the numerator
-    #
-    #  Note that we're going to use a boolean flag to switch
-    #  between numerator and denominator if we encounter a "/".
-    #  This same style is used for processing recursively
-    #  reduced subunits
-    set numerflag 1
-    set numerator [list]
-    set denominator [list]
-    foreach subunit $unitString {
-
-	#  Check for "/"
-	if { "$subunit" == "/" } {
-	    set numerflag [expr {$numerflag?0:1}]
-	    continue
-	}
-
-	#  Constant factor
-	if { [string is double -strict $subunit] } {
-	    if { $subunit == 0.0 } {
-		error "illegal zero factor"
-	    } else {
-		if { $numerflag } {
-		    set factor [expr {$factor * $subunit}]
-		} else {
-		    set factor [expr {$factor / $subunit}]
-		}
-		continue
-	    }
-	}
-
-	#  Check for power string (e.g. "s^2")
-	#  We could use regexp to match and split in one operation,
-	#  like {([^\^]*)\^(.*)} but that seems to be pretty durn
-	#  slow, so we'll just using [string] operations.
-	if { [set index [string first "^" $subunit]] >= 0 } {
-	    set subunitname [string range $subunit 0 [expr {$index-1}]]
-	    set exponent [string range $subunit [expr {$index+1}] end]
-	    if { ! [string is integer -strict $exponent] } {
-		error "invalid integer exponent"
-	    }
-	    #  This is a good test and error message, but it won't
-	    #  happen, because the negative sign (hypen) has already
-	    #  been interpreted as a unit separator.  Negative
-	    #  exponents will trigger the 'invalid integer' message,
-	    #  because there is no exponent. :-)
-	    if { $exponent < 1 } {
-		error "invalid non-positive exponent"
-	    }
-	} else {
-	    set subunitname $subunit
-	    set exponent 1
-	}
-
-	# Check subunit name syntax
-	if { ! [string is alpha -strict $subunitname] } {
-	    error "invalid non-alphabetic unit name"
-	}
-
-	#  Try looking up the subunitname.  
-	#
-	#  Start with the unit name.  But if the unit ends in "s"
-	#  or "es", then we want to try shortened (singular)
-	#  versions of the subunit as well.
-	set unitValue ""
-
-	set subunitmatchlist [list $subunitname]
-	if { [string range $subunitname end end] == "s" } {
-	    lappend subunitmatchlist [string range $subunitname 0 end-1]
-	}
-	if { [string range $subunitname end-1 end] == "es" } {
-	    lappend subunitmatchlist [string range $subunitname 0 end-2]
-	}
-
-	foreach singularunit $subunitmatchlist {
-
-	    set len [string length $singularunit]
-
-	    #  Search the unit list in order, because we 
-	    #  wouldn't want to accidentally match the "m" 
-	    #  at the end of "gram" and conclude that we 
-	    #  have "meter".  
-	    foreach {name value} $UnitList {
-
-		#  Try to match the string starting at the
-		#  at the end, just in case there is a prefix.
-		#  We only have a match if both the prefix and
-		#  unit name are exact matches.
-		set pos [expr {$len - [string length $name]}]
-		#set pos [expr {$len-1}]
-		if { [string range $singularunit $pos end] == $name } {
-
-		    set prefix [string range $singularunit 0 [expr {$pos-1}]]
-		    set matchsubunit $name
-
-		    #  If we have no prefix or a valid prefix, 
-		    #  then we've got an actual match.
-		    if { ("$prefix" == "") || \
-			    [info exists PrefixTable($prefix)] } {
-			#  Set the unit value string
-			set unitValue $value
-			# done searching UnitList
-			break
-		    }
-		}
-		# check for done 
-		if { $unitValue != "" } {
-		    break
-		}
-	    }
-	}
-
-	# Check for not-found
-	if { "$unitValue" == "" } {
-	    error "invalid unit name '$subunitname'"
-	}
-
-	#  Multiply the factor by the prefix value
-	if { "$prefix" != "" } { 
-	    #  Look up prefix value recursively, so abbreviations
-	    #  like "k" for "kilo" will work.  Note that we
-	    #  don't need error checking here (as we do for
-	    #  unit lookup) because we have total control over
-	    #  the prefix table.
-	    while { ! [string is double -strict $prefix] } {
-		set prefix $PrefixTable($prefix)
-	    }
-	    # Save prefix multiple in factor
-	    set multiple [expr {pow($prefix,$exponent)}]
-	    if { $numerflag } {
-		set factor [expr {$factor * $multiple}]
-	    } else {
-		set factor [expr {$factor / $multiple}]
-	    }
-	}
-
-
-	# Is this a primitive subunit?
-	if { "$unitValue" == "-primitive" } {
-	    # just append the matching subunit to the result
-	    # (this doesn't have prefix or trailing "s")
-	    for {set i 0} {$i<$exponent} {incr i} {
-		if { $numerflag } {
-		    lappend numerator $matchsubunit
-		} else {
-		    lappend denominator $matchsubunit
-		}
-	    }
-	} else {
-	    #  Recursively reduce, unless it is in the cache
-	    if { [info exists ::units::cache($unitValue)] } {
-		set reducedUnit $::units::cache($unitValue)
-	    } else {
-		set reducedUnit [::units::reduce $unitValue]
-		set ::units::cache($unitValue) $reducedUnit
-	    }
-
-	    #  Include multiple factor from reduced unit
-	    set multiple [expr {pow([lindex $reducedUnit 0],$exponent)}]
-	    if { $numerflag } {
-		set factor [expr {$factor * $multiple}]
-	    } else {
-		set factor [expr {$factor / $multiple}]
-	    }
-
-	    #  Add primitive subunits to numerator/denominator
-	    #
-	    #  Note that we're use a nested boolean flag to switch
-	    #  between numerator and denominator.  Subunits in
-	    #  the numerator of the unitString are processed
-	    #  normally, but subunits in the denominator of
-	    #  unitString must be inverted.
-	    set numerflag2 $numerflag
-	    foreach u [lrange $reducedUnit 1 end] {
-		if { "$u" == "/" } {
-		    set numerflag2 [expr {$numerflag2?0:1}]
-		    continue
-		}
-		#  Append the reduced units "exponent" times
-		for {set i 0} {$i<$exponent} {incr i} {
-		    if { $numerflag2 } {
-			lappend numerator $u
-		    } else {
-			lappend denominator $u
-		    }
-		}
-	    }
-	}
-    }
-
-    #  Sort both numerator and denominator
-    set numerator [lsort $numerator]
-    set denominator [lsort $denominator]
-
-    #  Cancel any duplicate units.
-    #  Foreach and for loops don't work well for this.
-    #  (We keep changing list length).
-    set i 0
-    while {$i < [llength $numerator]} {
-	set u [lindex $numerator $i]
-	set index [lsearch $denominator $u]
-	if { $index >= 0 } {
-	    set numerator [lreplace $numerator $i $i]
-	    set denominator [lreplace $denominator $index $index]
-	} else {
-	    incr i
-	}
-    }
-
-    #  Now we've got numerator, denominator, and factors.
-    #  Assemble the result into a single list.
-    if { [llength $denominator] > 0 } {
-	set result [eval list $factor $numerator "/" $denominator]
-    } else {
-	set result [eval list $factor $numerator]
-    }
-
-    #  Now return the result
-    return $result
-}
-
-
-#-----------------------------------------------------------------
-#
-#  Initialize namespace variables
-#
-#-----------------------------------------------------------------
-namespace eval ::units {
-
-    set PrefixList {
-	yotta        1e24
-	zetta        1e21
-	exa          1e18
-	peta         1e15
-	tera         1e12
-	giga         1e9
-	mega         1e6
-	kilo         1e3
-	hecto        1e2
-	deka         1e1
-	deca         1e1
-	deci         1e-1
-	centi        1e-2
-	milli        1e-3
-	micro        1e-6
-	nano         1e-9
-	pico         1e-12
-	femto        1e-15
-	atto         1e-18
-	zepto        1e-21
-	yocto        1e-24
-	Y            yotta
-	Z            zetta
-	E            exa
-	P            peta
-	T            tera
-	G            giga
-	M            mega
-	k            kilo
-	h            hecto
-	da           deka
-	d            deci
-	c            centi
-	m            milli
-	u            micro
-	n            nano
-	p            pico
-	f            femto
-	a            atto
-	z            zepto
-	y            yocto
-    }
-
-    array set PrefixTable $PrefixList
-
-
-    set SIunits {
-	meter        -primitive
-	gram         -primitive
-	second       -primitive
-	ampere       -primitive
-	kelvin       -primitive
-	mole         -primitive
-	candela      -primitive
-	radian       meter/meter
-	steradian    meter^2/meter^2
-	hertz        /second
-	newton       meter-kilogram/second^2
-	pascal       kilogram/meter-second^2
-	joule        meter^2-kilogram/second^2
-	watt         meter^2-kilogram/second^3
-	coulomb      second-ampere
-	volt         meter^2-kilogram/second^3-ampere
-	farad        second^4-ampere^2/meter^2-kilogram
-	ohm	     meter^2-kilogram/second^3-ampere^2
-	siemens      second^3-ampere^2/meter^2-kilogram
-	weber        meter^2-kilogram/second^2-ampere
-	tesla        kilogram/second^2-ampere
-	henry        meter^2-kilogram/second^2-ampere^2
-	lumen        candela-steradian
-	lux          candela-steradian/meter^2
-	becquerel    /second
-	gray         meter^2/second^2
-	sievert      meter^2/second^2
-    }
-    set SIabbrevs {
-	m            meter
-	g            gram
-	s            second
-	A            ampere
-	K            kelvin
-	mol          mole
-	cd           candela
-	rad          radian
-	sr           steradian
-	Hz           hertz
-	N            newton
-	Pa           pascal
-	J            joule
-	W            watt
-	C            coulomb
-	V            volt
-	F            farad
-	S            siemens
-	Wb           weber
-	T            tesla
-	H            henry
-	lm           lumen
-	lx           lux
-	Bq           becquerel
-	Gy           gray
-	Sv           sievert
-    }
-
-    #  Selected non-SI units from Appendix B of the Guide for
-    #  the use of the International System of Units
-    set nonSIunits {
-	angstrom              1.0E-10meter
-	astronomicalUnit      1.495979E11meter
-	atmosphere            1.01325E5pascal
-	bar                   1.0E5pascal
-	calorie               4.1868joule
-	curie                 3.7E10becquerel
-	day                   8.64E4second
-	degree                1.745329E-2radian
-	erg                   1.0E-7joule
-	faraday               9.648531coulomb
-	fermi                 1.0E-15meter
-        foot                  3.048E-1meter
-	gauss                 1.0E-4tesla
-	gilbert               7.957747E-1ampere
-	grain                 6.479891E-5kilogram
-	hectare               1.0E4meter^2
-	hour                  3.6E3second
-	inch                  2.54E-2meter
-	lightYear             9.46073E15meter
-	liter                 1.0E-3meter^3
-	maxwell               1.0E-8weber
-	mho                   1.0siemens
-	micron                1.0E-6meter
-	mil                   2.54E-5meter
-	mile                  1.609344E3meter
-	minute                6.0E1second
-	parsec                3.085E16meter
-	pica                  4.233333E-3meter
-	pound                 4.535924E-1kilogram
-	revolution            6.283185radian
-	revolutionPerMinute   1.047198E-1radian/second
-	yard                  9.144E-1meter
-	year                  3.1536E7second
-    }
-    set nonSIabbrevs {
-	AU           astronomicalUnit
-	ft           foot
-	gr           grain
-	ha           hectare
-	h            hour
-	in           inch
-	L            liter
-	Mx           maxwell
-	mi           mile
-	min          minute
-	pc           parsec
-	lb           pound
-	r            revolution
-	rpm          revolutionPerMinute
-	yd           yard
-    }
-
-    foreach {name value} $SIunits {
-	lappend UnitList $name $value
-	set UnitTable($name) $value
-    }
-    foreach {name value} $nonSIunits {
-	lappend UnitList $name $value
-	set UnitTable($name) $value
-    }
-    foreach {name value} $SIabbrevs {
-	lappend UnitList $name $value
-	set UnitTable($name) $value
-    }
-    foreach {name value} $nonSIabbrevs {
-	lappend UnitList $name $value
-	set UnitTable($name) $value
-    }
-
-}
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uri/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uri/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,6 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.2]} {
-    # FRINK: nocheck
-    return
-}
-package ifneeded uri      1.2.1 [list source [file join $dir uri.tcl]]
-package ifneeded uri::urn 1.0.2 [list source [file join $dir urn-scheme.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uri/uri.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uri/uri.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,1055 +1,0 @@
-# uri.tcl --
-#
-#	URI parsing and fetch
-#
-# Copyright (c) 2000 Zveno Pty Ltd
-# Copyright (c) 2006 Pierre DAVID <Pierre.David@crc.u-strasbg.fr>
-# Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
-# Steve Ball, http://www.zveno.com/
-# Derived from urls.tcl by Andreas Kupries
-#
-# TODO:
-#	Handle www-url-encoding details
-#
-# CVS: $Id: uri.tcl,v 1.35 2007/01/11 19:35:23 andreas_kupries Exp $
-
-package require Tcl 8.2
-
-namespace eval ::uri {
-
-    namespace export split join
-    namespace export resolve isrelative
-    namespace export geturl
-    namespace export canonicalize
-    namespace export register
-
-    variable file:counter 0
-
-    # extend these variable in the coming namespaces
-    variable schemes       {}
-    variable schemePattern ""
-    variable url           ""
-    variable url2part
-    array set url2part     {}
-
-    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    # basic regular expressions used in URL syntax.
-
-    namespace eval basic {
-	variable	loAlpha		{[a-z]}
-	variable	hiAlpha		{[A-Z]}
-	variable	digit		{[0-9]}
-	variable	alpha		{[a-zA-Z]}
-	variable	safe		{[$_.+-]}
-	variable	extra		{[!*'(,)]}
-	# danger in next pattern, order important for []
-	variable	national	{[][|\}\{\^~`]}
-	variable	punctuation	{[<>#%"]}	;#" fake emacs hilit
-	variable	reserved	{[;/?:@&=]}
-	variable	hex		{[0-9A-Fa-f]}
-	variable	alphaDigit	{[A-Za-z0-9]}
-	variable	alphaDigitMinus	{[A-Za-z0-9-]}
-
-	# next is <national | punctuation>
-	variable	unsafe		{[][<>"#%\{\}|\\^~`]} ;#" emacs hilit
-	variable	escape		"%${hex}${hex}"
-
-	#	unreserved	= alpha | digit | safe | extra
-	#	xchar		= unreserved | reserved | escape
-
-	variable	unreserved	{[a-zA-Z0-9$_.+!*'(,)-]}
-	variable	uChar		"(${unreserved}|${escape})"
-	variable	xCharN		{[a-zA-Z0-9$_.+!*'(,);/?:@&=-]}
-	variable	xChar		"(${xCharN}|${escape})"
-	variable	digits		"${digit}+"
-
-	variable	toplabel	\
-		"(${alpha}${alphaDigitMinus}*${alphaDigit}|${alpha})"
-	variable	domainlabel	\
-		"(${alphaDigit}${alphaDigitMinus}*${alphaDigit}|${alphaDigit})"
-
-	variable	hostname	\
-		"((${domainlabel}\\.)*${toplabel})"
-	variable	hostnumber	\
-		"(${digits}\\.${digits}\\.${digits}\\.${digits})"
-
-	variable	host		"(${hostname}|${hostnumber})"
-
-	variable	port		$digits
-	variable	hostOrPort	"${host}(:${port})?"
-
-	variable	usrCharN	{[a-zA-Z0-9$_.+!*'(,);?&=-]}
-	variable	usrChar		"(${usrCharN}|${escape})"
-	variable	user		"${usrChar}*"
-	variable	password	$user
-	variable	login		"(${user}(:${password})?@)?${hostOrPort}"
-    } ;# basic {}
-}
-
-
-
-# ::uri::register --
-#
-#	Register a scheme (and aliases) in the package. The command
-#	creates a namespace below "::uri" with the same name as the
-#	scheme and executes the script declaring the pattern variables
-#	for this scheme in the new namespace. At last it updates the
-#	uri variables keeping track of overall scheme information.
-#
-#	The script has to declare at least the variable "schemepart",
-#	the pattern for an url of the registered scheme after the
-#	scheme declaration. Not declaring this variable is an error.
-#
-# Arguments:
-#	schemeList	Name of the scheme to register, plus aliases
-#       script		Script declaring the scheme patterns
-#
-# Results:
-#	None.
-
-proc ::uri::register {schemeList script} {
-    variable schemes
-    variable schemePattern
-    variable url
-    variable url2part
-
-    # Check scheme and its aliases for existence.
-    foreach scheme $schemeList {
-	if {[lsearch -exact $schemes $scheme] >= 0} {
-	    return -code error \
-		    "trying to register scheme (\"$scheme\") which is already known"
-	}
-    }
-
-    # Get the main scheme
-    set scheme  [lindex $schemeList 0]
-
-    if {[catch {namespace eval $scheme $script} msg]} {
-	catch {namespace delete $scheme}
-	return -code error \
-	    "error while evaluating scheme script: $msg"
-    }
-
-    if {![info exists ${scheme}::schemepart]} {
-	namespace delete $scheme
-	return -code error \
-	    "Variable \"schemepart\" is missing."
-    }
-
-    # Now we can extend the variables which keep track of the registered schemes.
-
-    eval [linsert $schemeList 0 lappend schemes]
-    set schemePattern	"([::join $schemes |]):"
-
-    foreach s $schemeList {
-	# FRINK: nocheck
-	set url2part($s) "${s}:[set ${scheme}::schemepart]"
-	# FRINK: nocheck
-	append url "(${s}:[set ${scheme}::schemepart])|"
-    }
-    set url [string trimright $url |]
-    return
-}
-
-# ::uri::split --
-#
-#	Splits the given <a url> into its constituents.
-#
-# Arguments:
-#	url	the URL to split
-#
-# Results:
-#	Tcl list containing constituents, suitable for 'array set'.
-
-proc ::uri::split {url {defaultscheme http}} {
-
-    set url [string trim $url]
-    set scheme {}
-
-    # RFC 1738:	scheme = 1*[ lowalpha | digit | "+" | "-" | "." ]
-    regexp -- {^([a-z0-9+.-][a-z0-9+.-]*):} $url dummy scheme
-
-    if {$scheme == {}} {
-	set scheme $defaultscheme
-    }
-
-    # ease maintenance: dynamic dispatch, able to handle all schemes
-    # added in future!
-
-    if {[::info procs Split[string totitle $scheme]] == {}} {
-	error "unknown scheme '$scheme' in '$url'"
-    }
-
-    regsub -- "^${scheme}:" $url {} url
-
-    set       parts(scheme) $scheme
-    array set parts [Split[string totitle $scheme] $url]
-
-    # should decode all encoded characters!
-
-    return [array get parts]
-}
-
-
-proc ::uri::SplitFtp {url} {
-    # @c Splits the given ftp-<a url> into its constituents.
-    # @a url: The url to split, without! scheme specification.
-    # @r List containing the constituents, suitable for 'array set'.
-
-    # general syntax:
-    # //<user>:<password>@<host>:<port>/<cwd1>/.../<cwdN>/<name>;type=<typecode>
-    #
-    # additional rules:
-    #
-    # <user>:<password> are optional, detectable by presence of @.
-    # <password> is optional too.
-    #
-    # "//" [ <user> [":" <password> ] "@"] <host> [":" <port>] "/"
-    #	<cwd1> "/" ..."/" <cwdN> "/" <name> [";type=" <typecode>]
-
-    upvar \#0 [namespace current]::ftp::typepart ftptype
-
-    array set parts {user {} pwd {} host {} port {} path {} type {}}
-
-    # slash off possible type specification
-
-    if {[regexp -indices -- "${ftptype}$" $url dummy ftype]} {
-
-	set from	[lindex $ftype 0]
-	set to		[lindex $ftype 1]
-
-	set parts(type)	[string range   $url $from $to]
-
-	set from	[lindex $dummy 0]
-	set url		[string replace $url $from end]
-    }
-
-    # Handle user, password, host and port
-
-    if {[string match "//*" $url]} {
-	set url [string range $url 2 end]
-
-	array set parts [GetUPHP url]
-    }
-
-    set parts(path) [string trimleft $url /]
-
-    return [array get parts]
-}
-
-
-proc ::uri::JoinFtp args {
-    array set components {
-	user {} pwd {} host {} port {}
-	path {} type {}
-    }
-    array set components $args
-
-    set userPwd {}
-    if {[string length $components(user)] || [string length $components(pwd)]} {
-	set userPwd $components(user)[expr {[string length $components(pwd)] ? ":$components(pwd)" : {}}]@
-    }
-
-    set port {}
-    if {[string length $components(port)]} {
-	set port :$components(port)
-    }
-
-    set type {}
-    if {[string length $components(type)]} {
-	set type \;type=$components(type)
-    }
-
-    return ftp://${userPwd}$components(host)${port}/[string trimleft $components(path) /]$type
-}
-
-
-proc ::uri::SplitHttps {url} {
-    return [SplitHttp $url]
-}
-
-proc ::uri::SplitHttp {url} {
-    # @c Splits the given http-<a url> into its constituents.
-    # @a url: The url to split, without! scheme specification.
-    # @r List containing the constituents, suitable for 'array set'.
-
-    # general syntax:
-    # //<host>:<port>/<path>?<searchpart>
-    #
-    #   where <host> and <port> are as described in Section 3.1. If :<port>
-    #   is omitted, the port defaults to 80.  No user name or password is
-    #   allowed.  <path> is an HTTP selector, and <searchpart> is a query
-    #   string. The <path> is optional, as is the <searchpart> and its
-    #   preceding "?". If neither <path> nor <searchpart> is present, the "/"
-    #   may also be omitted.
-    #
-    #   Within the <path> and <searchpart> components, "/", ";", "?" are
-    #   reserved.  The "/" character may be used within HTTP to designate a
-    #   hierarchical structure.
-    #
-    # path == <cwd1> "/" ..."/" <cwdN> "/" <name> ["#" <fragment>]
-
-    upvar #0 [namespace current]::http::search  search
-    upvar #0 [namespace current]::http::segment segment
-
-    array set parts {host {} port {} path {} query {}}
-
-    set searchPattern   "\\?(${search})\$"
-    set fragmentPattern "#(${segment})\$"
-
-    # slash off possible query. the 'search' regexp, while official,
-    # is not good enough. We have apparently lots of urls in the wild
-    # which contain unquoted urls with queries in a query. The RE
-    # finds the embedded query, not the actual one. Using string first
-    # now instead of a RE
-
-    if {[set pos [string first ? $url]] >= 0} {
-	incr pos
-	set parts(query) [string range   $url $pos end]
-	incr pos -1
-	set url          [string replace $url $pos end]
-    }
-
-    # slash off possible fragment
-
-    if {[regexp -indices -- $fragmentPattern $url match fragment]} {
-	set from [lindex $fragment 0]
-	set to   [lindex $fragment 1]
-
-	set parts(fragment) [string range $url $from $to]
-
-	set url [string replace $url [lindex $match 0] end]
-    }
-
-    if {[string match "//*" $url]} {
-	set url [string range $url 2 end]
-
-	array set parts [GetUPHP url]
-    }
-
-    set parts(path) [string trimleft $url /]
-
-    return [array get parts]
-}
-
-
-proc ::uri::JoinHttp {args} {
-    return [eval [linsert $args 0 ::uri::JoinHttpInner http 80]]
-}
-
-proc ::uri::JoinHttps {args} {
-    return [eval [linsert $args 0 ::uri::JoinHttpInner https 443]]
-}
-
-proc ::uri::JoinHttpInner {scheme defport args} {
-    array set components {host {} path {} query {}}
-    set       components(port) $defport
-    array set components $args
-
-    set port {}
-    if {[string length $components(port)] && $components(port) != $defport} {
-	set port :$components(port)
-    }
-
-    set query {}
-    if {[string length $components(query)]} {
-	set query ?$components(query)
-    }
-
-    regsub -- {^/} $components(path) {} components(path)
-
-    if { [info exists components(fragment)] && $components(fragment) != "" } {
-	set components(fragment) "#$components(fragment)"
-    } else {
-	set components(fragment) ""
-    }
-
-    return $scheme://$components(host)$port/$components(path)$components(fragment)$query
-}
-
-
-proc ::uri::SplitFile {url} {
-    # @c Splits the given file-<a url> into its constituents.
-    # @a url: The url to split, without! scheme specification.
-    # @r List containing the constituents, suitable for 'array set'.
-
-    upvar #0 [namespace current]::basic::hostname	hostname
-    upvar #0 [namespace current]::basic::hostnumber	hostnumber
-
-    if {[string match "//*" $url]} {
-	set url [string range $url 2 end]
-
-	set hostPattern "^($hostname|$hostnumber)"
-	switch -exact -- $::tcl_platform(platform) {
-	    windows {
-		# Catch drive letter
-		append hostPattern :?
-	    }
-	    default {
-		# Proceed as usual
-	    }
-	}
-
-	if {[regexp -indices -- $hostPattern $url match host]} {
-	    set fh	[lindex $host 0]
-	    set th	[lindex $host 1]
-
-	    set parts(host)	[string range $url $fh $th]
-
-	    set  matchEnd   [lindex $match 1]
-	    incr matchEnd
-
-	    set url	[string range $url $matchEnd end]
-	}
-    }
-
-    set parts(path) $url
-
-    return [array get parts]
-}
-
-
-proc ::uri::JoinFile args {
-    array set components {
-	host {} port {} path {}
-    }
-    array set components $args
-
-    switch -exact -- $::tcl_platform(platform) {
-	windows {
-	    if {[string length $components(host)]} {
-		return file://$components(host):$components(path)
-	    } else {
-		return file://$components(path)
-	    }
-	}
-	default {
-	    return file://$components(host)$components(path)
-	}
-    }
-}
-
-
-proc ::uri::SplitMailto {url} {
-    # @c Splits the given mailto-<a url> into its constituents.
-    # @a url: The url to split, without! scheme specification.
-    # @r List containing the constituents, suitable for 'array set'.
-
-    if {[string match "*@*" $url]} {
-	set url [::split $url @]
-	return [list user [lindex $url 0] host [lindex $url 1]]
-    } else {
-	return [list user $url]
-    }
-}
-
-
-proc ::uri::JoinMailto args {
-    array set components {
-	user {} host {}
-    }
-    array set components $args
-
-    return mailto:$components(user)@$components(host)
-}
-
-
-proc ::uri::SplitNews {url} {
-    if { [string first @ $url] >= 0 } {
-	return [list message-id $url]
-    } else {
-	return [list newsgroup-name $url]
-    }
-}
-
-
-proc ::uri::JoinNews args {
-    array set components {
-	message-id {} newsgroup-name {}
-    }
-    array set components $args
-    return news:$components(message-id)$components(newsgroup-name)
-}
-
-
-proc ::uri::SplitLdaps {url} {
-    ::uri::SplitLdap $url
-}
-
-proc ::uri::SplitLdap {url} {
-    # @c Splits the given Ldap-<a url> into its constituents.
-    # @a url: The url to split, without! scheme specification.
-    # @r List containing the constituents, suitable for 'array set'.
-
-    # general syntax:
-    # //<host>:<port>/<dn>?<attrs>?<scope>?<filter>?<extensions>
-    #
-    #   where <host> and <port> are as described in Section 5 of RFC 1738.
-    #   No user name or password is allowed.
-    #   If omitted, the port defaults to 389 for ldap, 636 for ldaps
-    #   <dn> is the base DN for the search
-    #   <attrs> is a comma separated list of attributes description
-    #   <scope> is either "base", "one" or "sub".
-    #   <filter> is a RFC 2254 filter specification
-    #   <extensions> are documented in RFC 2255
-    #
-
-    array set parts {host {} port {} dn {} attrs {} scope {} filter {} extensions {}}
-
-    #          host        port           dn          attrs       scope               filter     extns
-    set re {//([^:?/]+)(?::([0-9]+))?(?:/([^?]+)(?:\?([^?]*)(?:\?(base|one|sub)?(?:\?([^?]*)(?:\?(.*))?)?)?)?)?}
-
-    if {! [regexp $re $url match parts(host) parts(port) \
-		parts(dn) parts(attrs) parts(scope) parts(filter) \
-		parts(extensions)]} then {
-	return -code error "unable to match URL \"$url\""
-    }
-
-    set parts(attrs) [::split $parts(attrs) ","]
-
-    return [array get parts]
-}
-
-
-proc ::uri::JoinLdap {args} {
-    return [eval [linsert $args 0 ::uri::JoinLdapInner ldap 389]]
-}
-
-proc ::uri::JoinLdaps {args} {
-    return [eval [linsert $args 0 ::uri::JoinLdapInner ldaps 636]]
-}
-
-proc ::uri::JoinLdapInner {scheme defport args} {
-    array set components {host {} port {} dn {} attrs {} scope {} filter {} extensions {}}
-    set       components(port) $defport
-    array set components $args
-
-    set port {}
-    if {[string length $components(port)] && $components(port) != $defport} {
-	set port :$components(port)
-    }
-
-    set url "$scheme://$components(host)$port"
-
-    set components(attrs) [::join $components(attrs) ","]
-
-    set s ""
-    foreach c {dn attrs scope filter extensions} {
-	if {[string equal $c "dn"]} then {
-	    append s "/"
-	} else {
-	    append s "?"
-	}
-	if {! [string equal $components($c) ""]} then {
-	    append url "${s}$components($c)"
-	    set s ""
-	}
-    }
-
-    return $url
-}
-
-
-proc ::uri::GetUPHP {urlvar} {
-    # @c Parse user, password host and port out of the url stored in
-    # @c variable <a urlvar>.
-    # @d Side effect: The extracted information is removed from the given url.
-    # @r List containing the extracted information in a format suitable for
-    # @r 'array set'.
-    # @a urlvar: Name of the variable containing the url to parse.
-
-    upvar \#0 [namespace current]::basic::user		user
-    upvar \#0 [namespace current]::basic::password	password
-    upvar \#0 [namespace current]::basic::hostname	hostname
-    upvar \#0 [namespace current]::basic::hostnumber	hostnumber
-    upvar \#0 [namespace current]::basic::port		port
-
-    upvar $urlvar url
-
-    array set parts {user {} pwd {} host {} port {}}
-
-    # syntax
-    # "//" [ <user> [":" <password> ] "@"] <host> [":" <port>] "/"
-    # "//" already cut off by caller
-
-    set upPattern "^(${user})(:(${password}))?@"
-
-    if {[regexp -indices -- $upPattern $url match theUser c d thePassword]} {
-	set fu	[lindex $theUser 0]
-	set tu	[lindex $theUser 1]
-
-	set fp	[lindex $thePassword 0]
-	set tp	[lindex $thePassword 1]
-
-	set parts(user)	[string range $url $fu $tu]
-	set parts(pwd)	[string range $url $fp $tp]
-
-	set  matchEnd   [lindex $match 1]
-	incr matchEnd
-
-	set url	[string range $url $matchEnd end]
-    }
-
-    set hpPattern "^($hostname|$hostnumber)(:($port))?"
-
-    if {[regexp -indices -- $hpPattern $url match theHost c d e f g h thePort]} {
-	set fh	[lindex $theHost 0]
-	set th	[lindex $theHost 1]
-
-	set fp	[lindex $thePort 0]
-	set tp	[lindex $thePort 1]
-
-	set parts(host)	[string range $url $fh $th]
-	set parts(port)	[string range $url $fp $tp]
-
-	set  matchEnd   [lindex $match 1]
-	incr matchEnd
-
-	set url	[string range $url $matchEnd end]
-    }
-
-    return [array get parts]
-}
-
-
-proc ::uri::GetHostPort {urlvar} {
-    # @c Parse host and port out of the url stored in variable <a urlvar>.
-    # @d Side effect: The extracted information is removed from the given url.
-    # @r List containing the extracted information in a format suitable for
-    # @r 'array set'.
-    # @a urlvar: Name of the variable containing the url to parse.
-
-    upvar #0 [namespace current]::basic::hostname	hostname
-    upvar #0 [namespace current]::basic::hostnumber	hostnumber
-    upvar #0 [namespace current]::basic::port		port
-
-    upvar $urlvar url
-
-    set pattern "^(${hostname}|${hostnumber})(:(${port}))?"
-
-    if {[regexp -indices -- $pattern $url match host c d e f g h thePort]} {
-	set fromHost	[lindex $host 0]
-	set toHost	[lindex $host 1]
-
-	set fromPort	[lindex $thePort 0]
-	set toPort	[lindex $thePort 1]
-
-	set parts(host)	[string range $url $fromHost $toHost]
-	set parts(port)	[string range $url $fromPort $toPort]
-
-	set  matchEnd   [lindex $match 1]
-	incr matchEnd
-
-	set url [string range $url $matchEnd end]
-    }
-
-    return [array get parts]
-}
-
-
-# ::uri::resolve --
-#
-#	Resolve an arbitrary URL, given a base URL
-#
-# Arguments:
-#	base	base URL (absolute)
-#	url	arbitrary URL
-#
-# Results:
-#	Returns a URL
-
-proc ::uri::resolve {base url} {
-    if {[string length $url]} {
-	if {[isrelative $url]} {
-
-	    array set baseparts [split $base]
-
-	    switch -- $baseparts(scheme) {
-		http -
-		https -
-		ftp -
-		file {
-		    array set relparts [split $url]
-		    if { [string match /* $url] } {
-			catch { set baseparts(path) $relparts(path) }
-		    } elseif { [string match */ $baseparts(path)] } {
-			set baseparts(path) "$baseparts(path)$relparts(path)"
-		    } else {
-			if { [string length $relparts(path)] > 0 } {
-			    set path [lreplace [::split $baseparts(path) /] end end]
-			    set baseparts(path) "[::join $path /]/$relparts(path)"
-			}
-		    }
-		    catch { set baseparts(query) $relparts(query) }
-		    catch { set baseparts(fragment) $relparts(fragment) }
-            return [eval [linsert [array get baseparts] 0 join]]
-		}
-		default {
-		    return -code error "unable to resolve relative URL \"$url\""
-		}
-	    }
-
-	} else {
-	    return $url
-	}
-    } else {
-	return $base
-    }
-}
-
-
-# ::uri::isrelative --
-#
-#	Determines whether a URL is absolute or relative
-#
-# Arguments:
-#	url	URL to check
-#
-# Results:
-#	Returns 1 if the URL is relative, 0 otherwise
-
-proc ::uri::isrelative url {
-    return [expr {![regexp -- {^[a-z0-9+-.][a-z0-9+-.]*:} $url]}]
-}
-
-
-# ::uri::geturl --
-#
-#	Fetch the data from an arbitrary URL.
-#
-#	This package provides a handler for the file:
-#	scheme, since this conflicts with the file command.
-#
-# Arguments:
-#	url	address of data resource
-#	args	configuration options
-#
-# Results:
-#	Depends on scheme
-
-proc ::uri::geturl {url args} {
-    array set urlparts [split $url]
-
-    switch -- $urlparts(scheme) {
-	file {
-        return [eval [linsert $args 0 file_geturl $url]]
-	}
-	default {
-	    # Load a geturl package for the scheme first and only if
-	    # that fails the scheme package itself. This prevents
-	    # cyclic dependencies between packages.
-	    if {[catch {package require $urlparts(scheme)::geturl}]} {
-		package require $urlparts(scheme)
-	    }
-        return [eval [linsert $args 0 $urlparts(scheme)::geturl $url]]
-	}
-    }
-}
-
-
-# ::uri::file_geturl --
-#
-#	geturl implementation for file: scheme
-#
-# TODO:
-#	This is an initial, basic implementation.
-#	Eventually want to support all options for geturl.
-#
-# Arguments:
-#	url	URL to fetch
-#	args	configuration options
-#
-# Results:
-#	Returns data from file
-
-proc ::uri::file_geturl {url args} {
-    variable file:counter
-
-    set var [namespace current]::file[incr file:counter]
-    upvar #0 $var state
-    array set state {data {}}
-
-    array set parts [split $url]
-
-    set ch [open $parts(path)]
-    # Could determine text/binary from file extension,
-    # except on Macintosh
-    # fconfigure $ch -translation binary
-    set state(data) [read $ch]
-    close $ch
-
-    return $var
-}
-
-
-# ::uri::join --
-#
-#	Format a URL
-#
-# Arguments:
-#	args	components, key-value format
-#
-# Results:
-#	A URL
-
-proc ::uri::join args {
-    array set components $args
-
-    return [eval [linsert $args 0 Join[string totitle $components(scheme)]]]
-}
-
-
-# ::uri::canonicalize --
-#
-#	Canonicalize a URL
-#
-# Acknowledgements:
-#	Andreas Kupries <andreas_kupries@users.sourceforge.net>
-#
-# Arguments:
-#	uri	URI (which contains a path component)
-#
-# Results:
-#	The canonical form of the URI
-
-proc ::uri::canonicalize uri {
-
-    # Make uri canonical with respect to dots (path changing commands)
-    #
-    # Remove single dots (.)  => pwd not changing
-    # Remove double dots (..) => gobble previous segment of path
-    #
-    # Fixes for this command:
-    #
-    # * Ignore any url which cannot be split into components by this
-    #   module. Just assume that such urls do not have a path to
-    #   canonicalize.
-    #
-    # * Ignore any url which could be split into components, but does
-    #   not have a path component.
-    #
-    # In the text above 'ignore' means
-    # 'return the url unchanged to the caller'.
-
-    if {[catch {array set u [::uri::split $uri]}]} {
-	return $uri
-    }
-    if {![info exists u(path)]} {
-	return $uri
-    }
-
-    set uri $u(path)
-
-    # Remove leading "./" "../" "/.." (and "/../")
-    regsub -all -- {^(\./)+}    $uri {}  uri
-    regsub -all -- {^/(\.\./)+} $uri {/} uri
-    regsub -all -- {^(\.\./)+}  $uri {}  uri
-
-    # Remove inner /./ and /../
-    while {[regsub -all -- {/\./}         $uri {/} uri]} {}
-    while {[regsub -all -- {/[^/]+/\.\./} $uri {/} uri]} {}
-    while {[regsub -all -- {^[^/]+/\.\./} $uri {}  uri]} {}
-    # Munge trailing /..
-    while {[regsub -all -- {/[^/]+/\.\.} $uri {/} uri]} {}
-    if { $uri == ".." } { set uri "/" }
-
-    set u(path) $uri
-    set uri [eval [linsert [array get u] 0 ::uri::join]]
-
-    return $uri
-}
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# regular expressions covering various url schemes
-
-# Currently known URL schemes:
-#
-# (RFC 1738)
-# ------------------------------------------------
-# scheme	basic syntax of scheme specific part
-# ------------------------------------------------
-# ftp		//<user>:<password>@<host>:<port>/<cwd1>/.../<cwdN>/<name>;type=<typecode>
-#
-# http		//<host>:<port>/<path>?<searchpart>
-#
-# gopher	//<host>:<port>/<gophertype><selector>
-#				<gophertype><selector>%09<search>
-#		<gophertype><selector>%09<search>%09<gopher+_string>
-#
-# mailto	<rfc822-addr-spec>
-# news		<newsgroup-name>
-#		<message-id>
-# nntp		//<host>:<port>/<newsgroup-name>/<article-number>
-# telnet	//<user>:<password>@<host>:<port>/
-# wais		//<host>:<port>/<database>
-#		//<host>:<port>/<database>?<search>
-#		//<host>:<port>/<database>/<wtype>/<wpath>
-# file		//<host>/<path>
-# prospero	//<host>:<port>/<hsoname>;<field>=<value>
-# ------------------------------------------------
-#
-# (RFC 2111)
-# ------------------------------------------------
-# scheme	basic syntax of scheme specific part
-# ------------------------------------------------
-# mid	message-id
-#		message-id/content-id
-# cid	content-id
-# ------------------------------------------------
-#
-# (RFC 2255)
-# ------------------------------------------------
-# scheme	basic syntax of scheme specific part
-# ------------------------------------------------
-# ldap		//<host>:<port>/<dn>?<attrs>?<scope>?<filter>?<extensions>
-# ------------------------------------------------
-
-# FTP
-uri::register ftp {
-    variable escape [set [namespace parent [namespace current]]::basic::escape]
-    variable login  [set [namespace parent [namespace current]]::basic::login]
-
-    variable	charN	{[a-zA-Z0-9$_.+!*'(,)?:@&=-]}
-    variable	char	"(${charN}|${escape})"
-    variable	segment	"${char}*"
-    variable	path	"${segment}(/${segment})*"
-
-    variable	type		{[AaDdIi]}
-    variable	typepart	";type=(${type})"
-    variable	schemepart	\
-		    "//${login}(/${path}(${typepart})?)?"
-
-    variable	url		"ftp:${schemepart}"
-}
-
-# FILE
-uri::register file {
-    variable	host [set [namespace parent [namespace current]]::basic::host]
-    variable	path [set [namespace parent [namespace current]]::ftp::path]
-
-    variable	schemepart	"//(${host}|localhost)?/${path}"
-    variable	url		"file:${schemepart}"
-}
-
-# HTTP
-uri::register http {
-    variable	escape \
-        [set [namespace parent [namespace current]]::basic::escape]
-    variable	hostOrPort	\
-        [set [namespace parent [namespace current]]::basic::hostOrPort]
-
-    variable	charN		{[a-zA-Z0-9$_.+!*'(,);:@&=-]}
-    variable	char		"($charN|${escape})"
-    variable	segment		"${char}*"
-
-    variable	path		"${segment}(/${segment})*"
-    variable	search		$segment
-    variable	schemepart	\
-	    "//${hostOrPort}(/${path}(\\?${search})?)?"
-
-    variable	url		"http:${schemepart}"
-}
-
-# GOPHER
-uri::register gopher {
-    variable	xChar \
-        [set [namespace parent [namespace current]]::basic::xChar]
-    variable	hostOrPort \
-        [set [namespace parent [namespace current]]::basic::hostOrPort]
-    variable	search \
-        [set [namespace parent [namespace current]]::http::search]
-
-    variable	type		$xChar
-    variable	selector	"$xChar*"
-    variable	string		$selector
-    variable	schemepart	\
-	    "//${hostOrPort}(/(${type}(${selector}(%09${search}(%09${string})?)?)?)?)?"
-    variable	url		"gopher:${schemepart}"
-}
-
-# MAILTO
-uri::register mailto {
-    variable xChar [set [namespace parent [namespace current]]::basic::xChar]
-    variable host  [set [namespace parent [namespace current]]::basic::host]
-
-    variable schemepart	"$xChar+(@${host})?"
-    variable url	"mailto:${schemepart}"
-}
-
-# NEWS
-uri::register news {
-    variable escape [set [namespace parent [namespace current]]::basic::escape]
-    variable alpha  [set [namespace parent [namespace current]]::basic::alpha]
-    variable host   [set [namespace parent [namespace current]]::basic::host]
-
-    variable	aCharN		{[a-zA-Z0-9$_.+!*'(,);/?:&=-]}
-    variable	aChar		"($aCharN|${escape})"
-    variable	gChar		{[a-zA-Z0-9$_.+-]}
-    variable	newsgroup-name	"${alpha}${gChar}*"
-    variable	message-id	"${aChar}+@${host}"
-    variable	schemepart	"\\*|${newsgroup-name}|${message-id}"
-    variable	url		"news:${schemepart}"
-}
-
-# WAIS
-uri::register wais {
-    variable	uChar \
-        [set [namespace parent [namespace current]]::basic::xChar]
-    variable	hostOrPort \
-        [set [namespace parent [namespace current]]::basic::hostOrPort]
-    variable	search \
-        [set [namespace parent [namespace current]]::http::search]
-
-    variable	db		"${uChar}*"
-    variable	type		"${uChar}*"
-    variable	path		"${uChar}*"
-
-    variable	database	"//${hostOrPort}/${db}"
-    variable	index		"//${hostOrPort}/${db}\\?${search}"
-    variable	doc		"//${hostOrPort}/${db}/${type}/${path}"
-
-    #variable	schemepart	"${doc}|${index}|${database}"
-
-    variable	schemepart \
-	    "//${hostOrPort}/${db}((\\?${search})|(/${type}/${path}))?"
-
-    variable	url		"wais:${schemepart}"
-}
-
-# PROSPERO
-uri::register prospero {
-    variable	escape \
-        [set [namespace parent [namespace current]]::basic::escape]
-    variable	hostOrPort \
-        [set [namespace parent [namespace current]]::basic::hostOrPort]
-    variable	path \
-        [set [namespace parent [namespace current]]::ftp::path]
-
-    variable	charN		{[a-zA-Z0-9$_.+!*'(,)?:@&-]}
-    variable	char		"(${charN}|$escape)"
-
-    variable	fieldname	"${char}*"
-    variable	fieldvalue	"${char}*"
-    variable	fieldspec	";${fieldname}=${fieldvalue}"
-
-    variable	schemepart	"//${hostOrPort}/${path}(${fieldspec})*"
-    variable	url		"prospero:$schemepart"
-}
-
-# LDAP
-uri::register ldap {
-    variable	hostOrPort \
-        [set [namespace parent [namespace current]]::basic::hostOrPort]
-
-    # very crude parsing
-    variable	dn		{[^?]*}
-    variable	attrs		{[^?]*}
-    variable	scope		"base|one|sub"
-    variable	filter		{[^?]*}
-    # extensions are not handled yet
-
-    variable	schemepart	"//${hostOrPort}(/${dn}(\?${attrs}(\?(${scope})(\?${filter})?)?)?)?"
-    variable	url		"ldap:$schemepart"
-}
-
-package provide uri 1.2.1
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uri/urn-scheme.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uri/urn-scheme.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,136 +1,0 @@
-# urn-scheme.tcl - Copyright (C) 2001 Pat Thoyts <patthoyts@users.sf.net>
-#
-# extend the uri package to deal with URN (RFC 2141)
-# see http://www.normos.org/ietf/rfc/rfc2141.txt
-#
-# Released under the tcllib license.
-#
-# $Id: urn-scheme.tcl,v 1.11 2005/09/28 04:51:24 andreas_kupries Exp $
-# -------------------------------------------------------------------------
-
-package require uri      1.1.2
-
-namespace eval ::uri {}
-namespace eval ::uri::urn {
-    variable version 1.0.2
-}
-
-# -------------------------------------------------------------------------
-
-# Description:
-#   Called by uri::split with a url to split into its parts.
-#
-proc ::uri::SplitUrn {uri} {
-    #@c Split the given uri into then URN component parts
-    #@a uri: the URI to split without it's scheme part.
-    #@r List of the component parts suitable for 'array set'
-
-    upvar \#0 [namespace current]::urn::URNpart pattern
-    array set parts {nid {} nss {}}
-    if {[regexp -- ^$pattern $uri -> parts(nid) parts(nss)]} {
-        return [array get parts]
-    } else {
-        error "invalid urn syntax: \"$uri\" could not be parsed"
-    }
-}
-
-
-# -------------------------------------------------------------------------
-
-proc ::uri::JoinUrn args {
-    #@c Join the parts of a URN scheme URI
-    #@a list of nid value nss value
-    #@r a valid string representation for your URI
-    variable urn::NIDpart
-
-    array set parts [list nid {} nss {}]
-    array set parts $args
-    if {! [regexp -- ^$NIDpart$ $parts(nid)]} {
-        error "invalid urn: nid is invalid"
-    }
-    set url "urn:$parts(nid):[urn::quote $parts(nss)]"
-    return $url
-}
-
-# -------------------------------------------------------------------------
-
-# Quote the disallowed characters according to the RFC for URN scheme.
-# ref: RFC2141 sec2.2
-proc ::uri::urn::quote {url} {
-    variable trans
-    
-    set ndx 0
-    set result ""
-    while {[regexp -indices -- "\[^$trans\]" $url r]} {
-        set ndx [lindex $r 0]
-        scan [string index $url $ndx] %c chr
-        set rep %[format %.2X $chr]
-        if {[string match $rep %00]} {
-            error "invalid character: character $chr is not allowed"
-        }
-        
-        incr ndx -1
-        append result [string range $url 0 $ndx] $rep
-        incr ndx 2
-        set url [string range $url $ndx end]
-    }
-    append result $url
-    return $result
-}
-
-# -------------------------------------------------------------------------
-# Perform the reverse of urn::quote.
-
-if { [package vcompare [package provide Tcl] 8.3] < 0 } {
-    # Before Tcl 8.3 we do not have 'regexp -start'. We simulate it by
-    # using 'string range' and adjusting the match results.
-
-    proc ::uri::urn::unquote {url} {
-        set result ""
-        set start 0
-        while {[regexp -indices {%[0-9a-fA-F]{2}} [string range $url $start end] match]} {
-            foreach {first last} $match break
-            incr first $start ; # Make the indices relative to the true string.
-            incr last  $start ; # I.e. undo the effect of the 'string range' on match results.
-            append result [string range $url $start [expr {$first - 1}]]
-            append result [format %c 0x[string range $url [incr first] $last]]
-            set start [incr last]
-        }
-        append result [string range $url $start end]
-        return $result
-    }
-} else {
-    proc ::uri::urn::unquote {url} {
-        set result ""
-        set start 0
-        while {[regexp -start $start -indices {%[0-9a-fA-F]{2}} $url match]} {
-            foreach {first last} $match break
-            append result [string range $url $start [expr {$first - 1}]]
-            append result [format %c 0x[string range $url [incr first] $last]]
-            set start [incr last]
-        }
-        append result [string range $url $start end]
-        return $result
-    }
-}
-
-# -------------------------------------------------------------------------
-
-::uri::register {urn URN} {
-	variable NIDpart {[a-zA-Z0-9][a-zA-Z0-9-]{0,31}}
-        variable esc {%[0-9a-fA-F]{2}}
-        variable trans {a-zA-Z0-9$_.+!*'(,):=@;-}
-        variable NSSpart "($esc|\[$trans\])+"
-        variable URNpart "($NIDpart):($NSSpart)"
-        variable schemepart $URNpart
-	variable url "urn:$NIDpart:$NSSpart"
-}
-
-# -------------------------------------------------------------------------
-
-package provide uri::urn $::uri::urn::version
-
-# -------------------------------------------------------------------------
-# Local Variables:
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uuid/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uuid/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,8 +1,0 @@
-# pkgIndex.tcl - 
-#
-# uuid package index file
-#
-# $Id: pkgIndex.tcl,v 1.2 2005/09/30 05:36:39 andreas_kupries Exp $
-
-if {![package vsatisfies [package provide Tcl] 8.2]} {return}
-package ifneeded uuid 1.0.1 [list source [file join $dir uuid.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/uuid/uuid.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/uuid/uuid.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,216 +1,0 @@
-# uuid.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# UUIDs are 128 bit values that attempt to be unique in time and space.
-#
-# Reference:
-#   http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
-#
-# uuid: scheme:
-# http://www.globecom.net/ietf/draft/draft-kindel-uuid-uri-00.html
-#
-# Usage: uuid::uuid generate
-#        uuid::uuid equal $idA $idB
-
-namespace eval uuid {
-    variable version 1.0.1
-    variable accel
-    array set accel {critcl 0}
-
-    namespace export uuid
-
-    variable uid
-    if {![info exists uid]} {
-        set uid 1
-    }
-
-    if {[package vcompare [package provide Tcl] 8.4] < 0} {
-        package require struct::list
-        interp alias {} ::uuid::lset {} ::struct::list::lset
-    }
-
-    proc K {a b} {set a}
-}
-
-# Generates a binary UUID as per the draft spec. We generate a pseudo-random
-# type uuid (type 4). See section 3.4
-#
-proc ::uuid::generate_tcl {} {
-    package require md5 2
-    variable uid
-
-    set tok [md5::MD5Init]
-    md5::MD5Update $tok [clock seconds]; # timestamp
-    md5::MD5Update $tok [clock clicks];  # system incrementing counter
-    md5::MD5Update $tok [incr uid];      # package incrementing counter 
-    md5::MD5Update $tok [info hostname]; # spatial unique id (poor)
-    md5::MD5Update $tok [pid];           # additional entropy
-    md5::MD5Update $tok [array get ::tcl_platform]
-    
-    # More spatial information -- better than hostname.
-    # bug 1150714: opening a server socket may raise a warning messagebox
-    #   with WinXP firewall, using ipconfig will return all IP addresses
-    #   including ipv6 ones if available. ipconfig is OK on win98+
-    if {[string equal $::tcl_platform(platform) "windows"]} {
-        catch {exec ipconfig} config
-        md5::MD5Update $tok $config
-    } else {
-        catch {
-            set s [socket -server void -myaddr [info hostname] 0]
-            K [fconfigure $s -sockname] [close $s]
-        } r
-        md5::MD5Update $tok $r
-    }
-
-    if {[package provide Tk] != {}} {
-        md5::MD5Update $tok [winfo pointerxy .]
-        md5::MD5Update $tok [winfo id .]
-    }
-
-    set r [md5::MD5Final $tok]
-    binary scan $r c* r
-    
-    # 3.4: set uuid versioning fields
-    lset r 8 [expr {([lindex $r 8] & 0x7F) | 0x40}]
-    lset r 6 [expr {([lindex $r 6] & 0x0F) | 0x40}]
-    
-    return [binary format c* $r]
-}
-
-if {[string equal $tcl_platform(platform) "windows"] 
-        && [package provide critcl] != {}} {
-    namespace eval uuid {
-        critcl::ccode {
-            #define WIN32_LEAN_AND_MEAN
-            #define STRICT
-            #include <windows.h>
-            #include <ole2.h>
-            typedef long (__stdcall *LPFNUUIDCREATE)(UUID *);
-            typedef const unsigned char cu_char;
-        }
-        critcl::cproc generate_c {Tcl_Interp* interp} ok {
-            HRESULT hr = S_OK;
-            int r = TCL_OK;
-            UUID uuid = {0};
-            HMODULE hLib;
-            LPFNUUIDCREATE lpfnUuidCreate = NULL;
-
-            hLib = LoadLibrary(_T("rpcrt4.dll"));
-            if (hLib)
-                lpfnUuidCreate = (LPFNUUIDCREATE)
-                    GetProcAddress(hLib, "UuidCreate");
-            if (lpfnUuidCreate) {
-                Tcl_Obj *obj;
-                lpfnUuidCreate(&uuid);
-                obj = Tcl_NewByteArrayObj((cu_char *)&uuid, sizeof(uuid));
-                Tcl_SetObjResult(interp, obj);
-            } else {
-                Tcl_SetResult(interp, "error: failed to create a guid",
-                              TCL_STATIC);
-                r = TCL_ERROR;
-            }
-            return r;
-        }
-    }
-}
-
-# Convert a binary uuid into its string representation.
-#
-proc ::uuid::tostring {uuid} {
-    binary scan $uuid H* s
-    foreach {a b} {0 7 8 11 12 15 16 19 20 end} {
-        append r [string range $s $a $b] -
-    }
-    return [string tolower [string trimright $r -]]
-}
-
-# Convert a string representation of a uuid into its binary format.
-#
-proc ::uuid::fromstring {uuid} {
-    return [binary format H* [string map {- {}} $uuid]]
-}
-
-# Compare two uuids for equality.
-#
-proc ::uuid::equal {left right} {
-    set l [fromstring $left]
-    set r [fromstring $right]
-    return [string equal $l $r]
-}
-
-# Call our generate uuid implementation
-proc ::uuid::generate {} {
-    variable accel
-    if {$accel(critcl)} {
-        return [generate_c]
-    } else {
-        return [generate_tcl]
-    }
-}
-
-# uuid generate -> string rep of a new uuid
-# uuid equal uuid1 uuid2
-#
-proc uuid::uuid {cmd args} {
-    switch -exact -- $cmd {
-        generate {
-            if {[llength $args] != 0} {
-                return -code error "wrong # args:\
-                    should be \"uuid generate\""
-            }
-            return [tostring [generate]]
-        }
-        equal {
-            if {[llength $args] != 2} {
-                return -code error "wrong \# args:\
-                    should be \"uuid equal uuid1 uuid2\""
-            }
-            return [eval [linsert $args 0 equal]]
-        }
-        default {
-            return -code error "bad option \"$cmd\":\
-                must be generate or equal"
-        }
-    }
-}
-
-# -------------------------------------------------------------------------
-
-# LoadAccelerator --
-#
-#	This package can make use of a number of compiled extensions to
-#	accelerate the digest computation. This procedure manages the
-#	use of these extensions within the package. During normal usage
-#	this should not be called, but the test package manipulates the
-#	list of enabled accelerators.
-#
-proc ::uuid::LoadAccelerator {name} {
-    variable accel
-    set r 0
-    switch -exact -- $name {
-        critcl {
-            if {![catch {package require tcllibc}]} {
-                set r [expr {[info command ::uuid::generate_c] != {}}]
-            }
-        }
-        default {
-            return -code error "invalid accelerator package:\
-                must be one of [join [array names accel] {, }]"
-        }
-    }
-    set accel($name) $r
-}
-
-# -------------------------------------------------------------------------
-
-# Try and load a compiled extension to help.
-namespace eval ::uuid {
-    foreach e {critcl} { if {[LoadAccelerator $e]} { break } }
-}
-
-package provide uuid $::uuid::version
-
-# -------------------------------------------------------------------------
-# Local variables:
-#   mode: tcl
-#   indent-tabs-mode: nil
-# End:
Index: tolsh/tolsh.vfs/lib/tcllib1.10/wip/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/wip/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,5 +1,0 @@
-if {![package vsatisfies [package provide Tcl] 8.4]} {return}
-package ifneeded wip 1.0 [list source [file join $dir wip.tcl]]
-
-if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-package ifneeded wip 2.0 [list source [file join $dir wip2.tcl]]
Index: tolsh/tolsh.vfs/lib/tcllib1.10/wip/wip.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/wip/wip.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,386 +1,0 @@
-# ### ### ### ######### ######### #########
-##
-# (c) 2007 Andreas Kupries.
-
-# WIP = Word Interpreter (Also a Work In Progress :). Especially while
-# it is running :P
-
-# Micro interpreter for lists of words. Domain specific languages
-# based on this will have a bit of a Forth feel, with the input stream
-# segmented into words and any other structuring left to whatever
-# language. Note that we have here in essence only the core dispatch
-# loop, and no actual commands whatsoever, making this definitely only
-# a Forth feel and not an actual Forth.
-
-# The idea is derived from Colin McCormack's treeql processor,
-# modified to require less boiler plate within the command
-# implementations, at the expense of, likely, execution speed. In
-# addition the interface between processor core and commands is more
-# complex too.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require Tcl 8.4
-
-# For Tcl 8.{3,4} only snit1 of a suitable patchlevel is possible.
-package require snit 1.3
-
-# The run_next_* methods use set operations (x in set)
-package require struct::set
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-snit::type wip {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    constructor           {e}       {} ; # create processor
-
-    # Defining commands and where they dispatch to.
-    method def            {name {cp {}}} {} ; # Define a DSL command.
-    method defl           {names}        {} ; # Def many, simple names (cp = name)
-    method defd           {dict}         {} ; # s.a. name/cp dict
-    method deflva         {args}         {} ; # s.a. defl, var arg form
-    method defdva         {args}         {} ; # s.a. defd, var arg form
-
-    # Execution of word lists.
-    method runl           {alist}   {} ; # execute list of words
-    method run            {args}    {} ; # ditto, words as varargs
-    method run_next       {}        {} ; # run the next command in the input.
-    method run_next_while {accept}  {} ; # s.a., while acceptable command
-    method run_next_until {reject}  {} ; # s.a., until rejectable command
-
-    # Manipulation of the input word list.
-    method peek           {}        {} ; # peek at next word in input
-    method next           {}        {} ; # pull next word from input
-    method insert         {at args} {} ; # insert words back into the input
-    method push           {args}    {} ; # ditto, at == 0
-
-    # ### ### ### ######### ######### #########
-    ## Processor construction.
-
-    constructor {e args} {
-	if {$e eq ""} {
-	    return -code error "No engine specified"
-	}
-	set engine $e
-	$self Definitions $args
-	return
-    }
-
-    method Definitions {alist} {
-	# args = series of 'def name' and 'def name cp' statements.
-	# The code to handle them is in essence a WIP too, just
-	# hardcoded, as state machine.
-
-	set state expect-def
-	set n  {}
-	set cp {}
-	foreach a $alist {
-	    if {$state eq "expect-def"} {
-		if {$a ne "def"} {
-		    return -code error "Expected \"def\", got \"$a\""
-		}
-		set state get-name
-	    } elseif {$state eq "get-name"} {
-		set name $a
-		set state get-cp-or-def
-	    } elseif {$state eq "get-cp-or-def"} {
-		# This means that 'def' cannot be a command prefix for
-		# DSL command.
-		if {$a eq "def"} {
-		    # Short definition, name only, completed.
-		    $self def $name
-		    # We already have the first word of the next
-		    # definition here, name is coming up next.
-		    set state get-name
-		} else {
-		    # Long definition, name + cp, completed.
-		    $self def $name $a
-		    # Must be followed by the next definition.
-		    set state expect-def
-		}
-	    }
-	}
-	if {$state eq "get-cp-or-def"} {
-	    # Had a short definition last, now complete.
-	    $self def $name
-	} elseif {$state eq "get-name"} {
-	    # Incomplete definition at the end, bogus
-	    return -code error "Incomplete definition at end, name missing."
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Processor state
-    ## Handle of the object incoming commands are dispatched to.
-    ## The currently active DSL code, i.e. word list.
-
-    variable engine  {}      ; # command
-    variable program {}      ; # list (string)
-    variable arity -array {} ; # array (command name -> command arity)
-    variable cmd   -array {} ; # array (command name -> method cmd prefix)
-
-    # ### ### ### ######### ######### #########
-    ## API: DSL definition
-
-    ## DSL words map to method-prefixes, i.e. method names + fixed
-    ## arguments. We store them with the engine already added in front
-    ## to make them regular command prefixes. No 'mymethod' however,
-    ## that works only in engine code itself, not form the outside.
-
-    method def {name {mp {}}} {
-	if {$mp eq {}} {
-	    # Derive method-prefix from DSL word.
-	    set mp [list $name]
-	    set m  $name
-	    set n 0
-
-	} else {
-	    # No need to check for an empty method-prefix. That cannot
-	    # happen, as it is diverted, see above.
-
-	    set m [lindex $mp 0]
-	    set n [expr {[llength $mp]-1}]
-	}
-
-	# Get method arguments, check for problems.
-	set a [$engine info args $m]
-	if {[lindex $a end] eq "args"} {
-	    return -code error "Unable to handle Tcl varargs"
-	}
-
-	# The arity of the command is number of required arguments,
-	# with compensation for those already covered by the
-	# method-prefix.
-
-	set cmd($name)   [linsert $mp 0 $engine]
-	set arity($name) [expr {[llength $a] - $n}]
-	return
-    }
-
-    method deflva {args}  { $self defl $args ; return }
-    method defdva {args}  { $self defd $args ; return }
-    method defl   {names} { foreach n $names { $self def $n } ; return }
-    method defd   {dict}  {
-	if {[llength $dict]%2==1} {
-	    return -code error "Expected a dictionary, got \"$dict\""
-	}
-	foreach {name mp} $dict {
-	    $self def $name $mp
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API: DSL execution
-    #
-    ## Consider moving the core implementation into procs, to reduce
-    ## call overhead
-
-    method run {args} {
-	return [$self runl $args]
-    }
-
-    method runl {alist} {
-	# Note: We are saving the current program and restore it
-	# afterwards, this handles the possibility that this is a
-	# recursive call into the dispatcher.
-	set saved $program
-	set program $alist
-	set r {}
-	while {[llength $program]} {
-	    set r [$self run_next]
-	}
-	set program $saved
-	return $r
-    }
-
-    method run_next_while {accept} {
-	set r {}
-	while {[struct::set contains $accept [$self peek]]} {
-	    set r [$self run_next]
-	}
-	return $r
-    }
-
-    method run_next_until {reject} {
-	set r {}
-	while {![struct::set contains $reject [$self peek]]} {
-	    set r [$self run_next]
-	}
-	return $r
-    }
-
-    method run_next {} {
-	# The first word in the list is the current command. Determine
-	# the number of its fixed arguments. This also checks command
-	# validity in general.
-
-	set c [lindex $program 0]
-	if {![info exists arity($c)]} {
-	    return -code error \
-		"Unknown command \"$c\""
-	}
-
-	set n $arity($c)
-	set m $cmd($c)
-
-	# Take the fixed arguments from the input as well.
-
-	set cargs [lrange $program 1 $n]
-	incr n
-
-	# Remove the command to dispatch, and its fixed arguments from
-	# the program. This is done before the dispatch so that the
-	# command has access to the true current state of the input.
-
-	set program [lrange $program $n end]
-
-	# Now run the command with its arguments. Commands needing
-	# more than the declared fixed number of arguments are
-	# responsible for reading them from input via the method
-	# 'next' provided by the processor core.
-
-	# Note: m already has the engine at the front, it was stored
-	# that way, see 'def'.
-
-	if {![llength $cargs]} {
-	    return [eval $m]
-	} else {
-	    # Explanation: First linsert constructs 'linsert $m end {*}$cargs',
-	    # which the inner eval transforms into '{*}$m {*}$cargs', which at
-	    # last is run by the outer eval.
-	    return [eval [eval [linsert $cargs 0 linsert $m end]]]
-	}
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Input manipulation
-
-    # Get next word from the input (shift)
-    method next {} {
-	set w       [lindex $program 0]
-	set program [lrange $program 1 end]
-	return $w
-    }
-
-    # Peek at the next word in the input
-    method peek {} {
-	return [lindex $program 0]
-    }
-
-    # Retrieve the whole current program
-    method peekall {} {
-	return $program
-    }
-
-    # Replace the current programm
-    method replace {args} {
-	set program $args
-	return
-    }
-    method replacel {alist} {
-	set program $alist
-	return
-    }
-
-    # Insert words into the input stream.
-    method insert {at args} {
-	set program [eval [linsert $args end linsert $program $at]]
-	return
-    }
-    method insertl {at alist} {
-	set program [eval [linsert $alist end linsert $program $at]]
-	return
-    }
-
-    # <=> insert 0
-    method push {args} {
-	set program [eval [linsert $args end linsert $program 0]]
-	return
-    }
-    method pushl {alist} {
-	set program [eval [linsert $alist end linsert $program 0]]
-	return
-    }
-
-    # <=> insert end
-    method add {args} {
-	set program [eval [linsert $args end linsert $program end]]
-	return
-    }
-    method addl {alist} {
-	set program [eval [linsert $alist end linsert $program end]]
-	return
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-##
-
-# Macro to declare the method of a component as proc. We use this
-# later to make access to a WIP processor simpler (no need to write
-# the component reference on our own). And no, this is not the same as
-# the standard delegation. Doing that simply replaces the component
-# name in the call with '$self'. We remove the need to have this
-# written in the call.
-
-snit::macro wip::methodasproc {var method suffix} {
-    proc $method$suffix {args} [string map [list @v@ $var @m@ $method] {
-	upvar 1 {@v@} dst
-	return [eval [linsert $args 0 $dst {@m@}]]
-    }]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-# ### ### ### ######### ######### #########
-##
-
-# Macro to install most of the boilerplate needed to setup and use a
-# WIP. The only thing left is to call the method 'wip_setup' in the
-# constructor of the class using WIP. This macro allows the creation
-# of multiple wip's, through custom suffices.
-
-snit::macro wip::dsl {{suffix {}}} {
-    if {$suffix ne ""} {set suffix _$suffix}
-
-    # Instance state, wip processor used to run the language
-    component wip$suffix
-
-    # Standard method to create the processor component. The user has
-    # to manually add a call of this method to the constructor.
-
-    method wip${suffix}_setup {} [string map [list @@ $suffix] {
-	install {wip@@} using wip "${selfns}::wip@@" $self
-    }]
-
-    # Procedures for easy access to the processor methods, without
-    # having to use self and wip. I.e. special delegation.
-
-    foreach {p} {
-	add	addl	def
-	defd	defdva	defl	deflva
-	insert	insertl	replace	replacel
-	push	pushl	run	runl
-	next	peek	peekall	run_next
-	run_next_until	run_next_while
-    } {
-	wip::methodasproc wip$suffix $p $suffix
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide wip 1.0
Index: tolsh/tolsh.vfs/lib/tcllib1.10/wip/wip2.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tcllib1.10/wip/wip2.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,383 +1,0 @@
-# ### ### ### ######### ######### #########
-##
-# (c) 2007 Andreas Kupries.
-
-# WIP = Word Interpreter (Also a Work In Progress :). Especially while
-# it is running :P
-
-# Micro interpreter for lists of words. Domain specific languages
-# based on this will have a bit of a Forth feel, with the input stream
-# segmented into words and any other structuring left to whatever
-# language. Note that we have here in essence only the core dispatch
-# loop, and no actual commands whatsoever, making this definitely only
-# a Forth feel and not an actual Forth.
-
-# The idea is derived from Colin McCormack's treeql processor,
-# modified to require less boiler plate within the command
-# implementations, at the expense of, likely, execution speed. In
-# addition the interface between processor core and commands is more
-# complex too.
-
-# ### ### ### ######### ######### #########
-## Requisites
-
-package require Tcl 8.5
-
-# Use new Tcl 8.5a6+ features for specification of allowed packages.
-# We can use either snit 2.2+, or 1.3+ if snit2 is not available.
-package require snit 2.2 1.3
-
-# The run_next_* methods use set operations (x in set)
-package require struct::set
-
-# For 8.5 we are using features like word-expansion to simplify the
-# various evaluations. Otherwise this is identical to v1.
-
-# ### ### ### ######### ######### #########
-## API & Implementation
-
-snit::type wip {
-
-    # ### ### ### ######### ######### #########
-    ## API
-
-    constructor           {e}       {} ; # create processor
-
-    # Defining commands and where they dispatch to.
-    method def            {name {cp {}}} {} ; # Define a DSL command.
-    method defl           {names}        {} ; # Def many, simple names (cp = name)
-    method defd           {dict}         {} ; # s.a. name/cp dict
-    method deflva         {args}         {} ; # s.a. defl, var arg form
-    method defdva         {args}         {} ; # s.a. defd, var arg form
-
-    # Execution of word lists.
-    method runl           {alist}   {} ; # execute list of words
-    method run            {args}    {} ; # ditto, words as varargs
-    method run_next       {}        {} ; # run the next command in the input.
-    method run_next_while {accept}  {} ; # s.a., while acceptable command
-    method run_next_until {reject}  {} ; # s.a., until rejectable command
-
-    # Manipulation of the input word list.
-    method peek           {}        {} ; # peek at next word in input
-    method next           {}        {} ; # pull next word from input
-    method insert         {at args} {} ; # insert words back into the input
-    method push           {args}    {} ; # ditto, at == 0
-
-    # ### ### ### ######### ######### #########
-    ## Processor construction.
-
-    constructor {e args} {
-	if {$e eq ""} {
-	    return -code error "No engine specified"
-	}
-	set engine $e
-	$self Definitions $args
-	return
-    }
-
-    method Definitions {alist} {
-	# args = series of 'def name' and 'def name cp' statements.
-	# The code to handle them is in essence a WIP too, just
-	# hardcoded, as state machine.
-
-	set state expect-def
-	set n  {}
-	set cp {}
-	foreach a $alist {
-	    if {$state eq "expect-def"} {
-		if {$a ne "def"} {
-		    return -code error "Expected \"def\", got \"$a\""
-		}
-		set state get-name
-	    } elseif {$state eq "get-name"} {
-		set name $a
-		set state get-cp-or-def
-	    } elseif {$state eq "get-cp-or-def"} {
-		# This means that 'def' cannot be a command prefix for
-		# DSL command.
-		if {$a eq "def"} {
-		    # Short definition, name only, completed.
-		    $self def $name
-		    # We already have the first word of the next
-		    # definition here, name is coming up next.
-		    set state get-name
-		} else {
-		    # Long definition, name + cp, completed.
-		    $self def $name $a
-		    # Must be followed by the next definition.
-		    set state expect-def
-		}
-	    }
-	}
-	if {$state eq "get-cp-or-def"} {
-	    # Had a short definition last, now complete.
-	    $self def $name
-	} elseif {$state eq "get-name"} {
-	    # Incomplete definition at the end, bogus
-	    return -code error "Incomplete definition at end, name missing."
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Processor state
-    ## Handle of the object incoming commands are dispatched to.
-    ## The currently active DSL code, i.e. word list.
-
-    variable engine  {}      ; # command
-    variable program {}      ; # list (string)
-    variable arity -array {} ; # array (command name -> command arity)
-    variable cmd   -array {} ; # array (command name -> method cmd prefix)
-
-    # ### ### ### ######### ######### #########
-    ## API: DSL definition
-
-    ## DSL words map to method-prefixes, i.e. method names + fixed
-    ## arguments. We store them with the engine already added in front
-    ## to make them regular command prefixes. No 'mymethod' however,
-    ## that works only in engine code itself, not form the outside.
-
-    method def {name {mp {}}} {
-	if {$mp eq {}} {
-	    # Derive method-prefix from DSL word.
-	    set mp [list $name]
-	    set m  $name
-	    set n 0
-
-	} else {
-	    # No need to check for an empty method-prefix. That cannot
-	    # happen, as it is diverted, see above.
-
-	    set m [lindex $mp 0]
-	    set n [expr {[llength $mp]-1}]
-	}
-
-	# Get method arguments, check for problems.
-	set a [$engine info args $m]
-	if {[lindex $a end] eq "args"} {
-	    return -code error "Unable to handle Tcl varargs"
-	}
-
-	# The arity of the command is number of required arguments,
-	# with compensation for those already covered by the
-	# method-prefix.
-
-	set cmd($name)   [linsert $mp 0 $engine]
-	set arity($name) [expr {[llength $a] - $n}]
-	return
-    }
-
-    method deflva {args}  { $self defl $args ; return }
-    method defdva {args}  { $self defd $args ; return }
-    method defl   {names} { foreach n $names { $self def $n } ; return }
-    method defd   {dict}  {
-	if {[llength $dict]%2==1} {
-	    return -code error "Expected a dictionary, got \"$dict\""
-	}
-	foreach {name mp} $dict {
-	    $self def $name $mp
-	}
-	return
-    }
-
-    # ### ### ### ######### ######### #########
-    ## API: DSL execution
-    #
-    ## Consider moving the core implementation into procs, to reduce
-    ## call overhead
-
-    method run {args} {
-	return [$self runl $args]
-    }
-
-    method runl {alist} {
-	# Note: We are saving the current program and restore it
-	# afterwards, this handles the possibility that this is a
-	# recursive call into the dispatcher.
-	set saved $program
-	set program $alist
-	set r {}
-	while {[llength $program]} {
-	    set r [$self run_next]
-	}
-	set program $saved
-	return $r
-    }
-
-    method run_next_while {accept} {
-	set r {}
-	while {[struct::set contains $accept [$self peek]]} {
-	    set r [$self run_next]
-	}
-	return $r
-    }
-
-    method run_next_until {reject} {
-	set r {}
-	while {![struct::set contains $reject [$self peek]]} {
-	    set r [$self run_next]
-	}
-	return $r
-    }
-
-    method run_next {} {
-	# The first word in the list is the current command. Determine
-	# the number of its fixed arguments. This also checks command
-	# validity in general.
-
-	set c [lindex $program 0]
-	if {![info exists arity($c)]} {
-	    return -code error \
-		"Unknown command \"$c\""
-	}
-
-	set n $arity($c)
-	set m $cmd($c)
-
-	# Take the fixed arguments from the input as well.
-
-	set cargs [lrange $program 1 $n]
-	incr n
-
-	# Remove the command to dispatch, and its fixed arguments from
-	# the program. This is done before the dispatch so that the
-	# command has access to the true current state of the input.
-
-	set program [lrange $program $n end]
-
-	# Now run the command with its arguments. Commands needing
-	# more than the declared fixed number of arguments are
-	# responsible for reading them from input via the method
-	# 'next' provided by the processor core.
-
-	# Note: m already has the engine at the front, it was stored
-	# that way, see 'def'.
-
-	return [{*}$m {*}$cargs]
-    }
-
-    # ### ### ### ######### ######### #########
-    ## Input manipulation
-
-    # Get next word from the input (shift)
-    method next {} {
-	set w       [lindex $program 0]
-	set program [lrange $program 1 end]
-	return $w
-    }
-
-    # Peek at the next word in the input
-    method peek {} {
-	return [lindex $program 0]
-    }
-
-    # Retrieve the whole current program
-    method peekall {} {
-	return $program
-    }
-
-    # Replace the current programm
-    method replace {args} {
-	set program $args
-	return
-    }
-    method replacel {alist} {
-	set program $alist
-	return
-    }
-
-    # Insert words into the input stream.
-    method insert {at args} {
-	set program [linsert $program $at {*}$args]
-	return
-    }
-    method insertl {at alist} {
-	set program [linsert $program $at {*}$alist]
-	return
-    }
-
-    # <=> insert 0
-    method push {args} {
-	set program [linsert $program 0 {*}$args]
-	return
-    }
-    method pushl {alist} {
-	set program [linsert $program 0 {*}$alist]
-	return
-    }
-
-    # <=> insert end
-    method add {args} {
-	set program [linsert $program end {*}$args]
-	return
-    }
-    method addl {alist} {
-	set program [linsert $program end {*}$alist]
-	return
-    }
-
-    ##
-    # ### ### ### ######### ######### #########
-}
-
-# ### ### ### ######### ######### #########
-##
-
-# Macro to declare the method of a component as proc. We use this
-# later to make access to a WIP processor simpler (no need to write
-# the component reference on our own). And no, this is not the same as
-# the standard delegation. Doing that simply replaces the component
-# name in the call with '$self'. We remove the need to have this
-# written in the call.
-
-snit::macro wip::methodasproc {var method suffix} {
-    proc $method$suffix {args} [string map [list @v@ $var @m@ $method] {
-	upvar 1 {@v@} dst
-	return [$dst {@m@} {*}$args]
-    }]
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-# ### ### ### ######### ######### #########
-##
-
-# Macro to install most of the boilerplate needed to setup and use a
-# WIP. The only thing left is to call the method 'wip_setup' in the
-# constructor of the class using WIP. This macro allows the creation
-# of multiple wip's, through custom suffices.
-
-snit::macro wip::dsl {{suffix {}}} {
-    if {$suffix ne ""} {set suffix _$suffix}
-
-    # Instance state, wip processor used to run the language
-    component wip$suffix
-
-    # Standard method to create the processor component. The user has
-    # to manually add a call of this method to the constructor.
-
-    method wip${suffix}_setup {} [string map [list @@ $suffix] {
-	install {wip@@} using wip "${selfns}::wip@@" $self
-    }]
-
-    # Procedures for easy access to the processor methods, without
-    # having to use self and wip. I.e. special delegation.
-
-    foreach {p} {
-	add	addl	def
-	defd	defdva	defl	deflva
-	insert	insertl	replace	replacel
-	push	pushl	run	runl
-	next	peek	peekall	run_next
-	run_next_until	run_next_while
-    } {
-	wip::methodasproc wip$suffix $p $suffix
-    }
-    return
-}
-
-# ### ### ### ######### ######### #########
-## Ready
-
-package provide wip 2.0
Index: tolsh/tolsh.vfs/lib/tequila/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tequila/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
-# and sourced either when an application starts up or
-# by a "package unknown" script.  It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands.  When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-package ifneeded tequila 1.5 [list source [file join $dir tequila.tcl]]
-
-package ifneeded tequilas 1.5 [list source [file join $dir tequilas.tcl]]
Index: tolsh/tolsh.vfs/lib/tequila/tequila.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tequila/tequila.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,146 +1,0 @@
-# Copyright (C) 1999-2000 Jean-Claude Wippler <jcw@equi4.com>
-#
-# Tequila  -  client interface to the Tequila server
-
-package provide tequila 1.5
-
-namespace eval tequila {
-    namespace export open close do attach
-
-    variable _socket
-    variable _reply
-    
-        # setup communication with the tequila server
-    proc open {addr port} {
-        variable _socket
-        set _socket [socket $addr $port] 
-        fconfigure $_socket -translation binary -buffering none
-        fileevent $_socket readable tequila::privRequest
-    }
-
-        # setup callback for when link to server fails
-    proc failure {cmd} {
-        variable _socket
-        trace variable _socket u $cmd
-    }
-
-        # terminate communication (this is usually not needed)
-    proc close {} {
-        variable _socket
-        ::close $_socket 
-    }
-
-        # set up to pass almost all MK requests through to the server
-        # note that mk::loop is not implemented, is only works locally
-        # added 20-02-2000
-    proc proxy {} {
-        namespace eval ::mk {
-            foreach i {file view row cursor get set select channel} {
-                proc $i {args} "eval ::tequila::do Remote $i \$args"
-            }
-        }
-    }
-    
-        # send a request to the server and wait for a response
-    proc do {args} {
-        variable _socket
-        variable _reply ""
-        
-        catch {
-            puts -nonewline $_socket "[string length $args]\n$args"
-            while {[string length $_reply] == 0} {
-                vwait tequila::_reply
-            }
-        }
-        
-        set error 0
-        set results ""
-        foreach {error results} $_reply break
-        
-        if {[string compare $error 0] == 0} {
-            return $results
-        }
-        
-        if {[string length $results] > 0} {
-            error $results 
-        }
-        
-        error "Failed network request to the server."
-    }
-
-        # prepare for automatic change propagation
-    proc attach {array args} {
-        array set opts {-fetch 1 -tracking 1 -type S}
-        array set opts $args
-        
-        global $array
-        do Define $array 0 $opts(-type)
-        
-        if {$opts(-fetch)} {
-            set command GetAll
-        } else {
-            set command Listing
-        }
-        
-        array set $array [do $command $array $opts(-tracking)]
-        
-        trace variable $array wu tequila::privTracer
-    }
-
-        # called whenever a request comes in (private)
-    proc privRequest {} {
-        variable _socket
-        variable _reply
-        
-        if {[gets $_socket bytes] > 0} {
-            set request [read $_socket $bytes]
-            if ![eof $_socket] {
-                #puts tequila::privCallBack_$request
-                uplevel #0 tequila::privCallBack_$request
-                return
-            } 
-        }
-            # trouble, make sure we stop a pending request
-        set _reply [list 1 "Lost connection with the tequila server."]
-        ::close $_socket 
-        unset _socket
-    }
-
-        # handles traces to propagate changes to the server (private)
-    proc privTracer {a e op} {
-        if {$e != ""} {
-            switch $op {
-                w   { do Set $a $e [set ::${a}($e)] }
-                u   { do Unset $a $e }
-            }
-        }
-    }
-
-        # called by the server to return a result
-    proc privCallBack_Reply {args} {
-        variable _reply
-        set _reply $args
-    }
-
-        # called by the server to propagate an element write
-    proc privCallBack_Set {a e v} {
-        global $a
-        #puts "privCallBack_Set $a $e $v"
-        if {![info exists ${a}($e)] || [set ${a}($e)] != $v} {
-            trace vdelete $a wu tequila::privTracer
-            set ${a}($e) $v    
-            trace variable $a wu tequila::privTracer
-        }
-    }
-
-        # called by the server to propagate an element delete
-    proc privCallBack_Unset {a e} {
-        global $a
-        if {[info exists ${a}($e)]} {
-            trace vdelete $a wu tequila::privTracer
-            unset ${a}($e)
-            trace variable $a wu tequila::privTracer
-        }
-    }
-}
-
Index: tolsh/tolsh.vfs/lib/tequila/tequilas.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tequila/tequilas.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,442 +1,0 @@
-#!/bin/sh
-# Copyright (c) 1999-2000 Jean-Claude Wippler <jcw@equi4.com>
-#
-# Tequilas  -  the "Tequila Server" implements shared persistent arrays
-#\
-exec tclkit "$0" ${1+"$@"}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# Imlementation notes:
-#
-# Commands starting with "Tqs" can be called from the remote client
-# The rest uses lowercase "tqs" to prevent this (and for uniqueness)
-#
-# There is one global array which is used for all information which
-# this server needs to carry around and track, called "tqs_info":
-#
-#   tqs_info(pending)   - id of pending "after" request, unset if none
-#   tqs_info(timeout)   - milliSecs before timed commit, unset if never
-#   tqs_info(verbose)   - log level: 0=off, 1=req's, 2=notify, 3=reply
-#
-# External views (type "X") are stored as files in directory, one item
-# per text file.  This can be used to store large amounts of text in
-# regular files, outside Metakit (though commit doesn't apply to them):
-#
-#   tqs_external(view)  - directory name, set for each external view
-#
-# Valid while processing an incoming request:
-#   tqs_info(port)      - socket name of current client request
-#
-# The following will be defined for individual views:
-#   tqs_notify($view)   - socket name of client to notify on changes
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-    # conditonal logging output
-proc tqsPuts {level msg} {
-    global tqs_info
-    if {$level <= $tqs_info(verbose)} {
-        puts $msg
-    }
-}
-
-    # return a displayable string of limited length
-proc tqsDisplay {str len} {
-    if {[string length $str] > $len} {
-        set str "[string range $str 0 $len]..."
-    }
-    regsub -all {[^ -~]} $str {?} str
-    return $str
-}
-
-    # remote execution of any Metakit command, added 20-02-2000
-proc TqsRemote {cmd args} {
-	eval mk::$cmd $args
-}
-
-    # return the names of all views currently on file
-proc TqsInfo {} {
-    mk::file views tqs
-}
-
-    # get or set log level (see above for meaning of values 0..3)
-proc TqsVerbose {{level ""}} {
-    global tqs_info
-    if {$level != ""} {
-        set tqs_info(verbose) $level
-    }
-    return $tqs_info(verbose)
-}
-
-    # define a view (Metakit's equivalent concept for a Tcl array)
-    # if the second argument is true, all existing data is removed
-    # the third arg is used to specify a binary (B) of memo format (M)
-    # if the third arg is "X", use a directory with files for storage
-proc TqsDefine {view {clear 0} {type S}} {
-    if {$type == "X"} {
-        global tqs_external
-        set tqs_external($view) ""
-        if {$clear} {
-            catch {file delete -force $view.data}
-            tqsTrace $view "" u
-        }
-        file mkdir $view.data
-        #catch {mk::view delete tqs.$view}
-    } else {
-        mk::view layout tqs.$view "name text:$type date:I"
-        if {$clear && [mk::view size tqs.$view] > 0} {
-            mk::view size tqs.$view 0
-            tqsTrace $view "" u
-        }
-        #file delete -force $view.data
-    }
-    return
-}
-
-    # get rid of a view
-proc TqsUndefine {view} {
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        file delete -force $view.data
-        unset tqs_external($view)
-    } else {
-        mk::view delete tqs.$view
-    }
-    tqsTrace $view "" u
-    return
-}
-
-    # return the list of all keys, like "array names view"
-proc TqsNames {view} {
-    set result {}
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        foreach x [glob -nocomplain $view.data/*] {
-            regsub {.*/} $x {} x
-            lappend result $x
-        }
-    } else {
-        mk::loop c tqs.$view {
-            lappend result [mk::get $c name]
-        }
-    }
-    return $result
-}
-
-    # return the number of keys, like "array size view"
-proc TqsSize {view} {
-    set result {}
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        set result [llength [glob -nocomplain "$view.data/*"]]
-    } else {
-        set result [mk::view size tqs.$view]
-    }
-    return $result
-}
-
-    # return an existing value, lookup by key, like "set view(key)"
-proc TqsGet {view key} {
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        set fd [open $view.data/$key]
-        fconfigure $fd -translation binary
-        set v [read $fd]
-        close $fd
-        return $v
-    } else {
-        set n [mk::select tqs.$view name $key]
-        mk::get tqs.$view!$n text ;# throws error if absent
-    }
-}
-
-    # store a value, create if necessary, like "set view(key) data"
-    # the optional last arg can be used to force a specific timestamp
-proc TqsSet {view key data {timestamp ""}} {
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        set fd [open $view.data/$key w]
-        fconfigure $fd -translation binary
-        puts -nonewline $fd $data
-        close $fd
-        # timestamp is ignored
-    } else {
-        set n [mk::select tqs.$view name $key]
-        if {[llength $n] == 0} {
-            set n [mk::view size tqs.$view]
-        } elseif {[mk::get tqs.$view!$n text] == $data} {
-            return ;# no change, ignore
-        }
-        if {$timestamp == ""} {
-            set timestamp [clock seconds]
-        }
-        mk::set tqs.$view!$n name $key text $data date $timestamp
-    }
-    tqsTrace $view $key w
-    return
-}
-
-    # Append a value, create if entry did not exist
-proc TqsAppend {view key data} {
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        set fd [open $view.data/$key a]
-        fconfigure $fd -translation binary
-        puts -nonewline $fd $data
-        close $fd
-    } else {
-        set n [mk::select tqs.$view name $key]
-        if {[llength $n] > 0} {
-            if {[string length $data] == 0} then return ;# no change
-            set data "[mk::get tqs.$view!$n text]$data"
-        }
-        mk::set tqs.$view!$n name $key text $data date [clock seconds]
-    }
-    tqsTrace $view $key w
-    return
-}
-
-    # delete an existing entry by key, similar to "unset view(key)"
-proc TqsUnset {view key} {
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        file delete $view.data/$key
-    } else {
-        set n [mk::select tqs.$view name $key]
-        if {[llength $n] == 0} {
-            return ;# no change, ignore
-        }
-        mk::row delete tqs.$view!$n
-    }
-    tqsTrace $view $key u
-    return
-}
-
-    # return all key/value pairs, like "array get view"
-    # if set, the optional arg sets up change notification
-proc TqsGetAll {view {tracking 0}} {
-    set result {}
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        foreach x [TqsNames $view] {
-            lappend result $x [TqsGet $view $x]
-        }
-    } else {
-        mk::loop c tqs.$view {
-            eval lappend result [mk::get $c name text]
-        }
-    }
-    if {$tracking} { tqsSubscribe $view }
-    return $result
-}
-
-    # like TqsGetAll, returns modification dates instead of contents
-    # this can be used by the client to synchronize and track dates
-    # if set, the optional arg sets up change notification
-proc TqsListing {view {tracking 0}} {
-    set result {}
-    global tqs_external
-    if {[info exists tqs_external($view)]} {
-        foreach x [TqsNames $view] {
-            lappend result $x [file mtime $view.data/$x]
-        }
-    } else {
-        mk::loop c tqs.$view {
-            eval lappend result [mk::get $c name date]
-        }
-    }
-    if {$tracking} { tqsSubscribe $view }
-    return $result
-}
-    
-    # called to set up notification for a client
-proc tqsSubscribe {view} {
-    global tqs_info tqs_notify
-    
-        # remember the client IP and listening number for this view
-    tqsPuts 1 "Notification set up for '$view': $tqs_info(port)"
-    lappend tqs_notify($view) $tqs_info(port)
-}
-
-    # called to unset all notifications for a client
-proc tqsUnsubscribe {port} {
-    global tqs_notify
-    
-    foreach {k v} [array get tqs_notify] {
-        set n [lsearch -exact $v $port]
-        if {$n >= 0} {
-            tqsPuts 1 "  Forget notify for $k"
-
-            if {[llength $v] > 1} {
-                set tqs_notify($k) [lreplace $v $n $n]
-            } else {
-                unset tqs_notify($k)
-                tqsPuts 1 "   No more notifications for $k"
-            }
-        }
-    }
-}
-
-    # set a number of key/value pairs, like "array set view pairs"
-proc TqsSetAll {view pairs} {
-    foreach {key value} $pairs {
-        TqsSet $view $key $value
-    }
-}
-
-    # save changes to file now
-proc TqsCommit {} {
-    global tqs_info
-    
-    set n [clock clicks]
-    mk::file commit tqs
-    tqsPuts 1 "Commit done ([expr {[clock clicks] - $n}])"
-    
-    after cancel TqsCommit
-    catch {unset tqs_info(pending)}
-    return
-}
-
-    # change commit timer, default is to commit with explicit calls
-proc TqsTimer {{timer ""}} {
-    global tqs_info
-    
-    after cancel TqsCommit
-    
-    if {$timer == ""} {
-        catch {unset tqs_info(timeout)}
-    } else {
-        if {[info exists tqs_info(pending)]} {
-            set tqs_info(pending) [after $timer TqsCommit]
-        }
-        set tqs_info(timeout) $timer
-    }
-}
-
-    # handles tracing of all view changes (there's no read tracing)
-    # this is also the place where delayed commits are scheduled
-proc tqsTrace {view key operation} {
-    global tqs_info tqs_notify
-    
-    if [info exists tqs_notify($view)] {
-        switch $operation {
-            w   { set req [list Set $view $key [TqsGet $view $key]] }
-            u   { set req [list Unset $view $key] }
-        }
-        
-            # this is the data that gets sent out
-        set msg "[string length $req]\n$req"
-        
-        foreach p $tqs_notify($view) {
-            if {$p == $tqs_info(port)} continue ;# skip originator
-            
-            if [catch {
-                tqsPuts 2 [tqsDisplay "Notify $p - $req" 65]
-                puts -nonewline $p $msg
-                #flush $p
-            } error] {
-                tqsPuts 1 "Notify to $p failed for $view $key"
-                tqsPuts 1 "  Reason: $error"
-                catch {close $p}
-                tqsUnsubscribe $p
-            }
-        }
-    }
-    
-    if {![info exists tqs_info(pending)] && 
-            [info exists tqs_info(timeout)]} {
-        set tqs_info(pending) [after $tqs_info(timeout) TqsCommit]
-    }
-}
-
-    # called whenever a request comes in
-proc tqsRequest {sock} {
-    global tqs_info
-    
-    if {[gets $sock bytes] > 0} {
-        set request [read $sock [lindex $bytes 0]]
-        if ![eof $sock] {
-                # debugging: incoming request
-            tqsPuts 1 [tqsDisplay " $request" 65]
-            
-            set tqs_info(port) $sock
-            
-            set err [catch {uplevel #0 Tqs$request} reply]
-            set msg [list Reply $err $reply]
-            puts -nonewline $sock "[string length $msg]\n$msg"
-            
-                # debugging: returned results
-            if {[string length $reply] > 0} {
-                tqsPuts 3 "   result: [tqsDisplay $reply 54]"
-            }
-            
-            #flush $sock
-            return
-        } 
-    }
-    
-    tqsPuts 1 "Closing $sock"
-    close $sock 
-    tqsUnsubscribe $sock
-}
-
-    # called whenever a connection is opened
-proc tqsAccept {sock addr port} {
-    global tqs_info
-    fconfigure $sock -translation binary -buffering none
-    fileevent $sock readable [list tqsRequest $sock]
-}
-
-    # this can be called to start a background server
-proc tqsStart {port} {
-    global tqs_notify tqs_external
-
-    array set tqs_notify {}
-    
-    foreach x [glob -nocomplain *.data] {
-        regsub {\.data$} $x {} x
-        set tqs_external($x) ""
-    }
-    
-    socket -server tqsAccept $port
-}
-
-    # this wraps the server into a standalone, it runs until shutdown
-proc tqsRun {port} {
-    global tqs_info
-    
-    set tqs_info(shutdown) [clock seconds]
-    
-        # these status messages are not disabled if verbose is off
-    puts "Tequila server on port $port started."
-    tqsStart $port
-    vwait tqs_info(shutdown)
-    puts "Tequila server on port $port has been shut down."
-}
-
-    # client-callable: terminate a server started with "tqsRun"
-proc TqsShutdown {} {
-    global tqs_info
-
-        # returns number of seconds since the server was started
-        # main effect is setting tqs_info(shutdown), which ends vwait
-    set tqs_info(shutdown) [expr {[clock seconds]-$tqs_info(shutdown)}]
-}
-
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-# This script can be used standalone, in which case the code below will
-# be run, or as part of a scripted document, which expects a "package
-# ifneeded tequilas ..." to have been set up.  In that case, the code
-# below will not be executed, allowing the caller so set up different
-# parameter values before calling tqsRun or tqsStart (background use).
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-if {0 && [lsearch -exact [package names] tequilas] < 0} {
-    package require Mk4tcl
-    mk::file open tqs tequilas.dat -nocommit
-
-    set tqs_info(verbose) 0     ;# default logging is off
-    TqsTimer 30000              ;# default commit timer is 30 seconds
-    tqsRun 20458                ;# default port is 20458
-}
-
-package provide tequilas 1.5
Index: tolsh/tolsh.vfs/lib/tolcomm/pkgIndex.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/pkgIndex.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/lib/tolcomm/pkgIndex.tcl	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -1,6 +1,4 @@
 
   package ifneeded tolserver 1.0 [list source [file join $dir tolserver.tcl]]
-  package ifneeded tolshared 1.0 [list source [file join $dir tolshared.tcl]]
-  package ifneeded tolslave 1.0 [list source [file join $dir tolslave.tcl]]
   package ifneeded tolclient 1.0 [list source [file join $dir tolclient.tcl]]
   package ifneeded rmtps_client 1.0 [list source [file join $dir rmtps_client.tcl]]
Index: tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tcl	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -10,26 +10,5 @@
 package provide rmtps_client 1.0
 
-package require base64
-
-if { [ catch { package require tlogger } ] } {
-  namespace eval tlogger {
-    variable _level "error"
-
-    proc init { svc {logfile ""} } {
-    }
-    
-    proc level { svc l } {
-      variable _level $l
-    }
-
-    proc log { l msg } {
-      variable _level 
-
-      if { $l eq $_level } {
-        puts $msg
-      }
-    }
-  }
-}
+package require tlogger
 
 ###############################################################################
@@ -180,13 +159,4 @@
 }
 
-proc ask_server_channel { chan request } {
-
-  usado sobre todo para pedir la razon del fallo
-
-  el timeout quizas deba cerrar el channel, esa peticion se cancela
-
-  file channels puedo usarlo para verificar si un socket existe.
-}
-
 ###############################################################################
 #
@@ -300,6 +270,5 @@
   # Answer from server must be an integer value
   #
-  if { $result eq "" || ![string is integer $result] ||
-      ![string is boolean $result] } {
+  if {$result eq "" || ![string is integer $result]} {
     set result -1
   } else {
@@ -389,41 +358,4 @@
 }
 
-
-###############################################################################
-#
-#  ps_runtol -- execute a TOL process on a remote host
-#
-#   Arguments --
-#
-#     host        - computer (remote host) where RmtPS_Server is running
-#     port        - port where the server socket is listening
-#     cmdln_args  - TOL arguments
-#
-#   Return --
-#
-#     PID of the process if cmdline could be executed
-#     0 if the command line could not be executed
-#
-###############################################################################
-proc ::rmtps_client::ps_runtol { host port cmdln_args } {
-
-  log "debug" "enter ps_runtol $host $port $cmdln_args"
-
-  # send request to server
-  #
-  set cmdln64 [ base64::encode -wrapchar "" $cmdln_args ]
-  #set cmdln64 $cmdln_args
-  set result [ask_server $host $port "RUNTOL $cmdln64"]
-  # Make sure that 0 or PID>0 is returned
-  #
-  if {![string is integer $result] || $result<0} {
-    set result 0
-  }
-
-  log "debug" "leave ps_runtol $host $port $cmdln_args : $result"
-
-  set result
-}
-
 ###############################################################################
 #
Index: tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tol
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tol	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tol	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -10,7 +10,6 @@
  *  Argumentos:
  *
- *    Host: host que aloja al servidor RMTPS
- *    
- *    Port: puerto donde el servidor RMPTS esta escuchando
+ *    Host:
+ *    Port:
  *
  *  Resultado:
@@ -38,8 +37,6 @@
  *  Argumentos:
  *
- *    Host: host que aloja al servidor RMTPS
- *    
- *    Port: puerto donde el servidor RMPTS esta escuchando
- *
+ *    Host:
+ *    Port:
  *    CmdLine:
  *
@@ -68,97 +65,11 @@
 
 /**
- *  RemoteTOL -- Invoca un proceso TOL remoto
- *
- *  Argumentos:
- *
- *    Host: host que aloja al servidor RMTPS
- *    
- *    Port: puerto donde el servidor RMPTS esta escuchando
- *
- *    Args:
- *
- *  Resultado:
- *
- *    PID del proceso TOL lanzado o 0 si algun error ha ocurrido
- *  
- */
-Real RemoteTOL(Text Host, Real Port, Set Args )
-{
-
-  Text cmd = "::rmtps_client::ps_runtol";
-  Text port = FormatReal(Port, "%.0lf");
-  Text project = Args[ 1 ];
-  Set tolargs = Args[ 2 ];
-  Set cmdln_args = If( project=="", Copy( Empty ),
-                       [[ "-project", project ]] );
-  Set EvalSet( tolargs, Real( Set item ) {
-      Text type = Name( item[ 1 ] );
-      Case( type=="expr", {
-          Set Append( cmdln_args, [[ "-expr", item[ 1 ] ]] );
-          Real 0
-        },
-        type=="file", {
-          Real idx_rel = FindIndexByName( item, "relative" );
-          Set Append( cmdln_args,
-                      If( idx_rel, {
-                          Set [[ "-relative", item[ idx_rel ],
-                                 "-file", item[ 1 ] ]]
-                        }, {
-                          Set [[ "-file", item[ 1 ] ]]
-                        } ) );
-          Real 0
-        } ,
-        1, {
-          Warning( "RemoteTOL: tipo de elemento desconocido '"
-                   + type + "' debe "
-                   "ser 'expr' o 'file'" );
-          Real 0
-        } );
-        Real 0
-    } );
-  Set tcl_args = [[ cmd, host, port ]] << [[ cmdln_args ]];
-  //Set View( tcl_args, "Std" );
-  Set result = Tcl_EvalEx( tcl_args );
-  Real If(result["status"], Eval(result["result"]),{
-      WriteLn("RemoteTOL: "+result["result"],"E");
-      Real 0
-    })
-};
-PutDescription("Ejecuta en proceso TOL remoto. Args es un conjunto con los "
-               "argumentos a pasar a TOL en la linea de comandos.\n"
-               "Los elementos de Args son interpretados por el servidor de "
-               "procesos TOL y se traducen en argumentos de linea de comandos "
-               "al proceso TOL que se invoca. Los argumentos son:\n"
-               "\tText project = nombre del proyecto que se cargara\n"
-               "\tSet tolargs = conjunto de elementos a evaluar.\n"
-               "El conjunto tolargs contiene expresiones TOL o archivos a "
-               "evaluar en la linea de comandos. Cada uno de los "
-               "elementos es un conjunto con los siguientes elementos con "
-               "nombre:\n"
-               "\tText tolargs[1] : contiene la expresion o el nombre del "
-               "\tarchivo a evaluar. El nombre de tolargs[1] debe ser expr o "
-               "\tfile. Si el nombre es expr el valor se considera una "
-               "\texpresion TOL. Si el nombre es file el valor se considera "
-               "\tel nombre de un archivo a evaluar."
-               "\tText relative = nombre de proyecto respecto al cual se "
-               "\tcargara el archivo TOL. Este campo es opcional y solo se "
-               "\tconsidera cuando el tolargs[1] es un archivo. Por omision "
-               "\tel archivo se toma trelativo al argumento project.\n\n"
-               "Retorna el PID del proceso TOL ejecutado o 0 si algun error "
-               "ocurrio durante el intento de ejecucion. "
-               "Necesita que un servidor RmtPS_Server este escuchando en el "
-               "puerto Port del ordenador Host",
-               RemoteTOL);
-
-/**
  *  RemoteAlive -- Verifica, en remoto, si un proceso continua vivo
  *
  *  Argumentos:
  *
- *    Host: host que aloja al servidor RMTPS
- *    
- *    Port: puerto donde el servidor RMPTS esta escuchando
- *
- *    PID: pid del proceso a verificar
+ *    Host:
+ *    Port:
+ *    PID:
  *
  *  Resultado:
@@ -197,9 +108,7 @@
  *  Argumentos:
  *
- *    Host: host que aloja al servidor RMTPS
- *    
- *    Port: puerto donde el servidor RMPTS esta escuchando
- *
- *    PID: pid del proceso a finalizar
+ *    Host:
+ *    Port:
+ *    PID:
  *
  *  Resultado:
Index: tolsh/tolsh.vfs/lib/tolcomm/tolserver.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/tolserver.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/lib/tolcomm/tolserver.tcl	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -30,12 +30,4 @@
   }
 }
-
-global shared_tasks
-set shared_tasks(request) ""
-set shared_tasks(init) ""
-set shared_tasks(server_init) 0
-
-global shared_state
-global shared_finish
 
 ###############################################################################
@@ -296,5 +288,5 @@
   set idtask [insert_expr $chan $idrq $cmd]
   send_to_client $chan "TSTART" "$idrq $idtask"
-  after idle ::tolserver::dispatch_to_slave
+  schedule_queue
   
   log "debug" "leave, on_toleval"
@@ -448,17 +440,23 @@
 ###############################################################################
 proc ::tolserver::start { args } {
-  global shared_tasks
+  variable data
 
   array set options {
     -port 6669
-    -shport 20458
     -logfile ""
-    -compile ""
   }
   array set options $args
 
   ::tlogger::init tolserver $options(-logfile)
-  ::tlogger::level tolserver "debug"
-
+  ::tlogger::level tolserver "error"
+
+  # redirect the log
+  ::tol::console eval [string map "%P $options(-port)" {
+    Text {
+      Text srv_root = TolAppDataPath+"/server";
+      Real OSDirMake(srv_root);
+      Text PutDumpFile(srv_root+"/start.%P.log")
+    }
+  }]
   if {[catch {open_socket $options(-port)} msgerr]} {
     log emergency "::tolserver::start '$msgerr'"
@@ -467,58 +465,4 @@
     log "notice" "started"
   }
-  
-  server_attach_data $options(-shport)
-
-  log "debug" "shared_tasks(init)=$options(-compile)"
-  set shared_tasks(init) $options(-compile)  
-  set shared_tasks(server_init) 1
-}
-
-proc ::tolserver::server_attach_data { shared_port } {
-  package require tequila
-  global shared_tasks
-  global shared_state
-  global shared_finish
-
-  tequila::open localhost $shared_port
-  tequila::attach shared_tasks
-  tequila::attach shared_state
-  tequila::attach shared_finish
-  
-  #trace add var shared_finish(tasks) write tolserver::server_listen_finish
-  trace add var shared_finish write tolserver::server_listen_finish
-
-  # this trace is just for debbuging, it's not necesary actually
-  trace add var shared_tasks write tolserver::server_listen_tasks
-  
-  # this trace is just for debbuging, it's not necesary actually
-  trace add var shared_state write tolserver::server_listen_state
-}    
-
-proc tolserver::server_listen_finish {name index op} {
-  global shared_finish
-
-  log "debug" "enter server_listen_finish:index=$index"
-  log "debug" "[array get ::shared_finish]"
-  
-  # inform client this request has being finished
-  foreach {chan idtask} $shared_finish(tasks) break
-  after idle [namespace code "send_to_client $chan TFINISH $idtask"]
-
-  log "debug" "leave server_listen_finish"
-}
-
-proc tolserver::server_listen_tasks {name index op} {
-  global shared_tasks
-
-  log "debug" "server_listen_tasks:index=$index"
-  log "debug" "[array get shared_tasks]"
-}
-
-proc tolserver::server_listen_state {name index op} {
-  global shared_state
-
-  log "debug" "server_listen_state:index=$index"
-  log "debug" "[array get shared_state]"
 }
 
@@ -564,5 +508,5 @@
   set client [get_client_id $chan]
   set idtask "${client}:$data(queue,id)"
-  push_queue_tasks [list $idtask $idrq $chan $tol_expr]
+  lappend data(queue,tasks) [list $idtask $idrq $chan $tol_expr]
 
   log "debug" "leave, insert_expr, $idtask"
@@ -570,46 +514,41 @@
 }
 
-proc ::tolserver::push_queue_tasks {item} {
-  variable data
-
-  log "debug" "push_queue_tasks:item=$item"
-  lappend data(queue,tasks) $item
-}
-
-proc ::tolserver::dispatch_to_slave {} {
-  global shared_state
-
-  log "debug" "enter dispatch_to_slave"
-  if {$shared_state(slave) ne "ready"} {
-    log "debug" "dispatch_to_slave: vwait shared_state(slave)"
-    vwait shared_state(slave)
-  }
-  send_tasks_to_slave
-  log "debug" "leave dispatch_to_slave"
-}
-
-proc ::tolserver::send_tasks_to_slave {} {
-
-  log "debug" "enter send_tasks_to_slave"
-  set t_list [get_queue_tasks]
-  if {[llength $t_list] != 0} {
-    set_queue_shared $t_list
-  }
-  log "debug" "leave send_tasks_to_slave"
-}
-
-proc ::tolserver::get_queue_tasks {} {
-  variable data
-
-  set t_list $data(queue,tasks)
-  set data(queue,tasks) [list]
-  log "debug" "get_queue_tasks:t_list=$t_list"
-  return $t_list
-}
-
-proc ::tolserver::set_queue_shared {t_list} {
-  global shared_tasks
-  
-  log "debug" "set_queue_shared:t_list=$t_list"
-  set shared_tasks(request) $t_list
-}
+proc ::tolserver::process_queue { } {
+  variable data
+
+  log "debug" "enter, process_queue"
+
+  if {[llength $data(queue,tasks)]} {
+    set item [lindex $data(queue,tasks) 0]
+    set data(queue,tasks) [lrange data(queue,tasks) 1 end]
+    foreach {idtask idrq chan tol_expr} $item break
+    set idx [lsearch $data(queue,cancel) $idrq]
+    if {$idx != -1} {
+      log debug "canceling task $idtask"
+      # remove idrq from the cancel list
+      set data(queue,cancel) [lreplace $data(queue,cancel) $idx $idx]
+    } else {
+      log debug "processing task $idtask"
+      ::tol::console eval $tol_expr
+      # inform client this request has being finished
+      after idle [namespace code "send_to_client $chan TFINISH $idtask"]
+    }
+    schedule_queue
+  }
+
+  log "debug" "leave, process_queue"
+}
+
+###########################################################################
+#
+# 
+#
+###########################################################################
+proc ::tolserver::schedule_queue { } {
+
+  variable data
+
+  if {[llength $data(queue,tasks)]} {
+    after idle [namespace code process_queue]
+  }
+}
Index: tolsh/tolsh.vfs/lib/tolcomm/tolshared.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/tolshared.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,35 +1,0 @@
-###############################################################################
-#
-#  tolshared.tcl -- communication layer of tolsh when acting as a shared.
-#
-###############################################################################
-
-package provide tolshared 1.0
-
-###############################################################################
-#
-#  tolshared - namespace to encapsulate the shared state and behaviour
-#
-###############################################################################
-
-namespace eval ::tolshared {
-
-}
-
-###############################################################################
-#
-#  start -- Start the shared
-#
-###############################################################################
-proc ::tolshared::start { port datadir } {
-  global tqs_info
-  package require Mk4tcl
-  package require tequilas
-
-  puts "::tolshared::start"
-  # OJO: este archivo hay abrirlo en algun directorio controlado
-  mk::file open tqs [ file join $datadir tequilas.${port}.dat ] -nocommit
-  set tqs_info(verbose) 0     ;# default logging is off
-  TqsTimer ""                 ;# default commit timer is 30 seconds
-  tqsRun $port                ;# default port is 20458
-}
Index: tolsh/tolsh.vfs/lib/tolcomm/tolslave.tcl
===================================================================
--- tolsh/tolsh.vfs/lib/tolcomm/tolslave.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ 	(revision )
@@ -1,199 +1,0 @@
-###############################################################################
-#
-#  tolslave.tcl -- communication layer of tolsh when acting as a slave.
-#
-###############################################################################
-
-package provide tolslave 1.0
-
-package require tlogger
-
-###############################################################################
-#
-#  tolslave - namespace to encapsulate the slave state and behaviour
-#
-###############################################################################
-
-namespace eval ::tolslave {
-
-  variable data
-  
-  array set data {
-    queue,tasks  ""
-    queue,cancel ""
-  }
-}
-
-global shared_state
-set shared_state(slave) "busy"
-
-global shared_finish
-set shared_finish(tasks) ""
-
-global shared_tasks
-
-###############################################################################
-#
-#  log -- write a log message into the slave log file
-#
-#  This proc write a message into the server log channel which is
-#  handled by tlogger
-#
-#  Arguments:
-#
-#    msg - the message to be written
-#
-###############################################################################
-proc ::tolslave::log { level msg } {
-  
-  ::tlogger::log "tolslave" $level $msg
-}
-
-###############################################################################
-#
-#  start -- Start the slave
-#
-###############################################################################
-proc ::tolslave::start {args} {
-  global shared_state
-  global shared_tasks
-
-  array set options {
-    -port 6669
-    -shport 20458
-    -logfile ""
-  }
-  array set options $args
-
-  ::tlogger::init tolslave $options(-logfile)
-  ::tlogger::level tolslave "debug"
-  
-  # redirect the log
-  ::tol::console eval [string map "%P $options(-port)" {
-    Text {
-      Text srv_root = TolAppDataPath+"/server";
-      Real OSDirMake(srv_root);
-      Text PutDumpFile(srv_root+"/start.%P.log")
-    }
-  }]
-
-  slave_attach_data $options(-shport)
-
-  # Compile expression and tol file provided in the command line
-  #
-  if {$shared_tasks(server_init) == 0} {
-    vwait shared_tasks(server_init)
-  }
-  foreach item $shared_tasks(init) {
-    if {[lindex $item 0] eq "expr"} {
-      log "debug" "tol::console eval,item=$item"
-      tol::console eval [lindex $item 1]
-    } elseif {[lindex $item 0] eq "file"} {
-      log "debug" "tol::include,item=$item"
-      tol::include [lindex $item 1]
-    }
-  }
-
-  set shared_state(slave) "ready"
-  log "debug" "leave start"
-}
-
-proc ::tolslave::slave_attach_data { port } {
-  package require tequila
-  global shared_state
-  global shared_tasks
-  global shared_finish
-
-  tequila::open localhost $port
-  tequila::attach shared_state
-  tequila::attach shared_tasks
-  tequila::attach shared_finish
-  
-  #trace add var shared_tasks(request) write tolslave::slave_listen_tasks
-  trace add var shared_tasks write tolslave::slave_listen_tasks
-  
-  # this trace is just for debbuging, it's not necesary actually
-  trace add var shared_state write tolslave::slave_listen_state
-
-  # this trace is just for debbuging, it's not necesary actually
-  trace add var shared_finish write tolslave::slave_listen_finish
-}    
-
-proc tolslave::slave_listen_tasks {name index op} {
-  global shared_tasks
-
-  log "debug" "enter slave_listen_tasks:index=$index"
-  log "debug" "[array get ::shared_tasks]"
-  if {$index eq "request"} {
-    schedule_queue
-  }
-  log "debug" "leave slave_listen_tasks"
-}
-
-proc tolslave::slave_listen_state {name index op} {
-  global shared_state
-
-  log "debug" "slave_listen_state:index=$index"
-  log "debug" "[array get shared_state]"
-}
-
-proc tolslave::slave_listen_finish {name index op} {
-  global shared_finish
-
-  log "debug" "slave_listen_finish:index=$index"
-  log "debug" "[array get shared_finish]"
-}
-
-proc ::tolslave::schedule_queue { } {
-
-  log "debug" "enter, schedule_queue"
-  set t_list [get_queue_shared]
-  set_queue_tasks $t_list
-  after idle [process_queue]
-  log "debug" "leave, schedule_queue"
-}
-
-proc ::tolslave::get_queue_shared {} {
-  global shared_tasks
-
-  set t_list $shared_tasks(request)
-  log "debug" "get_queue_shared:t_list=$t_list"
-  return $t_list
-}
-
-proc ::tolslave::set_queue_tasks {t_list} {
-  variable data
-
-  log "debug" "set_queue_tasks:t_list=$t_list"
-  #lappend data(queue,tasks) {*}$t_list
-  set data(queue,tasks) $t_list
-}
-
-proc ::tolslave::process_queue { } {
-  variable data
-  global shared_state
-  global shared_finish
-
-  log "debug" "enter, process_queue"
-
-  set shared_state(slave) "busy"
-  
-  foreach item $data(queue,tasks) {
-    foreach {idtask idrq chan tol_expr} $item break
-    set idx [lsearch $data(queue,cancel) $idrq]
-    log "debug" "process_queue idx=$idx, idtask=$idtask"
-    if {$idx != -1} {
-      log debug "canceling task $idtask"
-      # remove idrq from the cancel list
-      set data(queue,cancel) [lreplace $data(queue,cancel) $idx $idx]
-    } else {
-      log debug "processing task $idtask"
-      log "debug" "::tol::console eval tol_expr=$tol_expr"
-      ::tol::console eval $tol_expr
-      # inform server this request has being finished
-      set shared_finish(tasks) [list $chan $idtask]
-    }
-  }
-  set shared_state(slave) "ready"
-  log "debug" "leave, process_queue"
-}
Index: tolsh/tolsh.vfs/main.tcl
===================================================================
--- tolsh/tolsh.vfs/main.tcl	(revision 1b5b24e974d86af9fe62a4722f3cb84c5cff2d2a)
+++ tolsh/tolsh.vfs/main.tcl	(revision 6d7779d88a35f4606432b88f2eceba8b66c4516b)
@@ -1,5 +1,5 @@
 
   package require starkit
-  set starkit::tolsh_mode [ starkit::startup ]
+  starkit::startup
   package require tolsh
 
